public void PopulateAllDevices() { _deviceList.Clear(); SourcesConfig config = SourcesConfig.LoadFromFile(); foreach (DsDevice device in DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice)) { _deviceList.Add(device.Name); } }
private void btnVideoDecoderSettings_Click(object sender, EventArgs e) { string decoderName = null; SourcesConfig config = SourcesConfig.LoadFromFile(); Source s = config[cbTunerDevice.SelectedItem as string]; if (s.Name.Equals(VideoInputDeviceList.NetworkDeviceName)) { decoderName = s[TVSource.Network][FilterType.VideoDecoder].Name; } else if (s.HasGraphFor(TVSource.LocalDigital)) { decoderName = s[TVSource.LocalDigital][FilterType.VideoDecoder].Name; } if (string.IsNullOrEmpty(decoderName)) { FCMessageBox.Show("No Decoder Specified!", "No video decoder is specified for this particular tuner.", this); return; } IGraphBuilder g = null; IBaseFilter f = null; try { g = (IGraphBuilder) new FilterGraph(); f = FilterGraphTools.AddFilterByName(g, FilterCategory.LegacyAmFilterCategory, decoderName) as IBaseFilter; if (f == null) { throw new Exception("Could not instantiate video decoder \"" + decoderName + "\"!"); } FilterPropertyPage propPage = new FilterPropertyPage(this, f); propPage.Show(); } catch (Exception ex) { FCMessageBox.Show("Error!", ex.Message, this); } finally { if (f != null) { Marshal.ReleaseComObject(f); } if (g != null) { Marshal.ReleaseComObject(g); } } }
/// <summary> /// Refreshes the list of available video input devices. /// </summary> /// <remarks> /// Only populates devices that we have a configuration entry for /// </remarks> public void PopulateSupportedDevices() { _deviceList.Clear(); SourcesConfig config = SourcesConfig.LoadFromFile(); foreach (DsDevice device in DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice)) { if (config.HasSource(device.Name)) { _deviceList.Add(device.Name); } } if (config.HasSource(NetworkDeviceName)) { _deviceList.Add(NetworkDeviceName); HasNetworkDevice = true; } }