gst-plugins-good: tests: fix wavenc test on big endian

Tim Müller tpm at kemper.freedesktop.org
Tue Jan 10 17:47:50 PST 2012


Module: gst-plugins-good
Branch: master
Commit: 834e58be9e75d878ae03aa95fabb7b01a2f11e99
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=834e58be9e75d878ae03aa95fabb7b01a2f11e99

Author: Tim-Philipp Müller <tim.muller at collabora.co.uk>
Date:   Wed Jan 11 01:45:34 2012 +0000

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.

---

 tests/check/pipelines/wavenc.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/tests/check/pipelines/wavenc.c b/tests/check/pipelines/wavenc.c
index ab9f62b..c5344a7 100644
--- a/tests/check/pipelines/wavenc.c
+++ b/tests/check/pipelines/wavenc.c
@@ -54,7 +54,7 @@ bus_handler (GstBus * bus, GstMessage * message, gpointer data)
 
 /*
  * 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.
  * ...
  *
@@ -65,7 +65,7 @@ static void
 make_n_channel_wav (const gint channels, const GValueArray * arr)
 {
   GstElement *pipeline;
-  GstElement **audiotestsrc, *interleave, *wavenc, *fakesink;
+  GstElement **audiotestsrc, *interleave, *wavenc, *conv, *fakesink;
   GstBus *bus;
   GMainLoop *loop;
   guint i;
@@ -81,10 +81,21 @@ make_n_channel_wav (const gint channels, const GValueArray * arr)
   g_object_set (interleave, "channel-positions", arr, NULL);
   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);
   fail_unless (wavenc != NULL);
   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);
   fail_unless (fakesink != NULL);



More information about the gstreamer-commits mailing list