【问题标题】:GStreamer - Sample PluginGStreamer - 示例插件
【发布时间】:2013-03-27 15:19:07
【问题描述】:

我是 gstreamer 的新手,正在尝试开发用于字幕解码的示例插件。

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

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

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

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

提前致谢, 克兰蒂


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");
}

【问题讨论】:

    标签: plugins gstreamer


    【解决方案1】:

    在尝试了几个关于 gstreamer 元素的示例后,发现了问题。

    除了 filesrc、filter、fakesink:: 如果我将 'decoder' 元素也添加到管道中,那么我可以将状态更改为 PLAYING

    但为什么需要这样做 - 我仍在努力解决

    而且有时,用于创建管道的名称也会引起问题:最好在 gst_pipeline_new ("pipeline") 中使用一些唯一的名称而不是管道;

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-08-10
      • 2023-03-14
      • 1970-01-01
      • 2017-12-16
      • 1970-01-01
      • 1970-01-01
      • 2017-02-27
      相关资源
      最近更新 更多