diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index 44ad2a3a1..5ba2793ee 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -504,7 +505,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; @@ -647,6 +648,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()) { @@ -911,10 +918,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); @@ -956,6 +961,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 5d18435fc..051efff92 100644 --- a/src/gui/epgview.h +++ b/src/gui/epgview.h @@ -105,7 +105,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 d33b8b5f0..dc8e0b2e4 100644 --- a/src/gui/moviebrowser.cpp +++ b/src/gui/moviebrowser.cpp @@ -1952,7 +1952,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 b72b52559..ad2f7d611 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -2160,7 +2160,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); if (restore) {