Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adapt TV player for new playback registration mechanism

  • Loading branch information...
commit e4c5cfe9ecb0fd9405df19e184a6939d57f862f3 1 parent ae61cb9
@jyavenard jyavenard authored
View
20 mythtv/libs/libmythtv/tv_play.cpp
@@ -272,6 +272,19 @@ void TV::ReleaseTV(TV* tv)
gTV = NULL;
}
+void TV::StopPlayback(void)
+{
+ if (TV::IsTVRunning())
+ {
+ QMutexLocker lock(gTVLock);
+
+ PlayerContext *ctx = gTV->GetPlayerReadLock(0, __FILE__, __LINE__);
+ PrepareToExitPlayer(ctx, __LINE__);
+ SetExitPlayer(true, true);
+ ReturnPlayerLock(ctx);
+ }
+}
+
/**
* \brief returns true if the recording completed when exiting.
*/
@@ -330,6 +343,9 @@ bool TV::StartTV(ProgramInfo *tvrec, uint flags)
SendMythSystemPlayEvent("PLAY_STARTED", curProgram);
}
+ // Notify others that we are about to play
+ gCoreContext->WantingPlayback(tv);
+
QString playerError = QString::null;
while (!quitAll)
{
@@ -1123,6 +1139,7 @@ void TV::InitFromDB(void)
vbimode = VBIMode::Parse(!feVBI.isEmpty() ? feVBI : beVBI);
gCoreContext->addListener(this);
+ gCoreContext->RegisterForPlayback(this, SLOT(StopPlayback()));
QMutexLocker lock(&initFromDBLock);
initFromDBDone = true;
@@ -1269,6 +1286,7 @@ TV::~TV(void)
browsehelper->Stop();
gCoreContext->removeListener(this);
+ gCoreContext->UnregisterForPlayback(this);
if (GetMythMainWindow() && weDisabledGUI)
GetMythMainWindow()->PopDrawDisabled();
@@ -5855,7 +5873,7 @@ bool TV::IsPaused(void)
{
if (!IsTVRunning())
return false;
-
+
QMutexLocker lock(gTVLock);
PlayerContext *ctx = gTV->GetPlayerReadLock(0, __FILE__, __LINE__);
View
1  mythtv/libs/libmythtv/tv_play.h
@@ -206,6 +206,7 @@ class MTV_PUBLIC TV : public QObject
public slots:
void HandleOSDClosed(int osdType);
void timerEvent(QTimerEvent*);
+ void StopPlayback(void);
protected:
// Protected event handling
Please sign in to comment.
Something went wrong with that request. Please try again.