After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 724899 - v4l2src does not set interlaced flag on buffers
v4l2src does not set interlaced flag on buffers
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
1.2.2
Other Linux
: Normal normal
: 1.3.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-02-21 15:53 UTC by Simon Farnsworth
Modified: 2014-02-21 19:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[PATCH] v4l2src: Flag interlaced buffers as interlaced. (1.46 KB, patch)
2014-02-21 15:53 UTC, Simon Farnsworth
committed Details | Review

Description Simon Farnsworth 2014-02-21 15:53:05 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.
Comment 1 Simon Farnsworth 2014-02-21 15:53:34 UTC
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(+)
Comment 2 Tim-Philipp Müller 2014-02-21 19:04:54 UTC
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?)
Comment 3 Simon Farnsworth 2014-02-21 19:24:34 UTC
(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.
Comment 4 Tim-Philipp Müller 2014-02-21 19:50:43 UTC
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