set caps in C problem

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

set caps in C problem

Forzaferrarileo
hi , I'm trying to set caps in my c code , using :

        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'

what I'm doing wrong? ( I'm using gstreamer1.0 )
Reply | Threaded
Open this post in threaded view
|

Re: set caps in C problem

Nirbheek Chauhan
On Sun, Dec 28, 2014 at 5:57 AM, Forzaferrarileo
<[hidden email]> 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
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: set caps in C problem

Forzaferrarileo
Ty , but now i have another problem :

GStreamer-WARNING **: Trying to connect elements that don't share a common ancestor: source and caps

  source = gst_element_factory_make ("videotestsrc", "source");
  capsfilter = gst_element_factory_make("capsfilter", "caps");
  convert = gst_element_factory_make ("videoconvert", "convert");
  sink = gst_element_factory_make ("autovideosink","sink");

 g_object_set(capsfilter, "caps", gst_caps_new_simple("video/x-raw",
                "width", G_TYPE_INT, 1280,
                "height", G_TYPE_INT, 720, NULL), NULL);

  pipeline = gst_pipeline_new ("test-pipeline");

  gst_bin_add_many (GST_BIN (pipeline), source, convert, sink, NULL);
   
  gst_element_link(source,capsfilter);
  gst_element_link(capsfilter,convert);
  gst_element_link(convert,sink);
Reply | Threaded
Open this post in threaded view
|

Re: set caps in C problem

Sérgio Agostinho
You forgot to add the caps filter to the pipeline.

Cheers

> On 28 Dec 2014, at 12:37, Forzaferrarileo <[hidden email]> wrote:
>
> Ty , but now i have another problem :
>
> GStreamer-WARNING **: Trying to connect elements that don't share a common
> ancestor: source and caps
>
>  source = gst_element_factory_make ("videotestsrc", "source");
>  capsfilter = gst_element_factory_make("capsfilter", "caps");
>  convert = gst_element_factory_make ("videoconvert", "convert");
>  sink = gst_element_factory_make ("autovideosink","sink");
>
> g_object_set(capsfilter, "caps", gst_caps_new_simple("video/x-raw",
>        "width", G_TYPE_INT, 1280,
>        "height", G_TYPE_INT, 720, NULL), NULL);
>
>  pipeline = gst_pipeline_new ("test-pipeline");
>
>  gst_bin_add_many (GST_BIN (pipeline), source, convert, sink, NULL);
>
>  gst_element_link(source,capsfilter);
>  gst_element_link(capsfilter,convert);
>  gst_element_link(convert,sink);
>
>
>
> --
> View this message in context: http://gstreamer-devel.966125.n4.nabble.com/set-caps-in-C-problem-tp4670021p4670024.html
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: set caps in C problem

dgoodrick
In reply to this post by Nirbheek Chauhan
Nirbheek Chauhan wrote
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);
What is the syntax of the properties in "g_object_set (capsfilter, "caps", caps, NULL);"
Does the property in quotes need to be spelled the same as the object being set?  e.g. "caps" ===caps or "spam" === spam ?
Is it a keyword?
Thanks,
-Dan