Skip to content

Commit

Permalink
Re-enable Picture in Picture and Picture By Picture.
Browse files Browse the repository at this point in the history
There is still a lot of work to be done to clean this up properly but I
realised my obvious mistake when I broke PiP in the first place.

Refs #9543

Cherry picked from c65b533
  • Loading branch information
Mark Kendall committed May 10, 2011
1 parent 5461754 commit 4062695
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 31 deletions.
62 changes: 36 additions & 26 deletions mythtv/libs/libmythtv/tv_play.cpp
Expand Up @@ -365,32 +365,7 @@ bool TV::StartTV(ProgramInfo *tvrec, uint flags)

// Process Events
VERBOSE(VB_PLAYBACK, LOC + "StartTV -- process events begin");

while (true)
{
qApp->processEvents();

TVState state = tv->GetState(0);
if ((kState_Error == state) || (kState_None == state))
break;

if (kState_ChangingState == state)
continue;

const PlayerContext *mctx = tv->GetPlayerReadLock(0, __FILE__, __LINE__);
if (mctx)
{
mctx->LockDeletePlayer(__FILE__, __LINE__);
if (mctx->player && !mctx->player->IsErrored())
{
mctx->player->EventLoop();
mctx->player->VideoLoop();
}
mctx->UnlockDeletePlayer(__FILE__, __LINE__);
}
tv->ReturnPlayerLock(mctx);
}

tv->PlaybackLoop();
VERBOSE(VB_PLAYBACK, LOC + "StartTV -- process events end");

if (tv->getJumpToProgram())
Expand Down Expand Up @@ -1280,6 +1255,41 @@ TV::~TV(void)
VERBOSE(VB_PLAYBACK, "TV::~TV() -- end");
}

/**
* \brief The main playback loop
*/
void TV::PlaybackLoop(void)
{
while (true)
{
qApp->processEvents();

TVState state = GetState(0);
if ((kState_Error == state) || (kState_None == state))
return;

if (kState_ChangingState == state)
continue;

int count = player.size();
for (int i = 0; i < count; i++)
{
const PlayerContext *mctx = GetPlayerReadLock(i, __FILE__, __LINE__);
if (mctx)
{
mctx->LockDeletePlayer(__FILE__, __LINE__);
if (mctx->player && !mctx->player->IsErrored())
{
mctx->player->EventLoop();
mctx->player->VideoLoop();
}
mctx->UnlockDeletePlayer(__FILE__, __LINE__);
}
ReturnPlayerLock(mctx);
}
}
}

/**
* \brief update the channel list with channels from the selected channel group
*/
Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmythtv/tv_play.h
Expand Up @@ -307,6 +307,7 @@ class MPUBLIC TV : public QObject
static EMBEDRETURNVOIDSCHEDIT RunScheduleEditorPtr;

private:
void PlaybackLoop(void);
bool ContextIsPaused(PlayerContext *ctx, const char *file, int location);
void SetActive(PlayerContext *lctx, int index, bool osd_msg);

Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/videoout_d3d.h
Expand Up @@ -43,7 +43,7 @@ class VideoOutputD3D : public VideoOutput
MythPlayer *pipplayer,
PIPLocation loc);
void RemovePIP(MythPlayer *pipplayer);
bool IsPIPSupported(void) const { return false; /*true*/}
bool IsPIPSupported(void) const { return true; }
virtual MythPainter *GetOSDPainter(void) { return (MythPainter*)m_osd_painter; }

private:
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/videoout_opengl.h
Expand Up @@ -46,7 +46,7 @@ class VideoOutputOpenGL : public VideoOutput
void MoveResizeWindow(QRect new_rect);

virtual void RemovePIP(MythPlayer *pipplayer);
virtual bool IsPIPSupported(void) const { return false/*true*/; }
virtual bool IsPIPSupported(void) const { return true; }
virtual bool hasFullScreenOSD(void) const { return true; }
virtual bool IsSyncLocked(void) const { return true; }
virtual bool ApproveDeintFilter(const QString& filtername) const;
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/videoout_vdpau.h
Expand Up @@ -55,7 +55,7 @@ class VideoOutputVDPAU : public VideoOutput
static MythCodecID GetBestSupportedCodec(uint width, uint height,
uint stream_type,
bool no_acceleration);
virtual bool IsPIPSupported(void) const { return false;/*true; */}
virtual bool IsPIPSupported(void) const { return true; }
virtual bool IsPBPSupported(void) const { return false; }
virtual bool NeedExtraAudioDecode(void) const
{ return codec_is_vdpau(video_codec_id); }
Expand Down
6 changes: 4 additions & 2 deletions mythtv/libs/libmythtv/videoout_xv.h
Expand Up @@ -91,8 +91,10 @@ class VideoOutputXv : public VideoOutput
int SetPictureAttribute(PictureAttribute attribute, int newValue);
void InitPictureAttributes(void);

virtual bool IsPIPSupported(void) const { return false; }
virtual bool IsPBPSupported(void) const { return false; }
virtual bool IsPIPSupported(void) const
{ return XVideo == VideoOutputSubType(); }
virtual bool IsPBPSupported(void) const
{ return XVideo == VideoOutputSubType(); }
virtual bool NeedExtraAudioDecode(void) const
{ return XVideoMC <= VideoOutputSubType(); }
virtual bool hasHWAcceleration(void) const
Expand Down

0 comments on commit 4062695

Please sign in to comment.