Permalink
Browse files

Fix video embedding when starting live tv.

Still some issues with OpenGL but they're not directly embedding
related.

Closes #9573
  • Loading branch information...
1 parent 4f9fd7b commit c96e65c22f859053fa3de5f5266430ec3d461226 Mark Kendall committed Jun 12, 2011
@@ -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 +
@@ -170,6 +182,8 @@ bool VideoOutputOpenGL::InputChanged(const QSize &input_size,
{
VideoAspectRatioChanged(aspect);
MoveResize();
+ if (wasembedding)
+ EmbedInWidget(oldrect);
}
return true;
}
@@ -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;
}
@@ -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();
@@ -706,6 +718,8 @@ bool VideoOutputVDPAU::InputChanged(const QSize &input_size,
{
VideoAspectRatioChanged(aspect);
MoveResize();
+ if (wasembedding)
+ EmbedInWidget(oldrect);
}
return true;
}
@@ -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;
}
@@ -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();
}
@@ -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

0 comments on commit c96e65c

Please sign in to comment.