gui/movieplayer.cpp: dynamic allocate/lock demux for playback

Origin commit data
------------------
Commit: 38c2f6408a
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2013-01-09 (Wed, 09 Jan 2013)
This commit is contained in:
[CST] Focus
2013-01-09 15:43:48 +04:00
parent e3046b34dd
commit a1bfbbe0c2

View File

@@ -84,11 +84,13 @@ CMoviePlayerGui::CMoviePlayerGui()
CMoviePlayerGui::~CMoviePlayerGui() CMoviePlayerGui::~CMoviePlayerGui()
{ {
#if 0
playback->Close(); playback->Close();
delete playback;
#endif
delete moviebrowser; delete moviebrowser;
delete filebrowser; delete filebrowser;
delete bookmarkmanager; delete bookmarkmanager;
delete playback;
instance_mp = NULL; instance_mp = NULL;
} }
@@ -98,7 +100,9 @@ void CMoviePlayerGui::Init(void)
frameBuffer = CFrameBuffer::getInstance(); frameBuffer = CFrameBuffer::getInstance();
#if 0
playback = new cPlayback(3); playback = new cPlayback(3);
#endif
moviebrowser = new CMovieBrowser(); moviebrowser = new CMovieBrowser();
bookmarkmanager = new CBookmarkManager(); bookmarkmanager = new CBookmarkManager();
@@ -406,6 +410,7 @@ void CMoviePlayerGui::PlayFile(void)
{ {
neutrino_msg_t msg; neutrino_msg_t msg;
neutrino_msg_data_t data; neutrino_msg_data_t data;
bool post_msg = false;
menu_ret = menu_return::RETURN_REPAINT; menu_ret = menu_return::RETURN_REPAINT;
int position = 0, duration = 0; int position = 0, duration = 0;
@@ -420,7 +425,14 @@ void CMoviePlayerGui::PlayFile(void)
printf("Startplay at %d seconds\n", startposition/1000); printf("Startplay at %d seconds\n", startposition/1000);
handleMovieBrowser(CRCInput::RC_nokey, position); 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(); cutNeutrino();
playback = new cPlayback(dnum);
playback->Open(is_file_player ? PLAYMODE_FILE : PLAYMODE_TS); playback->Open(is_file_player ? PLAYMODE_FILE : PLAYMODE_TS);
printf("IS FILE PLAYER: %s\n", is_file_player ? "true": "false" ); printf("IS FILE PLAYER: %s\n", is_file_player ? "true": "false" );
@@ -649,8 +661,14 @@ void CMoviePlayerGui::PlayFile(void)
sc->EnableVideo(true); sc->EnableVideo(true);
sc->Start(); sc->Start();
} else if ( msg == NeutrinoMessages::ANNOUNCE_RECORD || } else if ( msg == NeutrinoMessages::RECORD_START) {
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); CNeutrinoApp::getInstance()->handleMsg(msg, data);
} else if ( msg == NeutrinoMessages::ZAPTO || } else if ( msg == NeutrinoMessages::ZAPTO ||
msg == NeutrinoMessages::STANDBY_ON || msg == NeutrinoMessages::STANDBY_ON ||
@@ -688,6 +706,10 @@ void CMoviePlayerGui::PlayFile(void)
playback->SetSpeed(1); playback->SetSpeed(1);
playback->Close(); 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_PLAY, false);
CVFD::getInstance()->ShowIcon(FP_ICON_PAUSE, false); CVFD::getInstance()->ShowIcon(FP_ICON_PAUSE, false);