Exemplo n.º 1
0
LRESULT YouTubeWebPageView::OnStateChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/)
{
   T_enPlayerState enState = static_cast<T_enPlayerState>(static_cast<int>(lParam));

   ATLTRACE(_T("%08x: OnStateChanged: %s (%i)\n"),
      m_hWnd,
      GetStateCodeText(enState),
      lParam);

   if (enState == playerStateInitialized)
   {
      // simulate a WM_SIZE message to adjust web page size
      CRect rc;
      GetClientRect(&rc);

      BOOL bHandled = false;
      OnSize(WM_SIZE, 0, MAKELPARAM(rc.Width(),rc.Height()), bHandled);
   }
   else
   if (enState == playerStateVideoCued)
   {
      switch(m_enActionWhenReady)
      {
      case actionPlayVideo:
         SetVolume(100);
         PlayVideo();
         break;

      case actionSeekAndPause:
         m_uiSeekAndPauseStopCounter = 2;
         SetVolume(0);
         // note: calling SeekTo starts playing, so we pause the video when we reach the exact second
         SeekTo(m_dSeconds, true);
         break;

      case actionDoNothing:
      default:
         break;
      }
   }
   else
   if (enState == playerStatePlaying) // playing
   {
      // started playing due to SeekTo() call?
      if (m_enActionWhenReady == actionSeekAndPause)
      {
         CheckSeekToStart();
         SetTimer(IDT_SEEK_AND_PAUSE, 200);
      }
   }
   else
   if (enState == playerStatePaused) // paused
   {
      KillTimer(IDT_SEEK_AND_PAUSE);
      m_enActionWhenReady = actionDoNothing;
   }

   return 0;
}
Exemplo n.º 2
0
/**
 *  \brief  Shows the popup menu
 */
void GallerySlideView::MenuMain()
{
    // Create the main menu that will contain the submenus above
    MythMenu *menu = new MythMenu(tr("Slideshow Options"), this, "mainmenu");

    ImagePtrK im = m_slides.GetCurrent().GetImageData();
    if (im && im->m_type == kVideoFile)
        menu->AddItem(tr("Play Video"), SLOT(PlayVideo()));

    if (m_playing)
        menu->AddItem(tr("Stop"), SLOT(Stop()));
    else
        menu->AddItem(tr("Start SlideShow"), SLOT(Play()));

    if (gCoreContext->GetNumSetting("GalleryRepeat", 0))
        menu->AddItem(tr("Turn Repeat Off"), SLOT(RepeatOff()));
    else
        menu->AddItem(tr("Turn Repeat On"), SLOT(RepeatOn()));

    MenuTransforms(*menu);

    if (m_uiHideCaptions)
    {
        if (m_showCaptions)
            menu->AddItem(tr("Hide Captions"), SLOT(HideCaptions()));
        else
            menu->AddItem(tr("Show Captions"), SLOT(ShowCaptions()));
    }

    QString details;
    switch (m_infoList.GetState())
    {
    case kBasicInfo: details = tr("More Details"); break;
    case kFullInfo:  details = tr("Less Details"); break;
    default:
    case kNoInfo:    details = tr("Show Details"); break;
    }
    menu->AddItem(details, SLOT(ShowInfo()));

    if (m_infoList.GetState() != kNoInfo)
        menu->AddItem(tr("Hide Details"), SLOT(HideInfo()));

    MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
    MythDialogBox *menuPopup = new MythDialogBox(menu, popupStack, "menuPopup");
    if (menuPopup->Create())
        popupStack->AddScreen(menuPopup);
    else
        delete menuPopup;
}
Exemplo n.º 3
0
/*!
 \brief Transition to new slide has finished
 \details Resets buffers & old slide. Starts next transition if slide loads
 are pending (skipping). Otherwise updates text widgets for new slide, pre-loads
 next slide & starts any video.
*/
void GallerySlideView::TransitionComplete()
{
    if (m_IsDeleting)
        return;

    m_transitioning = false;

    // Release old slide, which may start a new transition
    m_slides.ReleaseCurrent();

    // No further actions when skipping
    if (m_transitioning)
        return;

    // Preload next slide, if any
    m_slides.Preload(m_view->HasNext());

    // Populate display for new slide
    ImagePtrK im  = m_slides.GetCurrent().GetImageData();

    // Update any file details information
    m_infoList.Update(im);

    if (im && m_uiCaptionText)
    {
        // show the date & comment
        QStringList text;
        text << m_mgr.LongDateOf(im);

        if (!im->m_comment.isEmpty())
            text << im->m_comment;

        m_uiCaptionText->SetText(text.join(" - "));
    }

    // Start any video unless we're paused or browsing
    if (im && im->m_type == kVideoFile)
    {
        if (m_playing)
            PlayVideo();
        else
            SetStatus(tr("Video"));
    }

    // Resume slideshow timer
    Release();
}
Exemplo n.º 4
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;
}
Exemplo n.º 5
0
/**
 *  \brief  Handle keypresses
 *  \param  event The pressed key
 *  \return True if key was used, otherwise false
 */
bool GallerySlideView::keyPressEvent(QKeyEvent *event)
{
    if (GetFocusWidget()->keyPressEvent(event))
        return true;

    QStringList actions;
    bool handled = GetMythMainWindow()->TranslateKeyPress("Images", event, actions);

    for (int i = 0; i < actions.size() && !handled; i++)
    {
        QString action = actions[i];
        handled = true;

        if (action == "LEFT")
            ShowPrevSlide();
        else if (action == "RIGHT")
            ShowNextSlide();
        else if (action == "INFO")
            ShowInfo();
        else if (action == "MENU")
            MenuMain();
        else if (action == "PLAY")
        {
            if (m_playing)
                Stop();
            else
                Play();
        }
        else if (action == "SELECT")
            PlayVideo();
        else if (action == "STOP")
            Stop();
        else if (action == "ROTRIGHT")
            Transform(kRotateCW);
        else if (action == "ROTLEFT")
            Transform(kRotateCCW);
        else if (action == "FLIPHORIZONTAL")
            Transform(kFlipHorizontal);
        else if (action == "FLIPVERTICAL")
            Transform(kFlipVertical);
        else if (action == "ZOOMIN")
            Zoom(10);
        else if (action == "ZOOMOUT")
            Zoom(-10);
        else if (action == "FULLSIZE")
            Zoom();
        else if (action == "SCROLLUP")
            Pan(QPoint(0, 100));
        else if (action == "SCROLLDOWN")
            Pan(QPoint(0, -100));
        else if (action == "SCROLLLEFT")
            Pan(QPoint(-120, 0));
        else if (action == "SCROLLRIGHT")
            Pan(QPoint(120, 0));
        else if (action == "RECENTER")
            Pan();
        else if (action == "ESCAPE" && !GetMythMainWindow()->IsExitingToMain())
            // Exit info details, if shown
            handled = m_infoList.Hide();
        else
            handled = false;
    }

    if (!handled)
        handled = MythScreenType::keyPressEvent(event);

    return handled;
}