我在为远程 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_sink(17065): 0:00:00.401251335 0x6f43f520 openslessink.c:152:_opensles_query_capabilities: engine.GetInterface(IODeviceCapabilities) 失败(0x0000000c)
以前有人有过这方面的经验吗?我能想到的唯一解决方案是每次我想更改源位置时都重建管道,但这似乎有点矫枉过正。