1

我需要流式传输 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));
4

1 回答 1

0

您指向错误的 IP 地址。该 IP 是一个普通的网络服务器,而不是流媒体广播。尝试在音乐播放器中播放广播电台.m3u,看看它实际播放的是哪个地址。

相反,尝试运行gst-launch souphttpsrc location=http://76.73.52.173/ ! decodebin ! autoaudiosink. 您可以gst_parse_launch()在程序中使用这些相同的字符串,并且您的程序会更短。

于 2010-07-16T21:29:55.403 回答