Merge remote-tracking branch 'origin/master' into 0.11
[platform/upstream/gstreamer.git] / tests / check / elements / audioconvert.c
index b5e292d..3e34ed0 100644 (file)
@@ -23,7 +23,6 @@
 
 #include <unistd.h>
 
-#include <gst/floatcast/floatcast.h>
 #include <gst/check/gstcheck.h>
 #include <gst/audio/multichannel.h>
 
  * get_peer, and then remove references in every test function */
 static GstPad *mysrcpad, *mysinkpad;
 
+#define FORMATS "{ F32LE, F32BE, F64LE, F64BE, " \
+                  "S32LE, S32BE, U32LE, U32BE, " \
+                  "S24LE, S24BE, U24LE, U24BE, " \
+                  "S16LE, S16BE, U16LE, U16BE, " \
+                  "S8, U8 } "
+
 #define CONVERT_CAPS_TEMPLATE_STRING    \
-  "audio/x-raw-float, " \
-    "rate = (int) [ 1, MAX ], " \
-    "channels = (int) [ 1, MAX ], " \
-    "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
-    "width = (int) { 32, 64 };" \
-  "audio/x-raw-int, " \
-    "rate = (int) [ 1, MAX ], " \
-    "channels = (int) [ 1, MAX ], " \
-    "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
-    "width = (int) 32, " \
-    "depth = (int) [ 1, 32 ], " \
-    "signed = (boolean) { true, false }; " \
-  "audio/x-raw-int, " \
+  "audio/x-raw, " \
+    "format = (string) "FORMATS", " \
     "rate = (int) [ 1, MAX ], " \
-    "channels = (int) [ 1, MAX ], " \
-    "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
-    "width = (int) 24, " \
-    "depth = (int) [ 1, 24 ], " \
-    "signed = (boolean) { true, false }; " \
-  "audio/x-raw-int, " \
-    "rate = (int) [ 1, MAX ], " \
-    "channels = (int) [ 1, MAX ], " \
-    "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
-    "width = (int) 16, " \
-    "depth = (int) [ 1, 16 ], " \
-    "signed = (boolean) { true, false }; " \
-  "audio/x-raw-int, " \
-    "rate = (int) [ 1, MAX ], " \
-    "channels = (int) [ 1, MAX ], " \
-    "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
-    "width = (int) 8, " \
-    "depth = (int) [ 1, 8 ], " \
-    "signed = (boolean) { true, false } "
+    "channels = (int) [ 1, MAX ]"
 
 static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
     GST_PAD_SINK,
@@ -88,20 +64,21 @@ setup_audioconvert (GstCaps * outcaps)
   audioconvert = gst_check_setup_element ("audioconvert");
   g_object_set (G_OBJECT (audioconvert), "dithering", 0, NULL);
   g_object_set (G_OBJECT (audioconvert), "noise-shaping", 0, NULL);
-  mysrcpad = gst_check_setup_src_pad (audioconvert, &srctemplate, NULL);
-  mysinkpad = gst_check_setup_sink_pad (audioconvert, &sinktemplate, NULL);
+  mysrcpad = gst_check_setup_src_pad (audioconvert, &srctemplate);
+  mysinkpad = gst_check_setup_sink_pad (audioconvert, &sinktemplate);
   /* this installs a getcaps func that will always return the caps we set
    * later */
   gst_pad_use_fixed_caps (mysinkpad);
+
+  gst_pad_set_active (mysrcpad, TRUE);
+  gst_pad_set_active (mysinkpad, TRUE);
+
   gst_pad_set_caps (mysinkpad, outcaps);
   gst_caps_unref (outcaps);
-  outcaps = gst_pad_get_negotiated_caps (mysinkpad);
+  outcaps = gst_pad_get_current_caps (mysinkpad);
   fail_unless (gst_caps_is_fixed (outcaps));
   gst_caps_unref (outcaps);
 
-  gst_pad_set_active (mysrcpad, TRUE);
-  gst_pad_set_active (mysinkpad, TRUE);
-
   return audioconvert;
 }
 
@@ -119,20 +96,22 @@ cleanup_audioconvert (GstElement * audioconvert)
 
 /* returns a newly allocated caps */
 static GstCaps *
-get_int_caps (guint channels, const gchar * endianness, guint width,
+get_int_caps (guint channels, gint endianness, guint width,
     guint depth, gboolean signedness)
 {
   GstCaps *caps;
   gchar *string;
+  GstAudioFormat fmt;
+
+  GST_DEBUG ("channels:%d, endianness:%d, width:%d, depth:%d, signedness:%d",
+      channels, endianness, width, depth, signedness);
+
+  fmt = gst_audio_format_build_integer (signedness, endianness, width, depth);
 
-  string = g_strdup_printf ("audio/x-raw-int, "
+  string = g_strdup_printf ("audio/x-raw, "
+      "format = (string) %s, "
       "rate = (int) 44100, "
-      "channels = (int) %d, "
-      "endianness = (int) %s, "
-      "width = (int) %d, "
-      "depth = (int) %d, "
-      "signed = (boolean) %s ",
-      channels, endianness, width, depth, signedness ? "true" : "false");
+      "channels = (int) %d", gst_audio_format_to_string (fmt), channels);
   GST_DEBUG ("creating caps from %s", string);
   caps = gst_caps_from_string (string);
   g_free (string);
@@ -143,16 +122,27 @@ get_int_caps (guint channels, const gchar * endianness, guint width,
 
 /* returns a newly allocated caps */
 static GstCaps *
-get_float_caps (guint channels, const gchar * endianness, guint width)
+get_float_caps (guint channels, gint endianness, guint width)
 {
   GstCaps *caps;
   gchar *string;
+  const gchar *format;
 
-  string = g_strdup_printf ("audio/x-raw-float, "
-      "rate = (int) 44100, "
-      "channels = (int) %d, "
-      "endianness = (int) %s, "
-      "width = (int) %d ", channels, endianness, width);
+  if (endianness == G_LITTLE_ENDIAN) {
+    if (width == 32)
+      format = "F32LE";
+    else
+      format = "F64LE";
+  } else {
+    if (width == 32)
+      format = "F32BE";
+    else
+      format = "F64BE";
+  }
+
+  string = g_strdup_printf ("audio/x-raw, "
+      "format = (string) %s, "
+      "rate = (int) 44100, " "channels = (int) %d", format, channels);
   GST_DEBUG ("creating caps from %s", string);
   caps = gst_caps_from_string (string);
   g_free (string);
@@ -395,7 +385,7 @@ set_channel_positions (GstCaps * caps, int channels,
  * ones. Only implemented for channels between 1 and 6.
  */
 static GstCaps *
-get_float_mc_caps (guint channels, const gchar * endianness, guint width,
+get_float_mc_caps (guint channels, gint endianness, guint width,
     gboolean mixed_up_layout)
 {
   GstCaps *caps = get_float_caps (channels, endianness, width);
@@ -411,7 +401,7 @@ get_float_mc_caps (guint channels, const gchar * endianness, guint width,
 }
 
 static GstCaps *
-get_int_mc_caps (guint channels, const gchar * endianness, guint width,
+get_int_mc_caps (guint channels, gint endianness, guint width,
     guint depth, gboolean signedness, gboolean mixed_up_layout)
 {
   GstCaps *caps = get_int_caps (channels, endianness, width, depth, signedness);
@@ -447,11 +437,11 @@ verify_convert (const gchar * which, void *in, int inlength,
           GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
       "could not set to playing");
 
+  gst_pad_push_event (mysrcpad, gst_event_new_caps (incaps));
+
   GST_DEBUG ("Creating buffer of %d bytes", inlength);
   inbuffer = gst_buffer_new_and_alloc (inlength);
-  memcpy (GST_BUFFER_DATA (inbuffer), in, inlength);
-  gst_buffer_set_caps (inbuffer, incaps);
-  ASSERT_CAPS_REFCOUNT (incaps, "incaps", 2);
+  gst_buffer_fill (inbuffer, 0, in, inlength);
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
 
   /* pushing gives away my reference ... */
@@ -467,8 +457,10 @@ verify_convert (const gchar * which, void *in, int inlength,
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
 
   ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 1);
-  fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer), outlength);
+  fail_unless_equals_int (gst_buffer_get_size (outbuffer), outlength);
 
+  gst_check_buffer_data (outbuffer, out, outlength);
+#if 0
   if (memcmp (GST_BUFFER_DATA (outbuffer), out, outlength) != 0) {
     g_print ("\nInput data:\n");
     gst_util_dump_mem (in, inlength);
@@ -479,6 +471,7 @@ verify_convert (const gchar * which, void *in, int inlength,
   }
   fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, outlength) == 0,
       "failed converting %s", which);
+#endif
 
   /* make sure that the channel positions are not lost */
   {
@@ -486,7 +479,7 @@ verify_convert (const gchar * which, void *in, int inlength,
     gint out_chans;
 
     in_s = gst_caps_get_structure (incaps, 0);
-    out_s = gst_caps_get_structure (GST_BUFFER_CAPS (outbuffer), 0);
+    out_s = gst_caps_get_structure (gst_pad_get_current_caps (mysinkpad), 0);
     fail_unless (gst_structure_get_int (out_s, "channels", &out_chans));
 
     /* positions for 1 and 2 channels are implicit if not provided */
@@ -508,7 +501,6 @@ done:
   GST_DEBUG ("cleanup audioconvert");
   cleanup_audioconvert (audioconvert);
   GST_DEBUG ("cleanup, unref incaps");
-  ASSERT_CAPS_REFCOUNT (incaps, "incaps", 1);
   gst_caps_unref (incaps);
 }
 
@@ -530,8 +522,8 @@ GST_START_TEST (test_int16)
     gint16 out[] = { 8064, 1024 };
 
     RUN_CONVERSION ("int16 stereo to mono",
-        in, get_int_caps (2, "BYTE_ORDER", 16, 16, TRUE),
-        out, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE));
+        in, get_int_caps (2, G_BYTE_ORDER, 16, 16, TRUE),
+        out, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE));
   }
   /* mono to stereo */
   {
@@ -539,8 +531,8 @@ GST_START_TEST (test_int16)
     gint16 out[] = { 512, 512, 1024, 1024 };
 
     RUN_CONVERSION ("int16 mono to stereo",
-        in, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE),
-        out, get_int_caps (2, "BYTE_ORDER", 16, 16, TRUE));
+        in, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE),
+        out, get_int_caps (2, G_BYTE_ORDER, 16, 16, TRUE));
   }
   /* signed -> unsigned */
   {
@@ -548,11 +540,11 @@ GST_START_TEST (test_int16)
     guint16 out[] = { 32768, 1, 65535, 0 };
 
     RUN_CONVERSION ("int16 signed to unsigned",
-        in, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE),
-        out, get_int_caps (1, "BYTE_ORDER", 16, 16, FALSE));
+        in, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE),
+        out, get_int_caps (1, G_BYTE_ORDER, 16, 16, FALSE));
     RUN_CONVERSION ("int16 unsigned to signed",
-        out, get_int_caps (1, "BYTE_ORDER", 16, 16, FALSE),
-        in, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE));
+        out, get_int_caps (1, G_BYTE_ORDER, 16, 16, FALSE),
+        in, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE));
   }
 }
 
@@ -567,8 +559,8 @@ GST_START_TEST (test_float32)
     gfloat out[] = { 0.29609375, 0.03125 };
 
     RUN_CONVERSION ("float32 stereo to mono",
-        in, get_float_caps (2, "BYTE_ORDER", 32),
-        out, get_float_caps (1, "BYTE_ORDER", 32));
+        in, get_float_caps (2, G_BYTE_ORDER, 32),
+        out, get_float_caps (1, G_BYTE_ORDER, 32));
   }
   /* mono to stereo */
   {
@@ -576,8 +568,8 @@ GST_START_TEST (test_float32)
     gfloat out[] = { 0.015625, 0.015625, 0.03125, 0.03125 };
 
     RUN_CONVERSION ("float32 mono to stereo",
-        in, get_float_caps (1, "BYTE_ORDER", 32),
-        out, get_float_caps (2, "BYTE_ORDER", 32));
+        in, get_float_caps (1, G_BYTE_ORDER, 32),
+        out, get_float_caps (2, G_BYTE_ORDER, 32));
   }
 }
 
@@ -593,12 +585,12 @@ GST_START_TEST (test_int_conversion)
     gint16 out[] = { 0, 256, 512, 32512, -32512 };
 
     RUN_CONVERSION ("int 8bit to 16bit signed",
-        in, get_int_caps (1, "BYTE_ORDER", 8, 8, TRUE),
-        out, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE)
+        in, get_int_caps (1, G_BYTE_ORDER, 8, 8, TRUE),
+        out, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE)
         );
     RUN_CONVERSION ("int 16bit signed to 8bit",
-        out, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE),
-        in, get_int_caps (1, "BYTE_ORDER", 8, 8, TRUE)
+        out, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE),
+        in, get_int_caps (1, G_BYTE_ORDER, 8, 8, TRUE)
         );
   }
   /* 16 -> 8 signed */
@@ -607,8 +599,8 @@ GST_START_TEST (test_int_conversion)
     gint8 out[] = { 0, 0, 1, 1, 1, 2 };
 
     RUN_CONVERSION ("16 bit to 8 signed",
-        in, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE),
-        out, get_int_caps (1, "BYTE_ORDER", 8, 8, TRUE)
+        in, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE),
+        out, get_int_caps (1, G_BYTE_ORDER, 8, 8, TRUE)
         );
   }
   /* 8 unsigned <-> 16 signed */
@@ -619,13 +611,13 @@ GST_START_TEST (test_int_conversion)
     GstCaps *incaps, *outcaps;
 
     /* exploded for easier valgrinding */
-    incaps = get_int_caps (1, "BYTE_ORDER", 8, 8, FALSE);
-    outcaps = get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE);
+    incaps = get_int_caps (1, G_BYTE_ORDER, 8, 8, FALSE);
+    outcaps = get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE);
     GST_DEBUG ("incaps: %" GST_PTR_FORMAT, incaps);
     GST_DEBUG ("outcaps: %" GST_PTR_FORMAT, outcaps);
     RUN_CONVERSION ("8 unsigned to 16 signed", in, incaps, out, outcaps);
     RUN_CONVERSION ("16 signed to 8 unsigned", out, get_int_caps (1,
-            "BYTE_ORDER", 16, 16, TRUE), in, get_int_caps (1, "BYTE_ORDER", 8,
+            G_BYTE_ORDER, 16, 16, TRUE), in, get_int_caps (1, G_BYTE_ORDER, 8,
             8, FALSE)
         );
   }
@@ -637,11 +629,11 @@ GST_START_TEST (test_int_conversion)
     /* out has the bytes in little-endian, so that's how they should be
      * interpreted during conversion */
 
-    RUN_CONVERSION ("8 to 24 signed", in, get_int_caps (1, "BYTE_ORDER", 8, 8,
-            TRUE), out, get_int_caps (1, "LITTLE_ENDIAN", 24, 24, TRUE)
+    RUN_CONVERSION ("8 to 24 signed", in, get_int_caps (1, G_BYTE_ORDER, 8, 8,
+            TRUE), out, get_int_caps (1, G_LITTLE_ENDIAN, 24, 24, TRUE)
         );
-    RUN_CONVERSION ("24 signed to 8", out, get_int_caps (1, "LITTLE_ENDIAN", 24,
-            24, TRUE), in, get_int_caps (1, "BYTE_ORDER", 8, 8, TRUE)
+    RUN_CONVERSION ("24 signed to 8", out, get_int_caps (1, G_LITTLE_ENDIAN, 24,
+            24, TRUE), in, get_int_caps (1, G_BYTE_ORDER, 8, 8, TRUE)
         );
   }
 
@@ -650,12 +642,12 @@ GST_START_TEST (test_int_conversion)
     gint16 in[] = { 0, 128, -128 };
     guint16 out[] = { 32768, 32896, 32640 };
     RUN_CONVERSION ("16 signed to 16 unsigned",
-        in, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE),
-        out, get_int_caps (1, "BYTE_ORDER", 16, 16, FALSE)
+        in, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE),
+        out, get_int_caps (1, G_BYTE_ORDER, 16, 16, FALSE)
         );
     RUN_CONVERSION ("16 unsigned to 16 signed",
-        out, get_int_caps (1, "BYTE_ORDER", 16, 16, FALSE),
-        in, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE)
+        out, get_int_caps (1, G_BYTE_ORDER, 16, 16, FALSE),
+        in, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE)
         );
   }
 
@@ -665,12 +657,12 @@ GST_START_TEST (test_int_conversion)
     gint16 in[] = { 0, 64 << 8, -64 << 8 };
     gint16 out[] = { 0, 64, -64 };
     RUN_CONVERSION ("16 signed to 8 in 16 signed",
-        in, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE),
-        out, get_int_caps (1, "BYTE_ORDER", 16, 8, TRUE)
+        in, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE),
+        out, get_int_caps (1, G_BYTE_ORDER, 16, 8, TRUE)
         );
     RUN_CONVERSION ("8 in 16 signed to 16 signed",
-        out, get_int_caps (1, "BYTE_ORDER", 16, 8, TRUE),
-        in, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE)
+        out, get_int_caps (1, G_BYTE_ORDER, 16, 8, TRUE),
+        in, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE)
         );
   }
 
@@ -680,12 +672,12 @@ GST_START_TEST (test_int_conversion)
     guint16 in[] = { 1 << 15, (1 << 15) - (64 << 8), (1 << 15) + (64 << 8) };
     guint16 out[] = { 1 << 7, (1 << 7) - 64, (1 << 7) + 64 };
     RUN_CONVERSION ("16 unsigned to 8 in 16 unsigned",
-        in, get_int_caps (1, "BYTE_ORDER", 16, 16, FALSE),
-        out, get_int_caps (1, "BYTE_ORDER", 16, 8, FALSE)
+        in, get_int_caps (1, G_BYTE_ORDER, 16, 16, FALSE),
+        out, get_int_caps (1, G_BYTE_ORDER, 16, 8, FALSE)
         );
     RUN_CONVERSION ("8 in 16 unsigned to 16 unsigned",
-        out, get_int_caps (1, "BYTE_ORDER", 16, 8, FALSE),
-        in, get_int_caps (1, "BYTE_ORDER", 16, 16, FALSE)
+        out, get_int_caps (1, G_BYTE_ORDER, 16, 8, FALSE),
+        in, get_int_caps (1, G_BYTE_ORDER, 16, 16, FALSE)
         );
   }
 
@@ -707,8 +699,8 @@ GST_START_TEST (test_int_conversion)
       -32
     };
     RUN_CONVERSION ("32 signed to 16 signed for rounding",
-        in, get_int_caps (1, "BYTE_ORDER", 32, 32, TRUE),
-        out, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE)
+        in, get_int_caps (1, G_BYTE_ORDER, 32, 32, TRUE),
+        out, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE)
         );
   }
 
@@ -730,8 +722,8 @@ GST_START_TEST (test_int_conversion)
       (1 << 15) - 32
     };
     RUN_CONVERSION ("32 signed to 16 unsigned for rounding",
-        in, get_int_caps (1, "BYTE_ORDER", 32, 32, TRUE),
-        out, get_int_caps (1, "BYTE_ORDER", 16, 16, FALSE)
+        in, get_int_caps (1, G_BYTE_ORDER, 32, 32, TRUE),
+        out, get_int_caps (1, G_BYTE_ORDER, 16, 16, FALSE)
         );
   }
 }
@@ -759,11 +751,11 @@ GST_START_TEST (test_float_conversion)
      * not produce exactly the same as the input due to floating
      * point rounding errors etc. */
     RUN_CONVERSION ("32 float le to 16 signed",
-        in_le, get_float_caps (1, "LITTLE_ENDIAN", 32),
-        out, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE));
+        in_le, get_float_caps (1, G_LITTLE_ENDIAN, 32),
+        out, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE));
     RUN_CONVERSION ("32 float be to 16 signed",
-        in_be, get_float_caps (1, "BIG_ENDIAN", 32),
-        out, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE));
+        in_be, get_float_caps (1, G_BIG_ENDIAN, 32),
+        out, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE));
   }
 
   {
@@ -771,8 +763,8 @@ GST_START_TEST (test_float_conversion)
     gfloat out[] = { 0.0, -1.0, 0.5, -0.5 };
 
     RUN_CONVERSION ("16 signed to 32 float",
-        in, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE),
-        out, get_float_caps (1, "BYTE_ORDER", 32));
+        in, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE),
+        out, get_float_caps (1, G_BYTE_ORDER, 32));
   }
 
   /* 64 float <-> 16 signed */
@@ -794,11 +786,11 @@ GST_START_TEST (test_float_conversion)
      * not produce exactly the same as the input due to floating
      * point rounding errors etc. */
     RUN_CONVERSION ("64 float LE to 16 signed",
-        in_le, get_float_caps (1, "LITTLE_ENDIAN", 64),
-        out, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE));
+        in_le, get_float_caps (1, G_LITTLE_ENDIAN, 64),
+        out, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE));
     RUN_CONVERSION ("64 float BE to 16 signed",
-        in_be, get_float_caps (1, "BIG_ENDIAN", 64),
-        out, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE));
+        in_be, get_float_caps (1, G_BIG_ENDIAN, 64),
+        out, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE));
   }
   {
     gint16 in[] = { 0, -32768, 16384, -16384 };
@@ -809,8 +801,8 @@ GST_START_TEST (test_float_conversion)
     };
 
     RUN_CONVERSION ("16 signed to 64 float",
-        in, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE),
-        out, get_float_caps (1, "BYTE_ORDER", 64));
+        in, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE),
+        out, get_float_caps (1, G_BYTE_ORDER, 64));
   }
   {
     gint32 in[] = { 0, (-1L << 31), (1L << 30), (-1L << 30) };
@@ -821,8 +813,8 @@ GST_START_TEST (test_float_conversion)
     };
 
     RUN_CONVERSION ("32 signed to 64 float",
-        in, get_int_caps (1, "BYTE_ORDER", 32, 32, TRUE),
-        out, get_float_caps (1, "BYTE_ORDER", 64));
+        in, get_int_caps (1, G_BYTE_ORDER, 32, 32, TRUE),
+        out, get_float_caps (1, G_BYTE_ORDER, 64));
   }
 
   /* 64-bit float <-> 32-bit float */
@@ -831,12 +823,12 @@ GST_START_TEST (test_float_conversion)
     gfloat out[] = { 0.0, 1.0, -1.0, 0.5, -0.5 };
 
     RUN_CONVERSION ("64 float to 32 float",
-        in, get_float_caps (1, "BYTE_ORDER", 64),
-        out, get_float_caps (1, "BYTE_ORDER", 32));
+        in, get_float_caps (1, G_BYTE_ORDER, 64),
+        out, get_float_caps (1, G_BYTE_ORDER, 32));
 
     RUN_CONVERSION ("32 float to 64 float",
-        out, get_float_caps (1, "BYTE_ORDER", 32),
-        in, get_float_caps (1, "BYTE_ORDER", 64));
+        out, get_float_caps (1, G_BYTE_ORDER, 32),
+        in, get_float_caps (1, G_BYTE_ORDER, 64));
   }
 
   /* 32-bit float little endian <-> big endian */
@@ -849,12 +841,12 @@ GST_START_TEST (test_float_conversion)
     };
 
     RUN_CONVERSION ("32 float LE to BE",
-        le, get_float_caps (1, "LITTLE_ENDIAN", 32),
-        be, get_float_caps (1, "BIG_ENDIAN", 32));
+        le, get_float_caps (1, G_LITTLE_ENDIAN, 32),
+        be, get_float_caps (1, G_BIG_ENDIAN, 32));
 
     RUN_CONVERSION ("32 float BE to LE",
-        be, get_float_caps (1, "BIG_ENDIAN", 32),
-        le, get_float_caps (1, "LITTLE_ENDIAN", 32));
+        be, get_float_caps (1, G_BIG_ENDIAN, 32),
+        le, get_float_caps (1, G_LITTLE_ENDIAN, 32));
   }
 
   /* 64-bit float little endian <-> big endian */
@@ -869,12 +861,12 @@ GST_START_TEST (test_float_conversion)
     };
 
     RUN_CONVERSION ("64 float LE to BE",
-        le, get_float_caps (1, "LITTLE_ENDIAN", 64),
-        be, get_float_caps (1, "BIG_ENDIAN", 64));
+        le, get_float_caps (1, G_LITTLE_ENDIAN, 64),
+        be, get_float_caps (1, G_BIG_ENDIAN, 64));
 
     RUN_CONVERSION ("64 float BE to LE",
-        be, get_float_caps (1, "BIG_ENDIAN", 64),
-        le, get_float_caps (1, "LITTLE_ENDIAN", 64));
+        be, get_float_caps (1, G_BIG_ENDIAN, 64),
+        le, get_float_caps (1, G_LITTLE_ENDIAN, 64));
   }
 }
 
@@ -888,10 +880,10 @@ GST_START_TEST (test_multichannel_conversion)
     gfloat out[] = { 0.0, 0.0 };
 
     RUN_CONVERSION ("3 channels to 1", in, get_float_mc_caps (3,
-            "BYTE_ORDER", 32, FALSE), out, get_float_caps (1, "BYTE_ORDER",
+            G_BYTE_ORDER, 32, FALSE), out, get_float_caps (1, G_BYTE_ORDER,
             32));
     RUN_CONVERSION ("1 channels to 3", out, get_float_caps (1,
-            "BYTE_ORDER", 32), in, get_float_mc_caps (3, "BYTE_ORDER",
+            G_BYTE_ORDER, 32), in, get_float_mc_caps (3, G_BYTE_ORDER,
             32, TRUE));
   }
 
@@ -900,18 +892,18 @@ GST_START_TEST (test_multichannel_conversion)
     gint16 out[] = { 0, 0 };
 
     RUN_CONVERSION ("3 channels to 1", in, get_int_mc_caps (3,
-            "BYTE_ORDER", 16, 16, TRUE, FALSE), out, get_int_caps (1,
-            "BYTE_ORDER", 16, 16, TRUE));
-    RUN_CONVERSION ("1 channels to 3", out, get_int_caps (1, "BYTE_ORDER", 16,
-            16, TRUE), in, get_int_mc_caps (3, "BYTE_ORDER", 16, 16, TRUE,
+            G_BYTE_ORDER, 16, 16, TRUE, FALSE), out, get_int_caps (1,
+            G_BYTE_ORDER, 16, 16, TRUE));
+    RUN_CONVERSION ("1 channels to 3", out, get_int_caps (1, G_BYTE_ORDER, 16,
+            16, TRUE), in, get_int_mc_caps (3, G_BYTE_ORDER, 16, 16, TRUE,
             TRUE));
   }
 
   {
     gint16 in[] = { 1, 2 };
     gint16 out[] = { 1, 1, 2, 2 };
-    GstCaps *in_caps = get_int_mc_caps (1, "BYTE_ORDER", 16, 16, TRUE, FALSE);
-    GstCaps *out_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, TRUE, FALSE);
+    GstCaps *in_caps = get_int_mc_caps (1, G_BYTE_ORDER, 16, 16, TRUE, FALSE);
+    GstCaps *out_caps = get_int_mc_caps (2, G_BYTE_ORDER, 16, 16, TRUE, FALSE);
     GstAudioChannelPosition in_layout[1] =
         { GST_AUDIO_CHANNEL_POSITION_FRONT_MONO };
     GstAudioChannelPosition out_layout[2] =
@@ -929,8 +921,8 @@ GST_START_TEST (test_multichannel_conversion)
   {
     gint16 in[] = { 1, 2 };
     gint16 out[] = { 1, 1, 2, 2 };
-    GstCaps *in_caps = get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE);
-    GstCaps *out_caps = get_int_caps (2, "BYTE_ORDER", 16, 16, TRUE);
+    GstCaps *in_caps = get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE);
+    GstCaps *out_caps = get_int_caps (2, G_BYTE_ORDER, 16, 16, TRUE);
 
     RUN_CONVERSION ("1 channels to 2 with standard layout and no positions set",
         in, gst_caps_copy (in_caps), out, gst_caps_copy (out_caps));
@@ -942,8 +934,8 @@ GST_START_TEST (test_multichannel_conversion)
   {
     gint16 in[] = { 1, 2 };
     gint16 out[] = { 1, 0, 2, 0 };
-    GstCaps *in_caps = get_int_mc_caps (1, "BYTE_ORDER", 16, 16, TRUE, FALSE);
-    GstCaps *out_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, TRUE, FALSE);
+    GstCaps *in_caps = get_int_mc_caps (1, G_BYTE_ORDER, 16, 16, TRUE, FALSE);
+    GstCaps *out_caps = get_int_mc_caps (2, G_BYTE_ORDER, 16, 16, TRUE, FALSE);
     GstAudioChannelPosition in_layout[1] =
         { GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT };
     GstAudioChannelPosition out_layout[2] =
@@ -961,8 +953,8 @@ GST_START_TEST (test_multichannel_conversion)
   {
     gint16 in[] = { 1, 2, 3, 4 };
     gint16 out[] = { 2, 4 };
-    GstCaps *in_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, TRUE, FALSE);
-    GstCaps *out_caps = get_int_mc_caps (1, "BYTE_ORDER", 16, 16, TRUE, FALSE);
+    GstCaps *in_caps = get_int_mc_caps (2, G_BYTE_ORDER, 16, 16, TRUE, FALSE);
+    GstCaps *out_caps = get_int_mc_caps (1, G_BYTE_ORDER, 16, 16, TRUE, FALSE);
     GstAudioChannelPosition in_layout[2] =
         { GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
       GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT
@@ -980,8 +972,8 @@ GST_START_TEST (test_multichannel_conversion)
   {
     gint16 in[] = { 1, 2, 3, 4 };
     gint16 out[] = { 2, 4 };
-    GstCaps *in_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, TRUE, FALSE);
-    GstCaps *out_caps = get_int_mc_caps (1, "BYTE_ORDER", 16, 16, TRUE, FALSE);
+    GstCaps *in_caps = get_int_mc_caps (2, G_BYTE_ORDER, 16, 16, TRUE, FALSE);
+    GstCaps *out_caps = get_int_mc_caps (1, G_BYTE_ORDER, 16, 16, TRUE, FALSE);
     GstAudioChannelPosition in_layout[2] =
         { GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
       GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT
@@ -999,8 +991,8 @@ GST_START_TEST (test_multichannel_conversion)
   {
     gint16 in[] = { 1, 2, 3, 4 };
     gint16 out[] = { 1, 3 };
-    GstCaps *in_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, TRUE, FALSE);
-    GstCaps *out_caps = get_int_mc_caps (1, "BYTE_ORDER", 16, 16, TRUE, FALSE);
+    GstCaps *in_caps = get_int_mc_caps (2, G_BYTE_ORDER, 16, 16, TRUE, FALSE);
+    GstCaps *out_caps = get_int_mc_caps (1, G_BYTE_ORDER, 16, 16, TRUE, FALSE);
     GstAudioChannelPosition in_layout[2] =
         { GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
       GST_AUDIO_CHANNEL_POSITION_REAR_CENTER
@@ -1018,8 +1010,8 @@ GST_START_TEST (test_multichannel_conversion)
   {
     gint16 in[] = { 1, 2, 3, 4 };
     gint16 out[] = { 1, 3 };
-    GstCaps *in_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, TRUE, FALSE);
-    GstCaps *out_caps = get_int_mc_caps (1, "BYTE_ORDER", 16, 16, TRUE, FALSE);
+    GstCaps *in_caps = get_int_mc_caps (2, G_BYTE_ORDER, 16, 16, TRUE, FALSE);
+    GstCaps *out_caps = get_int_mc_caps (1, G_BYTE_ORDER, 16, 16, TRUE, FALSE);
     GstAudioChannelPosition in_layout[2] =
         { GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
       GST_AUDIO_CHANNEL_POSITION_REAR_LEFT
@@ -1036,16 +1028,16 @@ GST_START_TEST (test_multichannel_conversion)
   {
     gint16 in[] = { 4, 5, 4, 2, 2, 1 };
     gint16 out[] = { 3, 3 };
-    GstCaps *in_caps = get_int_mc_caps (6, "BYTE_ORDER", 16, 16, TRUE, FALSE);
-    GstCaps *out_caps = get_int_caps (2, "BYTE_ORDER", 16, 16, TRUE);
+    GstCaps *in_caps = get_int_mc_caps (6, G_BYTE_ORDER, 16, 16, TRUE, FALSE);
+    GstCaps *out_caps = get_int_caps (2, G_BYTE_ORDER, 16, 16, TRUE);
 
     RUN_CONVERSION ("5.1 to 2 channels", in, in_caps, out, out_caps);
   }
   {
     gint16 in[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
     gint16 out[] = { 0, 0 };
-    GstCaps *in_caps = get_int_mc_caps (11, "BYTE_ORDER", 16, 16, TRUE, FALSE);
-    GstCaps *out_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, TRUE, FALSE);
+    GstCaps *in_caps = get_int_mc_caps (11, G_BYTE_ORDER, 16, 16, TRUE, FALSE);
+    GstCaps *out_caps = get_int_mc_caps (2, G_BYTE_ORDER, 16, 16, TRUE, FALSE);
     GstAudioChannelPosition in_layout[11] = {
       GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
       GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
@@ -1100,8 +1092,8 @@ GST_START_TEST (test_channel_remapping)
   {
     gfloat in[] = { 0.0, 1.0, -0.5 };
     gfloat out[] = { -0.5, 1.0, 0.0 };
-    GstCaps *in_caps = get_float_mc_caps (3, "BYTE_ORDER", 32, FALSE);
-    GstCaps *out_caps = get_float_mc_caps (3, "BYTE_ORDER", 32, TRUE);
+    GstCaps *in_caps = get_float_mc_caps (3, G_BYTE_ORDER, 32, FALSE);
+    GstCaps *out_caps = get_float_mc_caps (3, G_BYTE_ORDER, 32, TRUE);
 
     RUN_CONVERSION ("3 channels layout remapping float", in, in_caps,
         out, out_caps);
@@ -1111,8 +1103,8 @@ GST_START_TEST (test_channel_remapping)
   {
     guint16 in[] = { 0, 65535, 0x9999 };
     guint16 out[] = { 0x9999, 65535, 0 };
-    GstCaps *in_caps = get_int_mc_caps (3, "BYTE_ORDER", 16, 16, FALSE, FALSE);
-    GstCaps *out_caps = get_int_mc_caps (3, "BYTE_ORDER", 16, 16, FALSE, TRUE);
+    GstCaps *in_caps = get_int_mc_caps (3, G_BYTE_ORDER, 16, 16, FALSE, FALSE);
+    GstCaps *out_caps = get_int_mc_caps (3, G_BYTE_ORDER, 16, 16, FALSE, TRUE);
 
     RUN_CONVERSION ("3 channels layout remapping int", in, in_caps,
         out, out_caps);
@@ -1122,8 +1114,8 @@ GST_START_TEST (test_channel_remapping)
   {
     guint16 in[] = { 0, 1, 2, 3, 4, 5, 6, 7 };
     guint16 out[] = { 4, 0, 1, 6, 7, 2, 3, 5 };
-    GstCaps *in_caps = get_int_mc_caps (8, "BYTE_ORDER", 16, 16, FALSE, FALSE);
-    GstCaps *out_caps = get_int_mc_caps (8, "BYTE_ORDER", 16, 16, FALSE, TRUE);
+    GstCaps *in_caps = get_int_mc_caps (8, G_BYTE_ORDER, 16, 16, FALSE, FALSE);
+    GstCaps *out_caps = get_int_mc_caps (8, G_BYTE_ORDER, 16, 16, FALSE, TRUE);
 
     set_channel_positions (in_caps, 8, n8chan_pos_remap_in);
     set_channel_positions (out_caps, 8, n8chan_pos_remap_out);
@@ -1137,8 +1129,8 @@ GST_START_TEST (test_channel_remapping)
     guint16 in[] = { 0, 1, 2, 3, 4, 5, 6, 7 };
     guint32 out[] =
         { 4 << 16, 0, 1 << 16, 6 << 16, 7 << 16, 2 << 16, 3 << 16, 5 << 16 };
-    GstCaps *in_caps = get_int_mc_caps (8, "BYTE_ORDER", 16, 16, FALSE, FALSE);
-    GstCaps *out_caps = get_int_mc_caps (8, "BYTE_ORDER", 32, 32, FALSE, TRUE);
+    GstCaps *in_caps = get_int_mc_caps (8, G_BYTE_ORDER, 16, 16, FALSE, FALSE);
+    GstCaps *out_caps = get_int_mc_caps (8, G_BYTE_ORDER, 32, 32, FALSE, TRUE);
 
     set_channel_positions (in_caps, 8, n8chan_pos_remap_in);
     set_channel_positions (out_caps, 8, n8chan_pos_remap_out);
@@ -1146,8 +1138,8 @@ GST_START_TEST (test_channel_remapping)
     RUN_CONVERSION ("8 channels layout remapping int16 --> int32", in, in_caps,
         out, out_caps);
 
-    in_caps = get_int_mc_caps (8, "BYTE_ORDER", 16, 16, FALSE, FALSE);
-    out_caps = get_int_mc_caps (8, "BYTE_ORDER", 32, 32, FALSE, TRUE);
+    in_caps = get_int_mc_caps (8, G_BYTE_ORDER, 16, 16, FALSE, FALSE);
+    out_caps = get_int_mc_caps (8, G_BYTE_ORDER, 32, 32, FALSE, TRUE);
     set_channel_positions (in_caps, 8, n8chan_pos_remap_in);
     set_channel_positions (out_caps, 8, n8chan_pos_remap_out);
     RUN_CONVERSION ("8 channels layout remapping int16 <-- int32", out,
@@ -1158,8 +1150,8 @@ GST_START_TEST (test_channel_remapping)
   {
     gfloat in[] = { 100.0 / G_MAXINT16, 0.0, -100.0 / G_MAXINT16 };
     gint16 out[] = { -100, 0, 100 };
-    GstCaps *in_caps = get_float_mc_caps (3, "BYTE_ORDER", 32, TRUE);
-    GstCaps *out_caps = get_int_mc_caps (3, "BYTE_ORDER", 16, 16, TRUE, FALSE);
+    GstCaps *in_caps = get_float_mc_caps (3, G_BYTE_ORDER, 32, TRUE);
+    GstCaps *out_caps = get_int_mc_caps (3, G_BYTE_ORDER, 16, 16, TRUE, FALSE);
 
     RUN_CONVERSION ("3 channels layout remapping float32 --> int16", in,
         in_caps, out, out_caps);
@@ -1169,8 +1161,8 @@ GST_START_TEST (test_channel_remapping)
   {
     gint16 in[] = { 1, 2, 3, 4 };
     gint16 out[] = { 1, 2, 2, 4 };
-    GstCaps *in_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, TRUE, FALSE);
-    GstCaps *out_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, TRUE, FALSE);
+    GstCaps *in_caps = get_int_mc_caps (2, G_BYTE_ORDER, 16, 16, TRUE, FALSE);
+    GstCaps *out_caps = get_int_mc_caps (2, G_BYTE_ORDER, 16, 16, TRUE, FALSE);
     GstAudioChannelPosition in_layout[2] =
         { GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
       GST_AUDIO_CHANNEL_POSITION_LFE
@@ -1191,8 +1183,8 @@ GST_START_TEST (test_channel_remapping)
   {
     gint16 in[] = { 1, 2, 3, 4 };
     gint16 out[] = { 2, 1, 4, 3 };
-    GstCaps *in_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, TRUE, FALSE);
-    GstCaps *out_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, TRUE, FALSE);
+    GstCaps *in_caps = get_int_mc_caps (2, G_BYTE_ORDER, 16, 16, TRUE, FALSE);
+    GstCaps *out_caps = get_int_mc_caps (2, G_BYTE_ORDER, 16, 16, TRUE, FALSE);
     GstAudioChannelPosition in_layout[2] =
         { GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
       GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT
@@ -1213,8 +1205,8 @@ GST_START_TEST (test_channel_remapping)
   {
     gint16 in[] = { 1, 2, 3, 4 };
     gint16 out[] = { 1, 1, 3, 3 };
-    GstCaps *in_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, TRUE, FALSE);
-    GstCaps *out_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, TRUE, FALSE);
+    GstCaps *in_caps = get_int_mc_caps (2, G_BYTE_ORDER, 16, 16, TRUE, FALSE);
+    GstCaps *out_caps = get_int_mc_caps (2, G_BYTE_ORDER, 16, 16, TRUE, FALSE);
     GstAudioChannelPosition in_layout[2] =
         { GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
       GST_AUDIO_CHANNEL_POSITION_REAR_CENTER
@@ -1235,8 +1227,8 @@ GST_START_TEST (test_channel_remapping)
   {
     gint16 in[] = { 1, 2, 3, 4 };
     gint16 out[] = { 0, 0, 0, 0 };
-    GstCaps *in_caps = get_int_mc_caps (1, "BYTE_ORDER", 16, 16, TRUE, FALSE);
-    GstCaps *out_caps = get_int_mc_caps (1, "BYTE_ORDER", 16, 16, TRUE, FALSE);
+    GstCaps *in_caps = get_int_mc_caps (1, G_BYTE_ORDER, 16, 16, TRUE, FALSE);
+    GstCaps *out_caps = get_int_mc_caps (1, G_BYTE_ORDER, 16, 16, TRUE, FALSE);
     GstAudioChannelPosition in_layout[1] =
         { GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT };
     GstAudioChannelPosition out_layout[1] =
@@ -1253,8 +1245,8 @@ GST_START_TEST (test_channel_remapping)
   {
     gint16 in[] = { 1, 2, 3, 4 };
     gint16 out[] = { 1, 2, 3, 4 };
-    GstCaps *in_caps = get_int_mc_caps (1, "BYTE_ORDER", 16, 16, TRUE, FALSE);
-    GstCaps *out_caps = get_int_mc_caps (1, "BYTE_ORDER", 16, 16, TRUE, FALSE);
+    GstCaps *in_caps = get_int_mc_caps (1, G_BYTE_ORDER, 16, 16, TRUE, FALSE);
+    GstCaps *out_caps = get_int_mc_caps (1, G_BYTE_ORDER, 16, 16, TRUE, FALSE);
     GstAudioChannelPosition in_layout[1] =
         { GST_AUDIO_CHANNEL_POSITION_FRONT_MONO };
     GstAudioChannelPosition out_layout[1] =
@@ -1271,8 +1263,8 @@ GST_START_TEST (test_channel_remapping)
   {
     gint16 in[] = { 1, 2, 3, 4 };
     gint16 out[] = { 1, 2, 3, 4 };
-    GstCaps *in_caps = get_int_mc_caps (1, "BYTE_ORDER", 16, 16, TRUE, FALSE);
-    GstCaps *out_caps = get_int_mc_caps (1, "BYTE_ORDER", 16, 16, TRUE, FALSE);
+    GstCaps *in_caps = get_int_mc_caps (1, G_BYTE_ORDER, 16, 16, TRUE, FALSE);
+    GstCaps *out_caps = get_int_mc_caps (1, G_BYTE_ORDER, 16, 16, TRUE, FALSE);
     GstAudioChannelPosition in_layout[1] =
         { GST_AUDIO_CHANNEL_POSITION_FRONT_MONO };
     GstAudioChannelPosition out_layout[1] =
@@ -1315,8 +1307,8 @@ GST_START_TEST (test_caps_negotiation)
   fail_if (gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE) !=
       GST_STATE_CHANGE_SUCCESS, "Failed to set test pipeline to PAUSED");
 
-  caps1 = gst_pad_get_caps (ac3_src);
-  fail_if (caps1 == NULL, "gst_pad_get_caps returned NULL");
+  caps1 = gst_pad_query_caps (ac3_src, NULL);
+  fail_if (caps1 == NULL, "gst_pad_query_caps returned NULL");
   GST_DEBUG ("Caps size 1 : %d", gst_caps_get_size (caps1));
 
   fail_if (gst_element_set_state (pipeline, GST_STATE_READY) ==
@@ -1334,9 +1326,9 @@ GST_START_TEST (test_caps_negotiation)
   fail_if (gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE) !=
       GST_STATE_CHANGE_SUCCESS, "Failed to set test pipeline back to PAUSED");
 
-  caps2 = gst_pad_get_caps (ac3_src);
+  caps2 = gst_pad_query_caps (ac3_src, NULL);
 
-  fail_if (caps2 == NULL, "gst_pad_get_caps returned NULL");
+  fail_if (caps2 == NULL, "gst_pad_query_caps returned NULL");
   GST_DEBUG ("Caps size 2 : %d", gst_caps_get_size (caps2));
   fail_unless (gst_caps_get_size (caps1) == gst_caps_get_size (caps2));
 
@@ -1362,8 +1354,8 @@ GST_START_TEST (test_convert_undefined_multichannel)
   {
     guint16 out[] = { 0x2000 };
     guint8 in[] = { 0x20 };
-    GstCaps *out_caps = get_int_mc_caps (1, "BYTE_ORDER", 16, 16, FALSE, FALSE);
-    GstCaps *in_caps = get_int_mc_caps (1, "BYTE_ORDER", 8, 8, FALSE, FALSE);
+    GstCaps *out_caps = get_int_mc_caps (1, G_BYTE_ORDER, 16, 16, FALSE, FALSE);
+    GstCaps *in_caps = get_int_mc_caps (1, G_BYTE_ORDER, 8, 8, FALSE, FALSE);
 
     set_channel_positions (out_caps, 1, undefined_positions[1 - 1]);
     set_channel_positions (in_caps, 1, undefined_positions[1 - 1]);
@@ -1376,8 +1368,8 @@ GST_START_TEST (test_convert_undefined_multichannel)
   {
     guint16 out[] = { 0x8000, 0x2000 };
     guint8 in[] = { 0x80, 0x20 };
-    GstCaps *out_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, FALSE, FALSE);
-    GstCaps *in_caps = get_int_mc_caps (2, "BYTE_ORDER", 8, 8, FALSE, FALSE);
+    GstCaps *out_caps = get_int_mc_caps (2, G_BYTE_ORDER, 16, 16, FALSE, FALSE);
+    GstCaps *in_caps = get_int_mc_caps (2, G_BYTE_ORDER, 8, 8, FALSE, FALSE);
 
     set_channel_positions (out_caps, 2, undefined_positions[2 - 1]);
     set_channel_positions (in_caps, 2, undefined_positions[2 - 1]);
@@ -1390,8 +1382,8 @@ GST_START_TEST (test_convert_undefined_multichannel)
   {
     guint16 out[] = { 0x0000, 0x2000, 0x8000, 0x2000, 0x0000, 0xff00 };
     guint8 in[] = { 0x00, 0x20, 0x80, 0x20, 0x00, 0xff };
-    GstCaps *out_caps = get_int_mc_caps (6, "BYTE_ORDER", 16, 16, FALSE, FALSE);
-    GstCaps *in_caps = get_int_mc_caps (6, "BYTE_ORDER", 8, 8, FALSE, FALSE);
+    GstCaps *out_caps = get_int_mc_caps (6, G_BYTE_ORDER, 16, 16, FALSE, FALSE);
+    GstCaps *in_caps = get_int_mc_caps (6, G_BYTE_ORDER, 8, 8, FALSE, FALSE);
 
     set_channel_positions (out_caps, 6, undefined_positions[6 - 1]);
     set_channel_positions (in_caps, 6, undefined_positions[6 - 1]);
@@ -1406,8 +1398,8 @@ GST_START_TEST (test_convert_undefined_multichannel)
       0x0000, 0xff00, 0x0000
     };
     guint8 in[] = { 0x00, 0xff, 0x00, 0x20, 0x80, 0x20, 0x00, 0xff, 0x00 };
-    GstCaps *out_caps = get_int_mc_caps (9, "BYTE_ORDER", 16, 16, FALSE, FALSE);
-    GstCaps *in_caps = get_int_mc_caps (9, "BYTE_ORDER", 8, 8, FALSE, FALSE);
+    GstCaps *out_caps = get_int_mc_caps (9, G_BYTE_ORDER, 16, 16, FALSE, FALSE);
+    GstCaps *in_caps = get_int_mc_caps (9, G_BYTE_ORDER, 8, 8, FALSE, FALSE);
 
     set_channel_positions (out_caps, 9, undefined_positions[9 - 1]);
     set_channel_positions (in_caps, 9, undefined_positions[9 - 1]);
@@ -1427,8 +1419,8 @@ GST_START_TEST (test_convert_undefined_multichannel)
       0x20, 0x80, 0x20, 0x00
     };
     GstCaps *out_caps =
-        get_int_mc_caps (15, "BYTE_ORDER", 16, 16, FALSE, FALSE);
-    GstCaps *in_caps = get_int_mc_caps (15, "BYTE_ORDER", 8, 8, FALSE, FALSE);
+        get_int_mc_caps (15, G_BYTE_ORDER, 16, 16, FALSE, FALSE);
+    GstCaps *in_caps = get_int_mc_caps (15, G_BYTE_ORDER, 8, 8, FALSE, FALSE);
 
     set_channel_positions (out_caps, 15, undefined_positions[15 - 1]);
     set_channel_positions (in_caps, 15, undefined_positions[15 - 1]);
@@ -1443,8 +1435,8 @@ GST_START_TEST (test_convert_undefined_multichannel)
   {
     guint16 in[] = { 0x2000 };
     guint8 out[] = { 0x20 };
-    GstCaps *in_caps = get_int_mc_caps (1, "BYTE_ORDER", 16, 16, FALSE, FALSE);
-    GstCaps *out_caps = get_int_mc_caps (1, "BYTE_ORDER", 8, 8, FALSE, FALSE);
+    GstCaps *in_caps = get_int_mc_caps (1, G_BYTE_ORDER, 16, 16, FALSE, FALSE);
+    GstCaps *out_caps = get_int_mc_caps (1, G_BYTE_ORDER, 8, 8, FALSE, FALSE);
 
     set_channel_positions (out_caps, 1, undefined_positions[1 - 1]);
     set_channel_positions (in_caps, 1, undefined_positions[1 - 1]);
@@ -1457,8 +1449,8 @@ GST_START_TEST (test_convert_undefined_multichannel)
   {
     guint16 in[] = { 0x8000, 0x2000 };
     guint8 out[] = { 0x80, 0x20 };
-    GstCaps *in_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, FALSE, FALSE);
-    GstCaps *out_caps = get_int_mc_caps (2, "BYTE_ORDER", 8, 8, FALSE, FALSE);
+    GstCaps *in_caps = get_int_mc_caps (2, G_BYTE_ORDER, 16, 16, FALSE, FALSE);
+    GstCaps *out_caps = get_int_mc_caps (2, G_BYTE_ORDER, 8, 8, FALSE, FALSE);
 
     set_channel_positions (out_caps, 2, undefined_positions[2 - 1]);
     set_channel_positions (in_caps, 2, undefined_positions[2 - 1]);
@@ -1471,8 +1463,8 @@ GST_START_TEST (test_convert_undefined_multichannel)
   {
     guint16 in[] = { 0x0000, 0x2000, 0x8000, 0x2000, 0x0000, 0xff00 };
     guint8 out[] = { 0x00, 0x20, 0x80, 0x20, 0x00, 0xff };
-    GstCaps *in_caps = get_int_mc_caps (6, "BYTE_ORDER", 16, 16, FALSE, FALSE);
-    GstCaps *out_caps = get_int_mc_caps (6, "BYTE_ORDER", 8, 8, FALSE, FALSE);
+    GstCaps *in_caps = get_int_mc_caps (6, G_BYTE_ORDER, 16, 16, FALSE, FALSE);
+    GstCaps *out_caps = get_int_mc_caps (6, G_BYTE_ORDER, 8, 8, FALSE, FALSE);
 
     set_channel_positions (out_caps, 6, undefined_positions[6 - 1]);
     set_channel_positions (in_caps, 6, undefined_positions[6 - 1]);
@@ -1487,8 +1479,8 @@ GST_START_TEST (test_convert_undefined_multichannel)
       0x0000, 0xff00, 0x0000
     };
     guint8 out[] = { 0x00, 0xff, 0x00, 0x20, 0x80, 0x20, 0x00, 0xff, 0x00 };
-    GstCaps *in_caps = get_int_mc_caps (9, "BYTE_ORDER", 16, 16, FALSE, FALSE);
-    GstCaps *out_caps = get_int_mc_caps (9, "BYTE_ORDER", 8, 8, FALSE, FALSE);
+    GstCaps *in_caps = get_int_mc_caps (9, G_BYTE_ORDER, 16, 16, FALSE, FALSE);
+    GstCaps *out_caps = get_int_mc_caps (9, G_BYTE_ORDER, 8, 8, FALSE, FALSE);
 
     set_channel_positions (out_caps, 9, undefined_positions[9 - 1]);
     set_channel_positions (in_caps, 9, undefined_positions[9 - 1]);
@@ -1507,8 +1499,8 @@ GST_START_TEST (test_convert_undefined_multichannel)
         { 0x00, 0xff, 0x00, 0x20, 0x80, 0x20, 0x00, 0xff, 0x00, 0xff, 0x00,
       0x20, 0x80, 0x20, 0x00
     };
-    GstCaps *in_caps = get_int_mc_caps (15, "BYTE_ORDER", 16, 16, FALSE, FALSE);
-    GstCaps *out_caps = get_int_mc_caps (15, "BYTE_ORDER", 8, 8, FALSE, FALSE);
+    GstCaps *in_caps = get_int_mc_caps (15, G_BYTE_ORDER, 16, 16, FALSE, FALSE);
+    GstCaps *out_caps = get_int_mc_caps (15, G_BYTE_ORDER, 8, 8, FALSE, FALSE);
 
     set_channel_positions (out_caps, 15, undefined_positions[15 - 1]);
     set_channel_positions (in_caps, 15, undefined_positions[15 - 1]);
@@ -1524,8 +1516,8 @@ GST_START_TEST (test_convert_undefined_multichannel)
   {
     guint16 in[] = { 0x2000 };
     guint16 out[] = { 0x2000 };
-    GstCaps *in_caps = get_int_mc_caps (1, "BYTE_ORDER", 16, 16, FALSE, FALSE);
-    GstCaps *out_caps = get_int_mc_caps (1, "BYTE_ORDER", 16, 16, FALSE, FALSE);
+    GstCaps *in_caps = get_int_mc_caps (1, G_BYTE_ORDER, 16, 16, FALSE, FALSE);
+    GstCaps *out_caps = get_int_mc_caps (1, G_BYTE_ORDER, 16, 16, FALSE, FALSE);
 
     set_channel_positions (out_caps, 1, undefined_positions[1 - 1]);
     set_channel_positions (in_caps, 1, undefined_positions[1 - 1]);
@@ -1538,8 +1530,8 @@ GST_START_TEST (test_convert_undefined_multichannel)
   {
     guint16 in[] = { 0x8000, 0x2000 };
     guint16 out[] = { 0x8000, 0x2000 };
-    GstCaps *in_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, FALSE, FALSE);
-    GstCaps *out_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, FALSE, FALSE);
+    GstCaps *in_caps = get_int_mc_caps (2, G_BYTE_ORDER, 16, 16, FALSE, FALSE);
+    GstCaps *out_caps = get_int_mc_caps (2, G_BYTE_ORDER, 16, 16, FALSE, FALSE);
 
     set_channel_positions (out_caps, 2, undefined_positions[2 - 1]);
     set_channel_positions (in_caps, 2, undefined_positions[2 - 1]);
@@ -1552,8 +1544,8 @@ GST_START_TEST (test_convert_undefined_multichannel)
   {
     guint16 in[] = { 0x0000, 0x2000, 0x8000, 0x2000, 0x0000, 0xff00 };
     guint16 out[] = { 0x0000, 0x2000, 0x8000, 0x2000, 0x0000, 0xff00 };
-    GstCaps *in_caps = get_int_mc_caps (6, "BYTE_ORDER", 16, 16, FALSE, FALSE);
-    GstCaps *out_caps = get_int_mc_caps (6, "BYTE_ORDER", 16, 16, FALSE, FALSE);
+    GstCaps *in_caps = get_int_mc_caps (6, G_BYTE_ORDER, 16, 16, FALSE, FALSE);
+    GstCaps *out_caps = get_int_mc_caps (6, G_BYTE_ORDER, 16, 16, FALSE, FALSE);
 
     set_channel_positions (out_caps, 6, undefined_positions[6 - 1]);
     set_channel_positions (in_caps, 6, undefined_positions[6 - 1]);
@@ -1570,8 +1562,8 @@ GST_START_TEST (test_convert_undefined_multichannel)
     guint16 out[] = { 0x0000, 0xff00, 0x0000, 0x2000, 0x8000, 0x2000,
       0x0000, 0xff00, 0x0000
     };
-    GstCaps *in_caps = get_int_mc_caps (9, "BYTE_ORDER", 16, 16, FALSE, FALSE);
-    GstCaps *out_caps = get_int_mc_caps (9, "BYTE_ORDER", 16, 16, FALSE, FALSE);
+    GstCaps *in_caps = get_int_mc_caps (9, G_BYTE_ORDER, 16, 16, FALSE, FALSE);
+    GstCaps *out_caps = get_int_mc_caps (9, G_BYTE_ORDER, 16, 16, FALSE, FALSE);
 
     set_channel_positions (out_caps, 9, undefined_positions[9 - 1]);
     set_channel_positions (in_caps, 9, undefined_positions[9 - 1]);
@@ -1590,9 +1582,9 @@ GST_START_TEST (test_convert_undefined_multichannel)
       0x0000, 0xff00, 0x0000, 0xff00, 0x0000, 0x2000, 0x8000, 0x2000,
       0x0000
     };
-    GstCaps *in_caps = get_int_mc_caps (15, "BYTE_ORDER", 16, 16, FALSE, FALSE);
+    GstCaps *in_caps = get_int_mc_caps (15, G_BYTE_ORDER, 16, 16, FALSE, FALSE);
     GstCaps *out_caps =
-        get_int_mc_caps (15, "BYTE_ORDER", 16, 16, FALSE, FALSE);
+        get_int_mc_caps (15, G_BYTE_ORDER, 16, 16, FALSE, FALSE);
 
     set_channel_positions (out_caps, 15, undefined_positions[15 - 1]);
     set_channel_positions (in_caps, 15, undefined_positions[15 - 1]);
@@ -1610,8 +1602,8 @@ GST_START_TEST (test_convert_undefined_multichannel)
       0x0000, 0x8000, 0x0000
     };
     gfloat out[] = { -1.0, 0.0, -1.0, 0.0, 0.0, 0.0, -1.0, 0.0, -1.0 };
-    GstCaps *in_caps = get_int_mc_caps (9, "BYTE_ORDER", 16, 16, FALSE, FALSE);
-    GstCaps *out_caps = get_float_mc_caps (9, "BYTE_ORDER", 32, FALSE);
+    GstCaps *in_caps = get_int_mc_caps (9, G_BYTE_ORDER, 16, 16, FALSE, FALSE);
+    GstCaps *out_caps = get_float_mc_caps (9, G_BYTE_ORDER, 32, FALSE);
 
     set_channel_positions (out_caps, 9, undefined_positions[9 - 1]);
     set_channel_positions (in_caps, 9, undefined_positions[9 - 1]);
@@ -1630,8 +1622,8 @@ GST_START_TEST (test_convert_undefined_multichannel)
         { -1.0, 0.0, -1.0, 0.0, 0.0, 0.0, -1.0, 0.0, -1.0, 0.0, -1.0, 0.0, 0.0,
       0.0, -1.0
     };
-    GstCaps *in_caps = get_int_mc_caps (15, "BYTE_ORDER", 16, 16, FALSE, FALSE);
-    GstCaps *out_caps = get_float_mc_caps (15, "BYTE_ORDER", 32, FALSE);
+    GstCaps *in_caps = get_int_mc_caps (15, G_BYTE_ORDER, 16, 16, FALSE, FALSE);
+    GstCaps *out_caps = get_float_mc_caps (15, G_BYTE_ORDER, 32, FALSE);
 
     set_channel_positions (out_caps, 15, undefined_positions[15 - 1]);
     set_channel_positions (in_caps, 15, undefined_positions[15 - 1]);
@@ -1648,8 +1640,8 @@ GST_START_TEST (test_convert_undefined_multichannel)
       0x0000, 0x8000, 0x0000
     };
     gfloat out[] = { -1.0, 0.0, -1.0, 0.0, 0.0, 0.0, -1.0, 0.0, -1.0 };
-    GstCaps *in_caps = get_int_mc_caps (9, "BYTE_ORDER", 16, 16, FALSE, FALSE);
-    GstCaps *out_caps = get_float_mc_caps (9, "BYTE_ORDER", 32, FALSE);
+    GstCaps *in_caps = get_int_mc_caps (9, G_BYTE_ORDER, 16, 16, FALSE, FALSE);
+    GstCaps *out_caps = get_float_mc_caps (9, G_BYTE_ORDER, 32, FALSE);
 
     //set_channel_positions (out_caps, 9, undefined_positions[9 - 1]);
     set_channel_positions (in_caps, 9, undefined_positions[9 - 1]);
@@ -1669,8 +1661,8 @@ GST_START_TEST (test_convert_undefined_multichannel)
         { -1.0, 0.0, -1.0, 0.0, 0.0, 0.0, -1.0, 0.0, -1.0, 0.0, -1.0, 0.0, 0.0,
       0.0, -1.0
     };
-    GstCaps *in_caps = get_int_mc_caps (15, "BYTE_ORDER", 16, 16, FALSE, FALSE);
-    GstCaps *out_caps = get_float_mc_caps (15, "BYTE_ORDER", 32, FALSE);
+    GstCaps *in_caps = get_int_mc_caps (15, G_BYTE_ORDER, 16, 16, FALSE, FALSE);
+    GstCaps *out_caps = get_float_mc_caps (15, G_BYTE_ORDER, 32, FALSE);
 
     //set_channel_positions (out_caps, 9, undefined_positions[9 - 1]);
     set_channel_positions (in_caps, 15, undefined_positions[15 - 1]);
@@ -1683,8 +1675,8 @@ GST_START_TEST (test_convert_undefined_multichannel)
   {
     guint16 in[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
     gfloat out[] = { -1.0, -1.0 };
-    GstCaps *in_caps = get_int_mc_caps (8, "BYTE_ORDER", 16, 16, FALSE, FALSE);
-    GstCaps *out_caps = get_float_mc_caps (2, "BYTE_ORDER", 32, FALSE);
+    GstCaps *in_caps = get_int_mc_caps (8, G_BYTE_ORDER, 16, 16, FALSE, FALSE);
+    GstCaps *out_caps = get_float_mc_caps (2, G_BYTE_ORDER, 32, FALSE);
 
     set_channel_positions (in_caps, 8, undefined_positions[8 - 1]);
 
@@ -1708,8 +1700,8 @@ GST_START_TEST (test_convert_undefined_multichannel)
     };
     gint16 in[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
     gint16 out[] = { 0, 0 };
-    GstCaps *in_caps = get_int_mc_caps (8, "BYTE_ORDER", 16, 16, TRUE, FALSE);
-    GstCaps *out_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, TRUE, FALSE);
+    GstCaps *in_caps = get_int_mc_caps (8, G_BYTE_ORDER, 16, 16, TRUE, FALSE);
+    GstCaps *out_caps = get_int_mc_caps (2, G_BYTE_ORDER, 16, 16, TRUE, FALSE);
 
     set_channel_positions (in_caps, 8, layout8ch);