无法使用 gst_element_make_from_uri 播放 uri
我需要传输 RTSP / HTTP 流,当我使用 source = gst_element_make_from_uri();
创建元素源时,它不起作用。有人使用 gstreamer 来传输 RTSP / HTTP 流吗?
source = gst_element_make_from_uri (GST_URI_SRC,"http://76.73.90.27:80/" ,NULL);
decoder = gst_element_factory_make ("mad", "mad-decoder");
sink = gst_element_factory_make ("alsasink", "audio-output");
g_object_set (G_OBJECT (source), "location", argv[1], NULL);
gst_element_set_state (pipeline, GST_STATE_NULL);
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
gst_bus_add_watch (bus, bus_call, loop);
gst_object_unref (bus);
gst_bin_add_many (GST_BIN (pipeline),
source, decoder,sink, NULL);
gst_element_link_many (source, decoder, sink, NULL);
gst_element_set_state (pipeline, GST_STATE_PLAYING);
g_main_loop_run (loop);
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (GST_OBJECT (pipeline));
I need to stream RTSP / HTTP stream and when I create an element source using source = gst_element_make_from_uri();
it doesn't work. Has anybody used gstreamer for streaming RTSP / HTTP streams?
source = gst_element_make_from_uri (GST_URI_SRC,"http://76.73.90.27:80/" ,NULL);
decoder = gst_element_factory_make ("mad", "mad-decoder");
sink = gst_element_factory_make ("alsasink", "audio-output");
g_object_set (G_OBJECT (source), "location", argv[1], NULL);
gst_element_set_state (pipeline, GST_STATE_NULL);
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
gst_bus_add_watch (bus, bus_call, loop);
gst_object_unref (bus);
gst_bin_add_many (GST_BIN (pipeline),
source, decoder,sink, NULL);
gst_element_link_many (source, decoder, sink, NULL);
gst_element_set_state (pipeline, GST_STATE_PLAYING);
g_main_loop_run (loop);
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (GST_OBJECT (pipeline));
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您指向了错误的 IP 地址。该 IP 是普通的网络服务器,而不是流媒体广播。尝试在音乐播放器中播放广播电台的
.m3u
并查看它实际播放的地址。相反,尝试运行
gst-launch souphttpsrc location=http://76.73.52.173/ !解码器!自动音频接收器。您可以使用
gst_parse_launch()
在程序中使用这些相同的字符串,并且您的程序会短得多。You are pointing at the wrong IP address. That IP is a normal web server, not streaming radio. Try playing the radio station's
.m3u
in a music player and see which address it actually plays.Instead, try running
gst-launch souphttpsrc location=http://76.73.52.173/ ! decodebin ! autoaudiosink
. You can usegst_parse_launch()
to use these same strings in your program, and your program will be much shorter.