Exemple #1
0
int CApplicationPlayer::GetPreferredPlaylist() const
{
  if (IsPlayingVideo())
    return PLAYLIST_VIDEO;

  if (IsPlayingAudio())
    return PLAYLIST_MUSIC;

  return PLAYLIST_NONE;
}
Exemple #2
0
void CApplicationPlayer::SetPlaySpeed(float speed)
{
  std::shared_ptr<IPlayer> player = GetInternal();
  if (!player)
    return;

  if (!IsPlayingAudio() && !IsPlayingVideo())
    return ;

  SetSpeed(speed);
}
Exemple #3
0
S32 CPlayHelper::_frameFunc(Frame_t* pFram, Void* Param)
{
	while (!IsPlaying())
	{
		//Open后,堵住,点play后开始
		Sleep(3);	
	}

	//暂停和恢复
	PauseResume();

	//按帧播放PlayFrame();
	PlayFrame();

	m_nCurFrame = pFram->FrameNo;
	if(pFram->FrameType == FRAME_I || pFram->FrameType == FRAME_P)
	{
		if(IsPlayingVideo())
		{
			DWORD dwStart = GetTickCount();
			PlayVideo(pFram->Data, pFram->DataLen);
			if(!m_isPlayFrame)
			{
				SpeedCtrl(pFram->Pts - m_nPts, dwStart);
			}
		}
		m_nPts = pFram->Pts;
	}
	else if(pFram->FrameType == FRAME_A)
	{
		if(IsPlayingAudio())
		{
			char* audioBuf = NULL;
			int iAudioLen = 0;
			audioBuf = FS_GetPCMData(m_hDecoder, (char*)pFram->Data, pFram->DataLen, iAudioLen); 

			PlayAudio(audioBuf, iAudioLen);
		}
	}

	return 0;
}
Exemple #4
0
void CApplicationPlayer::SetPlaySpeed(int iSpeed, bool bApplicationMuted)
{
  boost::shared_ptr<IPlayer> player = GetInternal();
  if (!player)
    return;

  if (!IsPlayingAudio() && !IsPlayingVideo())
    return ;
  if (m_iPlaySpeed == iSpeed)
    return ;
  if (!CanSeek())
    return;
  if (IsPaused())
  {
    if (
      ((m_iPlaySpeed > 1) && (iSpeed > m_iPlaySpeed)) ||
      ((m_iPlaySpeed < -1) && (iSpeed < m_iPlaySpeed))
    )
    {
      iSpeed = m_iPlaySpeed; // from pause to ff/rw, do previous ff/rw speed
    }
    Pause();
  }
  m_iPlaySpeed = iSpeed;

  ToFFRW(m_iPlaySpeed);

  // if player has volume control, set it.
  if (ControlsVolume())
  {
    if (m_iPlaySpeed == 1)
    { // restore volume
      player->SetVolume(g_application.GetVolume(false));
    }
    else
    { // mute volume
      player->SetVolume(VOLUME_MINIMUM);
    }
    player->SetMute(bApplicationMuted);
  }
}