set caps in C problem

Nirbheek Chauhan nirbheek.chauhan at gmail.com
Sun Dec 28 00:46:37 PST 2014


On Sun, Dec 28, 2014 at 5:57 AM, Forzaferrarileo
<leonardo.ferroro at gmail.com> wrote:
>         source = gst_element_factory_make("videotestsrc","source");
>
>         caps = gst_caps_new_simple("video/x-raw",
>                 "width", G_TYPE_INT, 1280,
>                 "height", G_TYPE_INT, 720,
>                 "framerate", GST_TYPE_FRACTION, 25, 1, NULL);
>
>         g_object_set(source, "caps", caps, NULL);
>         gst_caps_unref(caps);
>
> but I'm getting :   GLib-GObject-WARNING **: g_object_set_valist: object
> class 'GstVideoTestSrc' has no property named 'caps'
>

If you check the available properties on the element using
`gst-inspect-1.0 videotestsrc`, you'll notice that there is indeed no
"caps" property.

If you want to have the equivalent of `gst-launch-1.0 videotestsrc !
video/x-raw,width=1280,...`, then you need to insert a "capsfilter"
element after videotestsrc and set the "caps" property on that.
Something like this:

source = gst_element_factory_make ("videotestsrc","source");
capsfilter = gst_element_factory_make ("capsfilter", NULL);
caps = gst_caps_new_simple (...);
g_object_set (capsfilter, "caps", caps, NULL);
gst_element_add_many (pipeline, source, capsfilter, NULL);
gst_element_link (source, capsfilter);
[...]


-- 
~Nirbheek Chauhan


More information about the gstreamer-devel mailing list