使用gst管道播放多个音频文件

时间:2013-02-01 11:30:23

标签: c++ gstreamer

我正在使用gst库来播放多个音频文件,我遇到了一个问题:

  

错误:内部数据流错误

这是我的代码(没有其他demuxer和sink init):

GstElement *elm1, *elm2;

elm1  = gst_element_factory_make ("filesrc", "file1.ogg");
elm2  = gst_element_factory_make ("filesrc", "file2.ogg");

g_object_set (G_OBJECT (elm1), "location", "file1.ogg", NULL);
g_object_set (G_OBJECT (elm2), "location", "file2.ogg", NULL);

GstBus *bus;

bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
bus_watch_id = gst_bus_add_watch (bus, bus_call, loop);
gst_object_unref (bus);

gst_bin_add_many (GST_BIN (pipeline), elm1, elm2, demuxer, sink, NULL);

gst_element_link_many (elm1, elm2, demuxer);

g_signal_connect (demuxer, "pad-added", G_CALLBACK (on_pad_added), sink);
gst_element_set_state (pipeline, GST_STATE_PLAYING);

我做错了吗?

1 个答案:

答案 0 :(得分:1)

您需要侦听文件1的EOS,然后将filesrc更改为file-2。

以下答案可以帮助您 -

'GStreamer dynamically change the filesrc location of a pipeline- No sound'

相关问题