- upnpbrowser: fix neutrino mode while playing audio

This commit is contained in:
svenhoefer
2017-03-27 08:11:49 +02:00
parent 324359d31d
commit 81078780db
2 changed files with 13 additions and 2 deletions

View File

@@ -733,6 +733,7 @@ bool CUpnpBrowserGui::selectItem(std::string id)
while (loop) { while (loop) {
updateTimes(); updateTimes();
updateMode();
if (refresh) { if (refresh) {
printf("selectItem: refresh, timeout = %d\n", (int) timeout); printf("selectItem: refresh, timeout = %d\n", (int) timeout);
@@ -1268,14 +1269,21 @@ void CUpnpBrowserGui::updateTimes(const bool force)
} }
} }
void CUpnpBrowserGui::updateMode()
{
/* switch back to mode_upnp if audio has stopped automatically */
if ((CAudioPlayer::getInstance()->getState() == CBaseDec::STOP) && (CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_audio))
{
CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoMessages::mode_upnp | NeutrinoMessages::norezap);
}
}
void CUpnpBrowserGui::playAudio(std::string name, int type) void CUpnpBrowserGui::playAudio(std::string name, int type)
{ {
CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoMessages::mode_audio); 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::stopAudio() void CUpnpBrowserGui::stopAudio()
@@ -1284,6 +1292,8 @@ void CUpnpBrowserGui::stopAudio()
{ {
CAudioPlayer::getInstance()->stop(); CAudioPlayer::getInstance()->stop();
} }
CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoMessages::mode_upnp | NeutrinoMessages::norezap);
} }
void CUpnpBrowserGui::showPicture(std::string name) void CUpnpBrowserGui::showPicture(std::string name)

View File

@@ -124,6 +124,7 @@ class CUpnpBrowserGui : public CMenuTarget, public CListHelpers
void paintItem2DetailsLine(int pos); void paintItem2DetailsLine(int pos);
void updateTimes(const bool force = false); void updateTimes(const bool force = false);
void updateMode();
void playAudio(std::string name, int type); void playAudio(std::string name, int type);
void stopAudio(); void stopAudio();
void showPicture(std::string name); void showPicture(std::string name);