PVPlayerDataSink *mVideoSink;
PVMFNodeInterface *mVideoNode;
- PvmiMIOControl *mVideoOutputMIO;
+ AndroidSurfaceOutput *mVideoOutputMIO;
PvmiCapabilityAndConfig *mPlayerCapConfig;
bool mEmulation;
void* mLibHandle;
+
+ // video display surface
+ android::sp<android::ISurface> mSurface;
};
PlayerDriver::PlayerDriver(PVPlayer* pvPlayer) :
mVideoSink = NULL;
mVideoNode = NULL;
mVideoOutputMIO = NULL;
+ mSurface = NULL;
mPlayerCapConfig = NULL;
mDownloadContextData = NULL;
void PlayerDriver::handleSetVideoSurface(PlayerSetVideoSurface* command)
{
- int error = 0;
- AndroidSurfaceOutput* mio = NULL;
- // attempt to load device-specific video MIO
- if (mLibHandle != NULL) {
- VideoMioFactory f = (VideoMioFactory) ::dlsym(mLibHandle, VIDEO_MIO_FACTORY_NAME);
- if (f != NULL) {
- mio = f();
+ // create video MIO if needed
+ if (mVideoOutputMIO == NULL) {
+ int error = 0;
+ AndroidSurfaceOutput* mio = NULL;
+
+ // attempt to load device-specific video MIO
+ if (mLibHandle != NULL) {
+ VideoMioFactory f = (VideoMioFactory) ::dlsym(mLibHandle, VIDEO_MIO_FACTORY_NAME);
+ if (f != NULL) {
+ mio = f();
+ }
}
- }
- // if no device-specific MIO was created, use the generic one
- if (mio == NULL) {
- LOGW("Using generic video MIO");
- mio = new AndroidSurfaceOutput();
- }
+ // if no device-specific MIO was created, use the generic one
+ if (mio == NULL) {
+ LOGW("Using generic video MIO");
+ mio = new AndroidSurfaceOutput();
+ }
- // initialize the MIO parameters
- status_t ret = mio->set(mPvPlayer, command->surface(), mEmulation);
- if (ret != NO_ERROR) {
- LOGE("Video MIO set failed");
- commandFailed(command);
- delete mio;
- return;
- }
- mVideoOutputMIO = mio;
+ // initialize the MIO parameters
+ status_t ret = mio->set(mPvPlayer, command->surface(), mEmulation);
+ if (ret != NO_ERROR) {
+ LOGE("Video MIO set failed");
+ commandFailed(command);
+ delete mio;
+ return;
+ }
+ mVideoOutputMIO = mio;
- mVideoNode = PVMediaOutputNodeFactory::CreateMediaOutputNode(mVideoOutputMIO);
- mVideoSink = new PVPlayerDataSinkPVMFNode;
+ mVideoNode = PVMediaOutputNodeFactory::CreateMediaOutputNode(mVideoOutputMIO);
+ mVideoSink = new PVPlayerDataSinkPVMFNode;
- ((PVPlayerDataSinkPVMFNode *)mVideoSink)->SetDataSinkNode(mVideoNode);
- ((PVPlayerDataSinkPVMFNode *)mVideoSink)->SetDataSinkFormatType((char*)PVMF_MIME_YUV420);
+ ((PVPlayerDataSinkPVMFNode *)mVideoSink)->SetDataSinkNode(mVideoNode);
+ ((PVPlayerDataSinkPVMFNode *)mVideoSink)->SetDataSinkFormatType((char*)PVMF_MIME_YUV420);
- OSCL_TRY(error, mPlayer->AddDataSink(*mVideoSink, command));
- OSCL_FIRST_CATCH_ANY(error, commandFailed(command));
+ OSCL_TRY(error, mPlayer->AddDataSink(*mVideoSink, command));
+ OSCL_FIRST_CATCH_ANY(error, commandFailed(command));
+ } else {
+ // change display surface
+ if (mVideoOutputMIO->set(mPvPlayer, command->surface(), mEmulation) == NO_ERROR) {
+ FinishSyncCommand(command);
+ } else {
+ LOGE("Video MIO set failed");
+ commandFailed(command);
+ }
+ }
}
void PlayerDriver::handleSetAudioSink(PlayerSetAudioSink* command)