MoviePlayer: Rework enable/disable of osd time, file time and mute icon

This commit is contained in:
M. Liebmann
2016-12-05 14:19:06 +01:00
parent fd21f57406
commit 2045e91c47
2 changed files with 46 additions and 33 deletions

View File

@@ -83,6 +83,8 @@ extern CVolume* g_volume;
#define TIMESHIFT_SECONDS 3 #define TIMESHIFT_SECONDS 3
#define ISO_MOUNT_POINT "/media/iso" #define ISO_MOUNT_POINT "/media/iso"
#define MUTE true
#define NO_MUTE false
CMoviePlayerGui* CMoviePlayerGui::instance_mp = NULL; CMoviePlayerGui* CMoviePlayerGui::instance_mp = NULL;
CMoviePlayerGui* CMoviePlayerGui::instance_bg = NULL; CMoviePlayerGui* CMoviePlayerGui::instance_bg = NULL;
@@ -204,6 +206,8 @@ void CMoviePlayerGui::Init(void)
blockedFromPlugin = false; blockedFromPlugin = false;
m_screensaver = false; m_screensaver = false;
m_idletime = time(NULL); m_idletime = time(NULL);
m_mode = CTimeOSD::MODE_HIDE;
m_restore = false;
} }
void CMoviePlayerGui::cutNeutrino() void CMoviePlayerGui::cutNeutrino()
@@ -458,10 +462,31 @@ void CMoviePlayerGui::ClearQueue()
milist.clear(); milist.clear();
} }
void CMoviePlayerGui::EnableClockAndMute(bool enable)
void CMoviePlayerGui::enableOsdElements(bool mute)
{ {
CAudioMute::getInstance()->enableMuteIcon(enable); if (mute)
CInfoClock::getInstance()->enableInfoClock(enable); CAudioMute::getInstance()->enableMuteIcon(true);
CInfoClock::getInstance()->enableInfoClock(true);
if (m_restore) {
FileTime.setMode(m_mode);
FileTime.update(position, duration);
}
}
void CMoviePlayerGui::disableOsdElements(bool mute)
{
if (mute)
CAudioMute::getInstance()->enableMuteIcon(false);
CInfoClock::getInstance()->enableInfoClock(false);
m_mode = FileTime.getMode();
m_restore = FileTime.IsVisible();
if (m_restore)
FileTime.kill();
} }
void CMoviePlayerGui::makeFilename() void CMoviePlayerGui::makeFilename()
@@ -565,7 +590,7 @@ bool CMoviePlayerGui::SelectFile()
} }
#endif #endif
else if (isMovieBrowser) { else if (isMovieBrowser) {
EnableClockAndMute(false); disableOsdElements(MUTE);
if (moviebrowser->exec(Path_local.c_str())) { if (moviebrowser->exec(Path_local.c_str())) {
Path_local = moviebrowser->getCurrentDir(); Path_local = moviebrowser->getCurrentDir();
CFile *file = NULL; CFile *file = NULL;
@@ -585,9 +610,9 @@ bool CMoviePlayerGui::SelectFile()
ret = prepareFile(&p_movie_info->file); ret = prepareFile(&p_movie_info->file);
} else } else
menu_ret = moviebrowser->getMenuRet(); menu_ret = moviebrowser->getMenuRet();
EnableClockAndMute(true); enableOsdElements(MUTE);
} else { // filebrowser } else { // filebrowser
EnableClockAndMute(false); disableOsdElements(MUTE);
while (ret == false && filebrowser->exec(Path_local.c_str()) == true) { while (ret == false && filebrowser->exec(Path_local.c_str()) == true) {
Path_local = filebrowser->getCurrentDir(); Path_local = filebrowser->getCurrentDir();
CFile *file = NULL; CFile *file = NULL;
@@ -609,7 +634,7 @@ bool CMoviePlayerGui::SelectFile()
} }
} }
menu_ret = filebrowser->getMenuRet(); menu_ret = filebrowser->getMenuRet();
EnableClockAndMute(true); enableOsdElements(MUTE);
} }
g_settings.network_nfs_moviedir = Path_local; g_settings.network_nfs_moviedir = Path_local;
@@ -1199,7 +1224,7 @@ bool CMoviePlayerGui::PlayFileStart(void)
if (is_file_player) if (is_file_player)
selectAutoLang(); selectAutoLang();
EnableClockAndMute(true); enableOsdElements(MUTE);
return res; return res;
} }
@@ -1400,7 +1425,7 @@ void CMoviePlayerGui::PlayFileLoop(void)
if (timeshift == TSHIFT_MODE_OFF) if (timeshift == TSHIFT_MODE_OFF)
callInfoViewer(); callInfoViewer();
} else if (!filelist.empty()) { } else if (!filelist.empty()) {
EnableClockAndMute(false); disableOsdElements(MUTE);
CFileBrowser *playlist = new CFileBrowser(); CFileBrowser *playlist = new CFileBrowser();
CFile *pfile = NULL; CFile *pfile = NULL;
pfile = &(*filelist_it); pfile = &(*filelist_it);
@@ -1423,7 +1448,7 @@ void CMoviePlayerGui::PlayFileLoop(void)
filelist_it = filelist.begin() + selected; filelist_it = filelist.begin() + selected;
} }
delete playlist; delete playlist;
EnableClockAndMute(true); enableOsdElements(MUTE);
} }
} else if (msg == (neutrino_msg_t) g_settings.mpkey_pause) { } else if (msg == (neutrino_msg_t) g_settings.mpkey_pause) {
if (playstate == CMoviePlayerGui::PAUSE) { if (playstate == CMoviePlayerGui::PAUSE) {
@@ -1524,14 +1549,12 @@ void CMoviePlayerGui::PlayFileLoop(void)
SetPosition(1000 * (hh * 3600 + mm * 60 + ss), true); SetPosition(1000 * (hh * 3600 + mm * 60 + ss), true);
} else if (msg == CRCInput::RC_help) { } else if (msg == CRCInput::RC_help) {
disableOsdElements(NO_MUTE);
showHelp(); showHelp();
enableOsdElements(NO_MUTE);
} else if (msg == CRCInput::RC_info) { } else if (msg == CRCInput::RC_info) {
if (fromInfoviewer) { if (fromInfoviewer) {
CTimeOSD::mode m_mode = FileTime.getMode(); disableOsdElements(NO_MUTE);
bool restore = FileTime.IsVisible();
if (restore)
FileTime.kill();
CInfoClock::getInstance()->enableInfoClock(false);
#ifdef ENABLE_LUA #ifdef ENABLE_LUA
if (isLuaPlay && haveLuaInfoFunc) { if (isLuaPlay && haveLuaInfoFunc) {
int xres = 0, yres = 0, aspectRatio = 0, framerate = -1; int xres = 0, yres = 0, aspectRatio = 0, framerate = -1;
@@ -1550,11 +1573,7 @@ void CMoviePlayerGui::PlayFileLoop(void)
} }
#endif #endif
fromInfoviewer = false; fromInfoviewer = false;
CInfoClock::getInstance()->enableInfoClock(true); enableOsdElements(NO_MUTE);
if (restore) {
FileTime.setMode(m_mode);
FileTime.update(position, duration);
}
} }
else else
callInfoViewer(); callInfoViewer();
@@ -2167,19 +2186,9 @@ void CMoviePlayerGui::handleMovieBrowser(neutrino_msg_t msg, int /*position*/)
} }
} }
} else if (msg == NeutrinoMessages::SHOW_EPG && p_movie_info) { } else if (msg == NeutrinoMessages::SHOW_EPG && p_movie_info) {
CTimeOSD::mode m_mode = FileTime.getMode(); disableOsdElements(NO_MUTE);
bool restore = FileTime.IsVisible();
if (restore)
FileTime.kill();
CInfoClock::getInstance()->enableInfoClock(false);
g_EpgData->show_mp(p_movie_info, position, duration); g_EpgData->show_mp(p_movie_info, position, duration);
enableOsdElements(NO_MUTE);
CInfoClock::getInstance()->enableInfoClock(true);
if (restore) {
FileTime.setMode(m_mode);
FileTime.update(position, duration);
}
} }
return; return;
} }

View File

@@ -189,6 +189,9 @@ class CMoviePlayerGui : public CMenuTarget
static CMoviePlayerGui* instance_mp; static CMoviePlayerGui* instance_mp;
static CMoviePlayerGui* instance_bg; static CMoviePlayerGui* instance_bg;
CTimeOSD::mode m_mode;
bool m_restore;
void Init(void); void Init(void);
void PlayFile(); void PlayFile();
bool PlayFileStart(); bool PlayFileStart();
@@ -221,7 +224,8 @@ class CMoviePlayerGui : public CMenuTarget
void Cleanup(); void Cleanup();
void ClearFlags(); void ClearFlags();
void ClearQueue(); void ClearQueue();
void EnableClockAndMute(bool enable); void enableOsdElements(bool mute);
void disableOsdElements(bool mute);
static void *ShowStartHint(void *arg); static void *ShowStartHint(void *arg);
static void* bgPlayThread(void *arg); static void* bgPlayThread(void *arg);
static bool sortStreamList(livestream_info_t info1, livestream_info_t info2); static bool sortStreamList(livestream_info_t info1, livestream_info_t info2);