How do I set the cap in code

David Ing ding at panopto.com
Fri May 8 17:46:56 UTC 2020


I think that the caps filter *should* connect to any pad for which the static
caps template
<https://gstreamer.freedesktop.org/documentation/gstreamer/gstpadtemplate.html?gi-language=c>
is compatible with the caps specified in the caps filter.

Some questions come to mind:

   - Are you trying to connect the filter while the pipeline state is
   PAUSED or PLAYING?  (That might not work.)
   - Are you trying to set caps while the pipeline state is PAUSED or
   PLAYING?  (That might not work either.)

I am not familiar with the gstreamer element that you are using ... and I
am merely a gstreamer novice.  Perhaps an expert would be more helpful.


On Fri, May 8, 2020 at 8:58 AM William Johnston <wgj at cast.uark.edu> wrote:

> I tried that first. And I tried it again just now to make sure. The caps
> filter will not bind to EMPTY caps.
> On 5/8/2020 1:27 AM, David Ing wrote:
>
> 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
>>
>
> _______________________________________________
> gstreamer-devel mailing listgstreamer-devel at lists.freedesktop.orghttps://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
> _______________________________________________
> 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/20200508/04ba907e/attachment.htm>


More information about the gstreamer-devel mailing list