[gst-devel] why is it not working ?
Laurent Belmonte
lolo3d at tuxfamily.org
Tue Oct 7 01:38:09 CEST 2003
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
More information about the gstreamer-devel
mailing list