Modifying GstVideoMeta format on a buffer in-place

Nicolas Dufresne nicolas at ndufresne.ca
Sun Feb 19 19:58:44 UTC 2017


Le vendredi 17 février 2017 à 10:37 +0000, Ryan Talbot a écrit :
> I'm modifying the OpenCV disparity plugin to get at the raw 16-bit
> signed disparity values, if the downstream caps request "video/x-
> raw,format=GRAY16_LE".  After some headache, I managed to get the
> caps negotiation to work so that either RGB or GRAY16_LE could be
> obtained from the source pad.  I was still running into trouble
> trying to use the buffers in pipelines, though, most notably when I
> tried to use videoconvert on them to prep them for encoding or
> display, I would get a message like this with every video frame:
> 
> ** (gst-launch-1.0:9670): CRITICAL **: gst_video_frame_map_id:
> assertion 'info->finfo->format == meta->format' failed
> WARNING: from element
> /GstPipeline:pipeline0/GstVideoConvert:videoconvert0: Internal
> GStreamer error: code not implemented.  Please file a bug at http://b
> ugzilla.gnome.org/enter_bug.cgi?product=GStreamer.
> Additional debug info:
> gstvideofilter.c(292): gst_video_filter_transform ():
> /GstPipeline:pipeline0/GstVideoConvert:videoconvert0:
> invalid video buffer received
> 
> I didn't realize that just getting the caps set wasn't enough, and
> that there was essentially another copy of some of the caps data in
> meta data embedded in the buffer.
> 
> What is the correct way to modify this meta data?  As it is, I'm
> basically doing:
> 
> GstVideoMeta *meta = gst_buffer_get_video_meta (buffer);
> meta->format = GST_VIDEO_FORMAT_GRAY16_LE;
> ret = gst_pad_push (srcpad, buffer);
> 
> ...that works, pipelines are happy, but it seems like a hack.  Is
> there a more preferred way of doing this?  It seems like maybe this
> plugin should derive from GST_TYPE_VIDEO_FILTER instead of
> GST_TYPE_ELEMENT, so that GstBaseTransform::transform_meta could be
> hooked into, although I'm not sure I have time to rewrite the plugin
> to that extent at the moment.

This element should be ported to the BaseOpenCVFilter class (like all
the others) and should use the BaseTransform mechanism indeed. Doing
in-place color conversion isn't common though. We usually concern into
a new buffer.

Nicolas

> 
> Thanks for any insight!
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20170219/e52814f6/attachment.sig>


More information about the gstreamer-devel mailing list