- neutrino/upnpbrowser: add and use new mode_upnp; ...

... switch to correct mode before start playing audio/video/pic
This commit is contained in:
svenhoefer
2016-01-25 22:43:27 +01:00
parent f1f9a1041c
commit 0c2a3a9853
3 changed files with 16 additions and 2 deletions

View File

@@ -92,8 +92,8 @@ int CUpnpBrowserGui::exec(CMenuTarget* parent, const std::string & /*actionKey*/
CNeutrinoApp::getInstance()->stopPlayBack(true); CNeutrinoApp::getInstance()->stopPlayBack(true);
m_frameBuffer->showFrame("mp3.jpg"); m_frameBuffer->showFrame("mp3.jpg");
// tell neutrino we're in audio mode // tell neutrino we're in upnp mode
CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE , NeutrinoMessages::mode_audio); CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE , NeutrinoMessages::mode_upnp);
// remember last mode // remember last mode
m_LastMode=(CNeutrinoApp::getInstance()->getLastMode()); 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) void CUpnpBrowserGui::playAudio(std::string name, int type)
{ {
CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoMessages::mode_audio);
CAudiofile mp3(name, (CFile::FileType) type); CAudiofile mp3(name, (CFile::FileType) type);
CAudioPlayer::getInstance()->play(&mp3, g_settings.audioplayer_highprio == 1); 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) 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->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); 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->ShowImage(name, false);
g_PicViewer->Cleanup(); g_PicViewer->Cleanup();
CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoMessages::mode_upnp | NeutrinoMessages::norezap);
} }
void CUpnpBrowserGui::playVideo(std::string name, std::string url) void CUpnpBrowserGui::playVideo(std::string name, std::string url)
{ {
CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoMessages::mode_ts);
if (CAudioPlayer::getInstance()->getState() != CBaseDec::STOP) if (CAudioPlayer::getInstance()->getState() != CBaseDec::STOP)
CAudioPlayer::getInstance()->stop(); CAudioPlayer::getInstance()->stop();
m_frameBuffer->stopFrame(); m_frameBuffer->stopFrame();
CMoviePlayerGui::getInstance().SetFile(name, url); CMoviePlayerGui::getInstance().SetFile(name, url);
CMoviePlayerGui::getInstance().exec(NULL, "upnp"); CMoviePlayerGui::getInstance().exec(NULL, "upnp");
CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoMessages::mode_upnp | NeutrinoMessages::norezap);
} }

View File

@@ -151,6 +151,7 @@ public:
mode_ts = 7, mode_ts = 7,
mode_off = 8, mode_off = 8,
mode_webtv = 9, mode_webtv = 9,
mode_upnp = 10,
mode_mask = 0xFF, mode_mask = 0xFF,
norezap = 0x100 norezap = 0x100
}; };

View File

@@ -177,6 +177,7 @@ struct NeutrinoMessages {
mode_pic = 6, mode_pic = 6,
mode_ts = 7, mode_ts = 7,
mode_webtv = 9, mode_webtv = 9,
mode_upnp = 10,
mode_mask = 0xFF, mode_mask = 0xFF,
norezap = 0x100 norezap = 0x100
}; };