首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >通过gstreamer在Android上播放mp3,无法创建具有动态位置的管道

通过gstreamer在Android上播放mp3,无法创建具有动态位置的管道
EN

Stack Overflow用户
提问于 2013-11-02 13:43:06
回答 1查看 434关注 0票数 0

我在为远程mp3播放创建管道时遇到了一些问题。如果我像这样建造管道:

代码语言:javascript
复制
data->pipeline = gst_parse_launch("souphttpsrc location=https://xxxx ! mad ! autoaudiosink", &error);

弹得很好。然而,我必须有一个动态的位置,所以我必须保持一个参考源垫。这就是我所拥有的

代码语言:javascript
复制
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;
}

然后我通过

代码语言:javascript
复制
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)

有人有过这方面的经验吗?我唯一能想到的解决方案是每次我想要更改源位置时重新构建管道,但这似乎有点过火了。

EN

回答 1

Stack Overflow用户

发布于 2013-11-03 17:46:01

gst_element_set_state (数据->管道,GST_STATE_PLAYING);如果以后想要更改uri,请在总线上等待EOS,gst_element_set_state (数据->管道,GST_STATE_READY);设置新uri并再次播放。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19742508

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档