Skip to content

Commit

Permalink
Fix video embedding when starting live tv.
Browse files Browse the repository at this point in the history
Still some issues with OpenGL but they're not directly embedding
related.

Closes #9573
  • Loading branch information
Mark Kendall committed Jun 12, 2011
1 parent 4f9fd7b commit c96e65c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 10 deletions.
16 changes: 16 additions & 0 deletions mythtv/libs/libmythtv/videoout_opengl.cpp
Expand Up @@ -155,6 +155,18 @@ bool VideoOutputOpenGL::InputChanged(const QSize &input_size,
.arg(toString(video_codec_id)).arg(toString(av_codec_id)));

QMutexLocker locker(&gl_context_lock);

// Ensure we don't lose embedding through program changes. This duplicates
// code in VideoOutput::Init but we need start here otherwise the embedding
// is lost during window re-initialistion.
bool wasembedding = window.IsEmbedding();
QRect oldrect;
if (wasembedding)
{
oldrect = window.GetEmbeddingRect();
StopEmbedding();
}

if (!codec_is_std(av_codec_id))
{
VERBOSE(VB_IMPORTANT, LOC_ERR +
Expand All @@ -170,6 +182,8 @@ bool VideoOutputOpenGL::InputChanged(const QSize &input_size,
{
VideoAspectRatioChanged(aspect);
MoveResize();
if (wasembedding)
EmbedInWidget(oldrect);
}
return true;
}
Expand All @@ -179,6 +193,8 @@ bool VideoOutputOpenGL::InputChanged(const QSize &input_size,
if (Init(input_size.width(), input_size.height(),
aspect, gl_parent_win, disp, av_codec_id))
{
if (wasembedding)
EmbedInWidget(oldrect);
BestDeint();
return true;
}
Expand Down
16 changes: 16 additions & 0 deletions mythtv/libs/libmythtv/videoout_vdpau.cpp
Expand Up @@ -695,6 +695,18 @@ bool VideoOutputVDPAU::InputChanged(const QSize &input_size,
.arg(toString(video_codec_id)).arg(toString(av_codec_id)));

QMutexLocker locker(&m_lock);

// Ensure we don't lose embedding through program changes. This duplicates
// code in VideoOutput::Init but we need start here otherwise the embedding
// is lost during window re-initialistion.
bool wasembedding = window.IsEmbedding();
QRect oldrect;
if (wasembedding)
{
oldrect = window.GetEmbeddingRect();
StopEmbedding();
}

bool cid_changed = (video_codec_id != av_codec_id);
bool res_changed = input_size != window.GetActualVideoDim();
bool asp_changed = aspect != window.GetVideoAspect();
Expand All @@ -706,6 +718,8 @@ bool VideoOutputVDPAU::InputChanged(const QSize &input_size,
{
VideoAspectRatioChanged(aspect);
MoveResize();
if (wasembedding)
EmbedInWidget(oldrect);
}
return true;
}
Expand All @@ -715,6 +729,8 @@ bool VideoOutputVDPAU::InputChanged(const QSize &input_size,
if (Init(input_size.width(), input_size.height(),
aspect, m_win, disp, av_codec_id))
{
if (wasembedding)
EmbedInWidget(oldrect);
BestDeint();
return true;
}
Expand Down
11 changes: 1 addition & 10 deletions mythtv/libs/libmythtv/videooutbase.cpp
Expand Up @@ -382,7 +382,7 @@ bool VideoOutput::Init(int width, int height, float aspect, WId winid,
QRect oldrect;
if (wasembedding)
{
oldrect = window.GetDisplayVisibleRect();
oldrect = window.GetEmbeddingRect();
StopEmbedding();
}

Expand All @@ -392,17 +392,8 @@ bool VideoOutput::Init(int width, int height, float aspect, WId winid,
if (db_vdisp_profile)
db_vdisp_profile->SetInput(window.GetVideoDim());

/*
aspectoverride = db_aspectoverride;
// If autodection is enabled. Start in the defaultmode
adjustfill = db_adjustfill >= kAdjustFill_AutoDetect_DefaultOff ?
(AdjustFillMode) (db_adjustfill - kAdjustFill_AutoDetect_DefaultOff) : db_adjustfill;
*/
if (wasembedding)
{
VERBOSE(VB_PLAYBACK, LOC + "Restoring embedded playback");
EmbedInWidget(oldrect);
}

VideoAspectRatioChanged(aspect); // apply aspect ratio and letterbox mode

Expand Down

0 comments on commit c96e65c

Please sign in to comment.