All pastes #20743 Raw Edit

kikidonk

public text v1 · immutable
#20743 ·published 2005-08-22 15:34 UTC
rendered paste body
#include <gst/gst.h>

int main (int argc, char **argv)
{
	GstElement *playbin;
	GstElement *gconf;
	GstElement *bin;
	GstElement *tee;
	GstElement *nowplaying;
	
	gst_init (&argc, &argv);
	
	playbin = gst_element_factory_make ("playbin", "playbin");
	g_object_set (G_OBJECT (playbin), "uri", "file:///home/kikidonk/lone-music/iced.mp3", NULL);

	bin = gst_bin_new ("bin");
	gconf = gst_element_factory_make ("alsasink", "alsasink");
	tee = gst_element_factory_make ("tee", "tee");
	nowplaying = gst_element_factory_make ("nowplaying", "nowplaying");
	
	gst_bin_add (GST_BIN (bin), nowplaying);
	gst_bin_add (GST_BIN (bin), gconf);
	gst_bin_add (GST_BIN (bin), tee);
	
	gst_element_link (nowplaying, tee);
	gst_element_link (tee, gconf);
	
	gst_element_add_ghost_pad (bin, gst_element_get_pad (nowplaying, "sink"), "sink");
	
	
	g_object_set (G_OBJECT (playbin), "audio-sink", bin, NULL);
	gst_element_set_state (playbin, GST_STATE_PLAYING);
	
	/* Go ! */
	gst_main ();
	
	gst_element_set_state (playbin, GST_STATE_NULL);
	gst_object_unref (GST_OBJECT (playbin));
	
	return 0;
}