[gst-devel] Sound only once

Bernd Muent Bernd.Muent at euroscript.de
Tue Dec 13 09:30:01 CET 2005


Hi,
I created a game which should play a simple sound every time when a 
worms eats a fruit. But it is working only once. After that no error is 
show in the console but neighter no sound :-(
I have to start gstreaemer-properties and click on TEST to reset 
gstreamer. After that the sound is played one time again, but not a second.
What's wrong? Which ressources do I block and must I free?

My code (linked to gstreamer-0.8):

#include <gst/gst.h>

GstElement *bin,*filesrc,*decoder,*osssink;

void playSound(char *fileName) {
         if (bin!=NULL)
             gst_element_set_state(GST_ELEMENT(bin),GST_STATE_NULL);
         bin=gst_pipeline_new("pipeline");

         filesrc=gst_element_factory_make("filesrc",
                                          "disk_source");
         if(!filesrc) return;
         g_object_set(G_OBJECT(filesrc),"location",fileName,NULL);
         decoder=gst_element_factory_make("mad",
                                          "decode");
         if (!decoder) return;
         osssink = gst_element_factory_make("osssink",
                                            "play_audio");
         if (!osssink) return;
         gst_bin_add_many(GST_BIN(bin),filesrc,decoder,osssink,NULL);
         gst_element_link_many(filesrc,decoder,osssink,NULL);
         gst_element_set_state(bin,GST_STATE_PLAYING);
         printf("Playing %s\n",fileName); # For debugging
}

I pass mp3 files to this void.

Thank you for tips, Bernd


-- 
Bernd Münt                   Durchwahl: 030/69032-509
euroscript Deutschland GmbH  Zentrale:  030/69032-300
Abteilung IT-Management      Fax:       030/69032-505
Alt-Moabit 91                Mail:      Bernd.Muent at euroscript.de
10559 Berlin                 Web:       http://www.euroscript.de




More information about the gstreamer-devel mailing list