• Hans Verkuil's avatar
    [media] vb2: fix timecode and flags handling for output buffers · f1343281
    Hans Verkuil authored
    When sending a buffer to a video output device some of the fields need
    to be copied so they arrive in the driver. These are the KEY/P/BFRAME
    flags and the TIMECODE flag, and, if that flag is set, the timecode field
    itself.
    
    There are a number of functions involved in this: the __fill_vb2_buffer()
    is called while preparing a buffer. For output buffers the buffer contains
    the video data, so any meta data associated with that (KEY/P/BFRAME and
    the field information) should be stored at that point.
    
    The timecode, timecode flag and timestamp information is not part of that,
    that information will have to be set when vb2_internal_qbuf() is called to
    actually queue the buffer to the driver. Usually VIDIOC_QBUF will do the
    prepare as well, but you can call PREPARE_BUF first and only later VIDIOC_QBUF.
    You most likely will want to set the timestamp and timecode when you actually
    queue the buffer, not when you prepare it.
    
    Finally, in buf_prepare() make sure the timestamp and sequence fields are
    actually cleared so that when you do a QUERYBUF of a prepared-but-not-yet-queued
    buffer you will not see stale timestamp/sequence data.
    Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
    Signed-off-by: default avatarSakari Ailus <sakari.ailus@iki.fi>
    Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
    f1343281
videobuf2-core.c 76 KB