How do I set the cap in code

David Ing ding at panopto.com
Fri May 8 06:27:44 UTC 2020


Setting caps directly on a pad is not always possible because the caps are
basically negotiated as the pipeline moves from the READY to PAUSED state
(IIRC).  Part of this negotiation involves communicating with upstream and
downstream elements to determine the caps at each stage of the pipeline (at
each pad).  I don't fully understand how it works (I am just a novice).

You do have an option to link your pad to a capsfilter
<https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-plugins/html/gstreamer-plugins-capsfilter.html>
which
would then place constraints on the caps of your pad.  Basically the caps
negotiation will be forced to come up with something that fits your caps
filter, otherwise the pipeline will never enter the PAUSED state (you would
see some kind of error).

On Thu, May 7, 2020 at 8:28 PM William Johnston <wgj at cast.uark.edu> wrote:

> I have and element that looks like this:
>
> element: misbfixcoordinates1
>      pad: videosink
>          caps (writable):   video/x-raw, format=(string)RGB
>          template caps: video/x-raw, format=(string)RGB
>      pad: misbsink
>           caps (writable):   EMPTY
>           template caps: meta/klv
>      pad: videosrc
>          caps (writable):   video/x-raw, format=(string)RGB,
> width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ],
> framerate=(fraction)[ 0/1, 2147483647/1 ]
>          template caps: video/x-raw, format=(string)RGB
>      pad: misbsrc
>          caps (writable):   EMPTY
>          template caps: meta/klv
>
> See those "EMPTY" caps? I want to set them to something else. I thought
> this would work:
>
> GstPad*
> misbsinkPad=gst_element_get_static_pad(misbfixcoordinates,"misbsink");
> GstCaps* newCaps1=gst_caps_from_string("meta/klv");
> gst_pad_set_caps(misbsinkPad,newCaps1);
>
> But it doesn't change anything. Anyone know how to do this?
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20200507/5fab80f8/attachment.htm>


More information about the gstreamer-devel mailing list