1

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.

Please help.. I am attaching the code snippet also

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 は、ストリーミング ラジオではなく、通常の Web サーバーです。音楽プレーヤーでラジオ局を再生してみて、.m3u実際に再生されるアドレスを確認してください。

代わりに、実行してみてくださいgst-launch souphttpsrc location=http://76.73.52.173/ ! decodebin ! autoaudiosink。プログラムでこれらの同じ文字列を使用するために使用できgst_parse_launch()、プログラムははるかに短くなります。

于 2010-07-16T21:29:55.403 に答える