public Presenter(ITuner _form) { this._form = _form; _form.SetDevices(DeviceManager.GetActiveDevices()); _form.StartButtonClick += _form_StartButtonClick; _form.StopButtonClick += _form_StopButtonClick; }
public void InitializeGraph() { int hr = 0; graphBuilder = (IFilterGraph2) new FilterGraph(); rot = new DsROTEntry(graphBuilder); ICaptureGraphBuilder2 capBuilder = (ICaptureGraphBuilder2) new CaptureGraphBuilder2(); capBuilder.SetFiltergraph(graphBuilder); // Get the BDA network provider specific for this given network type networkProvider = BDAUtils.GetNetworkProvider(networkType); hr = graphBuilder.AddFilter(networkProvider, "BDA Network Provider"); DsError.ThrowExceptionForHR(hr); tuner = (ITuner)networkProvider; // found a BDA Tuner and a BDA Capture that can connect to this network provider BDAUtils.AddBDATunerAndDemodulatorToGraph(graphBuilder, networkProvider, out bdaTuner, out bdaCapture); if ((bdaTuner != null) && (bdaCapture != null)) { // Create and add the mpeg2 demux mpeg2Demux = (IBaseFilter) new MPEG2Demultiplexer(); hr = graphBuilder.AddFilter(mpeg2Demux, "MPEG2 Demultiplexer"); DsError.ThrowExceptionForHR(hr); // connect it to the BDA Capture hr = capBuilder.RenderStream(null, null, bdaCapture, null, mpeg2Demux); DsError.ThrowExceptionForHR(hr); // Add the two mpeg2 transport stream helper filters BDAUtils.AddTransportStreamFiltersToGraph(graphBuilder, out bdaTIF, out bdaSecTab); if ((bdaTIF != null) && (bdaSecTab != null)) { // Render all the output pins of the demux (missing filters are added) for (int i = 0; i < 5; i++) { IPin pin = DsFindPin.ByDirection(mpeg2Demux, PinDirection.Output, i); hr = graphBuilder.Render(pin); Marshal.ReleaseComObject(pin); } } else { throw new ApplicationException("Can't add the BDA support filters"); } } else { throw new ApplicationException("Can't add a tuner and a demodulator"); } }
public ConcretHomeTheater(IAmplifier amplifier, ITuner tuner, IDvdPlayer dvdPlayer, ICdPlayer cdPlayer, IProjector projector, ITheaterLight theaterLight, IScreen screen) { this._amp = amplifier; this._tuner = tuner; this._dvd = dvdPlayer; this._cd = cdPlayer; this._projector = projector; this._lights = theaterLight; this._screen = screen; }
private static void Main(string[] args) { IUnityContainer container = new UnityContainer(); ContainerMagic.RegisterElements(container); IBattery battery = container.Resolve <IBattery>(); Dial dial = container.Resolve <Dial>(); ITuner tuner = container.Resolve <ITuner>(); IRadio radio = container.Resolve <IRadio>(new ParameterOverride("radioBattery", battery), new ParameterOverride("radioTuner", tuner), new ParameterOverride("radioName", "BrokenRadio")); radio.Start(); }
public void SetTuner(ITuner tuner) { ITuner oldTuner = uiTuningSpace.Content as ITuner; if (oldTuner != null) { oldTuner.Tuning -= Tuner_Tuning; uiTuningSpace.Content = null; } uiTuningSpace.Content = tuner; if (tuner != null) { tuner.Tuning += Tuner_Tuning; } }
public HomeTheaterFacade( IAmplifier amp, ITuner tuner, IDvdPlayer dvd, ICdPlayer cd, IProjector projector, IThreaterLights lights, IScreen screen, IPopcornPopper popper) { _amp = amp; _tuner = tuner; _dvd = dvd; _cd = cd; _projector = projector; _lights = lights; _screen = screen; _popper = popper; }
static void Main(string[] args) { IUnityContainer container = new UnityContainer(); ContainerMagic.RegisterElements(container); IBattery battery = container.Resolve <IBattery>(); Console.WriteLine(battery.SerialNumber()); Dial dial = container.Resolve <Dial>(); Console.WriteLine(dial.DialType()); ITuner tuner = container.Resolve <ITuner>(); IRadio radio = container.Resolve <IRadio>(new ParameterOverride("radioBattery2", battery), new ParameterOverride("radioTuner2", tuner), new ParameterOverride("radioName", "BrokenRadio")); radio.Start(); ISpeaker cheapSpeaker = container.Resolve <ISpeaker>("Cheap"); ISpeaker priceySpeaker = container.Resolve <ISpeaker>("Expensive"); cheapSpeaker.Start(); priceySpeaker.Start(); // create a dummy extension for string String a = "Je suis une vrai string"; Console.WriteLine(a + ", et en appelant MySuperExtentionMethod, ça retourne : " + a.MySuperExtentionMethod()); // string format with property, of instance variable LogItem r = new LogItem() { ItemCount = 455 }; Console.WriteLine(String.Format($"Write cache dump {r} ({r.ItemCount} items affected)")); }
static void Main(string[] args) { IUnityContainer container = new Unity.UnityContainer(); UnityContainer.RegisterElements(container); IBattery battery = container.Resolve <IBattery>(); Console.WriteLine(battery.SerialNumber()); ITuner tuner = container.Resolve <ITuner>(); Console.WriteLine(tuner.SerialNumber()); ICasing casing = container.Resolve <ICasing>(); Console.WriteLine(casing.TypeOfMaterial()); Console.ReadLine(); }
public static void Main(string[] args) { // Resolving the Dependencies IUnityContainer container = new UnityContainer(); ContainerAction.RegisterElements(container); //Checking for the Charge of the Battery IBattery battery = container.Resolve <IBattery>(); Console.WriteLine(battery.ChargeRemaining()); //Checking for the Tuner Manufacturer ITuner tuner = container.Resolve <ITuner>(); Console.WriteLine(tuner.Manufacturer()); Console.ReadKey(); }
static void Main(string[] args) { IUnityContainer container = new UnityContainer(); ContainerMagic.RegisterElements(container); IBattery battery = container.Resolve <IBattery>(); Console.WriteLine(battery.SerialNumber()); Dial dial = container.Resolve <Dial>(new ParameterOverride("typeOfDial", "linear")); Console.WriteLine(dial.DialType()); ITuner tuner = container.Resolve <ITuner>(); Console.WriteLine(tuner.SerialNumber()); IRadio radio = container.Resolve <IRadio>(new ParameterOverride("radioBattery", battery), new ParameterOverride("radioTuner", tuner), new ParameterOverride("radioName", "BrokenRadio")); radio.Start(); ISpeaker cheapSpeaker = container.Resolve <ISpeaker>("Cheap"); ISpeaker priceySpeaker = container.Resolve <ISpeaker>("Expensive"); cheapSpeaker.Start(); priceySpeaker.Start(); ICasing casing = container.Resolve <ICasing>(); Console.WriteLine(casing.TypeOfMaterial()); Console.WriteLine("Press any key to continue..."); Console.ReadLine(); }
public Radio(IBattery radioBattery, ITuner radioTuner, string radioName) { Battery = radioBattery; Tuner = radioTuner; Name = radioName; }
/// <summary> /// Creates the tuning space. /// </summary> protected void CreateTuningSpace() { Log.Log.WriteFile("dvbt:CreateTuningSpace()"); ITuner tuner = (ITuner)_filterNetworkProvider; SystemTuningSpaces systemTuningSpaces = new SystemTuningSpaces(); ITuningSpaceContainer container = systemTuningSpaces as ITuningSpaceContainer; if (container == null) { Log.Log.Error("CreateTuningSpace() Failed to get ITuningSpaceContainer"); return; } IEnumTuningSpaces enumTuning; ITuningSpace[] spaces = new ITuningSpace[2]; ITuneRequest request; container.get_EnumTuningSpaces(out enumTuning); while (true) { int fetched; enumTuning.Next(1, spaces, out fetched); if (fetched != 1) { break; } string name; spaces[0].get_UniqueName(out name); if (name == "MediaPortal DVBT TuningSpace") { Log.Log.WriteFile("dvbt:found correct tuningspace {0}", name); _tuningSpace = (IDVBTuningSpace)spaces[0]; tuner.put_TuningSpace(_tuningSpace); _tuningSpace.CreateTuneRequest(out request); _tuneRequest = (IDVBTuneRequest)request; return; } Release.ComObject("ITuningSpace", spaces[0]); } Release.ComObject("IEnumTuningSpaces", enumTuning); Log.Log.WriteFile("dvbt:Create new tuningspace"); _tuningSpace = (IDVBTuningSpace) new DVBTuningSpace(); IDVBTuningSpace tuningSpace = (IDVBTuningSpace)_tuningSpace; tuningSpace.put_UniqueName("MediaPortal DVBT TuningSpace"); tuningSpace.put_FriendlyName("MediaPortal DVBT TuningSpace"); tuningSpace.put__NetworkType(typeof(DVBTNetworkProvider).GUID); tuningSpace.put_SystemType(DVBSystemType.Terrestrial); IDVBTLocator locator = (IDVBTLocator) new DVBTLocator(); locator.put_CarrierFrequency(-1); locator.put_InnerFEC(FECMethod.MethodNotSet); locator.put_InnerFECRate(BinaryConvolutionCodeRate.RateNotSet); locator.put_Modulation(ModulationType.ModNotSet); locator.put_OuterFEC(FECMethod.MethodNotSet); locator.put_OuterFECRate(BinaryConvolutionCodeRate.RateNotSet); locator.put_SymbolRate(-1); object newIndex; _tuningSpace.put_DefaultLocator(locator); container.Add(_tuningSpace, out newIndex); tuner.put_TuningSpace(_tuningSpace); Release.ComObject("ITuningSpaceContainer", container); _tuningSpace.CreateTuneRequest(out request); _tuneRequest = request; }
public void SetTuner(ITuner tuner) { Console.WriteLine($"{_name} Amplifier setting tuner to {tuner.GetName()}"); }
public Resize(ITuner tuner) { this.Tuner = tuner; tuner.TunableTool = this; }
public WinTV418ATSC(StreamSourceInfo sourceConfig, OpenGraphRequest openGraphRequest) : base(sourceConfig, openGraphRequest) { if (SourceConfig.TVTuner == null) { throw new SourceConfigException("TVTuner config section not found!"); } _deviceIndex = sourceConfig.TVTuner.DeviceIndex; tuningSpace = GetTuningSpace(); Guid networkType; tuningSpace.get__NetworkType(out networkType); if (networkType.Equals(Guid.Empty)) { throw new Exception("Not a digital Network Type!"); } networkProvider = (IBaseFilter)Activator.CreateInstance(Type.GetTypeFromCLSID(networkType)); int hr = _graphBuilder.AddFilter(networkProvider, "Network Provider"); DsError.ThrowExceptionForHR(hr); tuner = (ITuner)networkProvider; //add MPEG2 Demux mpeg2Demux = FilterGraphTools.AddFilterByName(_graphBuilder, FilterCategory.LegacyAmFilterCategory, "MPEG-2 Demultiplexer"); //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"); //tunerFilter = FilterGraphTools.AddFilterByName(_graphBuilder, FilterCategory.BDASourceFiltersCategory, "Hauppauge WinTV 418 BDA Tuner"); DsDevice tunerDevice = FindDevice(FilterCategory.BDASourceFiltersCategory, "Hauppauge WinTV 418 BDA Tuner"); tunerFilter = FilterGraphTools.AddFilterByDevicePath(_graphBuilder, tunerDevice.DevicePath, tunerDevice.Name); //captureFilter = FilterGraphTools.AddFilterByName(_graphBuilder, FilterCategory.BDAReceiverComponentsCategory, "Hauppauge WinTV 418 TS Capture"); DsDevice captureDevice = FindDevice(FilterCategory.BDAReceiverComponentsCategory, "Hauppauge WinTV 418 TS Capture"); captureFilter = FilterGraphTools.AddFilterByDevicePath(_graphBuilder, captureDevice.DevicePath, captureDevice.Name); //connect network provider to BDA tuner ConnectFilters(networkProvider, "Antenna Out", (IBaseFilter)tunerFilter, "Input0", false); ConnectFilters((IBaseFilter)tunerFilter, "MPEG2 Transport", captureFilter, "MPEG2 Transport", false); //These filters need to be connected via their explicit pins, // because Hauppauge saw fit to name all the pins on the capture filter the same name. IPin captureFilterOut = DsFindPin.ByDirection(captureFilter, PinDirection.Output, 0); IPin mpeg2DemuxIn = DsFindPin.ByDirection(mpeg2Demux, PinDirection.Input, 0); FilterGraphTools.ConnectFilters(_graphBuilder, captureFilterOut, mpeg2DemuxIn, false); //clean up the two pins Marshal.ReleaseComObject(captureFilterOut); Marshal.ReleaseComObject(mpeg2DemuxIn); //add and connect meta data filters and connect them to the Demux ConnectFilters(mpeg2Demux, "1", bdaTransportInfo, "Input", false); ConnectFilters(mpeg2Demux, "5", mpeg2SectionsAndTables, "In", false); //this interface must be queried after the S&T filter has been connected. mpeg2Data = (IMpeg2Data)mpeg2SectionsAndTables; _vctParser = new Parser(mpeg2Data); //build out the rest of the graph for the given source config / profile BuildForProfile(); ConnectNetMuxToNetSnk(); if (KnownChannels.Count > 0) { this.Channel = KnownChannels.Items[0]; } SaveGraphFile("WinTV418ATSC.grf"); }
private void BuildGraph() { int hr = 0; graphBuilder = (IFilterGraph2) new FilterGraph(); rot = new DsROTEntry(graphBuilder); ICaptureGraphBuilder2 capBuilder = (ICaptureGraphBuilder2) new CaptureGraphBuilder2(); capBuilder.SetFiltergraph(graphBuilder); // Get the BDA network provider specific for this given network type networkProvider = BDAUtils.GetNetworkProvider(networkType); hr = graphBuilder.AddFilter(networkProvider, "BDA Network Provider"); DsError.ThrowExceptionForHR(hr); tuner = (ITuner)networkProvider; // Get a tuning space for this network type tuningSpace = BDAUtils.GetTuningSpace(networkType); hr = tuner.put_TuningSpace(tuningSpace); DsError.ThrowExceptionForHR(hr); // Create a tune request from this tuning space tuneRequest = BDAUtils.CreateTuneRequest(tuningSpace); // Is it okay ? hr = tuner.Validate(tuneRequest); if (hr == 0) { // Set it hr = tuner.put_TuneRequest(tuneRequest); DsError.ThrowExceptionForHR(hr); // found a BDA Tuner and a BDA Capture that can connect to this network provider BDAUtils.AddBDATunerAndDemodulatorToGraph(graphBuilder, networkProvider, out bdaTuner, out bdaCapture); if ((bdaTuner != null) && (bdaCapture != null)) { // Create and add the mpeg2 demux mpeg2Demux = (IBaseFilter) new MPEG2Demultiplexer(); hr = graphBuilder.AddFilter(mpeg2Demux, "MPEG2 Demultiplexer"); DsError.ThrowExceptionForHR(hr); // connect it to the BDA Capture hr = capBuilder.RenderStream(null, null, bdaCapture, null, mpeg2Demux); DsError.ThrowExceptionForHR(hr); // Add the two mpeg2 transport stream helper filters BDAUtils.AddTransportStreamFiltersToGraph(graphBuilder, out bdaTIF, out bdaSecTab); if ((bdaTIF != null) && (bdaSecTab != null)) { // Render all the output pins of the demux (missing filters are added) for (int i = 0; i < 5; i++) { IPin pin = DsFindPin.ByDirection(mpeg2Demux, PinDirection.Output, i); hr = graphBuilder.Render(pin); Marshal.ReleaseComObject(pin); } } IBDA_Topology topo = (IBDA_Topology)bdaTuner; int[] nodeTypes = new int[10]; int nodeTypesCount; // Get all nodes in the BDA Tuner hr = topo.GetNodeTypes(out nodeTypesCount, nodeTypes.Length, nodeTypes); DsError.ThrowExceptionForHR(hr); // For each nodes types for (int i = 0; i < nodeTypesCount; i++) { Guid[] nodeGuid = new Guid[10]; int nodeGuidCount; // Get its exposed interfaces hr = topo.GetNodeInterfaces(nodeTypes[i], out nodeGuidCount, nodeGuid.Length, nodeGuid); DsError.ThrowExceptionForHR(hr); // For each exposed interfaces for (int j = 0; j < nodeGuidCount; j++) { Debug.WriteLine(string.Format("node {0}/{1} : {2}", i, j, nodeGuid[j])); Console.WriteLine(string.Format("node {0}/{1} : {2}", i, j, nodeGuid[j])); // Is IBDA_LNBInfo supported by this node ? if (nodeGuid[j] == typeof(IBDA_LNBInfo).GUID) { // Yes, retrieve this node object ctrlNode; hr = topo.GetControlNode(0, 1, nodeTypes[i], out ctrlNode); DsError.ThrowExceptionForHR(hr); // Do the cast (it should not fail) lnbInfo = ctrlNode as IBDA_LNBInfo; // Exit the for j loop if found a SignalStatistics object if (lnbInfo != null) { break; } } } // If already found a SignalStatistics object, exit the for i loop if (lnbInfo != null) { break; } } } } }
/// <summary> /// Creates the tuning space. /// </summary> protected void CreateTuningSpace() { Log.Log.WriteFile("atsc:CreateTuningSpace()"); ITuner tuner = (ITuner)_filterNetworkProvider; SystemTuningSpaces systemTuningSpaces = new SystemTuningSpaces(); ITuningSpaceContainer container = systemTuningSpaces as ITuningSpaceContainer; if (container == null) { Log.Log.Error("CreateTuningSpace() Failed to get ITuningSpaceContainer"); return; } IEnumTuningSpaces enumTuning; ITuningSpace[] spaces = new ITuningSpace[2]; ITuneRequest request; container.get_EnumTuningSpaces(out enumTuning); while (true) { int fetched; enumTuning.Next(1, spaces, out fetched); if (fetched != 1) { break; } string name; spaces[0].get_UniqueName(out name); if (name == "MediaPortal ATSC TuningSpace") { Log.Log.WriteFile("atsc:found correct tuningspace {0}", name); _tuningSpace = (IATSCTuningSpace)spaces[0]; tuner.put_TuningSpace(_tuningSpace); _tuningSpace.CreateTuneRequest(out request); _tuneRequest = (IATSCChannelTuneRequest)request; return; } Release.ComObject("ITuningSpace", spaces[0]); } Release.ComObject("IEnumTuningSpaces", enumTuning); Log.Log.WriteFile("atsc:Create new tuningspace"); _tuningSpace = (IATSCTuningSpace) new ATSCTuningSpace(); IATSCTuningSpace tuningSpace = (IATSCTuningSpace)_tuningSpace; tuningSpace.put_UniqueName("MediaPortal ATSC TuningSpace"); tuningSpace.put_FriendlyName("MediaPortal ATSC TuningSpace"); tuningSpace.put__NetworkType(typeof(ATSCNetworkProvider).GUID); tuningSpace.put_CountryCode(0); tuningSpace.put_InputType(TunerInputType.Antenna); tuningSpace.put_MaxMinorChannel(999); //minor channels per major tuningSpace.put_MaxPhysicalChannel(158); //69 for OTA 158 for QAM tuningSpace.put_MaxChannel(99); //major channels tuningSpace.put_MinMinorChannel(0); tuningSpace.put_MinPhysicalChannel(1); //OTA 1, QAM 2 tuningSpace.put_MinChannel(1); IATSCLocator locator = (IATSCLocator) new ATSCLocator(); locator.put_CarrierFrequency(-1); locator.put_InnerFEC(FECMethod.MethodNotSet); locator.put_InnerFECRate(BinaryConvolutionCodeRate.RateNotSet); locator.put_Modulation(ModulationType.Mod8Vsb); //OTA modultation, QAM = .Mod256Qam locator.put_OuterFEC(FECMethod.MethodNotSet); locator.put_OuterFECRate(BinaryConvolutionCodeRate.RateNotSet); locator.put_PhysicalChannel(-1); locator.put_SymbolRate(-1); locator.put_TSID(-1); object newIndex; _tuningSpace.put_DefaultLocator(locator); container.Add(_tuningSpace, out newIndex); tuner.put_TuningSpace(_tuningSpace); Release.ComObject("TuningSpaceContainer", container); _tuningSpace.CreateTuneRequest(out request); _tuneRequest = (IATSCChannelTuneRequest)request; }
private void BuildGraph() { int hr = 0; graphBuilder = (IFilterGraph2) new FilterGraph(); rot = new DsROTEntry(graphBuilder); ICaptureGraphBuilder2 capBuilder = (ICaptureGraphBuilder2) new CaptureGraphBuilder2(); capBuilder.SetFiltergraph(graphBuilder); // Get the BDA network provider specific for this given network type networkProvider = BDAUtils.GetNetworkProvider(networkType); hr = graphBuilder.AddFilter(networkProvider, "BDA Network Provider"); DsError.ThrowExceptionForHR(hr); tuner = (ITuner)networkProvider; // Get a tuning space for this network type tuningSpace = BDAUtils.GetTuningSpace(networkType); hr = tuner.put_TuningSpace(tuningSpace); DsError.ThrowExceptionForHR(hr); // Create a tune request from this tuning space tuneRequest = BDAUtils.CreateTuneRequest(tuningSpace); // Is it okay ? hr = tuner.Validate(tuneRequest); if (hr == 0) { // Set it hr = tuner.put_TuneRequest(tuneRequest); DsError.ThrowExceptionForHR(hr); // found a BDA Tuner and a BDA Capture that can connect to this network provider BDAUtils.AddBDATunerAndDemodulatorToGraph(graphBuilder, networkProvider, out bdaTuner, out bdaCapture); if ((bdaTuner != null) && (bdaCapture != null)) { // Create and add the mpeg2 demux mpeg2Demux = (IBaseFilter) new MPEG2Demultiplexer(); hr = graphBuilder.AddFilter(mpeg2Demux, "MPEG2 Demultiplexer"); DsError.ThrowExceptionForHR(hr); // connect it to the BDA Capture hr = capBuilder.RenderStream(null, null, bdaCapture, null, mpeg2Demux); DsError.ThrowExceptionForHR(hr); // Add the two mpeg2 transport stream helper filters BDAUtils.AddTransportStreamFiltersToGraph(graphBuilder, out bdaTIF, out bdaSecTab); if ((bdaTIF != null) && (bdaSecTab != null)) { // Render all the output pins of the demux (missing filters are added) for (int i = 0; i < 5; i++) { IPin pin = DsFindPin.ByDirection(mpeg2Demux, PinDirection.Output, i); hr = graphBuilder.Render(pin); Marshal.ReleaseComObject(pin); } } } } }
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 Interpolation(ITuner tuner) { this.Tuner = tuner; tuner.TunableTool = this; }
/// <summary> /// Creates the tuning space. /// </summary> protected void CreateTuningSpace() { Log.Log.WriteFile("dvbs:CreateTuningSpace()"); ITuner tuner = (ITuner)_filterNetworkProvider; SystemTuningSpaces systemTuningSpaces = new SystemTuningSpaces(); ITuningSpaceContainer container = systemTuningSpaces as ITuningSpaceContainer; if (container == null) { Log.Log.Error("CreateTuningSpace() Failed to get ITuningSpaceContainer"); return; } IEnumTuningSpaces enumTuning; ITuningSpace[] spaces = new ITuningSpace[2]; int lowOsc; int hiOsc; int lnbSwitch; if (_parameters.UseDefaultLnbFrequencies) { lowOsc = 9750; hiOsc = 10600; lnbSwitch = 11700; } else { lowOsc = _parameters.LnbLowFrequency; hiOsc = _parameters.LnbHighFrequency; lnbSwitch = _parameters.LnbSwitchFrequency; } ITuneRequest request; container.get_EnumTuningSpaces(out enumTuning); IDVBSTuningSpace tuningSpace; while (true) { int fetched; enumTuning.Next(1, spaces, out fetched); if (fetched != 1) { break; } string name; spaces[0].get_UniqueName(out name); if (name == "MediaPortal DVBS TuningSpace") { Log.Log.WriteFile("dvbs:found correct tuningspace {0}", name); _tuningSpace = (IDVBSTuningSpace)spaces[0]; tuningSpace = (IDVBSTuningSpace)_tuningSpace; tuningSpace.put_LNBSwitch(lnbSwitch * 1000); tuningSpace.put_SpectralInversion(SpectralInversion.Automatic); tuningSpace.put_LowOscillator(lowOsc * 1000); tuningSpace.put_HighOscillator(hiOsc * 1000); tuner.put_TuningSpace(tuningSpace); tuningSpace.CreateTuneRequest(out request); _tuneRequest = (IDVBTuneRequest)request; return; } Release.ComObject("ITuningSpace", spaces[0]); } Release.ComObject("IEnumTuningSpaces", enumTuning); Log.Log.WriteFile("dvbs:Create new tuningspace"); _tuningSpace = (IDVBSTuningSpace) new DVBSTuningSpace(); tuningSpace = (IDVBSTuningSpace)_tuningSpace; tuningSpace.put_UniqueName("MediaPortal DVBS TuningSpace"); tuningSpace.put_FriendlyName("MediaPortal DVBS TuningSpace"); tuningSpace.put__NetworkType(typeof(DVBSNetworkProvider).GUID); tuningSpace.put_SystemType(DVBSystemType.Satellite); tuningSpace.put_LNBSwitch(lnbSwitch * 1000); tuningSpace.put_LowOscillator(lowOsc * 1000); tuningSpace.put_HighOscillator(hiOsc * 1000); IDVBSLocator locator = (IDVBSLocator) new DVBSLocator(); locator.put_CarrierFrequency(-1); locator.put_InnerFEC(FECMethod.MethodNotSet); locator.put_InnerFECRate(BinaryConvolutionCodeRate.RateNotSet); locator.put_Modulation(ModulationType.ModNotSet); locator.put_OuterFEC(FECMethod.MethodNotSet); locator.put_OuterFECRate(BinaryConvolutionCodeRate.RateNotSet); locator.put_SymbolRate(-1); object newIndex; _tuningSpace.put_DefaultLocator(locator); container.Add(_tuningSpace, out newIndex); tuner.put_TuningSpace(_tuningSpace); Release.ComObject("TuningSpaceContainer", container); _tuningSpace.CreateTuneRequest(out request); _tuneRequest = (IDVBTuneRequest)request; }