我在为远程mp3播放创建管道时遇到了一些问题。如果我像这样建造管道:
data->pipeline = gst_parse_launch("souphttpsrc location=https://xxxx ! mad ! autoaudiosink", &error);弹得很好。然而,我必须有一个动态的位置,所以我必须保持一个参考源垫。这就是我所拥有的
data->source = gst_element_factory_make("souphttpsrc", "source");
decoder = gst_element_factory_make ("mad","decoder");
sink = gst_element_factory_make ("autoaudiosink", "sink");
data->pipeline = gst_pipeline_new ("mp3-player");
if (!data->pipeline || !data->source || !decoder || !sink) {
g_printerr ("Not all elements could be created.\n");
return NULL;
}
gst_bin_add_many (GST_BIN (data->pipeline), data->source, decoder, sink, NULL);
if (!gst_element_link_many (data->source, decoder, sink, NULL)) {
gchar *message = g_strdup_printf("Unable to build pipeline: %s", error->message);
g_clear_error (&error);
set_ui_message(message, data);
g_free (message);
return NULL;
}然后我通过
g_object_set(data->source, "location", char_uri, NULL);然而,什么都没有发挥。我还看到了以下输出:
错误/GStreamer+opensles_接收器(17065):0:00:00.401251335 0x6f43f520 openslessink.c:152:_opensles_query_capabilities: engine.GetInterface(IODeviceCapabilities)失败(0x0000000c)
有人有过这方面的经验吗?我唯一能想到的解决方案是每次我想要更改源位置时重新构建管道,但这似乎有点过火了。
发布于 2013-11-03 17:46:01
gst_element_set_state (数据->管道,GST_STATE_PLAYING);如果以后想要更改uri,请在总线上等待EOS,gst_element_set_state (数据->管道,GST_STATE_READY);设置新uri并再次播放。
https://stackoverflow.com/questions/19742508
复制相似问题