QT_BEGIN_NAMESPACE /*------------------------------------------------------------------------------ | OpenMAXILPlayerControl::OpenMAXILPlayerControl +-----------------------------------------------------------------------------*/ OpenMAXILPlayerControl::OpenMAXILPlayerControl(QObject *parent) : QMediaPlayerControl(parent) , m_ownStream(false) , m_seekToStartPending(false) , m_pendingSeekPosition(-1) , m_mediaProcessor(new OMX_MediaProcessor(OMX_TextureProviderSh(new OMX_TextureProviderQQuickItem()))) , m_textureData(NULL) , m_sceneGraphInitialized(false) , m_quickItem(NULL) { LOG_DEBUG(LOG_TAG, "%s", Q_FUNC_INFO); connect(m_mediaProcessor, SIGNAL(textureReady(const OMX_TextureData*)), this, SIGNAL(textureReady(const OMX_TextureData*))); connect(m_mediaProcessor, SIGNAL(textureInvalidated()), this, SIGNAL(textureInvalidated())); connect(m_mediaProcessor, SIGNAL(stateChanged(OMX_MediaProcessor::OMX_MediaProcessorState)), this, SLOT(onStateChanged(OMX_MediaProcessor::OMX_MediaProcessorState))); connect(m_mediaProcessor, SIGNAL(metadataChanged(QVariantMap)), this, SIGNAL(metaDataChanged(QVariantMap))); }
/*------------------------------------------------------------------------------ | OMX_VideoProcessor::cleanup +-----------------------------------------------------------------------------*/ void OMX_MediaProcessor::cleanup() { LOG_INFORMATION(LOG_TAG, "Cleaning up..."); #if 0 if (m_refresh) { m_BcmHost.vc_tv_hdmi_power_on_best( tv_state.width, tv_state.height, tv_state.frame_rate, HDMI_NONINTERLACED, (EDID_MODE_MATCH_FLAG_T)(HDMI_MODE_MATCH_FRAMERATE| HDMI_MODE_MATCH_RESOLUTION|HDMI_MODE_MATCH_SCANMODE) ); } #endif LOG_VERBOSE(LOG_TAG, "Closing players..."); #ifdef ENABLE_SUBTITLES m_player_subtitles->Close(); #endif m_player_video->Close(); m_player_audio->Close(); if (m_omx_pkt) { m_omx_reader->FreePacket(m_omx_pkt); m_omx_pkt = NULL; } LOG_VERBOSE(LOG_TAG, "Closing players..."); m_omx_reader->Close(); m_metadata.clear(); emit metadataChanged(m_metadata); vc_tv_show_info(0); // lcarlon: free the texture. Invoke freeTexture so that it is the user // of the class to do it cause it is commonly required to do it in the // current OpenGL and EGL context. Do it here, after the stop command is // considered finished: this is needed to avoid hardlock in case the // used wants to free the texture in his own thread, which would still // be blocked waiting for the stop command to finish. LOG_VERBOSE(LOG_TAG, "Freeing texture..."); m_provider->freeTexture(m_textureData); m_textureData = NULL; emit textureInvalidated(); LOG_INFORMATION(LOG_TAG, "Cleanup done."); }
/*------------------------------------------------------------------------------ | OMX_VideoProcessor::cleanup +-----------------------------------------------------------------------------*/ void OMX_MediaProcessor::cleanup() { LOG_INFORMATION(LOG_TAG, "Cleaning up..."); if (!m_pendingStop /* && !g_abort */) { LOG_VERBOSE(LOG_TAG, "Waiting for audio completion..."); if (m_has_audio) m_player_audio->WaitCompletion(); LOG_VERBOSE(LOG_TAG, "Waiting for video completion..."); if (m_has_video) m_player_video->WaitCompletion(); } #if 0 if (m_refresh) { m_BcmHost.vc_tv_hdmi_power_on_best( tv_state.width, tv_state.height, tv_state.frame_rate, HDMI_NONINTERLACED, (EDID_MODE_MATCH_FLAG_T)(HDMI_MODE_MATCH_FRAMERATE| HDMI_MODE_MATCH_RESOLUTION|HDMI_MODE_MATCH_SCANMODE) ); } #endif LOG_VERBOSE(LOG_TAG, "Stopping OMX clock..."); m_av_clock->OMXStop(); m_av_clock->OMXStateIdle(); LOG_VERBOSE(LOG_TAG, "Closing players..."); #ifdef ENABLE_SUBTITLES m_player_subtitles->Close(); #endif m_player_video->Close(); m_player_audio->Close(); if (m_omx_pkt) { m_omx_reader.FreePacket(m_omx_pkt); m_omx_pkt = NULL; } LOG_VERBOSE(LOG_TAG, "Closing players..."); m_omx_reader.Close(); vc_tv_show_info(0); // lcarlon: this should only be done in object destructor. //LOG_VERBOSE(LOG_TAG, "Deinitializing engines..."); //m_OMX.Deinitialize(); //m_RBP.Deinitialize(); // lcarlon: free the texture. LOG_VERBOSE(LOG_TAG, "Freeing texture..."); emit textureInvalidated(); #if 0 QMetaObject::invokeMethod( (QObject*)m_provider, "freeTexture", Qt::QueuedConnection, Q_ARG(OMX_TextureData*, m_textureData) ); #endif m_textureData = NULL; // Actually change the state here and reset flags. m_state = STATE_STOPPED; m_mutexPending.lock(); if (m_pendingStop) { m_pendingStop = false; m_waitPendingCommand.wakeAll(); } m_mutexPending.unlock(); LOG_INFORMATION(LOG_TAG, "Cleanup done."); }