Example #1
0
        public Task Play(MediaItem channel)
        {
            if (!(channel is AtscMedia))
            {
                return(Task.CompletedTask);
            }
            var atsc          = channel as AtscMedia;
            var tuningSpaces2 = new SystemTuningSpaces();
            var tuningSpaces  = (ITuningSpaceContainer) new SystemTuningSpaces();

            var atscTuningSpace = new ATSCTuningSpace
            {
                NetworkType     = "{0DAD2FDD-5FD7-11D3-8F50-00C04F7971E2}",
                CountryCode     = 1,
                MaxChannel      = 999,
                MaxMinorChannel = 99,
                UniqueName      = "ATSC"
            };
            var tuneRequest = (IATSCChannelTuneRequest)atscTuningSpace.CreateTuneRequest();

            var locator = new ATSCLocator {
                PhysicalChannel = 19
            };

            tuneRequest.Channel      = 19;
            tuneRequest.MinorChannel = 1;

            tuneRequest.Locator = (Locator)locator;
            var objTuneRequest = (object)tuneRequest;

            video.axMSVidCtl1.View(ref objTuneRequest);
            video.axMSVidCtl1.Run();
            Playing?.Invoke(this, null);
            return(Task.CompletedTask);
        }
Example #2
0
    /// <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;
    }
Example #3
0
    /// <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;
    }
Example #4
0
        /// <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;
        }
Example #5
0
        /// <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;
        }
Example #6
0
        /// <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;
        }
    /// <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;
    }