rendered paste body#include <gst/gst.h> /////////////////////////////////////////////////////////////////////////////// // // // ddd bbb ///// // ddd bbb // // // ddd bbb // // // ddd ddd uuu uuu bbb bbb // // // ddd ddddd uuu uuu bbbbb bbb // // // ddd ddd uuu uuu bbb bbb // // // ddd ddddd uuuuuuuu bbbbb bbb // // // ddd ddd uuuuu u bbb bbb // // // // // // Code and ASCII by // // // David Zotlöterer // // // // // // COMPILE WITH // // // °°°°°°°°°°°° // // // gcc -Wall $(pkg-config --cflags --libs gstreamer-0.10) dub.c -o dub // // // // // /////////////////////////////////////////////////////////////////////////////// // // // ///////////////////////////////////////////////////////////////////////////////int //wedontneednostdlibs ;)cmp (char *a, char *b) { int i; for(i=0;a[i]!=0&&b[i]!=0;i++) if(a[i]!=b[i]) return 0; return a[i]==b[i];}//Globals for beeing un-nice ;)GstElement *pipeline, *source, *parser, *sink;static void //had no statics - until NOW!!!cb_new_pad (GstElement *element, GstPad *pad, gpointer data) { GstPad *dspad; //Search the old one dspad = gst_element_get_pad (sink, "sink"); //Link em all - wooohooa gst_pad_link (pad, dspad); //Everybody's freeeeeeeee...... gst_object_unref (dspad);}int //hier ein wort welches nicht fehlen sollte...: M_A_I_Nmain (int argc, char *argv[]) { //Puffer für den Filename char file[255]; //GST-Kontext erzeugen gst_init (&argc, &argv); //Initialisieren der gst-elemente pipeline = gst_pipeline_new ("audio-player" ); source = gst_element_factory_make ("filesrc", NULL); parser = gst_element_factory_make ("wavparse", NULL); sink = gst_element_factory_make ("dsppcmsink", NULL); if(!pipeline || !source || !parser || !sink) { g_print("Failed to create context."); //Fehlerbedingt terminieren return 1; } //die gst-elemente in die gst-chain einhängen gst_bin_add_many (GST_BIN (pipeline), source, parser, sink, NULL); //die elemente miteinander verlinken gst_element_link (source, parser); //watch that wavey-thinggie g_signal_connect (parser, "pad-added", G_CALLBACK (new_pad), NULL); //file = Console.ReadLine(); scanf("%s", file); while(!cmp(file, "quit")) { //Datenquelle festlegen... g_object_set (G_OBJECT (source), "location", file, NULL); //...und ab dafür gst_element_set_state (pipeline, GST_STATE_PLAYING); //file = Console.ReadLine(); scanf("%s", file); //ein trip bis zum STATE_NULL gibt angeblich alle ressourcen frei gst_element_set_state (pipeline, GST_STATE_NULL); } //Freundlicherweise geben wir auch ein bisschen memfree gst_object_unref (GST_OBJECT (pipeline)); //und wenn sie nicht gestorben sind... return 0;}