tags:

views:

30

answers:

1

Hi

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));
A: 

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 use gst_parse_launch() to use these same strings in your program, and your program will be much shorter.

joeforker
Thanks. but using phonon i am unable to play .m3u / PLS files. Can u plz suggest how to play a playlist
ruby
@ruby I used winamp ; you might be able to use totem, vlc, or any other normal audio player. How do you normally listen to this radio station when you are not writing an application? .m3u is a very simple format. In your application, you just need to parse the station's playlist and attempt to open the next URL in the .m3u when you get an error or and end-of-stream.
joeforker