Print out caps of an element

Nicolas Dufresne nicolas at ndufresne.ca
Thu Jan 16 19:01:23 UTC 2020


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
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



More information about the gstreamer-devel mailing list