📄 videoplayerengine.cpp
字号:
/*
* ============================================================================
* Name : CVideoPlayerEngine from VideoPlayerEngine.cpp
* Part of : VideoPlayer
* Created : 31.01.2006 by ToBeReplacedByAuthor
* Implementation notes:
*
* Version :
* Copyright: ToBeReplacedByCopyright
* ============================================================================
*/
// INCLUDE FILES
#include <coemain.h>
#include <mmf\common\mmferrors.h>
#include "VideoPlayerEngine.h"
// ================= MEMBER FUNCTIONS =======================
// Two-phased constructor.
CVideoPlayerEngine* CVideoPlayerEngine::NewL(MObserver& aObserver,
RWindowBase& aWindow)
{
CVideoPlayerEngine* self = new(ELeave) CVideoPlayerEngine(aObserver, aWindow);
CleanupStack::PushL( self );
self->ConstructL();
CleanupStack::Pop();
return self;
}
// destructor
CVideoPlayerEngine::~CVideoPlayerEngine()
{
delete iVideoPlayer;
}
// from MVideoPlayerUtilityObserver
void CVideoPlayerEngine::MvpuoOpenComplete(TInt aError)
{
if(aError==KErrNone)
{
iVideoPlayer->Prepare();
}
else
{
iObserver.OnComplete(aError);
}
}
void CVideoPlayerEngine::MvpuoPrepareComplete(TInt aError)
{
if((aError==KErrNone)||(aError==KErrMMPartialPlayback))
{
iVideoPlayer->Play();
}
else
{
iObserver.OnComplete(aError);
}
}
void CVideoPlayerEngine::MvpuoFrameReady(CFbsBitmap& aFrame,TInt aError)
{
}
void CVideoPlayerEngine::MvpuoPlayComplete(TInt aError)
{
iVideoPlayer->Close();
iObserver.OnComplete(aError);
}
void CVideoPlayerEngine::MvpuoEvent(const TMMFEvent& aEvent)
{
iVideoPlayer->Stop();
}
// new functions
void CVideoPlayerEngine::PlayL(const TFileName& aFileName)
{
delete iVideoPlayer;
iVideoPlayer = NULL;
CCoeEnv* coeEnv = CCoeEnv::Static();
TRect rect(iWindow.Position(), iWindow.Size());
iVideoPlayer = CVideoPlayerUtility::NewL( *this, EMdaPriorityNormal,
EMdaPriorityPreferenceNone, coeEnv->WsSession(),
*(coeEnv->ScreenDevice()), iWindow, rect, rect);
iVideoPlayer->OpenFileL(aFileName);
}
void CVideoPlayerEngine::Play()
{
if(iVideoPlayer!=NULL)
{
iVideoPlayer->Play();
}
}
void CVideoPlayerEngine::PauseL()
{
if(iVideoPlayer!=NULL)
{
iVideoPlayer->PauseL();
}
}
void CVideoPlayerEngine::Stop()
{
if(iVideoPlayer!=NULL)
{
iVideoPlayer->Stop();
}
}
// constructor
CVideoPlayerEngine::CVideoPlayerEngine(MObserver& aObserver, RWindowBase& aWindow)
: iObserver(aObserver), iWindow(aWindow)
{
}
// EPOC default constructor can leave.
void CVideoPlayerEngine::ConstructL()
{
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -