[maemo-developers] problem with playing wav file
From: Stefan Kost ensonic at hora-obscura.deDate: Sun Aug 17 21:04:58 EEST 2008
- Previous message: Host AP driver for Wifi Wlan ?
- Next message: Q: Maemo Extras Builder dependency failure
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Ganesh Kundapur schrieb:
> Hi,
> I'm able to play the wav file by using gst-launch as fallows
>
> gst-launch-0.10 filesrc location=~/songs/4voice.wav ! wavparse !
> audioconvert ! alsasink
> Setting pipeline to PAUSED ...
> Pipeline is PREROLLING ...
> Pipeline is PREROLLED ...
> Setting pipeline to PLAYING ...
> New clock: GstAudioSinkClock
> Caught interrupt -- handling interrupt.
> Interrupt: Setting pipeline to PAUSED ...
> Execution ended after 1914601000 ns.
> Setting pipeline to PAUSED ...
> Setting pipeline to READY ...
> Setting pipeline to NULL ...
> FREEING pipeline ...
>
>
> I modified the helloworld code to play the wav as
> 1. I created "waveparse" in place of oggdemux and vorbis parser elements
> 2. Added filesrc, waveparse and alsasink to the pipeline and linked.
>
> --
> int
> main ( int argc, char *argv[] )
> {
> GMainLoop *loop;
> GstBus *bus;
>
> gst_init ( &argc, &argv );
> loop = g_main_loop_new ( NULL, FALSE );
>
> pipeline = gst_pipeline_new ( "audio-player" );
> source = gst_element_factory_make ( "filesrc", "file-source" );
> //parser = gst_element_factory_make ( "oggdemux", "ogg-parser" );
> parser = gst_element_factory_make ( "wavparse", "wave-parser" );
> //decoder = gst_element_factory_make ( "vorbisdec",
> "vorbis-decoder" );
> conv = gst_element_factory_make ( "audioconvert", "converter" );
> sink = gst_element_factory_make ( "alsasink", "alsa-output" );
>
> if ( !pipeline || !source || !parser || !conv || !sink ) {
> g_print ( "One element could not be created\n" );
> return -1;
> }
>
> g_object_set (G_OBJECT (source), "location", argv[1], 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, parser,
> conv, sink, NULL );
>
> //gst_element_link ( source, parser );
> gst_element_link_many ( source, parser, conv, sink, NULL );
> g_signal_connect ( parser, "pad-added", G_CALLBACK ( new_pad ),
> NULL );
This is the problem:
gst_element_link ( source, parser );
gst_element_link ( conv, sink );
g_signal_connect ( parser, "pad-added", G_CALLBACK ( new_pad ), conv );
in new_pad() callback link the new pad you receive to the sink-pad of conv.
Stefan
>
> g_print ( "Setting to Playing\n" );
> gst_element_set_state ( pipeline, GST_STATE_PLAYING );
> g_print ( "Running\n" );
> g_main_loop_run ( loop );
>
> g_print ( "Returned, stopping playback\n" );
> gst_element_set_state ( pipeline, GST_STATE_NULL );
> g_print ( "Deleting pipeline\n" );
>
> gst_object_unref ( GST_OBJECT ( pipeline ) );
>
> return 0;
> }
> --
>
>
> When i tried to run the fallowing code, i'm getting fallowing errors
> --
> ./a.out ~/songs/4voice.wav
> Setting to Playing
> Running
> Dynamic pad created, linking parser/decoder
>
> (a.out:20136): GStreamer-CRITICAL **: gst_element_get_static_pad:
> assertion `GST_IS_ELEMENT (element)' failed
>
> (a.out:20136): GStreamer-CRITICAL **: gst_pad_link_prepare: assertion
> `GST_IS_PAD (sinkpad)' failed
>
> (a.out:20136): GStreamer-CRITICAL **: gst_object_unref: assertion
> `object != NULL' failed
> Error: Internal data flow error.
> Returned, stopping playback
> Deleting pipeline
> --
>
> Somebody already posted the similar problem in the mailing list (
> http://lists.maemo.org/pipermail/maemo-developers/2006-August/023007.html
> ), but solution is not mentioned over there.
>
> It would be of great help if somebody look into this.
>
> Thanks,
> Ganesh
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> maemo-developers mailing list
> maemo-developers at maemo.org
> https://lists.maemo.org/mailman/listinfo/maemo-developers
- Previous message: Host AP driver for Wifi Wlan ?
- Next message: Q: Maemo Extras Builder dependency failure
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
