rendered paste body// gcc -Wall -pedantic -o test test.c `pkg-config --cflags --libs glib-2.0` `pkg-config --cflags --libs gstreamer-0.10` -std=c99
#include <gst/gst.h>
#include <stdio.h>
int main (void) {
GMainLoop * loop;
GstElement *pipeline, *source, *converter, *speex_enc, *speex_dec, *converter_2, *queue, *sink;
// initialize gstreamer, don't parse options
gst_init (NULL, NULL);
loop = g_main_loop_new (NULL, FALSE);
// make the pices
pipeline = gst_pipeline_new ("streamer");
source = gst_element_factory_make ("alsasrc", "input");
converter = gst_element_factory_make ("audioconvert", "converter_1");
speex_enc = gst_element_factory_make ("speexenc", "encoder");
speex_dec = gst_element_factory_make ("speexdec", "decoder");
converter_2 = gst_element_factory_make ("audioconvert", "converter_2");
queue = gst_element_factory_make ("queue", "buffer");
sink = gst_element_factory_make ("alsasink", "output");
// add all into pipeline
gst_bin_add_many (GST_BIN (pipeline), source, converter, speex_enc, speex_dec, converter_2, queue, sink, NULL);
// link source to sink.
gst_element_link_many (source, converter, speex_enc, speex_dec, converter_2, queue, sink, NULL);
//g_object_set (G_OBJECT (queue), "min-threshold-time", 20000, NULL);
// begin!
gst_element_set_state (pipeline, GST_STATE_PLAYING);
//g_main_loop_run (loop);
//
sleep (10);
gst_element_set_state (pipeline, GST_STATE_NULL);
// it should get here when finished (never?)
gst_object_unref (GST_OBJECT (pipeline));
return 0;
}