rendered paste bodystatic gboolean bus_call (GstBus *bus, GstMessage *msg, gpointer data) { GMainLoop *loop = (GMainLoop *) data; switch (GST_MESSAGE_TYPE (msg)) { case GST_MESSAGE_EOS: g_print ("End-of-stream\n"); g_main_loop_quit (loop); break; case GST_MESSAGE_ERROR: { gchar *debug; GError *err; gst_message_parse_error (msg, &err, &debug); g_free (debug); g_print ("Error: %s\n", err->message); g_error_free (err); g_main_loop_quit (loop); break; } default: break; } return TRUE;}int main(int argc, char **argv) { gst_init(&argc, &argv); GMainLoop *loop = g_main_loop_new(NULL, FALSE); // audioconvert capabilities GstCaps *caps_audio = gst_caps_new_simple("audio/x-raw-int", "rate", G_TYPE_INT, 44100, "channels", G_TYPE_INT, 2); // pipeline and elements GstElement *pipeline = gst_pipeline_new("mms to wav pipeline"); GstElement *mms_source = gst_element_factory_make("mmssrc", "mms-source"); GstElement *decodebin = gst_element_factory_make("decodebin", "generic decoder"); GstElement *audioconvert = gst_element_factory_make("audioconvert", "audio converter"); GstElement *audioresample = gst_element_factory_make("audioresample", "audio resampler"); GstElement *waveencoder = gst_element_factory_make("wavenc", "wav encoder"); GstElement *wav_sink = gst_element_factory_make("filesink", "wav-sink"); g_object_set(G_OBJECT(mms_source), "location", "mms://wm.npr.org/wm.npr.na-central/npr/fa/2006/01/20060113_fa_01.wma", NULL); g_object_set(G_OBJECT(wav_sink), "location", "foo.wav", NULL); GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline)); gst_bus_add_watch (bus, bus_call, loop); gst_object_unref (bus); gst_bin_add_many(GST_BIN(pipeline), mms_source, decodebin, audioconvert, audioresample, waveencoder, wav_sink, NULL); gst_element_link(mms_source, decodebin); gst_element_link(decodebin, audioconvert); gst_element_link(audioconvert, audioresample); gst_element_link_filtered(audioresample, waveencoder, caps_audio); gst_element_link(waveencoder, wav_sink); g_print ("Setting to PLAYING\n"); gst_element_set_state (pipeline, GST_STATE_PLAYING); g_print ("Running\n"); g_main_loop_run (loop); // now get rid of these files gst_object_unref(GST_OBJECT(pipeline)); return 1;}