check: Fix one leak in volume test
[platform/upstream/gstreamer.git] / tests / check / elements / volume.c
index b5fcd44..99806e3 100644 (file)
 
 #include <gst/base/gstbasetransform.h>
 #include <gst/check/gstcheck.h>
-#include <gst/controller/gstcontroller.h>
-#include <gst/interfaces/streamvolume.h>
+#include <gst/audio/streamvolume.h>
+#include <gst/controller/gstinterpolationcontrolsource.h>
+#include <gst/controller/gstdirectcontrolbinding.h>
 
 /* For ease of programming we use globals to keep refs for our floating
  * src and sink pads we create; otherwise we always have to do get_pad,
  * get_peer, and then remove references in every test function */
 static GstPad *mysrcpad, *mysinkpad;
 
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+#define FORMATS1 "{ S8, S16LE, S24LE, S32LE, F32LE, F64LE }"
+#define FORMATS2 "S8"
+#define FORMATS3 "S16LE"
+#define FORMATS4 "S24LE"
+#define FORMATS5 "S32LE"
+#define FORMATS6 "F32LE"
+#define FORMATS7 "F64LE"
+#define FORMATS8 "U16LE"
+#else
+#define FORMATS1 "{ S8, S16BE, S24BE, S32BE, F32BE, F64BE }"
+#define FORMATS2 "S8"
+#define FORMATS3 "S16BE"
+#define FORMATS4 "S24BE"
+#define FORMATS5 "S32BE"
+#define FORMATS6 "F32BE"
+#define FORMATS7 "F64BE"
+#define FORMATS8 "U16BE"
+#endif
 
 #define VOLUME_CAPS_TEMPLATE_STRING     \
-    "audio/x-raw-int, "                 \
-    "channels = (int) [ 1, MAX ], "     \
-    "rate = (int) [ 1,  MAX ], "        \
-    "endianness = (int) BYTE_ORDER, "   \
-    "width = (int) { 8, 16, 24, 32 }, " \
-    "depth = (int) { 8, 16, 24, 32 }, " \
-    "signed = (bool) TRUE; "            \
-    "audio/x-raw-float, "               \
+    "audio/x-raw, "                     \
+    "format = (string) "FORMATS1", "    \
     "channels = (int) [ 1, MAX ], "     \
     "rate = (int) [ 1,  MAX ], "        \
-    "endianness = (int) BYTE_ORDER, "   \
-    "width = (int) { 32, 64 }"          \
+    "layout = (string) interleaved"
 
 #define VOLUME_CAPS_STRING_S8           \
-    "audio/x-raw-int, "                 \
+    "audio/x-raw, "                     \
+    "format = (string) "FORMATS2", "   \
     "channels = (int) 1, "              \
-    "rate = (int) 44100, "              \
-    "endianness = (int) BYTE_ORDER, "   \
-    "width = (int) 8, "                 \
-    "depth = (int) 8, "                 \
-    "signed = (bool) TRUE"
+    "rate = (int) 44100,"               \
+    "layout = (string) interleaved"
 
 #define VOLUME_CAPS_STRING_S16          \
-    "audio/x-raw-int, "                 \
+    "audio/x-raw, "                     \
+    "format = (string) "FORMATS3", "   \
     "channels = (int) 1, "              \
-    "rate = (int) 44100, "              \
-    "endianness = (int) BYTE_ORDER, "   \
-    "width = (int) 16, "                \
-    "depth = (int) 16, "                \
-    "signed = (bool) TRUE"
+    "rate = (int) 44100,"               \
+    "layout = (string) interleaved"
 
 #define VOLUME_CAPS_STRING_S24          \
-    "audio/x-raw-int, "                 \
+    "audio/x-raw, "                     \
+    "format = (string) "FORMATS4", "   \
     "channels = (int) 1, "              \
-    "rate = (int) 44100, "              \
-    "endianness = (int) BYTE_ORDER, "   \
-    "width = (int) 24, "                \
-    "depth = (int) 24, "                \
-    "signed = (bool) TRUE"
+    "rate = (int) 44100,"               \
+    "layout = (string) interleaved"
 
 #define VOLUME_CAPS_STRING_S32          \
-    "audio/x-raw-int, "                 \
+    "audio/x-raw, "                     \
+    "format = (string) "FORMATS5", "   \
     "channels = (int) 1, "              \
-    "rate = (int) 44100, "              \
-    "endianness = (int) BYTE_ORDER, "   \
-    "width = (int) 32, "                \
-    "depth = (int) 32, "                \
-    "signed = (bool) TRUE"
+    "rate = (int) 44100,"               \
+    "layout = (string) interleaved"
 
 #define VOLUME_CAPS_STRING_F32          \
-    "audio/x-raw-float, "               \
+    "audio/x-raw, "                     \
+    "format = (string) "FORMATS6", "   \
     "channels = (int) 1, "              \
-    "rate = (int) 44100, "              \
-    "endianness = (int) BYTE_ORDER, "   \
-    "width = (int) 32"
+    "rate = (int) 44100,"               \
+    "layout = (string) interleaved"
 
 #define VOLUME_CAPS_STRING_F64          \
-    "audio/x-raw-float, "               \
+    "audio/x-raw, "                     \
+    "format = (string) "FORMATS7", "   \
     "channels = (int) 1, "              \
-    "rate = (int) 44100, "              \
-    "endianness = (int) BYTE_ORDER, "   \
-    "width = (int) 64"
+    "rate = (int) 44100,"               \
+    "layout = (string) interleaved"
 
 #define VOLUME_WRONG_CAPS_STRING        \
-    "audio/x-raw-int, "                 \
+    "audio/x-raw, "                     \
+    "format = (string) "FORMATS8", "   \
     "channels = (int) 1, "              \
-    "rate = (int) 44100, "              \
-    "endianness = (int) BYTE_ORDER, "   \
-    "width = (int) 16, "                \
-    "depth = (int) 16, "                \
-    "signed = (bool) FALSE"
+    "rate = (int) 44100,"               \
+    "layout = (string) interleaved"
 
 
 static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
@@ -125,8 +128,8 @@ setup_volume (void)
 
   GST_DEBUG ("setup_volume");
   volume = gst_check_setup_element ("volume");
-  mysrcpad = gst_check_setup_src_pad (volume, &srctemplate, NULL);
-  mysinkpad = gst_check_setup_sink_pad (volume, &sinktemplate, NULL);
+  mysrcpad = gst_check_setup_src_pad (volume, &srctemplate);
+  mysinkpad = gst_check_setup_sink_pad (volume, &sinktemplate);
   gst_pad_set_active (mysrcpad, TRUE);
   gst_pad_set_active (mysinkpad, TRUE);
 
@@ -185,7 +188,7 @@ GST_START_TEST (test_unity_s8)
   GstCaps *caps;
   gint8 in[2] = { 64, -16 };
   gint8 *res;
-  gsize size;
+  GstMapInfo map;
 
   volume = setup_volume ();
   fail_unless (gst_element_set_state (volume,
@@ -195,7 +198,7 @@ GST_START_TEST (test_unity_s8)
   inbuffer = gst_buffer_new_and_alloc (2);
   gst_buffer_fill (inbuffer, 0, in, 2);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S8);
-  gst_buffer_set_caps (inbuffer, caps);
+  gst_pad_set_caps (mysrcpad, caps);
   gst_caps_unref (caps);
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
 
@@ -206,10 +209,11 @@ GST_START_TEST (test_unity_s8)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
+  gst_buffer_map (outbuffer, &map, GST_MAP_READ);
+  res = (gint8 *) map.data;
   GST_INFO ("expected %+5d %+5d  real %+5d %+5d", in[0], in[1], res[0], res[1]);
   fail_unless (memcmp (res, in, 2) == 0);
-  gst_buffer_unmap (outbuffer, res, size);
+  gst_buffer_unmap (outbuffer, &map);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -226,7 +230,7 @@ GST_START_TEST (test_half_s8)
   gint8 in[2] = { 64, -16 };
   gint8 out[2] = { 32, -8 };
   gint8 *res;
-  gsize size;
+  GstMapInfo map;
 
   volume = setup_volume ();
   g_object_set (G_OBJECT (volume), "volume", 0.5, NULL);
@@ -237,7 +241,7 @@ GST_START_TEST (test_half_s8)
   inbuffer = gst_buffer_new_and_alloc (2);
   gst_buffer_fill (inbuffer, 0, in, 2);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S8);
-  gst_buffer_set_caps (inbuffer, caps);
+  gst_pad_set_caps (mysrcpad, caps);
   gst_caps_unref (caps);
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
   /* FIXME: reffing the inbuffer should make the transformation not be
@@ -253,11 +257,12 @@ GST_START_TEST (test_half_s8)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
+  gst_buffer_map (outbuffer, &map, GST_MAP_READ);
+  res = (gint8 *) map.data;
   GST_INFO ("expected %+5d %+5d  real %+5d %+5d", out[0], out[1], res[0],
       res[1]);
   fail_unless (memcmp (res, out, 2) == 0);
-  gst_buffer_unmap (outbuffer, res, size);
+  gst_buffer_unmap (outbuffer, &map);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -274,7 +279,7 @@ GST_START_TEST (test_double_s8)
   gint8 in[2] = { 64, -16 };
   gint8 out[2] = { 127, -32 };  /* notice the clamped sample */
   gint8 *res;
-  gsize size;
+  GstMapInfo map;
 
   volume = setup_volume ();
   g_object_set (G_OBJECT (volume), "volume", 2.0, NULL);
@@ -285,7 +290,7 @@ GST_START_TEST (test_double_s8)
   inbuffer = gst_buffer_new_and_alloc (2);
   gst_buffer_fill (inbuffer, 0, in, 2);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S8);
-  gst_buffer_set_caps (inbuffer, caps);
+  gst_pad_set_caps (mysrcpad, caps);
   gst_caps_unref (caps);
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
   /* FIXME: reffing the inbuffer should make the transformation not be
@@ -301,11 +306,12 @@ GST_START_TEST (test_double_s8)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
+  gst_buffer_map (outbuffer, &map, GST_MAP_READ);
+  res = (gint8 *) map.data;
   GST_INFO ("expected %+5d %+5d  real %+5d %+5d", out[0], out[1], res[0],
       res[1]);
   fail_unless (memcmp (res, out, 2) == 0);
-  gst_buffer_unmap (outbuffer, res, size);
+  gst_buffer_unmap (outbuffer, &map);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -313,27 +319,28 @@ GST_START_TEST (test_double_s8)
 
 GST_END_TEST;
 
-GST_START_TEST (test_mute_s8)
+GST_START_TEST (test_ten_s8)
 {
   GstElement *volume;
   GstBuffer *inbuffer;
   GstBuffer *outbuffer;
   GstCaps *caps;
-  gint8 in[2] = { 64, -16 };
-  gint8 out[2] = { 0, 0 };
+  gint8 in[2] = { 64, -10 };
+  gint8 out[2] = { 127, -100 }; /* notice the clamped sample */
   gint8 *res;
-  gsize size;
+  GstMapInfo map;
 
   volume = setup_volume ();
-  g_object_set (G_OBJECT (volume), "mute", TRUE, NULL);
+  g_object_set (G_OBJECT (volume), "volume", 10.0, NULL);
   fail_unless (gst_element_set_state (volume,
           GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
       "could not set to playing");
 
   inbuffer = gst_buffer_new_and_alloc (2);
   gst_buffer_fill (inbuffer, 0, in, 2);
+  fail_unless (gst_buffer_memcmp (inbuffer, 0, in, 2) == 0);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S8);
-  gst_buffer_set_caps (inbuffer, caps);
+  gst_pad_set_caps (mysrcpad, caps);
   gst_caps_unref (caps);
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
   /* FIXME: reffing the inbuffer should make the transformation not be
@@ -349,11 +356,59 @@ GST_START_TEST (test_mute_s8)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
+  gst_buffer_map (outbuffer, &map, GST_MAP_READ);
+  res = (gint8 *) map.data;
   GST_INFO ("expected %+5d %+5d  real %+5d %+5d", out[0], out[1], res[0],
       res[1]);
   fail_unless (memcmp (res, out, 2) == 0);
-  gst_buffer_unmap (outbuffer, res, size);
+  gst_buffer_unmap (outbuffer, &map);
+
+  /* cleanup */
+  cleanup_volume (volume);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_mute_s8)
+{
+  GstElement *volume;
+  GstBuffer *inbuffer;
+  GstBuffer *outbuffer;
+  GstCaps *caps;
+  gint8 in[2] = { 64, -16 };
+  gint8 out[2] = { 0, 0 };
+  GstMapInfo map;
+
+  volume = setup_volume ();
+  g_object_set (G_OBJECT (volume), "mute", TRUE, NULL);
+  fail_unless (gst_element_set_state (volume,
+          GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
+      "could not set to playing");
+
+  inbuffer = gst_buffer_new_and_alloc (2);
+  gst_buffer_fill (inbuffer, 0, in, 2);
+  caps = gst_caps_from_string (VOLUME_CAPS_STRING_S8);
+  gst_pad_set_caps (mysrcpad, caps);
+  gst_caps_unref (caps);
+  ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
+  /* FIXME: reffing the inbuffer should make the transformation not be
+   * inplace
+   gst_buffer_ref (inbuffer);
+   */
+
+  /* pushing gives away my reference ... */
+  fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
+  /* ... but it ends up being modified inplace and
+   * collected on the global buffer list */
+  ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
+  fail_unless_equals_int (g_list_length (buffers), 1);
+  fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
+  fail_unless (inbuffer == outbuffer);
+  gst_buffer_map (outbuffer, &map, GST_MAP_READ);
+  GST_INFO ("expected %+5d %+5d  real %+5d %+5d", out[0], out[1], map.data[0],
+      map.data[1]);
+  fail_unless (memcmp (map.data, out, 2) == 0);
+  gst_buffer_unmap (outbuffer, &map);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -367,8 +422,7 @@ GST_START_TEST (test_unity_s16)
   GstBuffer *inbuffer, *outbuffer;
   GstCaps *caps;
   gint16 in[2] = { 16384, -256 };
-  gint16 *res;
-  gsize size;
+  GstMapInfo map;
 
   volume = setup_volume ();
   fail_unless (gst_element_set_state (volume,
@@ -378,7 +432,7 @@ GST_START_TEST (test_unity_s16)
   inbuffer = gst_buffer_new_and_alloc (4);
   gst_buffer_fill (inbuffer, 0, in, 4);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
-  gst_buffer_set_caps (inbuffer, caps);
+  gst_pad_set_caps (mysrcpad, caps);
   gst_caps_unref (caps);
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
 
@@ -389,10 +443,11 @@ GST_START_TEST (test_unity_s16)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
-  GST_INFO ("expected %+5d %+5d  real %+5d %+5d", in[0], in[1], res[0], res[1]);
-  fail_unless (memcmp (res, in, 4) == 0);
-  gst_buffer_unmap (outbuffer, res, size);
+  gst_buffer_map (outbuffer, &map, GST_MAP_READ);
+  GST_INFO ("expected %+5d %+5d  real %+5d %+5d", in[0], in[1], map.data[0],
+      map.data[1]);
+  fail_unless (memcmp (map.data, in, 4) == 0);
+  gst_buffer_unmap (outbuffer, &map);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -408,8 +463,7 @@ GST_START_TEST (test_half_s16)
   GstCaps *caps;
   gint16 in[2] = { 16384, -256 };
   gint16 out[2] = { 8192, -128 };
-  gint16 *res;
-  gsize size;
+  GstMapInfo map;
 
   volume = setup_volume ();
   g_object_set (G_OBJECT (volume), "volume", 0.5, NULL);
@@ -420,7 +474,7 @@ GST_START_TEST (test_half_s16)
   inbuffer = gst_buffer_new_and_alloc (4);
   gst_buffer_fill (inbuffer, 0, in, 4);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
-  gst_buffer_set_caps (inbuffer, caps);
+  gst_pad_set_caps (mysrcpad, caps);
   gst_caps_unref (caps);
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
   /* FIXME: reffing the inbuffer should make the transformation not be
@@ -436,11 +490,11 @@ GST_START_TEST (test_half_s16)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
-  GST_INFO ("expected %+5d %+5d  real %+5d %+5d", out[0], out[1], res[0],
-      res[1]);
-  fail_unless (memcmp (res, out, 4) == 0);
-  gst_buffer_unmap (outbuffer, res, size);
+  gst_buffer_map (outbuffer, &map, GST_MAP_READ);
+  GST_INFO ("expected %+5d %+5d  real %+5d %+5d", out[0], out[1], map.data[0],
+      map.data[1]);
+  fail_unless (memcmp (map.data, out, 4) == 0);
+  gst_buffer_unmap (outbuffer, &map);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -456,8 +510,7 @@ GST_START_TEST (test_double_s16)
   GstCaps *caps;
   gint16 in[2] = { 16384, -256 };
   gint16 out[2] = { 32767, -512 };      /* notice the clamped sample */
-  gint16 *res;
-  gsize size;
+  GstMapInfo map;
 
   volume = setup_volume ();
   g_object_set (G_OBJECT (volume), "volume", 2.0, NULL);
@@ -468,7 +521,7 @@ GST_START_TEST (test_double_s16)
   inbuffer = gst_buffer_new_and_alloc (4);
   gst_buffer_fill (inbuffer, 0, in, 4);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
-  gst_buffer_set_caps (inbuffer, caps);
+  gst_pad_set_caps (mysrcpad, caps);
   gst_caps_unref (caps);
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
   /* FIXME: reffing the inbuffer should make the transformation not be
@@ -484,11 +537,59 @@ GST_START_TEST (test_double_s16)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
-  GST_INFO ("expected %+5d %+5d  real %+5d %+5d", out[0], out[1], res[0],
-      res[1]);
-  fail_unless (memcmp (res, out, 4) == 0);
-  gst_buffer_unmap (outbuffer, res, size);
+  gst_buffer_map (outbuffer, &map, GST_MAP_READ);
+  GST_INFO ("expected %+5d %+5d  real %+5d %+5d", out[0], out[1], map.data[0],
+      map.data[1]);
+  fail_unless (memcmp (map.data, out, 4) == 0);
+  gst_buffer_unmap (outbuffer, &map);
+
+  /* cleanup */
+  cleanup_volume (volume);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_ten_s16)
+{
+  GstElement *volume;
+  GstBuffer *inbuffer;
+  GstBuffer *outbuffer;
+  GstCaps *caps;
+  gint16 in[2] = { 16384, -10 };
+  gint16 out[2] = { 32767, -100 };      /* notice the clamped sample */
+  GstMapInfo map;
+
+  volume = setup_volume ();
+  g_object_set (G_OBJECT (volume), "volume", 10.0, NULL);
+  fail_unless (gst_element_set_state (volume,
+          GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
+      "could not set to playing");
+
+  inbuffer = gst_buffer_new_and_alloc (4);
+  gst_buffer_fill (inbuffer, 0, in, 4);
+  fail_unless (gst_buffer_memcmp (inbuffer, 0, in, 4) == 0);
+  caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
+  gst_pad_set_caps (mysrcpad, caps);
+  gst_caps_unref (caps);
+  ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
+  /* FIXME: reffing the inbuffer should make the transformation not be
+   * inplace
+   gst_buffer_ref (inbuffer);
+   */
+
+  /* pushing gives away my reference ... */
+  fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
+  /* ... but it ends up being modified inplace and
+   * collected on the global buffer list */
+  ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
+  fail_unless_equals_int (g_list_length (buffers), 1);
+  fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
+  fail_unless (inbuffer == outbuffer);
+  gst_buffer_map (outbuffer, &map, GST_MAP_READ);
+  GST_INFO ("expected %+5d %+5d  real %+5d %+5d", out[0], out[1], map.data[0],
+      map.data[1]);
+  fail_unless (memcmp (map.data, out, 4) == 0);
+  gst_buffer_unmap (outbuffer, &map);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -505,8 +606,7 @@ GST_START_TEST (test_mute_s16)
   GstCaps *caps;
   gint16 in[2] = { 16384, -256 };
   gint16 out[2] = { 0, 0 };
-  gint16 *res;
-  gsize size;
+  GstMapInfo map;
 
   volume = setup_volume ();
   g_object_set (G_OBJECT (volume), "mute", TRUE, NULL);
@@ -517,7 +617,7 @@ GST_START_TEST (test_mute_s16)
   inbuffer = gst_buffer_new_and_alloc (4);
   gst_buffer_fill (inbuffer, 0, in, 4);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
-  gst_buffer_set_caps (inbuffer, caps);
+  gst_pad_set_caps (mysrcpad, caps);
   gst_caps_unref (caps);
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
   /* FIXME: reffing the inbuffer should make the transformation not be
@@ -533,11 +633,11 @@ GST_START_TEST (test_mute_s16)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
-  GST_INFO ("expected %+5d %+5d  real %+5d %+5d", out[0], out[1], res[0],
-      res[1]);
-  fail_unless (memcmp (res, out, 4) == 0);
-  gst_buffer_unmap (outbuffer, res, size);
+  gst_buffer_map (outbuffer, &map, GST_MAP_READ);
+  GST_INFO ("expected %+5d %+5d  real %+5d %+5d", out[0], out[1], map.data[0],
+      map.data[1]);
+  fail_unless (memcmp (map.data, out, 4) == 0);
+  gst_buffer_unmap (outbuffer, &map);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -560,9 +660,8 @@ GST_START_TEST (test_unity_s24)
   GstCaps *caps;
   gint32 in_32[2] = { 4194304, -4096 };
   guint8 in[6];
-  guint8 *res;
+  GstMapInfo map;
   gint32 res_32[2];
-  gsize size;
 
   write_unaligned_u24 (in, in_32[0]);
   write_unaligned_u24 (in + 3, in_32[1]);
@@ -575,7 +674,7 @@ GST_START_TEST (test_unity_s24)
   inbuffer = gst_buffer_new_and_alloc (6);
   gst_buffer_fill (inbuffer, 0, in, 6);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S24);
-  gst_buffer_set_caps (inbuffer, caps);
+  gst_pad_set_caps (mysrcpad, caps);
   gst_caps_unref (caps);
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
 
@@ -586,15 +685,15 @@ GST_START_TEST (test_unity_s24)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
+  gst_buffer_map (outbuffer, &map, GST_MAP_READ);
 
-  res_32[0] = get_unaligned_i24 (res);
-  res_32[1] = get_unaligned_i24 ((res + 3));
+  res_32[0] = get_unaligned_i24 (map.data);
+  res_32[1] = get_unaligned_i24 ((map.data + 3));
 
   GST_INFO ("expected %+5d %+5d  real %+5d %+5d", in_32[0], in_32[1], res_32[0],
       res_32[1]);
-  fail_unless (memcmp (res, in, 6) == 0);
-  gst_buffer_unmap (outbuffer, res, size);
+  fail_unless (memcmp (map.data, in, 6) == 0);
+  gst_buffer_unmap (outbuffer, &map);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -610,10 +709,9 @@ GST_START_TEST (test_half_s24)
   GstCaps *caps;
   gint32 in_32[2] = { 4194304, -4096 };
   guint8 in[6];
-  guint8 *res;
+  GstMapInfo map;
   gint32 res_32[2];
   gint32 out_32[2] = { 2097152, -2048 };
-  gsize size;
 
   write_unaligned_u24 (in, in_32[0]);
   write_unaligned_u24 (in + 3, in_32[1]);
@@ -627,7 +725,7 @@ GST_START_TEST (test_half_s24)
   inbuffer = gst_buffer_new_and_alloc (6);
   gst_buffer_fill (inbuffer, 0, in, 6);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S24);
-  gst_buffer_set_caps (inbuffer, caps);
+  gst_pad_set_caps (mysrcpad, caps);
   gst_caps_unref (caps);
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
   /* FIXME: reffing the inbuffer should make the transformation not be
@@ -643,15 +741,15 @@ GST_START_TEST (test_half_s24)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
+  gst_buffer_map (outbuffer, &map, GST_MAP_READ);
 
-  res_32[0] = get_unaligned_i24 (res);
-  res_32[1] = get_unaligned_i24 ((res + 3));
+  res_32[0] = get_unaligned_i24 (map.data);
+  res_32[1] = get_unaligned_i24 ((map.data + 3));
 
   GST_INFO ("expected %+5d %+5d  real %+5d %+5d", out_32[0], out_32[1],
       res_32[0], res_32[1]);
   fail_unless (memcmp (res_32, out_32, 8) == 0);
-  gst_buffer_unmap (outbuffer, res, size);
+  gst_buffer_unmap (outbuffer, &map);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -667,10 +765,9 @@ GST_START_TEST (test_double_s24)
   GstCaps *caps;
   gint32 in_32[2] = { 4194304, -4096 };
   guint8 in[6];
-  guint8 *res;
+  GstMapInfo map;
   gint32 res_32[2];
   gint32 out_32[2] = { 8388607, -8192 };        /* notice the clamped sample */
-  gsize size;
 
   write_unaligned_u24 (in, in_32[0]);
   write_unaligned_u24 (in + 3, in_32[1]);
@@ -684,7 +781,7 @@ GST_START_TEST (test_double_s24)
   inbuffer = gst_buffer_new_and_alloc (6);
   gst_buffer_fill (inbuffer, 0, in, 6);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S24);
-  gst_buffer_set_caps (inbuffer, caps);
+  gst_pad_set_caps (mysrcpad, caps);
   gst_caps_unref (caps);
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
   /* FIXME: reffing the inbuffer should make the transformation not be
@@ -700,15 +797,15 @@ GST_START_TEST (test_double_s24)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
+  gst_buffer_map (outbuffer, &map, GST_MAP_READ);
 
-  res_32[0] = get_unaligned_i24 (res);
-  res_32[1] = get_unaligned_i24 ((res + 3));
+  res_32[0] = get_unaligned_i24 (map.data);
+  res_32[1] = get_unaligned_i24 ((map.data + 3));
 
   GST_INFO ("expected %+5d %+5d  real %+5d %+5d", out_32[0], out_32[1],
       res_32[0], res_32[1]);
   fail_unless (memcmp (res_32, out_32, 8) == 0);
-  gst_buffer_unmap (outbuffer, res, size);
+  gst_buffer_unmap (outbuffer, &map);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -716,6 +813,62 @@ GST_START_TEST (test_double_s24)
 
 GST_END_TEST;
 
+GST_START_TEST (test_ten_s24)
+{
+  GstElement *volume;
+  GstBuffer *inbuffer;
+  GstBuffer *outbuffer;
+  GstCaps *caps;
+  gint32 in_32[2] = { 4194304, -10 };
+  guint8 in[6];
+  GstMapInfo map;
+  gint32 res_32[2];
+  gint32 out_32[2] = { 8388607, -100 }; /* notice the clamped sample */
+
+  write_unaligned_u24 (in, in_32[0]);
+  write_unaligned_u24 (in + 3, in_32[1]);
+
+  volume = setup_volume ();
+  g_object_set (G_OBJECT (volume), "volume", 10.0, NULL);
+  fail_unless (gst_element_set_state (volume,
+          GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
+      "could not set to playing");
+
+  inbuffer = gst_buffer_new_and_alloc (6);
+  gst_buffer_fill (inbuffer, 0, in, 6);
+  fail_unless (gst_buffer_memcmp (inbuffer, 0, in, 6) == 0);
+  caps = gst_caps_from_string (VOLUME_CAPS_STRING_S24);
+  gst_pad_set_caps (mysrcpad, caps);
+  gst_caps_unref (caps);
+  ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
+  /* FIXME: reffing the inbuffer should make the transformation not be
+   * inplace
+   gst_buffer_ref (inbuffer);
+   */
+
+  /* pushing gives away my reference ... */
+  fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
+  /* ... but it ends up being modified inplace and
+   * collected on the global buffer list */
+  ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
+  fail_unless_equals_int (g_list_length (buffers), 1);
+  fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
+  fail_unless (inbuffer == outbuffer);
+  gst_buffer_map (outbuffer, &map, GST_MAP_READ);
+
+  res_32[0] = get_unaligned_i24 (map.data);
+  res_32[1] = get_unaligned_i24 ((map.data + 3));
+
+  GST_INFO ("expected %+5d %+5d  real %+5d %+5d", out_32[0], out_32[1],
+      res_32[0], res_32[1]);
+  fail_unless (memcmp (res_32, out_32, 8) == 0);
+  gst_buffer_unmap (outbuffer, &map);
+
+  /* cleanup */
+  cleanup_volume (volume);
+}
+
+GST_END_TEST;
 
 GST_START_TEST (test_mute_s24)
 {
@@ -725,10 +878,9 @@ GST_START_TEST (test_mute_s24)
   GstCaps *caps;
   gint32 in_32[2] = { 4194304, -4096 };
   guint8 in[6];
-  guint8 *res;
+  GstMapInfo map;
   gint32 res_32[2];
   gint32 out_32[2] = { 0, 0 };  /* notice the clamped sample */
-  gsize size;
 
   write_unaligned_u24 (in, in_32[0]);
   write_unaligned_u24 (in + 3, in_32[1]);
@@ -742,7 +894,7 @@ GST_START_TEST (test_mute_s24)
   inbuffer = gst_buffer_new_and_alloc (6);
   gst_buffer_fill (inbuffer, 0, in, 6);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S24);
-  gst_buffer_set_caps (inbuffer, caps);
+  gst_pad_set_caps (mysrcpad, caps);
   gst_caps_unref (caps);
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
   /* FIXME: reffing the inbuffer should make the transformation not be
@@ -759,15 +911,15 @@ GST_START_TEST (test_mute_s24)
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
 
-  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
+  gst_buffer_map (outbuffer, &map, GST_MAP_READ);
 
-  res_32[0] = get_unaligned_i24 (res);
-  res_32[1] = get_unaligned_i24 ((res + 3));
+  res_32[0] = get_unaligned_i24 (map.data);
+  res_32[1] = get_unaligned_i24 ((map.data + 3));
 
   GST_INFO ("expected %+5d %+5d  real %+5d %+5d", out_32[0], out_32[1],
       res_32[0], res_32[1]);
   fail_unless (memcmp (res_32, out_32, 8) == 0);
-  gst_buffer_unmap (outbuffer, res, size);
+  gst_buffer_unmap (outbuffer, &map);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -781,8 +933,7 @@ GST_START_TEST (test_unity_s32)
   GstBuffer *inbuffer, *outbuffer;
   GstCaps *caps;
   gint32 in[2] = { 1073741824, -65536 };
-  gint32 *res;
-  gsize size;
+  GstMapInfo map;
 
   volume = setup_volume ();
   fail_unless (gst_element_set_state (volume,
@@ -792,7 +943,7 @@ GST_START_TEST (test_unity_s32)
   inbuffer = gst_buffer_new_and_alloc (8);
   gst_buffer_fill (inbuffer, 0, in, 8);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S32);
-  gst_buffer_set_caps (inbuffer, caps);
+  gst_pad_set_caps (mysrcpad, caps);
   gst_caps_unref (caps);
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
 
@@ -803,10 +954,11 @@ GST_START_TEST (test_unity_s32)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
-  GST_INFO ("expected %+5d %+5d  real %+5d %+5d", in[0], in[1], res[0], res[1]);
-  fail_unless (memcmp (res, in, 8) == 0);
-  gst_buffer_unmap (outbuffer, res, size);
+  gst_buffer_map (outbuffer, &map, GST_MAP_READ);
+  GST_INFO ("expected %+5d %+5d  real %+5d %+5d", in[0], in[1], map.data[0],
+      map.data[1]);
+  fail_unless (memcmp (map.data, in, 8) == 0);
+  gst_buffer_unmap (outbuffer, &map);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -822,8 +974,7 @@ GST_START_TEST (test_half_s32)
   GstCaps *caps;
   gint32 in[2] = { 1073741824, -65536 };
   gint32 out[2] = { 536870912, -32768 };
-  gint32 *res;
-  gsize size;
+  GstMapInfo map;
 
   volume = setup_volume ();
   g_object_set (G_OBJECT (volume), "volume", 0.5, NULL);
@@ -834,7 +985,7 @@ GST_START_TEST (test_half_s32)
   inbuffer = gst_buffer_new_and_alloc (8);
   gst_buffer_fill (inbuffer, 0, in, 8);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S32);
-  gst_buffer_set_caps (inbuffer, caps);
+  gst_pad_set_caps (mysrcpad, caps);
   gst_caps_unref (caps);
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
   /* FIXME: reffing the inbuffer should make the transformation not be
@@ -850,11 +1001,11 @@ GST_START_TEST (test_half_s32)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
-  GST_INFO ("expected %+5d %+5d  real %+5d %+5d", out[0], out[1], res[0],
-      res[1]);
-  fail_unless (memcmp (res, out, 8) == 0);
-  gst_buffer_unmap (outbuffer, res, size);
+  gst_buffer_map (outbuffer, &map, GST_MAP_READ);
+  GST_INFO ("expected %+5d %+5d  real %+5d %+5d", out[0], out[1], map.data[0],
+      map.data[1]);
+  fail_unless (memcmp (map.data, out, 8) == 0);
+  gst_buffer_unmap (outbuffer, &map);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -870,8 +1021,7 @@ GST_START_TEST (test_double_s32)
   GstCaps *caps;
   gint32 in[2] = { 1073741824, -65536 };
   gint32 out[2] = { 2147483647, -131072 };      /* notice the clamped sample */
-  gint32 *res;
-  gsize size;
+  GstMapInfo map;
 
   volume = setup_volume ();
   g_object_set (G_OBJECT (volume), "volume", 2.0, NULL);
@@ -882,7 +1032,7 @@ GST_START_TEST (test_double_s32)
   inbuffer = gst_buffer_new_and_alloc (8);
   gst_buffer_fill (inbuffer, 0, in, 8);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S32);
-  gst_buffer_set_caps (inbuffer, caps);
+  gst_pad_set_caps (mysrcpad, caps);
   gst_caps_unref (caps);
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
   /* FIXME: reffing the inbuffer should make the transformation not be
@@ -898,11 +1048,11 @@ GST_START_TEST (test_double_s32)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
-  GST_INFO ("expected %+5d %+5d  real %+5d %+5d", out[0], out[1], res[0],
-      res[1]);
-  fail_unless (memcmp (res, out, 8) == 0);
-  gst_buffer_unmap (outbuffer, res, size);
+  gst_buffer_map (outbuffer, &map, GST_MAP_READ);
+  GST_INFO ("expected %+5d %+5d  real %+5d %+5d", out[0], out[1], map.data[0],
+      map.data[1]);
+  fail_unless (memcmp (map.data, out, 8) == 0);
+  gst_buffer_unmap (outbuffer, &map);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -910,6 +1060,53 @@ GST_START_TEST (test_double_s32)
 
 GST_END_TEST;
 
+GST_START_TEST (test_ten_s32)
+{
+  GstElement *volume;
+  GstBuffer *inbuffer;
+  GstBuffer *outbuffer;
+  GstCaps *caps;
+  gint32 in[2] = { 1073741824, -10 };
+  gint32 out[2] = { 2147483647, -100 }; /* notice the clamped sample */
+  GstMapInfo map;
+
+  volume = setup_volume ();
+  g_object_set (G_OBJECT (volume), "volume", 10.0, NULL);
+  fail_unless (gst_element_set_state (volume,
+          GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
+      "could not set to playing");
+
+  inbuffer = gst_buffer_new_and_alloc (8);
+  gst_buffer_fill (inbuffer, 0, in, 8);
+  fail_unless (gst_buffer_memcmp (inbuffer, 0, in, 8) == 0);
+  caps = gst_caps_from_string (VOLUME_CAPS_STRING_S32);
+  gst_pad_set_caps (mysrcpad, caps);
+  gst_caps_unref (caps);
+  ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
+  /* FIXME: reffing the inbuffer should make the transformation not be
+   * inplace
+   gst_buffer_ref (inbuffer);
+   */
+
+  /* pushing gives away my reference ... */
+  fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
+  /* ... but it ends up being modified inplace and
+   * collected on the global buffer list */
+  ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
+  fail_unless_equals_int (g_list_length (buffers), 1);
+  fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
+  fail_unless (inbuffer == outbuffer);
+  gst_buffer_map (outbuffer, &map, GST_MAP_READ);
+  GST_INFO ("expected %+5d %+5d  real %+5d %+5d", out[0], out[1], map.data[0],
+      map.data[1]);
+  fail_unless (memcmp (map.data, out, 8) == 0);
+  gst_buffer_unmap (outbuffer, &map);
+
+  /* cleanup */
+  cleanup_volume (volume);
+}
+
+GST_END_TEST;
 
 GST_START_TEST (test_mute_s32)
 {
@@ -919,8 +1116,7 @@ GST_START_TEST (test_mute_s32)
   GstCaps *caps;
   gint32 in[2] = { 1073741824, -65536 };
   gint32 out[2] = { 0, 0 };
-  gint32 *res;
-  gsize size;
+  GstMapInfo map;
 
   volume = setup_volume ();
   g_object_set (G_OBJECT (volume), "mute", TRUE, NULL);
@@ -931,7 +1127,7 @@ GST_START_TEST (test_mute_s32)
   inbuffer = gst_buffer_new_and_alloc (8);
   gst_buffer_fill (inbuffer, 0, in, 8);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S32);
-  gst_buffer_set_caps (inbuffer, caps);
+  gst_pad_set_caps (mysrcpad, caps);
   gst_caps_unref (caps);
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
   /* FIXME: reffing the inbuffer should make the transformation not be
@@ -947,11 +1143,11 @@ GST_START_TEST (test_mute_s32)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
-  GST_INFO ("expected %+5d %+5d  real %+5d %+5d", out[0], out[1], res[0],
-      res[1]);
-  fail_unless (memcmp (res, out, 8) == 0);
-  gst_buffer_unmap (outbuffer, res, size);
+  gst_buffer_map (outbuffer, &map, GST_MAP_READ);
+  GST_INFO ("expected %+5d %+5d  real %+5d %+5d", out[0], out[1], map.data[0],
+      map.data[1]);
+  fail_unless (memcmp (map.data, out, 8) == 0);
+  gst_buffer_unmap (outbuffer, &map);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -964,9 +1160,8 @@ GST_START_TEST (test_unity_f32)
   GstElement *volume;
   GstBuffer *inbuffer, *outbuffer;
   GstCaps *caps;
-  gfloat in[2] = { 0.75, -0.25 };
-  gfloat *res;
-  gsize size;
+  gfloat in[2] = { 0.75, -0.25 }, *res;
+  GstMapInfo map;
 
   volume = setup_volume ();
   fail_unless (gst_element_set_state (volume,
@@ -974,9 +1169,9 @@ GST_START_TEST (test_unity_f32)
       "could not set to playing");
 
   inbuffer = gst_buffer_new_and_alloc (8);
-  gst_buffer_fill (inbuffer, 0, in, 8);
+  gst_buffer_fill (inbuffer, 0, in, sizeof (in));
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_F32);
-  gst_buffer_set_caps (inbuffer, caps);
+  gst_pad_set_caps (mysrcpad, caps);
   gst_caps_unref (caps);
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
 
@@ -987,11 +1182,13 @@ GST_START_TEST (test_unity_f32)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
-  GST_INFO ("expected %+1.4f %+1.4f  real %+1.4f %+1.4f", in[0], in[1], res[0],
-      res[1]);
+  gst_buffer_map (outbuffer, &map, GST_MAP_READ);
+  res = (gfloat *) map.data;
+  GST_INFO ("expected %+1.4f %+1.4f  real %+1.4f %+1.4f", in[0], in[1],
+      res[0], res[1]);
   fail_unless_equals_float (res[0], in[0]);
   fail_unless_equals_float (res[1], in[1]);
+  gst_buffer_unmap (outbuffer, &map);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -1008,7 +1205,7 @@ GST_START_TEST (test_half_f32)
   gfloat in[2] = { 0.75, -0.25 };
   gfloat out[2] = { 0.375, -0.125 };
   gfloat *res;
-  gsize size;
+  GstMapInfo map;
 
   volume = setup_volume ();
   g_object_set (G_OBJECT (volume), "volume", 0.5, NULL);
@@ -1019,7 +1216,7 @@ GST_START_TEST (test_half_f32)
   inbuffer = gst_buffer_new_and_alloc (8);
   gst_buffer_fill (inbuffer, 0, in, 8);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_F32);
-  gst_buffer_set_caps (inbuffer, caps);
+  gst_pad_set_caps (mysrcpad, caps);
   gst_caps_unref (caps);
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
   /* FIXME: reffing the inbuffer should make the transformation not be
@@ -1035,12 +1232,13 @@ GST_START_TEST (test_half_f32)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
+  gst_buffer_map (outbuffer, &map, GST_MAP_READ);
+  res = (gfloat *) map.data;
   GST_INFO ("expected %+1.4f %+1.4f  real %+1.4f %+1.4f", out[0], out[1],
       res[0], res[1]);
   fail_unless_equals_float (res[0], out[0]);
   fail_unless_equals_float (res[1], out[1]);
-  gst_buffer_unmap (outbuffer, res, size);
+  gst_buffer_unmap (outbuffer, &map);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -1057,7 +1255,7 @@ GST_START_TEST (test_double_f32)
   gfloat in[2] = { 0.75, -0.25 };
   gfloat out[2] = { 1.5, -0.5 };        /* nothing is clamped */
   gfloat *res;
-  gsize size;
+  GstMapInfo map;
 
   volume = setup_volume ();
   g_object_set (G_OBJECT (volume), "volume", 2.0, NULL);
@@ -1068,7 +1266,58 @@ GST_START_TEST (test_double_f32)
   inbuffer = gst_buffer_new_and_alloc (8);
   gst_buffer_fill (inbuffer, 0, in, 8);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_F32);
-  gst_buffer_set_caps (inbuffer, caps);
+  gst_pad_set_caps (mysrcpad, caps);
+  gst_caps_unref (caps);
+  ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
+  /* FIXME: reffing the inbuffer should make the transformation not be
+   * inplace
+   gst_buffer_ref (inbuffer);
+   */
+
+  /* pushing gives away my reference ... */
+  fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
+  /* ... but it ends up being modified inplace and
+   * collected on the global buffer list */
+  ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
+  fail_unless_equals_int (g_list_length (buffers), 1);
+  fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
+  fail_unless (inbuffer == outbuffer);
+  gst_buffer_map (outbuffer, &map, GST_MAP_READ);
+  res = (gfloat *) map.data;
+  GST_INFO ("expected %+1.4f %+1.4f  real %+1.4f %+1.4f", out[0], out[1],
+      res[0], res[1]);
+  fail_unless_equals_float (res[0], out[0]);
+  fail_unless_equals_float (res[1], out[1]);
+  gst_buffer_unmap (outbuffer, &map);
+
+  /* cleanup */
+  cleanup_volume (volume);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_ten_f32)
+{
+  GstElement *volume;
+  GstBuffer *inbuffer;
+  GstBuffer *outbuffer;
+  GstCaps *caps;
+  gfloat in[2] = { 0.75, -0.25 };
+  gfloat out[2] = { 7.5, -2.5 };        /* nothing is clamped */
+  gfloat *res;
+  GstMapInfo map;
+
+  volume = setup_volume ();
+  g_object_set (G_OBJECT (volume), "volume", 10.0, NULL);
+  fail_unless (gst_element_set_state (volume,
+          GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
+      "could not set to playing");
+
+  inbuffer = gst_buffer_new_and_alloc (8);
+  gst_buffer_fill (inbuffer, 0, in, 8);
+  fail_unless (gst_buffer_memcmp (inbuffer, 0, in, 8) == 0);
+  caps = gst_caps_from_string (VOLUME_CAPS_STRING_F32);
+  gst_pad_set_caps (mysrcpad, caps);
   gst_caps_unref (caps);
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
   /* FIXME: reffing the inbuffer should make the transformation not be
@@ -1084,12 +1333,13 @@ GST_START_TEST (test_double_f32)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
+  gst_buffer_map (outbuffer, &map, GST_MAP_READ);
+  res = (gfloat *) map.data;
   GST_INFO ("expected %+1.4f %+1.4f  real %+1.4f %+1.4f", out[0], out[1],
       res[0], res[1]);
   fail_unless_equals_float (res[0], out[0]);
   fail_unless_equals_float (res[1], out[1]);
-  gst_buffer_unmap (outbuffer, res, size);
+  gst_buffer_unmap (outbuffer, &map);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -1107,7 +1357,7 @@ GST_START_TEST (test_mute_f32)
   gfloat in[2] = { 0.75, -0.25 };
   gfloat out[2] = { 0, 0 };
   gfloat *res;
-  gsize size;
+  GstMapInfo map;
 
   volume = setup_volume ();
   g_object_set (G_OBJECT (volume), "mute", TRUE, NULL);
@@ -1118,7 +1368,7 @@ GST_START_TEST (test_mute_f32)
   inbuffer = gst_buffer_new_and_alloc (8);
   gst_buffer_fill (inbuffer, 0, in, 8);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_F32);
-  gst_buffer_set_caps (inbuffer, caps);
+  gst_pad_set_caps (mysrcpad, caps);
   gst_caps_unref (caps);
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
   /* FIXME: reffing the inbuffer should make the transformation not be
@@ -1134,12 +1384,13 @@ GST_START_TEST (test_mute_f32)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
+  gst_buffer_map (outbuffer, &map, GST_MAP_READ);
+  res = (gfloat *) map.data;
   GST_INFO ("expected %+1.4f %+1.4f  real %+1.4f %+1.4f", out[0], out[1],
       res[0], res[1]);
   fail_unless_equals_float (res[0], out[0]);
   fail_unless_equals_float (res[1], out[1]);
-  gst_buffer_unmap (outbuffer, res, size);
+  gst_buffer_unmap (outbuffer, &map);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -1154,7 +1405,7 @@ GST_START_TEST (test_unity_f64)
   GstCaps *caps;
   gdouble in[2] = { 0.75, -0.25 };
   gdouble *res;
-  gsize size;
+  GstMapInfo map;
 
   volume = setup_volume ();
   fail_unless (gst_element_set_state (volume,
@@ -1164,7 +1415,7 @@ GST_START_TEST (test_unity_f64)
   inbuffer = gst_buffer_new_and_alloc (16);
   gst_buffer_fill (inbuffer, 0, in, 16);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_F64);
-  gst_buffer_set_caps (inbuffer, caps);
+  gst_pad_set_caps (mysrcpad, caps);
   gst_caps_unref (caps);
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
 
@@ -1175,11 +1426,13 @@ GST_START_TEST (test_unity_f64)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
-  GST_INFO ("expected %+1.4f %+1.4f  real %+1.4f %+1.4f", in[0], in[1], res[0],
-      res[1]);
+  gst_buffer_map (outbuffer, &map, GST_MAP_READ);
+  res = (gdouble *) map.data;
+  GST_INFO ("expected %+1.4f %+1.4f  real %+1.4f %+1.4f", in[0], in[1],
+      res[0], res[1]);
   fail_unless_equals_float (res[0], in[0]);
   fail_unless_equals_float (res[1], in[1]);
+  gst_buffer_unmap (outbuffer, &map);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -1196,7 +1449,7 @@ GST_START_TEST (test_half_f64)
   gdouble in[2] = { 0.75, -0.25 };
   gdouble out[2] = { 0.375, -0.125 };
   gdouble *res;
-  gsize size;
+  GstMapInfo map;
 
   volume = setup_volume ();
   g_object_set (G_OBJECT (volume), "volume", 0.5, NULL);
@@ -1207,7 +1460,7 @@ GST_START_TEST (test_half_f64)
   inbuffer = gst_buffer_new_and_alloc (16);
   gst_buffer_fill (inbuffer, 0, in, 16);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_F64);
-  gst_buffer_set_caps (inbuffer, caps);
+  gst_pad_set_caps (mysrcpad, caps);
   gst_caps_unref (caps);
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
   /* FIXME: reffing the inbuffer should make the transformation not be
@@ -1223,12 +1476,13 @@ GST_START_TEST (test_half_f64)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
+  gst_buffer_map (outbuffer, &map, GST_MAP_READ);
+  res = (gdouble *) map.data;
   GST_INFO ("expected %+1.4f %+1.4f  real %+1.4f %+1.4f", out[0], out[1],
       res[0], res[1]);
   fail_unless_equals_float (res[0], out[0]);
   fail_unless_equals_float (res[1], out[1]);
-  gst_buffer_unmap (outbuffer, res, size);
+  gst_buffer_unmap (outbuffer, &map);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -1245,7 +1499,7 @@ GST_START_TEST (test_double_f64)
   gdouble in[2] = { 0.75, -0.25 };
   gdouble out[2] = { 1.5, -0.5 };       /* nothing is clamped */
   gdouble *res;
-  gsize size;
+  GstMapInfo map;
 
   volume = setup_volume ();
   g_object_set (G_OBJECT (volume), "volume", 2.0, NULL);
@@ -1256,7 +1510,7 @@ GST_START_TEST (test_double_f64)
   inbuffer = gst_buffer_new_and_alloc (16);
   gst_buffer_fill (inbuffer, 0, in, 16);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_F64);
-  gst_buffer_set_caps (inbuffer, caps);
+  gst_pad_set_caps (mysrcpad, caps);
   gst_caps_unref (caps);
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
   /* FIXME: reffing the inbuffer should make the transformation not be
@@ -1272,12 +1526,64 @@ GST_START_TEST (test_double_f64)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
+  gst_buffer_map (outbuffer, &map, GST_MAP_READ);
+  res = (gdouble *) map.data;
   GST_INFO ("expected %+1.4f %+1.4f  real %+1.4f %+1.4f", out[0], out[1],
       res[0], res[1]);
   fail_unless_equals_float (res[0], out[0]);
   fail_unless_equals_float (res[1], out[1]);
-  gst_buffer_unmap (outbuffer, res, size);
+  gst_buffer_unmap (outbuffer, &map);
+
+  /* cleanup */
+  cleanup_volume (volume);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_ten_f64)
+{
+  GstElement *volume;
+  GstBuffer *inbuffer;
+  GstBuffer *outbuffer;
+  GstCaps *caps;
+  gdouble in[2] = { 0.75, -0.25 };
+  gdouble out[2] = { 7.5, -2.5 };       /* nothing is clamped */
+  gdouble *res;
+  GstMapInfo map;
+
+  volume = setup_volume ();
+  g_object_set (G_OBJECT (volume), "volume", 10.0, NULL);
+  fail_unless (gst_element_set_state (volume,
+          GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
+      "could not set to playing");
+
+  inbuffer = gst_buffer_new_and_alloc (16);
+  gst_buffer_fill (inbuffer, 0, in, 16);
+  fail_unless (gst_buffer_memcmp (inbuffer, 0, in, 16) == 0);
+  caps = gst_caps_from_string (VOLUME_CAPS_STRING_F64);
+  gst_pad_set_caps (mysrcpad, caps);
+  gst_caps_unref (caps);
+  ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
+  /* FIXME: reffing the inbuffer should make the transformation not be
+   * inplace
+   gst_buffer_ref (inbuffer);
+   */
+
+  /* pushing gives away my reference ... */
+  fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
+  /* ... but it ends up being modified inplace and
+   * collected on the global buffer list */
+  ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
+  fail_unless_equals_int (g_list_length (buffers), 1);
+  fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
+  fail_unless (inbuffer == outbuffer);
+  gst_buffer_map (outbuffer, &map, GST_MAP_READ);
+  res = (gdouble *) map.data;
+  GST_INFO ("expected %+1.4f %+1.4f  real %+1.4f %+1.4f", out[0], out[1],
+      res[0], res[1]);
+  fail_unless_equals_float (res[0], out[0]);
+  fail_unless_equals_float (res[1], out[1]);
+  gst_buffer_unmap (outbuffer, &map);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -1295,7 +1601,7 @@ GST_START_TEST (test_mute_f64)
   gdouble in[2] = { 0.75, -0.25 };
   gdouble out[2] = { 0, 0 };
   gdouble *res;
-  gsize size;
+  GstMapInfo map;
 
   volume = setup_volume ();
   g_object_set (G_OBJECT (volume), "mute", TRUE, NULL);
@@ -1306,7 +1612,7 @@ GST_START_TEST (test_mute_f64)
   inbuffer = gst_buffer_new_and_alloc (16);
   gst_buffer_fill (inbuffer, 0, in, 16);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_F64);
-  gst_buffer_set_caps (inbuffer, caps);
+  gst_pad_set_caps (mysrcpad, caps);
   gst_caps_unref (caps);
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
   /* FIXME: reffing the inbuffer should make the transformation not be
@@ -1322,12 +1628,13 @@ GST_START_TEST (test_mute_f64)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
+  gst_buffer_map (outbuffer, &map, GST_MAP_READ);
+  res = (gdouble *) map.data;
   GST_INFO ("expected %+1.4f %+1.4f  real %+1.4f %+1.4f", out[0], out[1],
       res[0], res[1]);
   fail_unless_equals_float (res[0], out[0]);
   fail_unless_equals_float (res[1], out[1]);
-  gst_buffer_unmap (outbuffer, res, size);
+  gst_buffer_unmap (outbuffer, &map);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -1354,7 +1661,7 @@ GST_START_TEST (test_wrong_caps)
   inbuffer = gst_buffer_new_and_alloc (4);
   gst_buffer_fill (inbuffer, 0, in, 4);
   caps = gst_caps_from_string (VOLUME_WRONG_CAPS_STRING);
-  gst_buffer_set_caps (inbuffer, caps);
+  gst_pad_set_caps (mysrcpad, caps);
   gst_caps_unref (caps);
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
   gst_buffer_ref (inbuffer);
@@ -1388,8 +1695,7 @@ GST_START_TEST (test_passthrough)
   GstBuffer *inbuffer, *outbuffer;
   GstCaps *caps;
   gint16 in[2] = { 16384, -256 };
-  gint16 *res;
-  gsize size;
+  GstMapInfo map;
 
   volume = setup_volume ();
   g_object_set (G_OBJECT (volume), "volume", 1.0, NULL);
@@ -1400,7 +1706,7 @@ GST_START_TEST (test_passthrough)
   inbuffer = gst_buffer_new_and_alloc (4);
   gst_buffer_fill (inbuffer, 0, in, 4);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
-  gst_buffer_set_caps (inbuffer, caps);
+  gst_pad_set_caps (mysrcpad, caps);
   gst_caps_unref (caps);
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
 
@@ -1411,10 +1717,11 @@ GST_START_TEST (test_passthrough)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
-  GST_INFO ("expected %+5d %+5d  real %+5d %+5d", in[0], in[1], res[0], res[1]);
-  fail_unless (memcmp (res, in, 4) == 0);
-  gst_buffer_unmap (outbuffer, res, size);
+  gst_buffer_map (outbuffer, &map, GST_MAP_READ);
+  GST_INFO ("expected %+5d %+5d  real %+5d %+5d", in[0], in[1], map.data[0],
+      map.data[1]);
+  fail_unless (memcmp (map.data, in, 4) == 0);
+  gst_buffer_unmap (outbuffer, &map);
 
   /* cleanup */
   cleanup_volume (volume);
@@ -1424,35 +1731,26 @@ GST_END_TEST;
 
 GST_START_TEST (test_controller_usability)
 {
-  GstInterpolationControlSource *csource;
-  GstController *c;
+  GstControlSource *cs;
+  GstTimedValueControlSource *tvcs;
+  GstControlBinding *cb;
   GstElement *volume;
-  GValue value = { 0, };
 
-  /* note: the volume element should init the controller library for us */
   volume = setup_volume ();
 
-  c = gst_controller_new (G_OBJECT (volume), "volume", NULL);
+  /* this shouldn't crash, whether this mode is implemented or not */
+  cs = gst_interpolation_control_source_new ();
+  g_object_set (cs, "mode", GST_INTERPOLATION_MODE_CUBIC, NULL);
+  cb = gst_direct_control_binding_new (GST_OBJECT_CAST (volume), "volume", cs);
+  gst_object_add_control_binding (GST_OBJECT_CAST (volume), cb);
 
-  fail_unless (GST_IS_CONTROLLER (c));
+  tvcs = (GstTimedValueControlSource *) cs;
+  gst_timed_value_control_source_set (tvcs, 0 * GST_SECOND, 0.0);
+  gst_timed_value_control_source_set (tvcs, 5 * GST_SECOND, 1.0);
+  gst_timed_value_control_source_set (tvcs, 10 * GST_SECOND, 0.0);
 
-  /* this shouldn't crash, whether this mode is implemented or not */
-  csource = gst_interpolation_control_source_new ();
-  gst_interpolation_control_source_set_interpolation_mode (csource,
-      GST_INTERPOLATE_CUBIC);
-  gst_controller_set_control_source (c, "volume", GST_CONTROL_SOURCE (csource));
-  g_object_unref (csource);
-
-  g_value_init (&value, G_TYPE_DOUBLE);
-  g_value_set_double (&value, 0.0);
-  gst_interpolation_control_source_set (csource, 0 * GST_SECOND, &value);
-  g_value_set_double (&value, 1.0);
-  gst_interpolation_control_source_set (csource, 5 * GST_SECOND, &value);
-  g_value_set_double (&value, 0.0);
-  gst_interpolation_control_source_set (csource, 10 * GST_SECOND, &value);
-  g_value_unset (&value);
-
-  g_object_unref (c);
+  gst_object_unref (cs);
+  gst_object_remove_control_binding (GST_OBJECT_CAST (volume), cb);
 
   cleanup_volume (volume);
 }
@@ -1461,26 +1759,20 @@ GST_END_TEST;
 
 GST_START_TEST (test_controller_processing)
 {
-  GstInterpolationControlSource *csource;
-  GstController *c;
+  GstControlSource *cs;
   GstElement *volume;
   GstBuffer *inbuffer, *outbuffer;
   GstCaps *caps;
   gint16 in[2] = { 16384, -256 };
-  gint16 *res;
-  gsize size;
+  GstMapInfo map;
+  GstSegment seg;
 
   volume = setup_volume ();
 
-  c = gst_controller_new (G_OBJECT (volume), "volume", NULL);
-
-  fail_unless (GST_IS_CONTROLLER (c));
-
-  csource = gst_interpolation_control_source_new ();
-  gst_interpolation_control_source_set_interpolation_mode (csource,
-      GST_INTERPOLATE_CUBIC);
-  gst_controller_set_control_source (c, "volume", GST_CONTROL_SOURCE (csource));
-  g_object_unref (csource);
+  cs = gst_interpolation_control_source_new ();
+  g_object_set (cs, "mode", GST_INTERPOLATION_MODE_CUBIC, NULL);
+  gst_object_add_control_binding (GST_OBJECT_CAST (volume),
+      gst_direct_control_binding_new (GST_OBJECT_CAST (volume), "volume", cs));
 
   fail_unless (gst_element_set_state (volume,
           GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
@@ -1489,11 +1781,15 @@ GST_START_TEST (test_controller_processing)
   inbuffer = gst_buffer_new_and_alloc (4);
   gst_buffer_fill (inbuffer, 0, in, 4);
   caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
-  gst_buffer_set_caps (inbuffer, caps);
+  gst_pad_set_caps (mysrcpad, caps);
   GST_BUFFER_TIMESTAMP (inbuffer) = 0;
   gst_caps_unref (caps);
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
 
+  gst_segment_init (&seg, GST_FORMAT_TIME);
+  fail_unless (gst_pad_push_event (mysrcpad,
+          gst_event_new_segment (&seg)) == TRUE);
+
   /* pushing gives away my reference ... */
   fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
   /* ... but it ends up being collected on the global buffer list */
@@ -1501,13 +1797,13 @@ GST_START_TEST (test_controller_processing)
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   fail_unless (inbuffer == outbuffer);
-  res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
-  GST_INFO ("expected %+5d %+5d  real %+5d %+5d", in[0], in[1], res[0], res[1]);
-  fail_unless (memcmp (res, in, 4) == 0);
-  gst_buffer_unmap (outbuffer, res, size);
-
-  g_object_unref (c);
+  gst_buffer_map (outbuffer, &map, GST_MAP_READ);
+  GST_INFO ("expected %+5d %+5d  real %+5d %+5d", in[0], in[1], map.data[0],
+      map.data[1]);
+  fail_unless (memcmp (map.data, in, 4) == 0);
+  gst_buffer_unmap (outbuffer, &map);
 
+  gst_object_unref (cs);
   cleanup_volume (volume);
 }
 
@@ -1524,26 +1820,32 @@ volume_suite (void)
   tcase_add_test (tc_chain, test_unity_s8);
   tcase_add_test (tc_chain, test_half_s8);
   tcase_add_test (tc_chain, test_double_s8);
+  tcase_add_test (tc_chain, test_ten_s8);
   tcase_add_test (tc_chain, test_mute_s8);
   tcase_add_test (tc_chain, test_unity_s16);
   tcase_add_test (tc_chain, test_half_s16);
   tcase_add_test (tc_chain, test_double_s16);
+  tcase_add_test (tc_chain, test_ten_s16);
   tcase_add_test (tc_chain, test_mute_s16);
   tcase_add_test (tc_chain, test_unity_s24);
   tcase_add_test (tc_chain, test_half_s24);
   tcase_add_test (tc_chain, test_double_s24);
+  tcase_add_test (tc_chain, test_ten_s24);
   tcase_add_test (tc_chain, test_mute_s24);
   tcase_add_test (tc_chain, test_unity_s32);
   tcase_add_test (tc_chain, test_half_s32);
   tcase_add_test (tc_chain, test_double_s32);
+  tcase_add_test (tc_chain, test_ten_s32);
   tcase_add_test (tc_chain, test_mute_s32);
   tcase_add_test (tc_chain, test_unity_f32);
   tcase_add_test (tc_chain, test_half_f32);
   tcase_add_test (tc_chain, test_double_f32);
+  tcase_add_test (tc_chain, test_ten_f32);
   tcase_add_test (tc_chain, test_mute_f32);
   tcase_add_test (tc_chain, test_unity_f64);
   tcase_add_test (tc_chain, test_half_f64);
   tcase_add_test (tc_chain, test_double_f64);
+  tcase_add_test (tc_chain, test_ten_f64);
   tcase_add_test (tc_chain, test_mute_f64);
   tcase_add_test (tc_chain, test_wrong_caps);
   tcase_add_test (tc_chain, test_passthrough);