How do I set the cap in code

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How do I set the cap in code

William
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
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How do I set the cap in code

David Ing
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 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 <[hidden email]> 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
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How do I set the cap in code

William

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 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 <[hidden email]> 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
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How do I set the cap in code

David Ing
I think that the caps filter should connect to any pad for which the static caps template 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 <[hidden email]> 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 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 <[hidden email]> 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
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel