Пример #1
0
        public void PopulateAllDevices()
        {
            _deviceList.Clear();
            SourcesConfig config = SourcesConfig.LoadFromFile();

            foreach (DsDevice device in DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice))
            {
                _deviceList.Add(device.Name);
            }
        }
Пример #2
0
        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);
                }
            }
        }
Пример #3
0
        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();
                }
            }
        }
Пример #4
0
        /// <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;
            }
        }
Пример #5
0
        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);
        }
Пример #6
0
 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);
     }
 }