[gst-devel] why is it not working ?

Thomas Vander Stichele thomas at apestaart.org
Fri Oct 10 00:40:02 CEST 2003


I checked it, a few comments:

a) you hardcode a path to a file I don't have :)
b) you never actually set the location in create_audio_channel on the
filesrc object
c) you don't check any return values of the functions - when I press f,
I get a bunch of asserts and segfaults.
d) your code is really hard to read - please stick to one
parenthesis/... coding style.

Start with b, I have a hunch that's the biggest problem here :)

Thomas

On Wed, 2003-10-08 at 11:36, Laurent Belmonte wrote:
> The code in attachement, command line for compile :
> 
> gcc test.c gst-audio.c `pkg-config gstreamer-0.6 gtk+-2.0 --libs
> --cflags`
> 
> hit 'f' key to start the sample play ( the problem, that is not working
> ..)
> 
> 
> On Tue, 2003-10-07 at 10:54, Thomas Vander Stichele wrote:
> > two things:
> > 
> > a) your code is very hard to read - please choose a coding style wrt.
> > spacing and braces and parentheses, and stick with it.  Alternatively,
> > use indent on it before posting your code.
> > 
> > b) I'm missing some essential code in your example; key_pressed is never
> > used, there are ellipses where I would like to see code, channel struct
> > isn't defined, ...
> > 
> > It would be a lot easier to try and debug a compiling example :)
> > 
> > Thomas
> > 
> > On Tue, 2003-10-07 at 10:37, Laurent Belmonte wrote:
> > > Hi,
> > > 
> > > I am writing some code that use gstreamer, but i cant stand why it is
> > > not working :
> > > 
> > > 
> > > static void idle(gpointer user_data) {
> > > 	gst_bin_iterate( main_bin);
> > > }
> > > 
> > > static void key_pressed(..) {
> > > 	channel = create_channel(id,"/my_song.mp3");
> > > 
> > >   gst_element_set_state( main_bin, GST_STATE_PAUSED);
> > >   gst_bin_add( main_bin, channel->pipe);
> > > 
> > >   pad = gst_element_get_request_pad( adder,"sink%d");
> > >   sprintf(buffer,"channel%d",channel->id);
> > > 
> > >   gst_pad_link (gst_element_get_pad (channel->pipe, buffer), pad);
> > > 
> > >   gst_element_set_state(main_bin,GST_STATE_PLAYING);
> > > }
> > > 
> > > static channel * create_channel(int id,const gchar * location ) {
> > > 	  sprintf(buffer,"pipeline%d",channel->id);
> > >   channel->pipe = gst_bin_new(buffer);
> > > 
> > >  sprintf(buffer,"filesrc%d",channel->id);
> > >   channel->filesrc = gst_element_factory_make("filesrc",buffer);
> > > 
> > >   gst_bin_add( GST_BIN(channel->pipe), channel->filesrc);
> > > 
> > >   decoder = gst_element_factory_make("mad","mpg123");
> > > 
> > >   gst_bin_add( GST_BIN(channel->pipe), decoder);
> > > 
> > >   gst_element_link(channel->filesrc,decoder);
> > > 
> > >   sprintf(buffer,"channel%d",channel->id);
> > >   gst_element_add_ghost_pad( channel->pipe,
> > > gst_element_get_pad(decoder,"src"),buffer);
> > >   return channel;
> > > }
> > > 
> > > main() {
> > > 	adder = gst_element_factory_make("adder","mixer");
> > >    output = gst_element_factory_make("osssink","output");
> > > 
> > >     main_bin = gst_pipeline_new("bin");
> > > 
> > >     gst_bin_add( GST_BIN( main_bin),adder);
> > >     gst_bin_add( GST_BIN( main_bin),output);
> > > 
> > >     gst_pad_link(gst_element_get_pad(adder,"src"),
> > > 		 gst_element_get_pad(output,"sink"));
> > > 
> > >     gst_element_set_state( main_bin, GST_STATE_PLAYING);
> > >     gtk_idle_add(idle,NULL);
> > > 
> > > 	..
> > > 	gtk_main();
> > > return 0;
> > > }
> > > 
> > > help me please !
> > > 
> > > Regards,
> > > Laurent Belmonte
> > > http://monkey-bubble.tuxfamily.org
> > > 
> > > 
> > > 
> > > -------------------------------------------------------
> > > This sf.net email is sponsored by:ThinkGeek
> > > Welcome to geek heaven.
> > > http://thinkgeek.com/sf
> > > _______________________________________________
> > > gstreamer-devel mailing list
> > > gstreamer-devel at lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
> > 
> > Dave/Dina : future TV today ! - http://davedina.apestaart.org/
> > <-*- thomas (dot) apestaart (dot) org -*->
> > "Two million women and only one Flasheart..."
> > <-*- thomas (at) apestaart (dot) org -*->
> > URGent, best radio on the net - 24/7 ! - http://urgent.rug.ac.be/
> > 
> > 

Dave/Dina : future TV today ! - http://davedina.apestaart.org/
<-*- thomas (dot) apestaart (dot) org -*->
When you can't trust yourself
trust someone else
<-*- thomas (at) apestaart (dot) org -*->
URGent, best radio on the net - 24/7 ! - http://urgent.rug.ac.be/






More information about the gstreamer-devel mailing list