GNOME Bugzilla – Bug 724899
v4l2src does not set interlaced flag on buffers
Last modified: 2014-02-21 19:50:56 UTC
v4l2src does not set GST_VIDEO_BUFFER_FLAG_INTERLACED on the buffers it pushes upstream; gstreamer-vaapi relies on this flag to determine whether to deinterlace the buffer or not. The attached patch sets GST_VIDEO_BUFFER_FLAG_INTERLACED whenever we're setting or unsetting GST_VIDEO_BUFFER_FLAG_TFF.
Created attachment 269928 [details] [review] [PATCH] v4l2src: Flag interlaced buffers as interlaced. We correctly indicate the field ordering on interlaced buffers, but fail to flag them as containing interlaced video. This means that downstream elements (like vaapipostproc from gstreamer-vaapi) don't recognise these buffers as in need of deinterlacing. Fix this by setting the interlaced flag on all interlaced buffers. Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk> --- sys/v4l2/gstv4l2bufferpool.c | 2 ++ 1 file changed, 2 insertions(+)
Right, it's needed because we signal interlace-mode=mixed instead of interlace-mode=interleaved. Just one thing I'm wondering about: do we need to add an else branch with an UNSET(FLAG_INTERLACED) too then? (it seems to do that for the TFF flag, I'm guessing because we don't know what flags will be set on recycled buffers from the buffer pool?)
(In reply to comment #2) > Right, it's needed because we signal interlace-mode=mixed instead of > interlace-mode=interleaved. > Right, and we can't change that because in V4L2 land, interlace is a per-buffer property, and could change frame-by-frame. > Just one thing I'm wondering about: do we need to add an else branch with an > UNSET(FLAG_INTERLACED) too then? (it seems to do that for the TFF flag, I'm > guessing because we don't know what flags will be set on recycled buffers from > the buffer pool?) Quite possibly - I didn't look in depth there. My test source happens to be interlaced all the time, so if we do need to unset it, I wouldn't notice.
Pushed, many thanks for the patch: commit 5535a824a40154b96e50eb46d4ed0b9c78e662d0 Author: Tim-Philipp Müller <tim@centricular.com> Date: Fri Feb 21 19:46:44 2014 +0000 v4l2src: also unset INTERLACED flag on buffers if frame is not interlaced https://bugzilla.gnome.org/show_bug.cgi?id=724899 commit b4820460d887fdd14844af74ee3d010b1f98d530 Author: Simon Farnsworth <simon.farnsworth@onelan.co.uk> Date: Fri Feb 21 14:31:59 2014 +0000 v4l2src: Flag interlaced buffers as interlaced. We correctly indicate the field ordering on interlaced buffers, but fail to flag them as containing interlaced video, which we need to do here because we signal interlace-mode=mixed in our caps. This means that downstream elements (like vaapipostproc from gstreamer-vaapi) don't recognise these buffers as in need of deinterlacing. Fix this by setting the interlaced flag on all interlaced buffers. Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk> https://bugzilla.gnome.org/show_bug.cgi?id=724899