当前位置: 首页>>代码示例>>C#>>正文


C# TvServer.StartTimeShifting方法代码示例

本文整理汇总了C#中TvControl.TvServer.StartTimeShifting方法的典型用法代码示例。如果您正苦于以下问题:C# TvServer.StartTimeShifting方法的具体用法?C# TvServer.StartTimeShifting怎么用?C# TvServer.StartTimeShifting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TvControl.TvServer的用法示例。


在下文中一共展示了TvServer.StartTimeShifting方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShowDialog

    public new DialogResult ShowDialog(IWin32Window owner)
    {
      Text = "Preview " + _channel.DisplayName;

      TvServer server = new TvServer();
      IUser user = new User("setuptv", false);
      TvResult result = server.StartTimeShifting(ref user, _channel.IdChannel, out _card);
      if (result != TvResult.Succeeded)
      {
        MessageBox.Show("Preview failed:" + result);
        Close();
        return DialogResult.None;
      }

      Log.Info("preview {0} user:{1} {2} {3} {4}", _channel.DisplayName, user.CardId, user.SubChannel, user.Name,
               _card.TimeShiftFileName);
      _player = new Player();
      _player.Play(_card.TimeShiftFileName, this);

      return base.ShowDialog(owner);
    }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:21,代码来源:FormPreview.cs

示例2: ViewChannelAndCheck

    /// <summary>
    /// Tunes to a new channel
    /// </summary>
    /// <param name="channel"></param>
    /// <returns></returns>
    public static bool ViewChannelAndCheck(Channel channel)
    {
      bool checkResult;
      bool doContinue;

      if (!Connected)
      {
        return false;
      }

      _status.Clear();

      _doingChannelChange = false;

      try
      {
        checkResult = PreTuneChecks(channel, out doContinue);
        if (doContinue == false)
          return checkResult;

        _doingChannelChange = true;
        TvResult succeeded;


        IUser user = new User();
        if (Card != null)
        {
          user.CardId = Card.Id;
        }

        if ((g_Player.Playing && g_Player.IsTimeShifting && !g_Player.Stopped) && (g_Player.IsTV || g_Player.IsRadio))
        {
          _status.Set(LiveTvStatus.WasPlaying);
        }

        //Start timeshifting the new tv channel
        TvServer server = new TvServer();
        VirtualCard card;
        int newCardId = -1;

        // check which card will be used
        newCardId = server.TimeShiftingWouldUseCard(ref user, channel.IdChannel);

        //Added by joboehl - If any major related to the timeshifting changed during the start, restart the player.           
        if (newCardId != -1 && Card.Id != newCardId)
        {
          _status.Set(LiveTvStatus.CardChange);
          RegisterCiMenu(newCardId);
        }

        // we need to stop player HERE if card has changed.        
        if (_status.AllSet(LiveTvStatus.WasPlaying | LiveTvStatus.CardChange))
        {
          Log.Debug("TVHome.ViewChannelAndCheck(): Stopping player. CardId:{0}/{1}, RTSP:{2}", Card.Id, newCardId,
                    Card.RTSPUrl);
          Log.Debug("TVHome.ViewChannelAndCheck(): Stopping player. Timeshifting:{0}", Card.TimeShiftFileName);
          Log.Debug("TVHome.ViewChannelAndCheck(): rebuilding graph (card changed) - timeshifting continueing.");
        }
        if (_status.IsSet(LiveTvStatus.WasPlaying))
        {
          RenderBlackImage();
          g_Player.PauseGraph();
        }
        else
        {
          // if CI menu is not attached due to card change, do it if graph was not playing 
          // (some handlers use polling threads that get stopped on graph stop)
          if (_status.IsNotSet(LiveTvStatus.CardChange))
            RegisterCiMenu(newCardId);
        }

        // if card was not changed
        if (_status.IsNotSet(LiveTvStatus.CardChange))
        {
          g_Player.OnZapping(0x80); // Setup Zapping for TsReader, requesting new PAT from stream
        }
        bool cardChanged = false;
        succeeded = server.StartTimeShifting(ref user, channel.IdChannel, out card, out cardChanged);

        if (_status.IsSet(LiveTvStatus.WasPlaying))
        {
          if (card != null)
            g_Player.OnZapping((int)card.Type);
          else
            g_Player.OnZapping(-1);
        }


        if (succeeded != TvResult.Succeeded)
        {
          //timeshifting new channel failed. 
          g_Player.Stop();

          // ensure right channel name, even if not watchable:Navigator.Channel = channel; 
          ChannelTuneFailedNotifyUser(succeeded, _status.IsSet(LiveTvStatus.WasPlaying), channel);
//.........这里部分代码省略.........
开发者ID:splatterpop,项目名称:MediaPortal-1,代码行数:101,代码来源:TVHome.cs

示例3: mpButtonTimeShift_Click

    private void mpButtonTimeShift_Click(object sender, EventArgs e)
    {
      if (ServiceHelper.IsStopped) return;
      if (mpComboBoxChannels.SelectedItem == null) return;
      int id = ((ComboBoxExItem)mpComboBoxChannels.SelectedItem).Id;

      TvServer server = new TvServer();
      VirtualCard card = GetCardTimeShiftingChannel(id);
      if (card != null)
      {
        card.StopTimeShifting();
        mpButtonRec.Enabled = false;
      }
      else
      {
        string timeShiftingFilename = string.Empty;
        int cardId = -1;
        foreach (ListViewItem listViewItem in mpListView1.SelectedItems)
        {
          if (listViewItem.SubItems[2].Text != "disabled")
          {
            cardId = Convert.ToInt32(listViewItem.SubItems[0].Tag);
            break; // Keep the first card enabled selected only
          }
        }
        IUser user = new User();
        user.Name = "setuptv-" + id + "-" + cardId;
        user.IsAdmin = true;
        user.CardId = cardId;

        TvResult result = server.StartTimeShifting(ref user, id, out card, cardId != -1);
        if (result != TvResult.Succeeded)
        {
          switch (result)
          {
            case TvResult.NoPmtFound:
              MessageBox.Show(this, "No PMT found");
              break;
            case TvResult.NoSignalDetected:
              MessageBox.Show(this, "No signal");
              break;
            case TvResult.CardIsDisabled:
              MessageBox.Show(this, "Card is not enabled");
              break;
            case TvResult.AllCardsBusy:
              MessageBox.Show(this, "All cards are busy");
              break;
            case TvResult.ChannelIsScrambled:
              MessageBox.Show(this, "Channel is scrambled");
              break;
            case TvResult.NoVideoAudioDetected:
              MessageBox.Show(this, "No Video/Audio detected");
              break;
            case TvResult.UnableToStartGraph:
              MessageBox.Show(this, "Unable to create/start graph");
              break;
            case TvResult.ChannelNotMappedToAnyCard:
              MessageBox.Show(this, "Channel is not mapped to any card");
              break;
            case TvResult.NoTuningDetails:
              MessageBox.Show(this, "No tuning information available for this channel");
              break;
            case TvResult.UnknownChannel:
              MessageBox.Show(this, "Unknown channel");
              break;
            case TvResult.UnknownError:
              MessageBox.Show(this, "Unknown error occured");
              break;
            case TvResult.ConnectionToSlaveFailed:
              MessageBox.Show(this, "Cannot connect to slave server");
              break;
            case TvResult.NotTheOwner:
              MessageBox.Show(this, "Failed since card is in use and we are not the owner");
              break;
            case TvResult.GraphBuildingFailed:
              MessageBox.Show(this, "Unable to create graph");
              break;
            case TvResult.SWEncoderMissing:
              MessageBox.Show(this, "No suppported software encoder installed");
              break;
            case TvResult.NoFreeDiskSpace:
              MessageBox.Show(this, "No free disk space");
              break;
          }
        }
        else
        {
          mpButtonRec.Enabled = true;
        }
      }
    }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:91,代码来源:TestService.cs

示例4: ScanForUsableChannels

    private void ScanForUsableChannels()
    {
      _abortScanning = false;
      _isScanning = true;
      NotifyForm dlg = new NotifyForm("Testing all checked tv channels...", "Please be patient...");
      dlg.Show(this);
      dlg.WaitForDisplay();

      // Create tunning objects Server, User and Card
      TvServer _server = new TvServer();
      IUser _user = new User();
      VirtualCard _card;

      foreach (ListViewItem item in mpListView1.Items)
      {
        if (item.Checked == false)
        {
          continue; // do not test "un-checked" channels
        }
        Channel _channel = (Channel)item.Tag; // get channel
        dlg.SetMessage(
          string.Format("Please be patient...\n\nTesting channel {0} ( {1} of {2} )",
                        _channel.DisplayName, item.Index + 1, mpListView1.Items.Count));
        Application.DoEvents();
        TvResult result = _server.StartTimeShifting(ref _user, _channel.IdChannel, out _card);
        if (result == TvResult.Succeeded)
        {
          _card.StopTimeShifting();
        }
        else
        {
          item.Checked = false;
          _channel.VisibleInGuide = false;
          _channel.Persist();
        }
        if (_abortScanning)
        {
          break;
        }
      }
      mpButtonTestAvailable.Text = "Test";
      dlg.Close();
      _isScanning = false;
      _abortScanning = false;
    }
开发者ID:nio22,项目名称:MediaPortal-1,代码行数:45,代码来源:TVChannels.cs


注:本文中的TvControl.TvServer.StartTimeShifting方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。