2013-03-27 82 views
1

我是gstreamer的新手,并试图开发标题解码的示例插件。GStreamer - 示例插件

我已经下载了gStreamer插件模板:基于this的信息。

当我从命令行启动插件时,它工作正常。

我写了一个示例应用程序来验证插件。 但是现在,我在将管线状态设置为PLAYING时遇到问题。以下是代码段

任何输入都会有很大的帮助。

由于提前, Kranti


gst_init(NULL, NULL); 

loop = g_main_loop_new (NULL, TRUE); 

g_print("\n Gstreamer is Initialized and Created the loop "); 

pipeline = gst_pipeline_new ("pipeline"); 

source = gst_element_factory_make ("filesrc", "source"); 

filter = gst_element_factory_make ("myfilter", "testfilter"); 

sink = gst_element_factory_make ("fakesink", "sink"); 

if((NULL != pipeline) && (NULL != source) && (NULL != filter) && (NULL != sink)) 
{ 
    g_print("\n Successfully created the factory elements "); 

    g_object_set(G_OBJECT (source), "location", fileName, NULL); 
    g_print("\n Set the file name \n"); 

    g_object_set(G_OBJECT (filter), "silent", 1, NULL); 
    g_print("\n Set the silent type \n"); 

    /* we add a message handler */ 
    bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); 
    bus_watch_id = gst_bus_add_watch (bus, bus_call, loop); 
    gst_object_unref (bus); 
    g_print("\n Created bus and a monitor to watch it"); 

    gst_bin_add_many(GST_BIN(pipeline), source, filter, sink, NULL); 
    gst_element_link_many(source, filter, sink); 
    g_print("\n Added and Linked the factory elements"); 

    g_signal_connect (filter, "pad-added", G_CALLBACK (on_pad_added), filter); 

    g_print ("Now reading: %s\n", "test.txt"); 
    g_print ("Setting the pipeline state to PLAYING "); 
    ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); 
    if(ret == GST_STATE_CHANGE_FAILURE) 
    { 
     g_print("\n Failure in setting pipeline state to PLAYING \n"); 
    } 

    else 
    { 
     g_print("\n Successfully set the pipeline state to playing \n"); 
    } 
} 

else 
{ 
    g_print("\n Failure in creating factory elements"); 
} 

回答

1

与GStreamer的元素几个例子尝试后,发现了这个问题。

除了filesrc,过滤器,fakesink ::如果我加上“解码器”元素也给管道,然后我能状态更改打

但是为什么,需要 - 我仍然在努力搞清楚了

有时,用于创建管道的名称也会导致问题:在gst_pipeline_new(“pipeline”)中最好使用一些唯一的名称而不是管道。