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); } } }
public void Record(string sourceName, string channel, string title, string mediaName) { Debug.WriteLine("RecorderControlService.Record " + sourceName + ", " + channel + ", " + title + ", " + mediaName); SourceConfig source = SourcesConfig.FindSource(sourceName); if (source != null) { SourceRecorder sourceRecorder = new SourceRecorder(source, channel, title, mediaName); if (sourceRecorder != null) { sourceRecorder.Record(); } } }
/// <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; } }
public async void TestVacanciesLoading() { var envMock = new Mock <IWebHostEnvironment>(); envMock.SetupGet(env => env.ContentRootPath).Returns(AppContentRoot); var optionsMock = new Mock <IOptions <SourcesConfig> >(); var configValues = new SourcesConfig { DataListUrl = "http://192.168.100.50/vacancies.txt", LocalCacheFileName = "Data/vacancies.txt" }; optionsMock.SetupGet(opt => opt.Value).Returns(configValues); var loader = new VacanciesDataLoader(envMock.Object, optionsMock.Object); var vacancies = await loader.LoadAsync(); Assert.NotEmpty(vacancies); Assert.NotEmpty(vacancies[0].Tags); }
public void Stop(string sourceName) { Debug.WriteLine("RecorderControlService.Stop " + sourceName); try { SourceConfig source = SourcesConfig.FindSource(sourceName); if (source != null) { SourceRecorder recorder = SourceRecorder.FindRecorder(source); if (recorder != null) { recorder.Stop(); recorder.Dispose(); } } } catch (Exception exc) { Debug.WriteLine("RecorderControlService.Stop Exception:"); Debug.WriteLine(exc.Message); } }