From d8b0c4194737adb06301519875eee390bccfc645 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Wed, 21 Jan 2015 18:00:25 +0300 Subject: [PATCH] neutrino.cpp: try to fix timeshift stop/restart, after quit from playback audioplayer, picture viewer and so on Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/ecff98443260141e160cdf296ab468df29d7cf92 Author: [CST] Focus Date: 2015-01-21 (Wed, 21 Jan 2015) ------------------ This commit was generated by Migit --- src/daemonc/remotecontrol.cpp | 12 +++++++----- src/driver/record.cpp | 12 ++++++++++-- src/driver/record.h | 1 + src/neutrino.cpp | 12 ++++++------ 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/daemonc/remotecontrol.cpp b/src/daemonc/remotecontrol.cpp index 26b6519c4..1a32f06df 100644 --- a/src/daemonc/remotecontrol.cpp +++ b/src/daemonc/remotecontrol.cpp @@ -674,9 +674,6 @@ const std::string & CRemoteControl::subChannelDown(void) void CRemoteControl::zapTo_ChannelID(const t_channel_id channel_id, const std::string & channame, int channum, const bool start_video) // UTF-8 { - current_channel_id = channel_id; - current_channel_name = channame; - current_channel_num = channum; //printf("zapTo_ChannelID: start_video: %d\n", start_video); if (start_video) startvideo(); @@ -702,7 +699,9 @@ void CRemoteControl::zapTo_ChannelID(const t_channel_id channel_id, const std::s { g_InfoViewer->chanready = 0; - CRecordManager::getInstance()->StopAutoRecord(); + CRecordManager::getInstance()->StopAutoTimer(); + if (channel_id != current_channel_id) + CRecordManager::getInstance()->StopAutoRecord(); g_RCInput->killTimer(scrambled_timer); //dvbsub_pause(true); @@ -713,9 +712,12 @@ void CRemoteControl::zapTo_ChannelID(const t_channel_id channel_id, const std::s g_Zapit->zapTo_serviceID_NOWAIT(channel_id); zap_completion_timeout = now + ZAP_GUARD_TIME; - //g_Sectionsd->setServiceChanged( current_channel_id, false ); + //g_Sectionsd->setServiceChanged( channel_id, false ); //g_RCInput->killTimer( current_programm_timer ); } + current_channel_id = channel_id; + current_channel_name = channame; + current_channel_num = channum; } void CRemoteControl::startvideo() diff --git a/src/driver/record.cpp b/src/driver/record.cpp index e8a4541ef..590d9038a 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -1050,6 +1050,11 @@ bool CRecordManager::StopAutoRecord(bool lock) return (inst != NULL); } +void CRecordManager::StopAutoTimer() +{ + g_RCInput->killTimer (shift_timer); +} + void CRecordManager::StartNextRecording() { CTimerd::RecordingInfo * eventinfo = NULL; @@ -1230,7 +1235,8 @@ int CRecordManager::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data else if ((msg == NeutrinoMessages::EVT_TIMER)) { if(data == shift_timer) { shift_timer = 0; - StartAutoRecord(); + if (!FindTimeshift()) + StartAutoRecord(); return messages_return::handled; } else if(data == check_timer) { @@ -1265,11 +1271,13 @@ void CRecordManager::StartTimeshift() std::string tmode = "ptimeshift"; // already recording, pause bool res = true; t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); + bool tstarted = false; /* start temporary timeshift if enabled and not running, but dont start second record */ if (g_settings.temp_timeshift) { if (!FindTimeshift()) { res = StartAutoRecord(); tmode = "timeshift"; // record just started + tstarted = true; } } else if (!RecordingStatus(live_channel_id)) { @@ -1280,7 +1288,7 @@ void CRecordManager::StartTimeshift() if(res) { CMoviePlayerGui::getInstance().exec(NULL, tmode); - if(g_settings.temp_timeshift && !g_settings.auto_timeshift && autoshift) + if(g_settings.temp_timeshift && tstarted && autoshift) ShowMenu(); } } diff --git a/src/driver/record.h b/src/driver/record.h index 4d255936c..abc54abb5 100644 --- a/src/driver/record.h +++ b/src/driver/record.h @@ -198,6 +198,7 @@ class CRecordManager : public CMenuTarget /*, public CChangeObserver*/ int exec(CMenuTarget* parent, const std::string & actionKey); bool StartAutoRecord(); bool StopAutoRecord(bool lock = true); + void StopAutoTimer(); MI_MOVIE_INFO * GetMovieInfo(const t_channel_id channel_id, bool timeshift = true); const std::string GetFileName(const t_channel_id channel_id, bool timeshift = true); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index f5a3121af..394a53086 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3470,23 +3470,23 @@ void CNeutrinoApp::tvMode( bool rezap ) videoDecoder->Standby(false); } - bool stopauto = (mode != mode_ts); - int oldmode = mode; - mode = mode_tv; #ifdef ENABLE_PIP pipDecoder->Pig(g_settings.pip_x, g_settings.pip_y, g_settings.pip_width, g_settings.pip_height, frameBuffer->getScreenWidth(true), frameBuffer->getScreenHeight(true)); #endif - if(stopauto /*&& autoshift*/) { +#if 0 + if(mode != mode_ts /*&& autoshift*/) { //printf("standby on: autoshift ! stopping ...\n"); CRecordManager::getInstance()->StopAutoRecord(); - //recordingstatus = 0; } - if (oldmode != mode_webtv) { +#endif + if (mode != mode_webtv) { frameBuffer->useBackground(false); frameBuffer->paintBackground(); } + mode = mode_tv; + g_RemoteControl->tvMode(); SetChannelMode(g_settings.channel_mode); if( rezap ) {