diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index d0b067d8b..9eed27704 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -547,7 +548,7 @@ bool CEpgData::isCurrentEPG(const t_channel_id channel_id) return false; } -int CEpgData::show_mp(MI_MOVIE_INFO *mi, int /*mp_position*/, int /*mp_duration*/, bool doLoop) +int CEpgData::show_mp(MI_MOVIE_INFO *mi, int mp_position, int mp_duration, bool doLoop) { int res = menu_return::RETURN_REPAINT; @@ -691,6 +692,12 @@ int CEpgData::show_mp(MI_MOVIE_INFO *mi, int /*mp_position*/, int /*mp_duration* extMovieInfo += mp_movie_info->file.getFileName(); extMovieInfo += "\n"; + // this calculation is taken from timeosd.cpp + epg_done = (mp_duration && mp_duration > 100) ? (mp_position * 100 / mp_duration) : -1; + if (epg_done > 100) + epg_done = 100; + //printf("[%s:%d] epg_done: %d\n", __func__, __LINE__, epg_done); + res = show(mp_movie_info->epgEpgId >> 16, 0, 0, doLoop, false, true); if(!epgTextSwitch.empty()) { @@ -955,10 +962,8 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start if (next_id) frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_RIGHT, sx + ox - iw - 10, iy); } - - // why we do not show movie progress? - showProgressBar(); } + showProgressBar(); // show Timer Event Buttons showTimerEventBar(true, isCurrentEPG(channel_id), mp_info); @@ -1000,6 +1005,20 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start showProgressBar(); } } + else if (epg_done != -1) + { + CMoviePlayerGui::getInstance().UpdatePosition(); + int mp_position = CMoviePlayerGui::getInstance().GetPosition(); + int mp_duration = CMoviePlayerGui::getInstance().GetDuration(); + + // this calculation is taken from timeosd.cpp + epg_done = (mp_duration && mp_duration > 100) ? (mp_position * 100 / mp_duration) : -1; + if (epg_done > 100) + epg_done = 100; + //printf("[%s:%d] epg_done: %d\n", __func__, __LINE__, epg_done); + + showProgressBar(); + } break; case NeutrinoMessages::EVT_CURRENTNEXT_EPG: if (/*!id && */ ((*(t_channel_id *) data) == (channel_id & 0xFFFFFFFFFFFFULL))) { diff --git a/src/gui/epgview.h b/src/gui/epgview.h index 092b79e14..0e2bc0801 100644 --- a/src/gui/epgview.h +++ b/src/gui/epgview.h @@ -117,7 +117,7 @@ class CEpgData ~CEpgData(); void start( ); int show(const t_channel_id channel_id, uint64_t id = 0, time_t* startzeit = NULL, bool doLoop = true, bool callFromfollowlist = false, bool mp_info = false ); - int show_mp(MI_MOVIE_INFO *mi, int mp_position = 1, int mp_duration = 1, bool doLoop = true); + int show_mp(MI_MOVIE_INFO *mi, int mp_position = 0, int mp_duration = 0, bool doLoop = true); void hide(); }; diff --git a/src/gui/moviebrowser.cpp b/src/gui/moviebrowser.cpp index 8186571f2..d0a52000a 100644 --- a/src/gui/moviebrowser.cpp +++ b/src/gui/moviebrowser.cpp @@ -2049,7 +2049,7 @@ bool CMovieBrowser::onButtonPressMainFrame(neutrino_msg_t msg) if (m_movieSelectionHandler != NULL) { framebuffer->paintBackground(); //clear whole screen - g_EpgData->show_mp(m_movieSelectionHandler, 0, 0); + g_EpgData->show_mp(m_movieSelectionHandler); refresh(); } } diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index 1eb27a41f..5fa3c3d52 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -2194,7 +2194,7 @@ void CMoviePlayerGui::handleMovieBrowser(neutrino_msg_t msg, int /*position*/) CLuaInstVideo::getInstance()->execLuaInfoFunc(luaState, xres, yres, aspectRatio, framerate); } else if (p_movie_info) - g_EpgData->show_mp(p_movie_info,0,0); + g_EpgData->show_mp(p_movie_info, position, duration); CInfoClock::getInstance()->enableInfoClock(true); InfoIcons->enableInfoIcons(true); //NI InfoIcons