[gst-devel] why is it not working ?

Thomas Vander Stichele thomas at apestaart.org
Tue Oct 7 01:55:02 CEST 2003


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/






More information about the gstreamer-devel mailing list