/** * 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); }
/** * 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; }