【发布时间】:2015-01-20 07:39:58
【问题描述】:
我正在为 Sailfish OS 开发音频播放器,并尝试通过 gstreamer 播放文件,但问题:没有声音。
我通过控制台检查了 gstream:
gst-launch-0.10 filesrc location=/path/to/file.ogg !解码器! 自动音频接收器
而且运行良好!
我测试了将音频文件转换为音频文件:
int
main (int argc,
char *argv[])
{
GstElement *pipeline;
GstBus *bus;
GstMessage *msg;
gst_init (&argc, &argv);
pipeline = gst_parse_launch ("filesrc location=/home/nemo/Music/Ringtones/Myfile.mp3 ! decodebin ! audioconvert ! vorbisenc ! oggmux ! filesink location=test.ogg", NULL);
gst_element_set_state (pipeline, GST_STATE_PLAYING);
bus = gst_element_get_bus (pipeline);
msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE, (GstMessageType)(GST_MESSAGE_ERROR | GST_MESSAGE_EOS));
if (msg != NULL)
gst_message_unref (msg);
gst_object_unref (bus);
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (pipeline);
return 0;
}
而且运行良好!
但是,当我尝试播放时,没有声音:
pipeline = gst_parse_launch ("filesrc location=/home/nemo/Music/Ringtones/Myfile.mp3 ! decodebin ! audioconvert ! autoaudiosink", NULL);
Gstreamer 版本:0.10
【问题讨论】:
标签: c++ linux audio gstreamer sailfish-os