summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim.muller@collabora.co.uk>2011-10-30 15:05:56 +0000
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2011-10-30 15:05:56 +0000
commitc5838071d5ccc96b8f98f9a87298fd3c5f1631c5 (patch)
treed63848b3e2cffbca11d0f4c3e21c105b2fcec204 /tests
parent0f2f8342855d4e6b3728571a6f4b4aee39a3c7fb (diff)
tests: port amrnbenc test to 0.11
Diffstat (limited to 'tests')
-rw-r--r--tests/check/elements/amrnbenc.c38
1 files changed, 15 insertions, 23 deletions
diff --git a/tests/check/elements/amrnbenc.c b/tests/check/elements/amrnbenc.c
index 82b938a3..72dc7661 100644
--- a/tests/check/elements/amrnbenc.c
+++ b/tests/check/elements/amrnbenc.c
@@ -22,8 +22,10 @@
*/
#include <gst/check/gstcheck.h>
+#include <gst/audio/audio.h>
-#define SRC_CAPS "audio/x-raw-int,width=16,depth=16,channels=1,rate=8000,signed=true,endianness=BYTE_ORDER"
+#define SRC_CAPS "audio/x-raw, format = (string)" GST_AUDIO_NE (S16) ", " \
+ "channels = (int) 1, rate = (int) 8000"
#define SINK_CAPS "audio/AMR"
GList *buffers;
@@ -43,32 +45,17 @@ static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
GST_STATIC_CAPS (SRC_CAPS)
);
-/* takes a copy of the passed buffer data */
-GstBuffer *
-buffer_new (const gchar * buffer_data, guint size)
-{
- GstBuffer *buffer;
- GstCaps *caps;
-
- buffer = gst_buffer_new_and_alloc (size);
- memcpy (GST_BUFFER_DATA (buffer), buffer_data, size);
- caps = gst_caps_from_string (SRC_CAPS);
- gst_buffer_set_caps (buffer, caps);
- gst_caps_unref (caps);
-
- return buffer;
-}
-
static void
buffer_unref (void *buffer, void *user_data)
{
gst_buffer_unref (GST_BUFFER (buffer));
}
-GstElement *
-setup_amrnbenc ()
+static GstElement *
+setup_amrnbenc (void)
{
GstElement *amrnbenc;
+ GstCaps *caps;
GstBus *bus;
guint64 granulerate_n, granulerate_d;
@@ -87,6 +74,10 @@ setup_amrnbenc ()
GST_STATE_PLAYING) != GST_STATE_CHANGE_FAILURE,
"could not set to playing");
+ caps = gst_caps_from_string (SRC_CAPS);
+ fail_unless (gst_pad_push_event (srcpad, gst_event_new_caps (caps)));
+ gst_caps_unref (caps);
+
buffers = NULL;
return amrnbenc;
}
@@ -119,13 +110,14 @@ push_data (gint size, GstFlowReturn expected_return)
{
GstBuffer *buffer;
GstFlowReturn res;
- gchar *data = g_malloc0 (size);
- buffer = buffer_new (data, size);
- g_free (data);
+ buffer = gst_buffer_new_and_alloc (size);
+
res = gst_pad_push (srcpad, buffer);
fail_unless (res == expected_return,
- "pushing audio returned %d not %d", res, expected_return);
+ "pushing audio returned %d (%s) not %d (%s)", res,
+ gst_flow_get_name (res), expected_return,
+ gst_flow_get_name (expected_return));
}
GST_START_TEST (test_enc)