aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Penquerc'h2011-08-29 09:18:39 -0500
committerSebastian Dröge2011-10-03 04:18:06 -0500
commitd4d5e350d073bab89faf6a781ba5ef9df45f19b8 (patch)
tree3914b9ea94e8f732a21f54926d82bdc8e2b178bc
parent8bf3d5a2b77eff15e130bde36366457c26b7f66a (diff)
downloadgstreamer0-10-ffmpeg-d4d5e350d073bab89faf6a781ba5ef9df45f19b8.tar.gz
gstreamer0-10-ffmpeg-d4d5e350d073bab89faf6a781ba5ef9df45f19b8.tar.xz
gstreamer0-10-ffmpeg-d4d5e350d073bab89faf6a781ba5ef9df45f19b8.zip
ffdec: ensure buffers have correct interlacedness in caps
Whether a frame is interlaced or not is unknown at the time of buffer allocation, so caps on the buffer in opaque will have a previous frame's interlaced flag set. So if interlacedness changes, we update the buffer (if any) caps with the correct interlaced flag once we know. https://bugzilla.gnome.org/show_bug.cgi?id=656155
-rw-r--r--ext/ffmpeg/gstffmpegdec.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/ext/ffmpeg/gstffmpegdec.c b/ext/ffmpeg/gstffmpegdec.c
index 47cd96c..cc07889 100644
--- a/ext/ffmpeg/gstffmpegdec.c
+++ b/ext/ffmpeg/gstffmpegdec.c
@@ -1809,6 +1809,28 @@ gst_ffmpegdec_video_frame (GstFFMpegDec * ffmpegdec,
1809 gst_ffmpegdec_negotiate (ffmpegdec, TRUE); 1809 gst_ffmpegdec_negotiate (ffmpegdec, TRUE);
1810 } 1810 }
1811 1811
1812
1813 /* Whether a frame is interlaced or not is unknown at the time of
1814 buffer allocation, so caps on the buffer in opaque will have
1815 the previous frame's interlaced flag set. So if interlacedness
1816 has changed since allocation, we update the buffer (if any)
1817 caps now with the correct interlaced flag. */
1818 if (ffmpegdec->picture->opaque != NULL) {
1819 GstBuffer *buffer = ffmpegdec->picture->opaque;
1820 if (GST_BUFFER_CAPS (buffer) && GST_PAD_CAPS (ffmpegdec->srcpad)) {
1821 GstStructure *s = gst_caps_get_structure (GST_BUFFER_CAPS (buffer), 0);
1822 gboolean interlaced;
1823 gboolean found = gst_structure_get_boolean (s, "interlaced", &interlaced);
1824 if (!found || (!!interlaced != !!ffmpegdec->format.video.interlaced)) {
1825 GST_DEBUG_OBJECT (ffmpegdec,
1826 "Buffer interlacing does not match pad, updating");
1827 buffer = gst_buffer_make_metadata_writable (buffer);
1828 gst_buffer_set_caps (buffer, GST_PAD_CAPS (ffmpegdec->srcpad));
1829 ffmpegdec->picture->opaque = buffer;
1830 }
1831 }
1832 }
1833
1812 /* check if we are dealing with a keyframe here, this will also check if we 1834 /* check if we are dealing with a keyframe here, this will also check if we
1813 * are dealing with B frames. */ 1835 * are dealing with B frames. */
1814 iskeyframe = check_keyframe (ffmpegdec); 1836 iskeyframe = check_keyframe (ffmpegdec);