Skip to content

Commit

Permalink
Adapt TV player for new playback registration mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
jyavenard committed Jul 15, 2012
1 parent ae61cb9 commit e4c5cfe
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
20 changes: 19 additions & 1 deletion mythtv/libs/libmythtv/tv_play.cpp
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -1269,6 +1286,7 @@ TV::~TV(void)
browsehelper->Stop();

gCoreContext->removeListener(this);
gCoreContext->UnregisterForPlayback(this);

if (GetMythMainWindow() && weDisabledGUI)
GetMythMainWindow()->PopDrawDisabled();
Expand Down Expand Up @@ -5855,7 +5873,7 @@ bool TV::IsPaused(void)
{
if (!IsTVRunning())
return false;

QMutexLocker lock(gTVLock);
PlayerContext *ctx = gTV->GetPlayerReadLock(0, __FILE__, __LINE__);

Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmythtv/tv_play.h
Expand Up @@ -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
Expand Down

0 comments on commit e4c5cfe

Please sign in to comment.