Gstreamer - decodebin - program number

Duchassin Frederic duchassin at sefram.fr
Wed Jul 26 12:13:33 UTC 2017


Hi Tim,

Thanks for the explanation. 
This is the code is use :

void element_added_cb (GstBin *bin, GstElement *element, gpointer user_data)
{
    gchar * name = GST_OBJECT_NAME (element);

    g_print ("element-added: %s\r\n", name);

    if (g_object_class_find_property (G_OBJECT_GET_CLASS (element),"program-number"))
        {
            int val = 22;
        g_object_set(G_OBJECT(element), "program-number ", val, NULL);
        }

}

But I always get an error on output :

element-added: tsdemux0
(QML_LibpcapGstreamerUart:1083): GLib-GObject-WARNING **: g_object_set_valist: object class 'GstTSDemux' has no property named 'program-number '
element-added: multiqueue0
element-added: mpegaudioparse0
element-added: mpegvparse0
element-added: mad0
element-added: imxvpudecoder0

It's strange isn't ?


Fred



-----Message d'origine-----
De : gstreamer-devel [mailto:gstreamer-devel-bounces at lists.freedesktop.org] De la part de Tim Müller
Envoyé : mercredi 26 juillet 2017 12:34
À : gstreamer-devel at lists.freedesktop.org
Objet : Re: Gstreamer - decodebin - program number

On Wed, 2017-07-26 at 11:30 +0200, Duchassin Frederic wrote:

Hi Fred,

I don't think this will work. You need to set this property on the actual GstElement, not a GstElementFactory.

If you were using playbin you could have used the (newish) "element- setup" signal for this.

With decodebin, you can use the "element-added" signal. Only problem is that this will be emitted for all elements that are added to decodebin, so you need to make sure you only set this property on the ts demuxer.

One way of doing this check is just checking for the property with something like:

  if (g_object_class_find_property (G_OBJECT_GET_CLASS (added_element),
"program-number")) {
    g_object_set (added_element, "program-number", ..., NULL);
  }

Or you get the factory from the element and then check the factory name.

Cheers
 -Tim


--
Tim Müller, Centricular Ltd - http://www.centricular.com

Join us at the GStreamer Conference!
21-22 October 2017 in Prague, Czech Republic http://gstreamer.freedesktop.org/conference/
_______________________________________________
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