GStreamer使用playbin,如何给动态生成的source组件设置属性?

static void cb_playbin_notify_source(GObject *obj, GParamSpec *param, gpointer u_data)
{
    
// check whether this is rtsp source
    gchar *objname = GST_OBJECT_NAME(obj);
    g_message(
"objname is %s", objname);

    
// check whether has a `protocols' property
    if (g_object_class_find_property(G_OBJECT_GET_CLASS(obj), "source")) {
        GObject 
*source_element;
        g_object_get(obj, 
"source"&source_element, NULL);
        
if (g_object_class_find_property(G_OBJECT_GET_CLASS(source_element), "protocols")) {
            g_object_set(source_element, 
"protocols"1, NULL);
        }
        g_object_unref(source_element);
    }
}


// connect signal
    g_signal_connect(G_OBJECT(playbin), "notify::source", G_CALLBACK(cb_playbin_notify_source), NULL);

 

posted @ 2011-01-03 11:25  super119  阅读(1269)  评论(0编辑  收藏  举报