From 17232ec52326a0e6b792a0f38f4ec86461efad2e Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Mon, 25 Jan 2016 18:13:11 +0300 Subject: [PATCH 1/5] gui/movieplayer.cpp: pass subtitles charset to playback instance Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/85c437fac3f2a8bf2e73ba06e8958d0aedbd81bb Author: [CST] Focus Date: 2016-01-25 (Mon, 25 Jan 2016) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- lib/libcoolstream/playback_cs.h | 2 +- lib/libcoolstream2/playback_cs.h | 2 +- src/gui/movieplayer.cpp | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/libcoolstream/playback_cs.h b/lib/libcoolstream/playback_cs.h index 399ef152a..8be1ba391 100644 --- a/lib/libcoolstream/playback_cs.h +++ b/lib/libcoolstream/playback_cs.h @@ -66,7 +66,7 @@ public: void FindAllPids(playback_audio_pid_info_t *audiopids, uint16_t size, uint16_t *numpida); void FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t *numpida, std::string *language); void FindAllSubs(uint16_t *pids, unsigned short *supported, uint16_t *numpida, std::string *language); - bool SelectSubtitles(int pid); + bool SelectSubtitles(int pid, std::string charset = ""); void GetChapters(std::vector &positions, std::vector &titles); void RequestAbort(); void GetTitles(std::vector &playlists, std::vector &titles, int ¤t); diff --git a/lib/libcoolstream2/playback_cs.h b/lib/libcoolstream2/playback_cs.h index e89fc576c..8480ed0aa 100644 --- a/lib/libcoolstream2/playback_cs.h +++ b/lib/libcoolstream2/playback_cs.h @@ -67,7 +67,7 @@ public: void FindAllPids(playback_audio_pid_info_t *audiopids, uint16_t size, uint16_t *numpida); void FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t *numpida, std::string *language); void FindAllSubs(uint16_t *pids, unsigned short *supported, uint16_t *numpida, std::string *language); - bool SelectSubtitles(int pid); + bool SelectSubtitles(int pid, std::string charset = ""); void GetChapters(std::vector &positions, std::vector &titles); void RequestAbort(); void GetTitles(std::vector &playlists, std::vector &titles, int ¤t); diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index a438bc3d2..8eb848940 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -1858,7 +1858,7 @@ void CMoviePlayerGui::selectSubtitle() if (!numsubs) playback->FindAllSubs(spids, sub_supported, &numsubs, slanguage); - CMenuOptionStringChooser * sc = new CMenuOptionStringChooser(LOCALE_SUBTITLES_CHARSET, &g_settings.subs_charset, true, NULL, CRCInput::RC_red, NULL, true); + CMenuOptionStringChooser * sc = new CMenuOptionStringChooser(LOCALE_SUBTITLES_CHARSET, &g_settings.subs_charset, currentspid == -1, NULL, CRCInput::RC_red, NULL, true); sc->addOption("UTF-8"); sc->addOption("UCS-2"); sc->addOption("CP1250"); @@ -1886,7 +1886,7 @@ void CMoviePlayerGui::selectSubtitle() APIDSelector.addItem(item); } sprintf(cnt, "%d", count); - APIDSelector.addItem(new CMenuForwarder(LOCALE_SUBTITLES_STOP, true, NULL, selector, cnt, CRCInput::RC_stop), currentspid > 0); + APIDSelector.addItem(new CMenuForwarder(LOCALE_SUBTITLES_STOP, currentspid != -1, NULL, selector, cnt, CRCInput::RC_stop), currentspid > 0); APIDSelector.exec(NULL, ""); delete selector; @@ -1895,12 +1895,12 @@ void CMoviePlayerGui::selectSubtitle() currentspid = spids[select]; /* external subtitles pid is 0x1FFF */ ext_subs = (currentspid == 0x1FFF); - playback->SelectSubtitles(currentspid); + playback->SelectSubtitles(currentspid, g_settings.subs_charset); printf("[movieplayer] spid changed to %d\n", currentspid); } else if (select > 0) { ext_subs = false; currentspid = -1; - playback->SelectSubtitles(currentspid); + playback->SelectSubtitles(currentspid, g_settings.subs_charset); printf("[movieplayer] spid changed to %d\n", currentspid); } } @@ -2127,7 +2127,7 @@ void CMoviePlayerGui::selectAutoLang() for (unsigned count = 0; count < numsubs; count++) { if (spids[count] == 0x1FFF) { currentspid = spids[count]; - playback->SelectSubtitles(currentspid); + playback->SelectSubtitles(currentspid, g_settings.subs_charset); } } } From f2903575d184008a5656b6e1f90f0bed8c349df1 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Mon, 25 Jan 2016 22:40:58 +0100 Subject: [PATCH 2/5] neutrino: allow to change to mode_ts before playback starts Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/f1f9a1041cbee31c5c7edbfe26da445048a4c73b Author: vanhofen Date: 2016-01-25 (Mon, 25 Jan 2016) Origin message was: ------------------ - neutrino: allow to change to mode_ts before playback starts ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/neutrino.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 0671723b3..d3cf456ff 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3263,7 +3263,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) lastMode=mode; mode=mode_pic; } - if((data & mode_mask)== mode_ts && CMoviePlayerGui::getInstance().Playing()) { + if((data & mode_mask)== mode_ts) { if(mode == mode_radio) frameBuffer->stopFrame(); lastMode=mode; From ded2f065ae29c80406daa0e0ccb0d064931e99a4 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Mon, 25 Jan 2016 22:43:27 +0100 Subject: [PATCH 3/5] neutrino/upnpbrowser: add and use new mode_upnp; ... ... switch to correct mode before start playing audio/video/pic Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/0c2a3a9853c222dbebee7fed1abf16de2c3354ed Author: vanhofen Date: 2016-01-25 (Mon, 25 Jan 2016) Origin message was: ------------------ - neutrino/upnpbrowser: add and use new mode_upnp; ... ... switch to correct mode before start playing audio/video/pic ------------------ This commit was generated by Migit --- src/gui/upnpbrowser.cpp | 16 ++++++++++++++-- src/neutrino.h | 1 + src/neutrinoMessages.h | 1 + 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/gui/upnpbrowser.cpp b/src/gui/upnpbrowser.cpp index dd18cee43..32912b418 100644 --- a/src/gui/upnpbrowser.cpp +++ b/src/gui/upnpbrowser.cpp @@ -92,8 +92,8 @@ int CUpnpBrowserGui::exec(CMenuTarget* parent, const std::string & /*actionKey*/ CNeutrinoApp::getInstance()->stopPlayBack(true); m_frameBuffer->showFrame("mp3.jpg"); - // tell neutrino we're in audio mode - CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE , NeutrinoMessages::mode_audio); + // tell neutrino we're in upnp mode + CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE , NeutrinoMessages::mode_upnp); // remember last mode m_LastMode=(CNeutrinoApp::getInstance()->getLastMode()); @@ -1230,12 +1230,18 @@ printf("updateTimes: force %d updatePlayed %d\n", force, updatePlayed); void CUpnpBrowserGui::playAudio(std::string name, int type) { + CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoMessages::mode_audio); + CAudiofile mp3(name, (CFile::FileType) type); CAudioPlayer::getInstance()->play(&mp3, g_settings.audioplayer_highprio == 1); + + CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoMessages::mode_upnp | NeutrinoMessages::norezap); } void CUpnpBrowserGui::showPicture(std::string name) { + CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoMessages::mode_pic); + g_PicViewer->SetScaling((CPictureViewer::ScalingMode)g_settings.picviewer_scaling); g_PicViewer->SetVisible(g_settings.screen_StartX, g_settings.screen_EndX, g_settings.screen_StartY, g_settings.screen_EndY); @@ -1246,14 +1252,20 @@ void CUpnpBrowserGui::showPicture(std::string name) g_PicViewer->ShowImage(name, false); g_PicViewer->Cleanup(); + + CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoMessages::mode_upnp | NeutrinoMessages::norezap); } void CUpnpBrowserGui::playVideo(std::string name, std::string url) { + CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoMessages::mode_ts); + if (CAudioPlayer::getInstance()->getState() != CBaseDec::STOP) CAudioPlayer::getInstance()->stop(); m_frameBuffer->stopFrame(); CMoviePlayerGui::getInstance().SetFile(name, url); CMoviePlayerGui::getInstance().exec(NULL, "upnp"); + + CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoMessages::mode_upnp | NeutrinoMessages::norezap); } diff --git a/src/neutrino.h b/src/neutrino.h index f2c1fc5c2..7dbbc84d0 100644 --- a/src/neutrino.h +++ b/src/neutrino.h @@ -151,6 +151,7 @@ public: mode_ts = 7, mode_off = 8, mode_webtv = 9, + mode_upnp = 10, mode_mask = 0xFF, norezap = 0x100 }; diff --git a/src/neutrinoMessages.h b/src/neutrinoMessages.h index 65519c02f..4049ead7e 100644 --- a/src/neutrinoMessages.h +++ b/src/neutrinoMessages.h @@ -177,6 +177,7 @@ struct NeutrinoMessages { mode_pic = 6, mode_ts = 7, mode_webtv = 9, + mode_upnp = 10, mode_mask = 0xFF, norezap = 0x100 }; From 7557f4eba94be6ae08e1603b4e77789adbb18315 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Mon, 25 Jan 2016 22:45:18 +0100 Subject: [PATCH 4/5] Revert "- infoviewer_bb: use getMoviePlayerButtonName in mode_audio too;" This reverts ugly commit b0fb5e4f8328ed567c5a9b1fbbad2876a8f19dc6 Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/61e457c0a6f40e5ffde0f2a1ea79e4804e35ca48 Author: vanhofen Date: 2016-01-25 (Mon, 25 Jan 2016) ------------------ This commit was generated by Migit --- src/gui/infoviewer_bb.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/infoviewer_bb.cpp b/src/gui/infoviewer_bb.cpp index 6b98c16f4..2d1fef675 100644 --- a/src/gui/infoviewer_bb.cpp +++ b/src/gui/infoviewer_bb.cpp @@ -221,7 +221,7 @@ void CInfoViewerBB::getBBButtonInfo() icon = NEUTRINO_ICON_BUTTON_RED; frameBuffer->getIconSize(icon.c_str(), &w, &h); mode = CNeutrinoApp::getInstance()->getMode(); - if (mode == NeutrinoMessages::mode_ts || mode == NeutrinoMessages::mode_audio) { + if (mode == NeutrinoMessages::mode_ts) { text = CKeybindSetup::getMoviePlayerButtonName(CRCInput::RC_red, active, g_settings.infobar_buttons_usertitle); if (!text.empty()) break; @@ -236,7 +236,7 @@ void CInfoViewerBB::getBBButtonInfo() icon = NEUTRINO_ICON_BUTTON_GREEN; frameBuffer->getIconSize(icon.c_str(), &w, &h); mode = CNeutrinoApp::getInstance()->getMode(); - if (mode == NeutrinoMessages::mode_ts || mode == NeutrinoMessages::mode_audio) { + if (mode == NeutrinoMessages::mode_ts) { text = CKeybindSetup::getMoviePlayerButtonName(CRCInput::RC_green, active, g_settings.infobar_buttons_usertitle); if (!text.empty()) break; @@ -251,7 +251,7 @@ void CInfoViewerBB::getBBButtonInfo() icon = NEUTRINO_ICON_BUTTON_YELLOW; frameBuffer->getIconSize(icon.c_str(), &w, &h); mode = CNeutrinoApp::getInstance()->getMode(); - if (mode == NeutrinoMessages::mode_ts || mode == NeutrinoMessages::mode_audio) { + if (mode == NeutrinoMessages::mode_ts) { text = CKeybindSetup::getMoviePlayerButtonName(CRCInput::RC_yellow, active, g_settings.infobar_buttons_usertitle); if (!text.empty()) break; @@ -266,7 +266,7 @@ void CInfoViewerBB::getBBButtonInfo() icon = NEUTRINO_ICON_BUTTON_BLUE; frameBuffer->getIconSize(icon.c_str(), &w, &h); mode = CNeutrinoApp::getInstance()->getMode(); - if (mode == NeutrinoMessages::mode_ts || mode == NeutrinoMessages::mode_audio) { + if (mode == NeutrinoMessages::mode_ts) { text = CKeybindSetup::getMoviePlayerButtonName(CRCInput::RC_blue, active, g_settings.infobar_buttons_usertitle); if (!text.empty()) break; @@ -279,8 +279,8 @@ void CInfoViewerBB::getBBButtonInfo() default: break; } - //label audio control button in movieplayer/upnp mode - if (mode == NeutrinoMessages::mode_ts || mode == NeutrinoMessages::mode_audio) + //label audio control button in movieplayer mode + if (mode == NeutrinoMessages::mode_ts) { if (!CMoviePlayerGui::getInstance().timeshift) { From 8e70d9fe7e5c6dca73aed474aa1bf5ecd32b4ecc Mon Sep 17 00:00:00 2001 From: vanhofen Date: Tue, 26 Jan 2016 00:57:08 +0100 Subject: [PATCH 5/5] infoviewer: fix audio description in mode_webtv Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/32c28038a36021febff59c520a0ed6de484fe687 Author: vanhofen Date: 2016-01-26 (Tue, 26 Jan 2016) Origin message was: ------------------ - infoviewer: fix audio description in mode_webtv ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/infoviewer_bb.cpp | 11 +++-------- src/gui/user_menue.cpp | 5 ++++- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/gui/infoviewer_bb.cpp b/src/gui/infoviewer_bb.cpp index 2d1fef675..e95d645cc 100644 --- a/src/gui/infoviewer_bb.cpp +++ b/src/gui/infoviewer_bb.cpp @@ -280,15 +280,10 @@ void CInfoViewerBB::getBBButtonInfo() break; } //label audio control button in movieplayer mode - if (mode == NeutrinoMessages::mode_ts) + if (mode == NeutrinoMessages::mode_ts && !CMoviePlayerGui::getInstance().timeshift) { - if (!CMoviePlayerGui::getInstance().timeshift) - { - if (text == g_Locale->getText(LOCALE_MPKEY_AUDIO) && !g_settings.infobar_buttons_usertitle) - { - text = CMoviePlayerGui::getInstance(mode == NeutrinoMessages::mode_webtv).CurrentAudioName(); - } - } + if (text == g_Locale->getText(LOCALE_MPKEY_AUDIO) && !g_settings.infobar_buttons_usertitle) + text = CMoviePlayerGui::getInstance(false).CurrentAudioName(); // use instance_mp } bbButtonInfo[i].w = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getRenderWidth(text) + w + 10; bbButtonInfo[i].cx = w + 5; diff --git a/src/gui/user_menue.cpp b/src/gui/user_menue.cpp index f156051d6..661c5e5d1 100644 --- a/src/gui/user_menue.cpp +++ b/src/gui/user_menue.cpp @@ -487,6 +487,7 @@ const char *CUserMenu::getUserMenuButtonName(int button, bool &active, bool retu neutrino_locale_t loc = NONEXISTANT_LOCALE; const char *text = NULL; + int mode = CNeutrinoApp::getInstance()->getMode(); std::vector items = ::split(g_settings.usermenu[button]->items, ','); for (std::vector::iterator it = items.begin(); it != items.end(); ++it) { @@ -537,7 +538,9 @@ const char *CUserMenu::getUserMenuButtonName(int button, bool &active, bool retu continue; case SNeutrinoSettings::ITEM_AUDIO_SELECT: if(loc == NONEXISTANT_LOCALE && !text) { - if (!g_RemoteControl->current_PIDs.APIDs.empty()) + if (mode == NeutrinoMessages::mode_webtv) + text = CMoviePlayerGui::getInstance(true).CurrentAudioName().c_str(); // use instance_bg + else if (!g_RemoteControl->current_PIDs.APIDs.empty()) text = g_RemoteControl->current_PIDs.APIDs[ g_RemoteControl->current_PIDs.PIDs.selected_apid].desc; } else