From a1bfbbe0c20995043aafd6dd9894ca0c2c20d198 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Wed, 9 Jan 2013 15:43:48 +0400 Subject: [PATCH] gui/movieplayer.cpp: dynamic allocate/lock demux for playback Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/38c2f6408a25089ed123a54675df5ca38a7f2432 Author: [CST] Focus Date: 2013-01-09 (Wed, 09 Jan 2013) --- src/gui/movieplayer.cpp | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index 4c8514d89..5620dcd70 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -84,11 +84,13 @@ CMoviePlayerGui::CMoviePlayerGui() CMoviePlayerGui::~CMoviePlayerGui() { +#if 0 playback->Close(); + delete playback; +#endif delete moviebrowser; delete filebrowser; delete bookmarkmanager; - delete playback; instance_mp = NULL; } @@ -98,7 +100,9 @@ void CMoviePlayerGui::Init(void) frameBuffer = CFrameBuffer::getInstance(); +#if 0 playback = new cPlayback(3); +#endif moviebrowser = new CMovieBrowser(); bookmarkmanager = new CBookmarkManager(); @@ -406,6 +410,7 @@ void CMoviePlayerGui::PlayFile(void) { neutrino_msg_t msg; neutrino_msg_data_t data; + bool post_msg = false; menu_ret = menu_return::RETURN_REPAINT; int position = 0, duration = 0; @@ -420,7 +425,14 @@ void CMoviePlayerGui::PlayFile(void) printf("Startplay at %d seconds\n", startposition/1000); handleMovieBrowser(CRCInput::RC_nokey, position); + int dnum = CFEManager::getInstance()->getDemux(0); + printf("CMoviePlayerGui::PlayFile: playback demux: %d\n", dnum); + if (!dnum) { + return; + } + CFEManager::getInstance()->lockDemux(dnum, 0); cutNeutrino(); + playback = new cPlayback(dnum); playback->Open(is_file_player ? PLAYMODE_FILE : PLAYMODE_TS); printf("IS FILE PLAYER: %s\n", is_file_player ? "true": "false" ); @@ -649,8 +661,14 @@ void CMoviePlayerGui::PlayFile(void) sc->EnableVideo(true); sc->Start(); - } else if ( msg == NeutrinoMessages::ANNOUNCE_RECORD || - msg == NeutrinoMessages::RECORD_START) { + } else if ( msg == NeutrinoMessages::RECORD_START) { + CTimerd::RecordingInfo * info = (CTimerd::RecordingInfo *) data; + CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(info->channel_id); + if (channel && (CFEManager::getInstance()->getDemux(channel->getTransponderId() == 0))) { + playstate = CMoviePlayerGui::STOPPED; + post_msg = true; + } + } else if ( msg == NeutrinoMessages::ANNOUNCE_RECORD) { CNeutrinoApp::getInstance()->handleMsg(msg, data); } else if ( msg == NeutrinoMessages::ZAPTO || msg == NeutrinoMessages::STANDBY_ON || @@ -688,6 +706,10 @@ void CMoviePlayerGui::PlayFile(void) playback->SetSpeed(1); playback->Close(); + delete playback; + CFEManager::getInstance()->unlockDemux(dnum); + if (post_msg) + g_RCInput->postMsg(msg, data); CVFD::getInstance()->ShowIcon(FP_ICON_PLAY, false); CVFD::getInstance()->ShowIcon(FP_ICON_PAUSE, false);