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;
}
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));