[gst-devel] Is there any way to play audio files asynchonously

Ganesh Kundapur ganesh.kundapur at gmail.com
Fri Jul 4 07:48:45 CEST 2008


Hi,
  I'm playing mp3 file and the code snippet for that is as fallows

...
loop = g_main_loop_new ( NULL, FALSE );

pipeline = gst_pipeline_new ( "mp3-player" );
source = gst_element_factory_make ( "filesrc", "file-source" );
decoder = gst_element_factory_make ( "mad", "mp3-decoder" );
conv = gst_element_factory_make ( "audioconvert", "converter" );
sink = gst_element_factory_make ( "alsasink", "sink" );

g_object_set ( G_OBJECT(source), "location", "x.mp3", NULL );

gst_bin_add_many ( GST_BIN(pipeline), souce, decoder, conv, sink, NULL );
gst_element_link_many ( souce, decoder, conv, sink, NULL );

gst_element_set_state ( pipeline, GST_STATE_PLAYING );
g_main_loop_run ( loop );

Here after, it starts playing. Once its playing, control is not coming out
till the stream ended.
If i want to pause after certain time interval say 10 sec, i cant do it
while playing the stream. Even i set alarm signal and signal handler, but
alarm signal is not delivered while playing the stream.

Is there any way to play the audio files asynchronously?


/Ganesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20080704/6836c60d/attachment.htm>


More information about the gstreamer-devel mailing list