encodebin: Add a audioconverter after the audio resampler.

This allows handling non-native-endianness conversion properly.
This commit is contained in:
Edward Hervey 2011-02-17 18:11:10 +01:00
parent 2fc70442a7
commit 4c68f3b597

View file

@ -1203,26 +1203,30 @@ _create_stream_group (GstEncodeBin * ebin, GstEncodingProfile * sprof,
last = cspace; last = cspace;
} else if (GST_IS_ENCODING_AUDIO_PROFILE (sprof)) { } else if (GST_IS_ENCODING_AUDIO_PROFILE (sprof)) {
GstElement *aconv, *ares, *arate; GstElement *aconv, *ares, *arate, *aconv2;
GST_LOG ("Adding conversion elements for audio stream"); GST_LOG ("Adding conversion elements for audio stream");
arate = gst_element_factory_make ("audiorate", NULL); arate = gst_element_factory_make ("audiorate", NULL);
g_object_set (arate, "tolerance", (guint64) ebin->tolerance, NULL); g_object_set (arate, "tolerance", (guint64) ebin->tolerance, NULL);
aconv = gst_element_factory_make ("audioconvert", NULL); aconv = gst_element_factory_make ("audioconvert", NULL);
aconv2 = gst_element_factory_make ("audioconvert", NULL);
ares = gst_element_factory_make ("audioresample", NULL); ares = gst_element_factory_make ("audioresample", NULL);
gst_bin_add_many ((GstBin *) ebin, arate, aconv, ares, NULL); gst_bin_add_many ((GstBin *) ebin, arate, aconv, ares, aconv2, NULL);
tosync = g_list_append (tosync, arate); tosync = g_list_append (tosync, arate);
tosync = g_list_append (tosync, aconv); tosync = g_list_append (tosync, aconv);
tosync = g_list_append (tosync, ares); tosync = g_list_append (tosync, ares);
tosync = g_list_append (tosync, aconv2);
if (!fast_element_link (arate, aconv) || if (!fast_element_link (arate, aconv) ||
!fast_element_link (aconv, ares) || !fast_element_link (ares, last)) !fast_element_link (aconv, ares) ||
!fast_element_link (ares, aconv2) || !fast_element_link (aconv2, last))
goto converter_link_failure; goto converter_link_failure;
sgroup->converters = g_list_prepend (sgroup->converters, arate); sgroup->converters = g_list_prepend (sgroup->converters, arate);
sgroup->converters = g_list_prepend (sgroup->converters, aconv); sgroup->converters = g_list_prepend (sgroup->converters, aconv);
sgroup->converters = g_list_prepend (sgroup->converters, ares); sgroup->converters = g_list_prepend (sgroup->converters, ares);
sgroup->converters = g_list_prepend (sgroup->converters, aconv2);
last = arate; last = arate;
} }