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

This commit is contained in:
[CST] Focus
2013-01-09 15:43:48 +04:00
parent bea14518a5
commit 38c2f6408a

View File

@@ -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);