现在的位置: 首页 > 综合 > 正文

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

2012年07月06日 ⁄ 综合 ⁄ 共 750字 ⁄ 字号 评论关闭
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);

 

抱歉!评论已关闭.