tests: fix wavenc test on big endian

wavenc only accepts little-endian PCM, but most of our
elements such as audiotestsrc only produce or process
audio in native endianness, so we need to plug a
converter before wavenc on big endian systems.
This commit is contained in:
Tim-Philipp Müller 2012-01-11 01:45:34 +00:00
parent 747e63f4e7
commit 834e58be9e

View file

@ -54,7 +54,7 @@ bus_handler (GstBus * bus, GstMessage * message, gpointer data)
/* /*
* gst-launch \ * gst-launch \
* audiotestsrc freq=440 num-buffers=100 ! interleave name=i ! wavenc ! filesink location=/tmp/mc.wav \ * audiotestsrc freq=440 num-buffers=100 ! interleave name=i ! audioconvert ! wavenc ! filesink location=/tmp/mc.wav \
* audiotestsrc freq=880 num-buffers=100 ! i. * audiotestsrc freq=880 num-buffers=100 ! i.
* ... * ...
* *
@ -65,7 +65,7 @@ static void
make_n_channel_wav (const gint channels, const GValueArray * arr) make_n_channel_wav (const gint channels, const GValueArray * arr)
{ {
GstElement *pipeline; GstElement *pipeline;
GstElement **audiotestsrc, *interleave, *wavenc, *fakesink; GstElement **audiotestsrc, *interleave, *wavenc, *conv, *fakesink;
GstBus *bus; GstBus *bus;
GMainLoop *loop; GMainLoop *loop;
guint i; guint i;
@ -81,10 +81,21 @@ make_n_channel_wav (const gint channels, const GValueArray * arr)
g_object_set (interleave, "channel-positions", arr, NULL); g_object_set (interleave, "channel-positions", arr, NULL);
gst_bin_add (GST_BIN (pipeline), interleave); gst_bin_add (GST_BIN (pipeline), interleave);
if (G_BYTE_ORDER == G_BIG_ENDIAN) {
/* we're not here to test orc; audioconvert misbehaves on ppc32 */
g_setenv ("ORC_CODE", "backup", 1);
conv = gst_element_factory_make ("audioconvert", NULL);
} else {
conv = gst_element_factory_make ("identity", NULL);
}
fail_unless (conv != NULL);
gst_bin_add (GST_BIN (pipeline), conv);
fail_unless (gst_element_link (interleave, conv));
wavenc = gst_element_factory_make ("wavenc", NULL); wavenc = gst_element_factory_make ("wavenc", NULL);
fail_unless (wavenc != NULL); fail_unless (wavenc != NULL);
gst_bin_add (GST_BIN (pipeline), wavenc); gst_bin_add (GST_BIN (pipeline), wavenc);
fail_unless (gst_element_link (interleave, wavenc)); fail_unless (gst_element_link (conv, wavenc));
fakesink = gst_element_factory_make ("fakesink", NULL); fakesink = gst_element_factory_make ("fakesink", NULL);
fail_unless (fakesink != NULL); fail_unless (fakesink != NULL);