コード例 #1
0
        public void GetTransportInfo(UInt32 instanceId, out UpnpAvTransportState currentTransportState,
                                     out UpnpAvTransportStatus currentTransportStatus, out string currentSpeed)
        {
            IList <object> outParams = _getTransportInfoAction.InvokeAction(new List <object> {
                instanceId
            });

            currentTransportState  = (UpnpAvTransportState)Enum.Parse(typeof(UpnpAvTransportState), (string)outParams[0]);
            currentTransportStatus = (UpnpAvTransportStatus)Enum.Parse(typeof(UpnpAvTransportStatus), (string)outParams[1]);
            currentSpeed           = (string)outParams[2];
        }
コード例 #2
0
 public void GetTransportInfo(UInt32 instanceId, out UpnpAvTransportState currentTransportState,
                             out UpnpAvTransportStatus currentTransportStatus, out string currentSpeed)
 {
   IList<object> outParams = _getTransportInfoAction.InvokeAction(new List<object> { instanceId });
   currentTransportState = (UpnpAvTransportState)Enum.Parse(typeof(UpnpAvTransportState), (string)outParams[0]);
   currentTransportStatus = (UpnpAvTransportStatus)Enum.Parse(typeof(UpnpAvTransportStatus), (string)outParams[1]);
   currentSpeed = (string)outParams[2];
 }
コード例 #3
0
ファイル: TunerDri.cs プロジェクト: doskabouter/MediaPortal-1
    /// <summary>
    /// Actually tune to a channel.
    /// </summary>
    /// <param name="channel">The channel to tune to.</param>
    protected override ITvSubChannel SubmitTuneRequest(int subChannelId, IChannel channel, ITuneRequest tuneRequest, bool performTune)
    {
      ATSCChannel atscChannel = channel as ATSCChannel;
      if (atscChannel == null)
      {
        throw new TvException("DRI CC: received tune request for unsupported channel");
      }
      Log.Log.Info("DRI CC: tune channel {0} \"{1}\", sub channel ID {2}", atscChannel.MajorChannel, channel.Name, subChannelId);

      bool newSubChannel = false;
      BaseSubChannel subChannel;
      if (!_mapSubChannels.TryGetValue(subChannelId, out subChannel))
      {
        Log.Log.Debug("  new subchannel");
        newSubChannel = true;
        subChannelId = GetNewSubChannel(channel);
        subChannel = _mapSubChannels[subChannelId];
      }
      else
      {
        Log.Log.Debug("  existing subchannel {0}", subChannelId);
      }

      subChannel.CurrentChannel = channel;
      try
      {
        subChannel.OnBeforeTune();
        if (_interfaceEpgGrabber != null)
        {
          _interfaceEpgGrabber.Reset();
        }

        if (performTune)
        {
          Log.Log.Debug("DRI CC: tuning...");
          // Note that this call is not blocking, so usually the isPcrLocked
          // variable return value is false... then shortly afterwards we'll
          // receive an update if the tuner locks on signal. It may be possible
          // to use the Tuner service TimeToBlock SV to delay long enough to
          // get lock, however that is probably slower on average than
          // receiving asynchronous updates.
          _eventSignalLock.Reset();
          _casService.SetChannel((uint)atscChannel.MajorChannel, 0, DriCasCaptureMode.Live, out _tunerLocked);
        }
        else
        {
          Log.Log.Info("DRI CC: already tuned");
        }

        if (_transportState != UpnpAvTransportState.PLAYING)
        {
          Log.Log.Debug("DRI CC: play...");
          ((IFileSourceFilter)_filterStreamSource).Load(_streamUrl, _mpeg2TransportStream);
          _avTransportService.Play((uint)_avTransportId, "1");
          _transportState = UpnpAvTransportState.PLAYING;
        }

        _lastSignalUpdate = DateTime.MinValue;
        subChannel.OnAfterTune();
      }
      catch (Exception)
      {
        if (newSubChannel)
        {
          Log.Log.Info("DRI CC: tuning failed, removing subchannel");
          _mapSubChannels.Remove(subChannelId);
        }
        throw;
      }

      return subChannel;
    }
コード例 #4
0
ファイル: TunerDri.cs プロジェクト: doskabouter/MediaPortal-1
 public override void StopGraph()
 {
   if (_avTransportService != null && _gotTunerControl)
   {
     _avTransportService.Stop((uint)_avTransportId);
     _transportState = UpnpAvTransportState.STOPPED;
   }
   _gotTunerControl = false;
   base.StopGraph();
   _previousChannel = null;
 }
コード例 #5
0
ファイル: TunerDri.cs プロジェクト: doskabouter/MediaPortal-1
 public override void PauseGraph()
 {
   if (_avTransportService != null && _gotTunerControl)
   {
     if (_canPause)
     {
       _avTransportService.Pause((uint)_avTransportId);
       _transportState = UpnpAvTransportState.PAUSED_PLAYBACK;
     }
     else
     {
       _avTransportService.Stop((uint)_avTransportId);
       _transportState = UpnpAvTransportState.STOPPED;
     }
   }
   base.PauseGraph();
 }
コード例 #6
0
ファイル: TunerDri.cs プロジェクト: doskabouter/MediaPortal-1
    public override void Dispose()
    {
      if (_eventSignalLock != null)
      {
        _eventSignalLock.Close();
        _eventSignalLock = null;
      }

      base.Dispose();

      RemoveStreamSourceFilter();
      if (_mpeg2TransportStream != null)
      {
        DsUtils.FreeAMMediaType(_mpeg2TransportStream);
        _mpeg2TransportStream = null;
      }
      if (_tunerService != null)
      {
        _tunerService.Dispose();
        _tunerService = null;
      }
      if (_fdcService != null)
      {
        _fdcService.Dispose();
        _fdcService = null;
      }
      if (_auxService != null)
      {
        _auxService.Dispose();
        _auxService = null;
      }
      if (_encoderService != null)
      {
        _encoderService.Dispose();
        _encoderService = null;
      }
      if (_casService != null)
      {
        _casService.Dispose();
        _casService = null;
      }
      if (_muxService != null)
      {
        _muxService.Dispose();
        _muxService = null;
      }
      if (_securityService != null)
      {
        _securityService.Dispose();
        _securityService = null;
      }
      if (_diagService != null)
      {
        _diagService.Dispose();
        _diagService = null;
      }
      if (_avTransportService != null)
      {
        if (_gotTunerControl && _transportState != UpnpAvTransportState.STOPPED)
        {
          _avTransportService.Stop((uint)_avTransportId);
          _transportState = UpnpAvTransportState.STOPPED;
        }
        _avTransportService.Dispose();
        _avTransportService = null;
      }
      if (_connectionManagerService != null)
      {
        _connectionManagerService.ConnectionComplete(_connectionId);
        _connectionManagerService.Dispose();
        _connectionManagerService = null;
      }

      if (_deviceConnection != null)
      {
        _deviceConnection.Disconnect();
        _deviceConnection = null;
      }
      _gotTunerControl = false;
    }