From: Christian Pointner Date: Mon, 11 Jul 2011 16:59:29 +0000 (+0000) Subject: dart-sounds now makes stereo out of mono sounds X-Git-Url: https://git.realraum.at/?a=commitdiff_plain;h=1e468cadc32cce96f3ce3349b9fa9547465f5738;p=svn42.git dart-sounds now makes stereo out of mono sounds --- diff --git a/dart-sounds/src/dart-sounds.c b/dart-sounds/src/dart-sounds.c index 254dc10..0d2fd9c 100644 --- a/dart-sounds/src/dart-sounds.c +++ b/dart-sounds/src/dart-sounds.c @@ -152,9 +152,10 @@ GstElement* init_pipeline(GMainLoop *loop, const char* media_d, GAsyncQueue* que GstElement *demuxer = gst_element_factory_make("oggdemux", "demuxer"); GstElement *decoder = gst_element_factory_make("vorbisdec", "decoder"); GstElement *conv = gst_element_factory_make("audioconvert", "converter"); + GstElement *filter = gst_element_factory_make("capsfilter", "filter"); GstElement *sink = gst_element_factory_make("autoaudiosink", "sink"); - if (!pipeline || !source || !demuxer || !decoder || !conv || !sink) { + if (!pipeline || !source || !demuxer || !decoder || !conv || !filter || !sink) { g_printerr("One element could not be created. Exiting.\n"); return NULL; } @@ -172,9 +173,13 @@ GstElement* init_pipeline(GMainLoop *loop, const char* media_d, GAsyncQueue* que gst_bus_add_watch(bus, bus_call, datab); gst_object_unref(bus); - gst_bin_add_many(GST_BIN(pipeline), source, demuxer, decoder, conv, sink, NULL); + + GstCaps* caps = gst_caps_new_simple("audio/x-raw-int", "channels", G_TYPE_INT, 2, NULL); + g_object_set(G_OBJECT(filter), "caps", caps, NULL); + + gst_bin_add_many(GST_BIN(pipeline), source, demuxer, decoder, conv, filter, sink, NULL); gst_element_link(source, demuxer); - gst_element_link_many(decoder, conv, sink, NULL); + gst_element_link_many(decoder, conv, filter, sink, NULL); g_signal_connect(demuxer, "pad-added", G_CALLBACK(on_pad_added), decoder); struct play_file_param* datap = malloc(sizeof(struct play_file_param));