diff --git a/ChangeLog b/ChangeLog index 256b267dbc..bc5369f210 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-01-31 Jan Schmidt + + * gst/playback/gstplaybin.c: (gen_vis_element): + Add audioresample+audioconvert in front of the visualisation + element, so that elements like libvisual 0.4 that don't support all + samplerates can work. + + Fixes: #402505 + 2007-01-30 Tim-Philipp Müller * gst/playback/gstplaybasebin.c: (gst_play_base_bin_get_property), diff --git a/gst/playback/gstplaybin.c b/gst/playback/gstplaybin.c index 003937c13d..78b1b136b1 100644 --- a/gst/playback/gstplaybin.c +++ b/gst/playback/gstplaybin.c @@ -1129,21 +1129,21 @@ link_failed: * normal video bin. The video bin is run in a thread to make sure it does * not block the audio playback pipeline. * - * +--------------------------------------------------------------------+ - * | visbin | - * | +------+ +--------+ +----------------+ | - * | | tee | | aqueue | | abin ... | | - * | +-sink src-sink src-sink | | - * | | | | +--------+ +----------------+ | - * | | | | | - * | | | | +------+ +---------+ +------+ +-----------+ | - * | | | | |vqueue| |audioconv| | vis | | vbin ... | | - * | | | src-sink src-sink src-sink src-sink | | - * | | | | +------+ +---------+ +------+ +-----------+ | - * | | | | | - * | | +------+ | - * sink-+ | - +---------------------------------------------------------------------+ + * +-----------------------------------------------------------------------+ + * | visbin | + * | +------+ +--------+ +----------------+ | + * | | tee | | aqueue | | abin ... | | + * | +-sink src-sink src-sink | | + * | | | | +--------+ +----------------+ | + * | | | | | + * | | | | +------+ +------------+ +------+ +-----------+ | + * | | | | |vqueue| | audioconv | | vis | | vbin ... | | + * | | | src-sink src-sink + samp src-sink src-sink | | + * | | | | +------+ +------------+ +------+ +-----------+ | + * | | | | | + * | | +------+ | + * sink-+ | + +------------------------------------------------------------------------+ */ static GstElement * gen_vis_element (GstPlayBin * play_bin) @@ -1154,6 +1154,8 @@ gen_vis_element (GstPlayBin * play_bin) GstElement *asink; GstElement *vsink; GstElement *conv; + GstElement *resamp; + GstElement *conv2; GstElement *vis; GstElement *vqueue, *aqueue; GstPad *pad, *rpad; @@ -1185,6 +1187,16 @@ gen_vis_element (GstPlayBin * play_bin) goto no_audioconvert; gst_bin_add (GST_BIN_CAST (element), conv); + resamp = gst_element_factory_make ("audioresample", "aresamp"); + if (resamp == NULL) + goto no_audioresample; + gst_bin_add (GST_BIN_CAST (element), resamp); + + conv2 = gst_element_factory_make ("audioconvert", "aconv2"); + if (conv2 == NULL) + goto no_audioconvert; + gst_bin_add (GST_BIN_CAST (element), conv2); + if (play_bin->visualisation) { gst_object_ref (play_bin->visualisation); vis = play_bin->visualisation; @@ -1196,7 +1208,9 @@ gen_vis_element (GstPlayBin * play_bin) gst_bin_add (GST_BIN_CAST (element), vis); res = gst_element_link_pads (vqueue, "src", conv, "sink"); - res &= gst_element_link_pads (conv, "src", vis, "sink"); + res &= gst_element_link_pads (conv, "src", resamp, "sink"); + res &= gst_element_link_pads (resamp, "src", conv2, "sink"); + res &= gst_element_link_pads (conv2, "src", vis, "sink"); res &= gst_element_link_pads (vis, "src", vsink, "sink"); if (!res) goto link_failed; @@ -1230,6 +1244,15 @@ no_audioconvert: gst_object_unref (element); return NULL; } +no_audioresample: + { + post_missing_element_message (play_bin, "audioresample"); + GST_ELEMENT_ERROR (play_bin, CORE, MISSING_PLUGIN, + (_("Missing element '%s' - check your GStreamer installation."), + "audioresample"), (NULL)); + gst_object_unref (element); + return NULL; + } no_goom: { post_missing_element_message (play_bin, "goom");