/// <summary> /// Factory Method to instantiate the graph specified in the configuration /// </summary> /// <param name="graph">configuration of graph needed</param> /// <param name="hostControl">control that the graph will render to</param> /// <returns>an instance of a subclass of BaseGraph</returns> public static BaseGraph CreateInstance(Config.Graph graph, Control hostControl) { switch (graph.Class) { case Config.GraphType.WinTV: return(new WinTV(graph, hostControl)); case Config.GraphType.Network: return(new LTNetSource(graph, hostControl)); case Config.GraphType.WinTVATSC: return(new WinTVATSC(graph, hostControl)); case Config.GraphType.AverA307Analog: return(new AverA307Analog(graph, hostControl)); case Config.GraphType.AverATSC: return(new AverATSC(graph, hostControl)); case Config.GraphType.AverA317Analog: return(new AverA317Analog(graph, hostControl)); case Config.GraphType.AverA323Analog: return(new AverA323Analog(graph, hostControl)); case Config.GraphType.ATSCTuner: return(new ATSCTuner(graph, hostControl)); default: throw new Exception("Invalid SourceType specified in configuration"); } }
public AnalogTuner(Config.Graph sourceConfig, Control hostControl) : base(sourceConfig, hostControl) { _curChannelIndex = AppUser.Current.ChannelIndex; _deviceIndex = 0; _captureDevice = FindDevice(FilterCategory.AMKSCapture, Config.FilterType.Capture); _tunerDevice = FindDevice(FilterCategory.AMKSTVTuner, Config.FilterType.Tuner); _audioDevice = FindDevice(FilterCategory.AMKSTVAudio, Config.FilterType.TVAudio); _crossbarDevice = FindDevice(FilterCategory.AMKSCrossbar, Config.FilterType.Crossbar); _writerDevice = FindDevice(FilterCategory.LegacyAmFilterCategory, Config.FilterType.Writer); if (_tunerDevice != null) { _tuner = AddFilterByDevicePath(_tunerDevice.DevicePath, _tunerDevice.Name); } if (_audioDevice != null) { _tvaudio = AddFilterByDevicePath(_audioDevice.DevicePath, _audioDevice.Name); } if (_crossbarDevice != null) { _crossbar2 = AddFilterByDevicePath(_crossbarDevice.DevicePath, _crossbarDevice.Name); } if (_captureDevice != null) { _captureFilter = AddFilterByDevicePath(_captureDevice.DevicePath, _captureDevice.Name); } AddAudioVolumeFilter(); }
public ATSCTuner(Config.Graph sourceConfig, Control hostControl) : base(sourceConfig, hostControl) { tunerFilter = FilterGraphTools.AddFilterByName(_graphBuilder, FilterCategory.BDASourceFiltersCategory, GraphConfig[FilterType.Tuner].Name); captureFilter = FilterGraphTools.AddFilterByName(_graphBuilder, FilterCategory.BDAReceiverComponentsCategory, GraphConfig[FilterType.Capture].Name); r_videoTee = FilterGraphTools.AddFilterByName(_graphBuilder, FilterCategory.LegacyAmFilterCategory, "Infinite Pin Tee Filter"); r_audioTee = FilterGraphTools.AddFilterByName(_graphBuilder, FilterCategory.LegacyAmFilterCategory, "Infinite Pin Tee Filter"); if (audioDecoder != null) { mediaLooksAudioDecoder = audioDecoder as IMLAudioDecoder; if (mediaLooksAudioDecoder != null) { Debug.WriteLine("MediaLooks Audio Decoder detected! Setting Pass-through Input Time Stamps = true"); mediaLooksAudioDecoder.UseInputTimeStamps(1); } AddAudioVolumeFilter(); AddAudioRenderer(); } if ((AppUser.Current.ChannelIndex >= 0) && (AppUser.Current.ChannelIndex < this.KnownChannels.Count)) { this.StartupChannel = this.KnownChannels.Items[AppUser.Current.ChannelIndex]; } }
public LTNetSource(Config.Graph sourceConfig, Control hostControl) : base(sourceConfig, hostControl) { this.Connected = ConnectionState.Disconnected; _mediaEvent = (IMediaEvent)_graphBuilder; dmxMsgReceiveTimer = new System.Timers.Timer(); dmxMsgReceiveTimer.Elapsed += new ElapsedEventHandler(dmxMsgReceiveTimer_Elapsed); dmxMsgReceiveTimer.Interval = 1000; }
/// <summary> /// Constructor, must be called by sub-classes /// </summary> /// <remarks> /// Takes care of basic stuff, creates the basic DirectShow graph builder and such, /// and adds video renderer /// </remarks> /// <param name="graphConfig">configuration</param> /// <param name="hostControl">control that the graph will render to</param> protected BaseGraph(Config.Graph graphConfig, Control hostControl) { int hr; _graphConfig = graphConfig; _hostControl = hostControl; //Create the Graph _graphBuilder = (IGraphBuilder) new FilterGraph(); _mediaControl = (IMediaControl)_graphBuilder; Debug.Assert(_mediaControl != null); //Create the Capture Graph Builder _captureGraphBuilder = (ICaptureGraphBuilder2) new CaptureGraphBuilder2(); // Attach the filter graph to the capture graph hr = _captureGraphBuilder.SetFiltergraph(_graphBuilder); DsError.ThrowExceptionForHR(hr); AddVideoRenderer(); }
public WinTVATSC(Config.Graph sourceConfig, Control hostControl) : base(sourceConfig, hostControl) { }
public AverA307Analog(Config.Graph sourceConfig, Control hostControl) : base(sourceConfig, hostControl) { }
public WinTV(Config.Graph sourceConfig, Control hostControl) : base(sourceConfig, hostControl) { CaptureRequiresNewGraph = true; }
public DigitalTuner(Config.Graph sourceConfig, Control hostControl) : base(sourceConfig, hostControl) { //deal with the Tuning Space and Network Provider tuningSpace = GetTuningSpace(); Guid networkProviderCLSID; Guid networkTypeCLSID; tuningSpace.get__NetworkType(out networkTypeCLSID); if (networkTypeCLSID.Equals(Guid.Empty)) { throw new Exception("Not a digital Network Type!"); } if (UseGenericNetworkProvider) { networkProviderCLSID = CLSID_NetworkProvider; } else { networkProviderCLSID = networkTypeCLSID; } networkProvider = (IBaseFilter)Activator.CreateInstance(Type.GetTypeFromCLSID(networkProviderCLSID)); tuner = (ITuner)networkProvider; // if (UseGenericNetworkProvider) { tuner.put_TuningSpace(tuningSpace); } int hr = _graphBuilder.AddFilter(networkProvider, "Network Provider"); DsError.ThrowExceptionForHR(hr); //add MPEG2 Demux mpeg2Demux = FilterGraphTools.AddFilterByName(_graphBuilder, FilterCategory.LegacyAmFilterCategory, "MPEG-2 Demultiplexer"); //add video decoder videoDecoder = FilterGraphTools.AddFilterByName(_graphBuilder, FilterCategory.LegacyAmFilterCategory, GraphConfig[FilterType.VideoDecoder].Name); if (videoDecoder == null) { throw new Exception("Could not instantiate video decoder!"); } //add audio decoder if (GraphConfig[FilterType.AudioDecoder] != null) { audioDecoder = FilterGraphTools.AddFilterByName(_graphBuilder, FilterCategory.LegacyAmFilterCategory, GraphConfig[FilterType.AudioDecoder].Name); if (audioDecoder == null) { throw new Exception("Could not instantiate audio decoder!"); } } //add BDA MPEG-2 Transport Information Filter bdaTransportInfo = FilterGraphTools.AddFilterByName(_graphBuilder, FilterCategory.BDATransportInformationRenderersCategory, "BDA MPEG2 Transport Information Filter"); //add MPEG-2 Sections and Tables Filter mpeg2SectionsAndTables = FilterGraphTools.AddFilterByName(_graphBuilder, FilterCategory.BDATransportInformationRenderersCategory, "MPEG-2 Sections and Tables"); // sampleGrabberFilter = FilterGraphTools.AddFilterByName(_graphBuilder, FilterCategory.LegacyAmFilterCategory, "SampleGrabber"); // sampleGrabber = (ISampleGrabber)sampleGrabberFilter; }
public BaseLocalTuner(Config.Graph sourceConfig, Control hostControl) : base(sourceConfig, hostControl) { LoadKnownChannels(); }
public AverATSC(Config.Graph sourceConfig, Control host) : base(sourceConfig, host) { }
public AverA323Analog(Config.Graph sourceConfig, Control hostControl) : base(sourceConfig, hostControl) { CaptureRequiresNewGraph = true; }