Пример #1
0
        /**
         * Get available sources of specified type.
         * @param type : Source type.
         * @return list of available sources. This sources can be selected by SetSource(...) method.
         */
        public static IList <string> GetSources(ESourceType type)
        {
            System.Collections.Generic.IList <string> sources = new System.Collections.Generic.List <string>();
            try
            {
                WMEncoderClass encoder = new WMEncoderClass();
                IWMEncSourcePluginInfoManager srcPlugMgr = encoder.SourcePluginInfoManager;
                IWMEncPluginInfo plugInfo;

                for (int i = 0; i < srcPlugMgr.Count; i++)
                {
                    plugInfo = srcPlugMgr.Item(i);
                    if (type == ESourceType.DesktopVideo &&
                        plugInfo.SchemeType == "ScreenCap" &&
                        plugInfo.MediaType == WMENC_SOURCE_TYPE.WMENC_VIDEO)
                    {
                        log.Debug(type + " source -->" + plugInfo.Name);
                        sources.Add(plugInfo.Name);
                    }
                    else
                    {
                        if (plugInfo.SchemeType == "DEVICE" && plugInfo.Resources == true)
                        {
                            for (int j = 0; j < plugInfo.Count; j++)
                            {
                                if (plugInfo.MediaType == WMENC_SOURCE_TYPE.WMENC_AUDIO &&
                                    type == ESourceType.DeviceAudio)
                                {
                                    log.Debug(type + " source(" + j + ") -->" + plugInfo.Item(j));
                                    sources.Add(plugInfo.Item(j));
                                }

                                if (plugInfo.MediaType == WMENC_SOURCE_TYPE.WMENC_VIDEO &&
                                    type == ESourceType.DeviceVideo)
                                {
                                    log.Debug(type + " source(" + j + ") -->" + plugInfo.Item(j));
                                    sources.Add(plugInfo.Item(j));
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                log.ErrorException("Exception retrieving sources", e);
                sources = null;
            }

            return(sources);
        }
Пример #2
0
 public bool CanConvert(ESourceType type)
 {
     if (SourceTypes != null && SourceTypes.Count > 0)
     {
         foreach (ESourceType st in SourceTypes)
         {
             if (st == type)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Пример #3
0
        /**
         * Set source.
         * @param type : source type.
         * @param name : source name.
         */
        public DVRBResult SetSource(ESourceType type, string name)
        {
            try
            {
                string       scheme = string.Empty;
                IWMEncSource source = null;
                switch (type)
                {
                case ESourceType.DeviceAudio:
                    scheme = "Device";
                    if (this.audioSource == null)
                    {
                        this.audioSource = (IWMEncAudioSource)this.sourceGroup.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO);
                    }

                    source = this.audioSource;
                    break;

                case ESourceType.DeviceVideo:
                    scheme = "Device";
                    if (this.videoSource == null)
                    {
                        this.videoSource = (IWMEncVideoSource)this.sourceGroup.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO);
                    }

                    source = this.videoSource;
                    break;

                case ESourceType.DesktopVideo:
                    scheme = "ScreenCap";
                    if (this.videoSource == null)
                    {
                        this.videoSource = (IWMEncVideoSource)this.sourceGroup.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO);
                    }

                    source = this.videoSource;
                    break;
                }

                log.Debug("Setting " + scheme + " -->" + name);
                source.SetInput(name, scheme, string.Empty);
            }
            catch (Exception e)
            {
                return(new DVRBResult(DVRBResult.ERROR, e.Message));
            }

            return(new DVRBResult());
        }
Пример #4
0
        /**
         * Set source.
         * @param type : source type.
         * @param name : source name.
         */
        public DVRBResult SetSource(ESourceType type, string name)
        {
            try
            {
                string scheme = string.Empty;
                IWMEncSource source = null;
                switch (type)
                {
                    case ESourceType.DeviceAudio:
                        scheme = "Device";
                        if (this.audioSource == null)
                        {
                            this.audioSource = (IWMEncAudioSource)this.sourceGroup.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO);
                        }

                        source = this.audioSource;
                        break;
                    case ESourceType.DeviceVideo:
                        scheme = "Device";
                        if (this.videoSource == null)
                        {
                            this.videoSource = (IWMEncVideoSource)this.sourceGroup.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO);
                        }

                        source = this.videoSource;
                        break;
                    case ESourceType.DesktopVideo:
                        scheme = "ScreenCap";
                        if (this.videoSource == null)
                        {
                            this.videoSource = (IWMEncVideoSource)this.sourceGroup.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO);
                        }

                        source = this.videoSource;
                        break;
                }

                log.Debug("Setting " + scheme + " -->" + name);
                source.SetInput(name, scheme, string.Empty);
            }
            catch (Exception e)
            {
                return new DVRBResult(DVRBResult.ERROR, e.Message);
            }

            return new DVRBResult();
        }
Пример #5
0
        /**
         * Get available sources of specified type.
         * @param type : Source type.
         * @return list of available sources. This sources can be selected by SetSource(...) method.
         */
        public static IList<string> GetSources(ESourceType type)
        {
            System.Collections.Generic.IList<string> sources = new System.Collections.Generic.List<string>();
            try
            {
                WMEncoderClass encoder = new WMEncoderClass();
                IWMEncSourcePluginInfoManager srcPlugMgr = encoder.SourcePluginInfoManager;
                IWMEncPluginInfo plugInfo;

                for (int i = 0; i < srcPlugMgr.Count; i++)
                {
                    plugInfo = srcPlugMgr.Item(i);
                    if (type == ESourceType.DesktopVideo &&
                        plugInfo.SchemeType == "ScreenCap" &&
                        plugInfo.MediaType == WMENC_SOURCE_TYPE.WMENC_VIDEO)
                    {
                        log.Debug(type + " source -->" + plugInfo.Name);
                        sources.Add(plugInfo.Name);
                    }
                    else
                    {
                        if (plugInfo.SchemeType == "DEVICE" && plugInfo.Resources == true)
                        {
                            for (int j = 0; j < plugInfo.Count; j++)
                            {
                                if (plugInfo.MediaType == WMENC_SOURCE_TYPE.WMENC_AUDIO &&
                                    type == ESourceType.DeviceAudio)
                                {
                                    log.Debug(type + " source(" + j + ") -->" + plugInfo.Item(j));
                                    sources.Add(plugInfo.Item(j));
                                }

                                if (plugInfo.MediaType == WMENC_SOURCE_TYPE.WMENC_VIDEO &&
                                    type == ESourceType.DeviceVideo)
                                {
                                    log.Debug(type + " source(" + j + ") -->" + plugInfo.Item(j));
                                    sources.Add(plugInfo.Item(j));
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                log.ErrorException("Exception retrieving sources", e);
                sources = null;
            }

            return sources;
        }