Print out caps of an element

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

Print out caps of an element

m.lenz
In a new application I grab video data with appsrc from a sensor and then
start streaming this RAW-Video data to my loopback address via an
udpsink-element. So I can grab it from there anytime and do other things I
want to do with it.

Now I simply want to grab the data from command line by this pipeline:
gst-launch-1.0 -v udpsrc address=127.0.0.1 port=5000 caps =
"application/x-rtp, media=(string)video, payload=(int)96,
clock-rate=(int)90000, encoding-name=(string)RAW, format=(string)I420,
depth=(string)8, width =(int)640, height=(int)480, framerate=(fraction)30/1"
! rtpvrawdepay ! rawvideoparse ! queue ! xvimagesink

This gives me an 'Internal data stream error' of udpsrc0. So there might be
something wrong with the caps.

In the application I use these caps for appsrc: ("video/x-raw", "format",
G_TYPE_STRING, "I420", "width", G_TYPE_INT, 640, "height", G_TYPE_INT, 480,
"framerate", GST_TYPE_FRACTION, 30, 1, NULL)

I have found out that I have to figure out the caps of my sink pad, but I
don't really know how. I have my 'GstElement *videosink;' and 'videosink =
gst_element_factory_make ("udpsink", "videosink");'

I can print out caps in such a way:
gchar *capsstr;
capsstr = gst_caps_to_string (GST_PAD_CAPS (pad)))
g_print ("caps: %s\n", capsstr);
g_free (capsstr);

But how do I get the pad of my udpsink?





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

Re: Print out caps of an element

Nicolas Dufresne-5
Le jeudi 16 janvier 2020 à 08:31 -0600, m.lenz a écrit :

> In a new application I grab video data with appsrc from a sensor and
> then
> start streaming this RAW-Video data to my loopback address via an
> udpsink-element. So I can grab it from there anytime and do other
> things I
> want to do with it.
>
> Now I simply want to grab the data from command line by this
> pipeline:
> gst-launch-1.0 -v udpsrc address=127.0.0.1 port=5000 caps =
> "application/x-rtp, media=(string)video, payload=(int)96,
> clock-rate=(int)90000, encoding-name=(string)RAW,
> format=(string)I420,
> depth=(string)8, width =(int)640, height=(int)480,
> framerate=(fraction)30/1"
> ! rtpvrawdepay ! rawvideoparse ! queue ! xvimagesink
>
> This gives me an 'Internal data stream error' of udpsrc0. So there
> might be
> something wrong with the caps.
>
> In the application I use these caps for appsrc: ("video/x-raw",
> "format",
> G_TYPE_STRING, "I420", "width", G_TYPE_INT, 640, "height",
> G_TYPE_INT, 480,
> "framerate", GST_TYPE_FRACTION, 30, 1, NULL)
>
> I have found out that I have to figure out the caps of my sink pad,
> but I
> don't really know how. I have my 'GstElement *videosink;' and
> 'videosink =
> gst_element_factory_make ("udpsink", "videosink");'
>
> I can print out caps in such a way:
> gchar *capsstr;
> capsstr = gst_caps_to_string (GST_PAD_CAPS (pad)))
> g_print ("caps: %s\n", capsstr);
> g_free (capsstr);

you can also do g_print("%" GST_PTR_FORMAT, caps); You should use
gst_pad_get_current_caps() instead of that macro.

>
> But how do I get the pad of my udpsink?

pad = gst_element_get_static_pad (udpsink, "sink");

>
>
>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> 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: Print out caps of an element

m.lenz
I tried out the following:

  GstElement *videosink;
  videosink = gst_element_factory_make ("udpsink", "videosink");
  ...
  GstPad *pad = gst_element_get_static_pad (videosink, "sink");
  GstCaps *caps = gst_pad_get_current_caps(pad);

But the returned pointer in caps is always NULL. The pointer of my pad
referring to the videosink is found!

Does the udpsink has no caps? Because this is what the documentation says
about this. I also tried if(gst_pad_has_current_caps(pad)) and this is also
always false.

Maybe it is a problem, that the caps will not be passed on the next element?
I created caps on appsrc and linked appsrc, rtpvrawpay and udpsink to a
pipeline at the end of my application.



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

Re: Print out caps of an element

Nicolas Dufresne-5


Le lun. 20 janv. 2020 05 h 45, m.lenz <[hidden email]> a écrit :
I tried out the following:

  GstElement *videosink;
  videosink = gst_element_factory_make ("udpsink", "videosink");
  ...
  GstPad *pad = gst_element_get_static_pad (videosink, "sink");
  GstCaps *caps = gst_pad_get_current_caps(pad);

But the returned pointer in caps is always NULL. The pointer of my pad
referring to the videosink is found!

Does the udpsink has no caps? Because this is what the documentation says
about this. I also tried if(gst_pad_has_current_caps(pad)) and this is also
always false.

Caps negotiation happens asynchronously. If your pipeline isn't running, this is expected. You can also check the allowed caps if you prefer.


udpsink allow pretty much anything, so that won't be very useful.


Maybe it is a problem, that the caps will not be passed on the next element?
I created caps on appsrc and linked appsrc, rtpvrawpay and udpsink to a
pipeline at the end of my application.

As said, caps will be negotiated asynchronously.




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
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