If compiled with MPD HTTP playback support, when MPD stream is paused then stop the Phonon/QMediaObject from playing. See README for config option on this.
BUG: 456
This commit is contained in:
committed by
craig.p.drummond
parent
87b3874f68
commit
348e32c2fa
@@ -89,6 +89,9 @@
|
||||
avoid clashes with menubar.
|
||||
56. When TrackOrganizer is called after TagEditor, only perform MPD update
|
||||
once.
|
||||
57. If compiled with MPD HTTP playback support, when MPD stream is paused then
|
||||
stop the Phonon/QMediaObject from playing. See README for config option
|
||||
on this.
|
||||
|
||||
1.3.4
|
||||
-----
|
||||
|
||||
10
README
10
README
@@ -435,6 +435,15 @@ menu=<Integer>
|
||||
run under Unity or MacOS - as these always have a menubar - in which case
|
||||
menu=3 will cause both a menubar and menu button to be present.
|
||||
|
||||
stopHttpStreamOnPause=<Boolean>
|
||||
If Cantata is playing MPD's HTTP output stream, then this controls what
|
||||
should happen when paused. When MPD's HTTP stream is paused, MPD will
|
||||
output silence over the stream. If this option is set to true, then
|
||||
Cantata will disconnect from MPD's HTTP stream. (NOTE: This will mean that
|
||||
there will be a delay when un-pausing). If set to false, Cantata will
|
||||
continue toi play the 'silence' (NOTE: This will use more bandwidth).
|
||||
Default is true.
|
||||
|
||||
e.g.
|
||||
[General]
|
||||
iconTheme=oxygen
|
||||
@@ -449,6 +458,7 @@ mpdListSize=5000
|
||||
alwaysUseHttp=true
|
||||
alwaysUseLsInfo=true
|
||||
menu=3
|
||||
stopHttpStreamOnPause=true
|
||||
|
||||
|
||||
8. CUE Files
|
||||
|
||||
@@ -916,6 +916,11 @@ int Settings::menu()
|
||||
return 0==v ? MC_Bar : v;
|
||||
}
|
||||
|
||||
void Settings::stopHttpStreamOnPause()
|
||||
{
|
||||
return cfg.get("stopHttpStreamOnPause", true);
|
||||
}
|
||||
|
||||
void Settings::removeConnectionDetails(const QString &v)
|
||||
{
|
||||
if (v==currentConnection()) {
|
||||
|
||||
@@ -182,6 +182,7 @@ public:
|
||||
bool alwaysUseLsInfo();
|
||||
bool showMenubar();
|
||||
int menu();
|
||||
bool stopHttpStreamOnPause();
|
||||
|
||||
void removeConnectionDetails(const QString &v);
|
||||
void saveConnectionDetails(const MPDConnectionDetails &v);
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "httpstream.h"
|
||||
#include "mpdconnection.h"
|
||||
#include "mpdstatus.h"
|
||||
#include "settings.h"
|
||||
#if QT_VERSION < 0x050000
|
||||
#include <phonon/audiooutput.h>
|
||||
#endif
|
||||
@@ -34,6 +35,7 @@ HttpStream::HttpStream(QObject *p)
|
||||
, state(MPDState_Inactive)
|
||||
, player(0)
|
||||
{
|
||||
stopOnPause=Settings::self()->stopHttpStreamOnPause();
|
||||
}
|
||||
|
||||
void HttpStream::setEnabled(bool e)
|
||||
@@ -81,16 +83,26 @@ void HttpStream::streamUrl(const QString &url)
|
||||
state=status->state();
|
||||
switch (status->state()) {
|
||||
case MPDState_Playing:
|
||||
player->play();
|
||||
#if QT_VERSION < 0x050000
|
||||
if (Phonon::PlayingState!=player->state()) {
|
||||
player->play();
|
||||
}
|
||||
#else
|
||||
if (QMediaPlayer::PlayingState!=player->state()) {
|
||||
player->play();
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case MPDState_Inactive:
|
||||
case MPDState_Stopped:
|
||||
player->stop();
|
||||
break;
|
||||
break;
|
||||
case MPDState_Paused:
|
||||
player->pause();
|
||||
if (stopOnPause) {
|
||||
player->stop();
|
||||
}
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
state=MPDState_Inactive;
|
||||
@@ -111,14 +123,24 @@ void HttpStream::updateStatus()
|
||||
state=status->state();
|
||||
switch (status->state()) {
|
||||
case MPDState_Playing:
|
||||
player->play();
|
||||
#if QT_VERSION < 0x050000
|
||||
if (Phonon::PlayingState!=player->state()) {
|
||||
player->play();
|
||||
}
|
||||
#else
|
||||
if (QMediaPlayer::PlayingState!=player->state()) {
|
||||
player->play();
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case MPDState_Inactive:
|
||||
case MPDState_Stopped:
|
||||
player->stop();
|
||||
break;
|
||||
case MPDState_Paused:
|
||||
player->pause();
|
||||
if (stopOnPause) {
|
||||
player->stop();
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ private Q_SLOTS:
|
||||
|
||||
private:
|
||||
bool enabled;
|
||||
bool stopOnPause;
|
||||
int state;
|
||||
#if QT_VERSION < 0x050000
|
||||
Phonon::MediaObject *player;
|
||||
|
||||
Reference in New Issue
Block a user