From: Wim Taymans Date: Tue, 31 Jan 2012 12:41:45 +0000 (+0100) Subject: tests: update some tests for new memory api X-Git-Tag: 1.19.3~509^2~7344 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2a91bbbc0b2d29ce2804abfdaa341d11eff0db09;p=platform%2Fupstream%2Fgstreamer.git tests: update some tests for new memory api --- diff --git a/tests/check/elements/alphacolor.c b/tests/check/elements/alphacolor.c index 5157cb67d8..ff2cc93ab8 100644 --- a/tests/check/elements/alphacolor.c +++ b/tests/check/elements/alphacolor.c @@ -114,15 +114,14 @@ create_buffer_rgb24_3x4 (void) }; guint rowstride = GST_ROUND_UP_4 (WIDTH * 3); GstBuffer *buf; - gpointer buf_data; - gsize size; + GstMapInfo info; buf = gst_buffer_new_and_alloc (HEIGHT * rowstride); - buf_data = gst_buffer_map (buf, &size, NULL, GST_MAP_READWRITE); - fail_unless_equals_int (size, sizeof (rgb24_3x4_img)); - memcpy (buf_data, rgb24_3x4_img, sizeof (rgb24_3x4_img)); + gst_buffer_map (buf, &info, GST_MAP_READWRITE); + fail_unless_equals_int (info.size, sizeof (rgb24_3x4_img)); + memcpy (info.data, rgb24_3x4_img, sizeof (rgb24_3x4_img)); - gst_buffer_unmap (buf, buf_data, size); + gst_buffer_unmap (buf, &info); return buf; } @@ -144,15 +143,14 @@ create_buffer_rgba32_3x4 (void) }; guint rowstride = WIDTH * 4; GstBuffer *buf; - gpointer buf_data; - gsize size; + GstMapInfo map; buf = gst_buffer_new_and_alloc (HEIGHT * rowstride); - buf_data = gst_buffer_map (buf, &size, NULL, GST_MAP_READWRITE); - fail_unless_equals_int (size, sizeof (rgba32_3x4_img)); - memcpy (buf_data, rgba32_3x4_img, sizeof (rgba32_3x4_img)); + gst_buffer_map (buf, &map, GST_MAP_READWRITE); + fail_unless_equals_int (map.size, sizeof (rgba32_3x4_img)); + memcpy (map.data, rgba32_3x4_img, sizeof (rgba32_3x4_img)); - gst_buffer_unmap (buf, buf_data, size); + gst_buffer_unmap (buf, &map); return buf; } @@ -212,8 +210,7 @@ GST_START_TEST (test_rgba32) GstCaps *incaps; guint8 *ayuv; guint outlength; - gpointer buf_data; - gsize size; + GstMapInfo map; incaps = create_caps_rgba32 (); alphacolor = setup_alphacolor (); @@ -240,10 +237,10 @@ GST_START_TEST (test_rgba32) ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 1); outlength = WIDTH * HEIGHT * 4; /* output is AYUV */ - buf_data = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ); - fail_unless_equals_int (size, outlength); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + fail_unless_equals_int (map.size, outlength); - ayuv = buf_data; + ayuv = map.data; /* check alpha values (0x00 = totally transparent, 0xff = totally opaque) */ fail_unless_ayuv_pixel_has_alpha (ayuv, 0, 0, 0xff); @@ -262,7 +259,7 @@ GST_START_TEST (test_rgba32) /* we don't check the YUV data, because apparently results differ slightly * depending on whether we run in valgrind or not */ - gst_buffer_unmap (outbuffer, buf_data, size); + gst_buffer_unmap (outbuffer, &map); buffers = g_list_remove (buffers, outbuffer); gst_buffer_unref (outbuffer); diff --git a/tests/check/elements/audiochebband.c b/tests/check/elements/audiochebband.c index 0b2d70fa60..f7afe7f6ae 100644 --- a/tests/check/elements/audiochebband.c +++ b/tests/check/elements/audiochebband.c @@ -50,18 +50,16 @@ static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", GST_STATIC_CAPS ("audio/x-raw, " "channels = (int) 1, " "rate = (int) 44100, " - "format = (string) { " - GST_AUDIO_NE(F32) ", " - GST_AUDIO_NE(F64) " }")); + "format = (string) { " + GST_AUDIO_NE (F32) ", " GST_AUDIO_NE (F64) " }")); static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw, " "channels = (int) 1, " "rate = (int) 44100, " - "format = (string) { " - GST_AUDIO_NE(F32) ", " - GST_AUDIO_NE(F64) " }")); + "format = (string) { " + GST_AUDIO_NE (F32) ", " GST_AUDIO_NE (F64) " }")); static GstElement * setup_audiochebband (void) @@ -104,6 +102,7 @@ GST_START_TEST (test_type1_32_bp_0hz) GstCaps *caps; gfloat *in, *res, rms; gint i; + GstMapInfo map; audiochebband = setup_audiochebband (); /* Set to bandpass */ @@ -121,10 +120,11 @@ GST_START_TEST (test_type1_32_bp_0hz) g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gfloat *) map.data; for (i = 0; i < 1024; i++) in[i] = 1.0; - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -137,7 +137,8 @@ GST_START_TEST (test_type1_32_bp_0hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gfloat *) map.data; rms = 0.0; for (i = 0; i < 1024; i++) @@ -145,7 +146,7 @@ GST_START_TEST (test_type1_32_bp_0hz) rms = sqrt (rms / 1024.0); fail_unless (rms <= 0.1); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiochebband (audiochebband); @@ -163,6 +164,7 @@ GST_START_TEST (test_type1_32_bp_11025hz) GstCaps *caps; gfloat *in, *res, rms; gint i; + GstMapInfo map; audiochebband = setup_audiochebband (); /* Set to bandpass */ @@ -180,14 +182,15 @@ GST_START_TEST (test_type1_32_bp_11025hz) g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gfloat *) map.data; for (i = 0; i < 1024; i += 4) { in[i] = 0.0; in[i + 1] = 1.0; in[i + 2] = 0.0; in[i + 3] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -200,7 +203,8 @@ GST_START_TEST (test_type1_32_bp_11025hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gfloat *) map.data; rms = 0.0; for (i = 0; i < 1024; i++) @@ -208,7 +212,7 @@ GST_START_TEST (test_type1_32_bp_11025hz) rms = sqrt (rms / 1024.0); fail_unless (rms >= 0.6); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiochebband (audiochebband); @@ -226,6 +230,7 @@ GST_START_TEST (test_type1_32_bp_22050hz) GstCaps *caps; gfloat *in, *res, rms; gint i; + GstMapInfo map; audiochebband = setup_audiochebband (); /* Set to bandpass */ @@ -243,12 +248,13 @@ GST_START_TEST (test_type1_32_bp_22050hz) g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gfloat *) map.data; for (i = 0; i < 1024; i += 2) { in[i] = 1.0; in[i + 1] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -261,7 +267,8 @@ GST_START_TEST (test_type1_32_bp_22050hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gfloat *) map.data; rms = 0.0; for (i = 0; i < 1024; i++) @@ -269,7 +276,7 @@ GST_START_TEST (test_type1_32_bp_22050hz) rms = sqrt (rms / 1024.0); fail_unless (rms <= 0.1); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiochebband (audiochebband); @@ -287,6 +294,7 @@ GST_START_TEST (test_type1_32_br_0hz) GstCaps *caps; gfloat *in, *res, rms; gint i; + GstMapInfo map; audiochebband = setup_audiochebband (); /* Set to bandreject */ @@ -304,10 +312,11 @@ GST_START_TEST (test_type1_32_br_0hz) g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gfloat *) map.data; for (i = 0; i < 1024; i++) in[i] = 1.0; - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -320,7 +329,8 @@ GST_START_TEST (test_type1_32_br_0hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gfloat *) map.data; rms = 0.0; for (i = 0; i < 1024; i++) @@ -328,7 +338,7 @@ GST_START_TEST (test_type1_32_br_0hz) rms = sqrt (rms / 1024.0); fail_unless (rms >= 0.9); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiochebband (audiochebband); @@ -346,6 +356,7 @@ GST_START_TEST (test_type1_32_br_11025hz) GstCaps *caps; gfloat *in, *res, rms; gint i; + GstMapInfo map; audiochebband = setup_audiochebband (); /* Set to bandreject */ @@ -363,14 +374,15 @@ GST_START_TEST (test_type1_32_br_11025hz) g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gfloat *) map.data; for (i = 0; i < 1024; i += 4) { in[i] = 0.0; in[i + 1] = 1.0; in[i + 2] = 0.0; in[i + 3] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -383,7 +395,8 @@ GST_START_TEST (test_type1_32_br_11025hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gfloat *) map.data; rms = 0.0; for (i = 0; i < 1024; i++) @@ -391,7 +404,7 @@ GST_START_TEST (test_type1_32_br_11025hz) rms = sqrt (rms / 1024.0); fail_unless (rms <= 0.1); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiochebband (audiochebband); @@ -409,6 +422,7 @@ GST_START_TEST (test_type1_32_br_22050hz) GstCaps *caps; gfloat *in, *res, rms; gint i; + GstMapInfo map; audiochebband = setup_audiochebband (); /* Set to bandreject */ @@ -426,12 +440,13 @@ GST_START_TEST (test_type1_32_br_22050hz) g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gfloat *) map.data; for (i = 0; i < 1024; i += 2) { in[i] = 1.0; in[i + 1] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -444,7 +459,8 @@ GST_START_TEST (test_type1_32_br_22050hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gfloat *) map.data; rms = 0.0; for (i = 0; i < 1024; i++) @@ -452,7 +468,7 @@ GST_START_TEST (test_type1_32_br_22050hz) rms = sqrt (rms / 1024.0); fail_unless (rms >= 0.9); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiochebband (audiochebband); @@ -470,6 +486,7 @@ GST_START_TEST (test_type1_64_bp_0hz) GstCaps *caps; gdouble *in, *res, rms; gint i; + GstMapInfo map; audiochebband = setup_audiochebband (); /* Set to bandpass */ @@ -487,10 +504,11 @@ GST_START_TEST (test_type1_64_bp_0hz) g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gdouble *) map.data; for (i = 0; i < 1024; i++) in[i] = 1.0; - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -503,7 +521,8 @@ GST_START_TEST (test_type1_64_bp_0hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gdouble *) map.data; rms = 0.0; for (i = 0; i < 1024; i++) @@ -511,7 +530,7 @@ GST_START_TEST (test_type1_64_bp_0hz) rms = sqrt (rms / 1024.0); fail_unless (rms <= 0.1); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiochebband (audiochebband); @@ -529,6 +548,7 @@ GST_START_TEST (test_type1_64_bp_11025hz) GstCaps *caps; gdouble *in, *res, rms; gint i; + GstMapInfo map; audiochebband = setup_audiochebband (); /* Set to bandpass */ @@ -546,14 +566,15 @@ GST_START_TEST (test_type1_64_bp_11025hz) g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gdouble *) map.data; for (i = 0; i < 1024; i += 4) { in[i] = 0.0; in[i + 1] = 1.0; in[i + 2] = 0.0; in[i + 3] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -566,7 +587,8 @@ GST_START_TEST (test_type1_64_bp_11025hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gdouble *) map.data; rms = 0.0; for (i = 0; i < 1024; i++) @@ -574,7 +596,7 @@ GST_START_TEST (test_type1_64_bp_11025hz) rms = sqrt (rms / 1024.0); fail_unless (rms >= 0.6); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiochebband (audiochebband); @@ -592,6 +614,7 @@ GST_START_TEST (test_type1_64_bp_22050hz) GstCaps *caps; gdouble *in, *res, rms; gint i; + GstMapInfo map; audiochebband = setup_audiochebband (); /* Set to bandpass */ @@ -609,12 +632,13 @@ GST_START_TEST (test_type1_64_bp_22050hz) g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gdouble *) map.data; for (i = 0; i < 1024; i += 2) { in[i] = 1.0; in[i + 1] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -627,7 +651,8 @@ GST_START_TEST (test_type1_64_bp_22050hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gdouble *) map.data; rms = 0.0; for (i = 0; i < 1024; i++) @@ -635,7 +660,7 @@ GST_START_TEST (test_type1_64_bp_22050hz) rms = sqrt (rms / 1024.0); fail_unless (rms <= 0.1); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiochebband (audiochebband); @@ -653,6 +678,7 @@ GST_START_TEST (test_type1_64_br_0hz) GstCaps *caps; gdouble *in, *res, rms; gint i; + GstMapInfo map; audiochebband = setup_audiochebband (); /* Set to bandreject */ @@ -670,10 +696,11 @@ GST_START_TEST (test_type1_64_br_0hz) g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gdouble *) map.data; for (i = 0; i < 1024; i++) in[i] = 1.0; - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -686,7 +713,8 @@ GST_START_TEST (test_type1_64_br_0hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gdouble *) map.data; rms = 0.0; for (i = 0; i < 1024; i++) @@ -694,7 +722,7 @@ GST_START_TEST (test_type1_64_br_0hz) rms = sqrt (rms / 1024.0); fail_unless (rms >= 0.9); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiochebband (audiochebband); @@ -712,6 +740,7 @@ GST_START_TEST (test_type1_64_br_11025hz) GstCaps *caps; gdouble *in, *res, rms; gint i; + GstMapInfo map; audiochebband = setup_audiochebband (); /* Set to bandreject */ @@ -729,14 +758,15 @@ GST_START_TEST (test_type1_64_br_11025hz) g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gdouble *) map.data; for (i = 0; i < 1024; i += 4) { in[i] = 0.0; in[i + 1] = 1.0; in[i + 2] = 0.0; in[i + 3] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -749,7 +779,8 @@ GST_START_TEST (test_type1_64_br_11025hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gdouble *) map.data; rms = 0.0; for (i = 0; i < 1024; i++) @@ -757,7 +788,7 @@ GST_START_TEST (test_type1_64_br_11025hz) rms = sqrt (rms / 1024.0); fail_unless (rms <= 0.1); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiochebband (audiochebband); @@ -775,6 +806,7 @@ GST_START_TEST (test_type1_64_br_22050hz) GstCaps *caps; gdouble *in, *res, rms; gint i; + GstMapInfo map; audiochebband = setup_audiochebband (); /* Set to bandreject */ @@ -792,12 +824,13 @@ GST_START_TEST (test_type1_64_br_22050hz) g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gdouble *) map.data; for (i = 0; i < 1024; i += 2) { in[i] = 1.0; in[i + 1] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -810,7 +843,8 @@ GST_START_TEST (test_type1_64_br_22050hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gdouble *) map.data; rms = 0.0; for (i = 0; i < 1024; i++) @@ -818,7 +852,7 @@ GST_START_TEST (test_type1_64_br_22050hz) rms = sqrt (rms / 1024.0); fail_unless (rms >= 0.9); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiochebband (audiochebband); @@ -836,6 +870,7 @@ GST_START_TEST (test_type2_32_bp_0hz) GstCaps *caps; gfloat *in, *res, rms; gint i; + GstMapInfo map; audiochebband = setup_audiochebband (); /* Set to bandpass */ @@ -853,10 +888,11 @@ GST_START_TEST (test_type2_32_bp_0hz) g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gfloat *) map.data; for (i = 0; i < 1024; i++) in[i] = 1.0; - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -869,7 +905,8 @@ GST_START_TEST (test_type2_32_bp_0hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gfloat *) map.data; rms = 0.0; for (i = 0; i < 1024; i++) @@ -877,7 +914,7 @@ GST_START_TEST (test_type2_32_bp_0hz) rms = sqrt (rms / 1024.0); fail_unless (rms <= 0.1); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiochebband (audiochebband); @@ -895,6 +932,7 @@ GST_START_TEST (test_type2_32_bp_11025hz) GstCaps *caps; gfloat *in, *res, rms; gint i; + GstMapInfo map; audiochebband = setup_audiochebband (); /* Set to bandpass */ @@ -912,14 +950,15 @@ GST_START_TEST (test_type2_32_bp_11025hz) g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gfloat *) map.data; for (i = 0; i < 1024; i += 4) { in[i] = 0.0; in[i + 1] = 1.0; in[i + 2] = 0.0; in[i + 3] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -932,7 +971,8 @@ GST_START_TEST (test_type2_32_bp_11025hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gfloat *) map.data; rms = 0.0; for (i = 0; i < 1024; i++) @@ -940,7 +980,7 @@ GST_START_TEST (test_type2_32_bp_11025hz) rms = sqrt (rms / 1024.0); fail_unless (rms >= 0.6); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiochebband (audiochebband); @@ -958,6 +998,7 @@ GST_START_TEST (test_type2_32_bp_22050hz) GstCaps *caps; gfloat *in, *res, rms; gint i; + GstMapInfo map; audiochebband = setup_audiochebband (); /* Set to bandpass */ @@ -975,12 +1016,13 @@ GST_START_TEST (test_type2_32_bp_22050hz) g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gfloat *) map.data; for (i = 0; i < 1024; i += 2) { in[i] = 1.0; in[i + 1] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -993,7 +1035,8 @@ GST_START_TEST (test_type2_32_bp_22050hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gfloat *) map.data; rms = 0.0; for (i = 0; i < 1024; i++) @@ -1001,7 +1044,7 @@ GST_START_TEST (test_type2_32_bp_22050hz) rms = sqrt (rms / 1024.0); fail_unless (rms <= 0.1); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiochebband (audiochebband); @@ -1019,6 +1062,7 @@ GST_START_TEST (test_type2_32_br_0hz) GstCaps *caps; gfloat *in, *res, rms; gint i; + GstMapInfo map; audiochebband = setup_audiochebband (); /* Set to bandreject */ @@ -1036,10 +1080,11 @@ GST_START_TEST (test_type2_32_br_0hz) g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gfloat *) map.data; for (i = 0; i < 1024; i++) in[i] = 1.0; - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -1052,7 +1097,8 @@ GST_START_TEST (test_type2_32_br_0hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gfloat *) map.data; rms = 0.0; for (i = 0; i < 1024; i++) @@ -1060,7 +1106,7 @@ GST_START_TEST (test_type2_32_br_0hz) rms = sqrt (rms / 1024.0); fail_unless (rms >= 0.9); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiochebband (audiochebband); @@ -1078,6 +1124,7 @@ GST_START_TEST (test_type2_32_br_11025hz) GstCaps *caps; gfloat *in, *res, rms; gint i; + GstMapInfo map; audiochebband = setup_audiochebband (); /* Set to bandreject */ @@ -1095,14 +1142,15 @@ GST_START_TEST (test_type2_32_br_11025hz) g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gfloat *) map.data; for (i = 0; i < 1024; i += 4) { in[i] = 0.0; in[i + 1] = 1.0; in[i + 2] = 0.0; in[i + 3] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -1115,7 +1163,8 @@ GST_START_TEST (test_type2_32_br_11025hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gfloat *) map.data; rms = 0.0; for (i = 0; i < 1024; i++) @@ -1123,7 +1172,7 @@ GST_START_TEST (test_type2_32_br_11025hz) rms = sqrt (rms / 1024.0); fail_unless (rms <= 0.1); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiochebband (audiochebband); @@ -1141,6 +1190,7 @@ GST_START_TEST (test_type2_32_br_22050hz) GstCaps *caps; gfloat *in, *res, rms; gint i; + GstMapInfo map; audiochebband = setup_audiochebband (); /* Set to bandreject */ @@ -1158,12 +1208,13 @@ GST_START_TEST (test_type2_32_br_22050hz) g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gfloat *) map.data; for (i = 0; i < 1024; i += 2) { in[i] = 1.0; in[i + 1] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -1176,7 +1227,8 @@ GST_START_TEST (test_type2_32_br_22050hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gfloat *) map.data; rms = 0.0; for (i = 0; i < 1024; i++) @@ -1184,7 +1236,7 @@ GST_START_TEST (test_type2_32_br_22050hz) rms = sqrt (rms / 1024.0); fail_unless (rms >= 0.9); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiochebband (audiochebband); @@ -1202,6 +1254,7 @@ GST_START_TEST (test_type2_64_bp_0hz) GstCaps *caps; gdouble *in, *res, rms; gint i; + GstMapInfo map; audiochebband = setup_audiochebband (); /* Set to bandpass */ @@ -1219,10 +1272,11 @@ GST_START_TEST (test_type2_64_bp_0hz) g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gdouble *) map.data; for (i = 0; i < 1024; i++) in[i] = 1.0; - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -1235,7 +1289,8 @@ GST_START_TEST (test_type2_64_bp_0hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gdouble *) map.data; rms = 0.0; for (i = 0; i < 1024; i++) @@ -1243,7 +1298,7 @@ GST_START_TEST (test_type2_64_bp_0hz) rms = sqrt (rms / 1024.0); fail_unless (rms <= 0.1); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiochebband (audiochebband); @@ -1261,6 +1316,7 @@ GST_START_TEST (test_type2_64_bp_11025hz) GstCaps *caps; gdouble *in, *res, rms; gint i; + GstMapInfo map; audiochebband = setup_audiochebband (); /* Set to bandpass */ @@ -1278,14 +1334,15 @@ GST_START_TEST (test_type2_64_bp_11025hz) g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gdouble *) map.data; for (i = 0; i < 1024; i += 4) { in[i] = 0.0; in[i + 1] = 1.0; in[i + 2] = 0.0; in[i + 3] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -1298,7 +1355,8 @@ GST_START_TEST (test_type2_64_bp_11025hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gdouble *) map.data; rms = 0.0; for (i = 0; i < 1024; i++) @@ -1306,7 +1364,7 @@ GST_START_TEST (test_type2_64_bp_11025hz) rms = sqrt (rms / 1024.0); fail_unless (rms >= 0.6); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiochebband (audiochebband); @@ -1324,6 +1382,7 @@ GST_START_TEST (test_type2_64_bp_22050hz) GstCaps *caps; gdouble *in, *res, rms; gint i; + GstMapInfo map; audiochebband = setup_audiochebband (); /* Set to bandpass */ @@ -1341,12 +1400,13 @@ GST_START_TEST (test_type2_64_bp_22050hz) g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gdouble *) map.data; for (i = 0; i < 1024; i += 2) { in[i] = 1.0; in[i + 1] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -1359,7 +1419,8 @@ GST_START_TEST (test_type2_64_bp_22050hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gdouble *) map.data; rms = 0.0; for (i = 0; i < 1024; i++) @@ -1367,7 +1428,7 @@ GST_START_TEST (test_type2_64_bp_22050hz) rms = sqrt (rms / 1024.0); fail_unless (rms <= 0.1); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiochebband (audiochebband); @@ -1385,6 +1446,7 @@ GST_START_TEST (test_type2_64_br_0hz) GstCaps *caps; gdouble *in, *res, rms; gint i; + GstMapInfo map; audiochebband = setup_audiochebband (); /* Set to bandreject */ @@ -1402,10 +1464,11 @@ GST_START_TEST (test_type2_64_br_0hz) g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gdouble *) map.data; for (i = 0; i < 1024; i++) in[i] = 1.0; - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -1418,7 +1481,8 @@ GST_START_TEST (test_type2_64_br_0hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gdouble *) map.data; rms = 0.0; for (i = 0; i < 1024; i++) @@ -1426,7 +1490,7 @@ GST_START_TEST (test_type2_64_br_0hz) rms = sqrt (rms / 1024.0); fail_unless (rms >= 0.9); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiochebband (audiochebband); @@ -1444,6 +1508,7 @@ GST_START_TEST (test_type2_64_br_11025hz) GstCaps *caps; gdouble *in, *res, rms; gint i; + GstMapInfo map; audiochebband = setup_audiochebband (); /* Set to bandreject */ @@ -1461,14 +1526,15 @@ GST_START_TEST (test_type2_64_br_11025hz) g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gdouble *) map.data; for (i = 0; i < 1024; i += 4) { in[i] = 0.0; in[i + 1] = 1.0; in[i + 2] = 0.0; in[i + 3] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -1481,7 +1547,8 @@ GST_START_TEST (test_type2_64_br_11025hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gdouble *) map.data; rms = 0.0; for (i = 0; i < 1024; i++) @@ -1489,7 +1556,7 @@ GST_START_TEST (test_type2_64_br_11025hz) rms = sqrt (rms / 1024.0); fail_unless (rms <= 0.1); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiochebband (audiochebband); @@ -1507,6 +1574,7 @@ GST_START_TEST (test_type2_64_br_22050hz) GstCaps *caps; gdouble *in, *res, rms; gint i; + GstMapInfo map; audiochebband = setup_audiochebband (); /* Set to bandreject */ @@ -1524,12 +1592,13 @@ GST_START_TEST (test_type2_64_br_22050hz) g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gdouble *) map.data; for (i = 0; i < 1024; i += 2) { in[i] = 1.0; in[i + 1] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -1542,7 +1611,8 @@ GST_START_TEST (test_type2_64_br_22050hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gdouble *) map.data; rms = 0.0; for (i = 0; i < 1024; i++) @@ -1550,7 +1620,7 @@ GST_START_TEST (test_type2_64_br_22050hz) rms = sqrt (rms / 1024.0); fail_unless (rms >= 0.9); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiochebband (audiochebband); diff --git a/tests/check/elements/audiocheblimit.c b/tests/check/elements/audiocheblimit.c index 9cdf63cb42..c8efc1f198 100644 --- a/tests/check/elements/audiocheblimit.c +++ b/tests/check/elements/audiocheblimit.c @@ -50,9 +50,8 @@ static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", GST_STATIC_CAPS ("audio/x-raw, " "channels = (int) 1, " "rate = (int) 44100, " - "format = (string) { " - GST_AUDIO_NE(F32) ", " - GST_AUDIO_NE(F64) " }")); + "format = (string) { " + GST_AUDIO_NE (F32) ", " GST_AUDIO_NE (F64) " }")); static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, @@ -60,8 +59,7 @@ static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", "channels = (int) 1, " "rate = (int) 44100, " "format = (string) { " - GST_AUDIO_NE(F32) ", " - GST_AUDIO_NE(F64) " }")); + GST_AUDIO_NE (F32) ", " GST_AUDIO_NE (F64) " }")); static GstElement * setup_audiocheblimit (void) @@ -104,6 +102,7 @@ GST_START_TEST (test_type1_32_lp_0hz) GstCaps *caps; gfloat *in, *res, rms; gint i; + GstMapInfo map; audiocheblimit = setup_audiocheblimit (); /* Set to lowpass */ @@ -118,10 +117,11 @@ GST_START_TEST (test_type1_32_lp_0hz) g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gfloat), 0); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gfloat *) map.data; for (i = 0; i < 128; i++) in[i] = 1.0; - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -134,7 +134,8 @@ GST_START_TEST (test_type1_32_lp_0hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gfloat *) map.data; rms = 0.0; for (i = 0; i < 128; i++) @@ -142,7 +143,7 @@ GST_START_TEST (test_type1_32_lp_0hz) rms = sqrt (rms / 128.0); fail_unless (rms >= 0.9); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiocheblimit (audiocheblimit); @@ -160,6 +161,7 @@ GST_START_TEST (test_type1_32_lp_22050hz) GstCaps *caps; gfloat *in, *res, rms; gint i; + GstMapInfo map; audiocheblimit = setup_audiocheblimit (); /* Set to lowpass */ @@ -174,12 +176,13 @@ GST_START_TEST (test_type1_32_lp_22050hz) g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gfloat), 0); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gfloat *) map.data; for (i = 0; i < 128; i += 2) { in[i] = 1.0; in[i + 1] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -192,7 +195,8 @@ GST_START_TEST (test_type1_32_lp_22050hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gfloat *) map.data; rms = 0.0; for (i = 0; i < 128; i++) @@ -200,7 +204,7 @@ GST_START_TEST (test_type1_32_lp_22050hz) rms = sqrt (rms / 128.0); fail_unless (rms <= 0.1); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiocheblimit (audiocheblimit); @@ -218,6 +222,7 @@ GST_START_TEST (test_type1_32_hp_0hz) GstCaps *caps; gfloat *in, *res, rms; gint i; + GstMapInfo map; audiocheblimit = setup_audiocheblimit (); /* Set to highpass */ @@ -232,10 +237,11 @@ GST_START_TEST (test_type1_32_hp_0hz) g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gfloat), 0); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gfloat *) map.data; for (i = 0; i < 128; i++) in[i] = 1.0; - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -248,7 +254,8 @@ GST_START_TEST (test_type1_32_hp_0hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gfloat *) map.data; rms = 0.0; for (i = 0; i < 128; i++) @@ -256,7 +263,7 @@ GST_START_TEST (test_type1_32_hp_0hz) rms = sqrt (rms / 128.0); fail_unless (rms <= 0.1); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiocheblimit (audiocheblimit); @@ -274,6 +281,7 @@ GST_START_TEST (test_type1_32_hp_22050hz) GstCaps *caps; gfloat *in, *res, rms; gint i; + GstMapInfo map; audiocheblimit = setup_audiocheblimit (); /* Set to highpass */ @@ -288,12 +296,13 @@ GST_START_TEST (test_type1_32_hp_22050hz) g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gfloat), 0); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gfloat *) map.data; for (i = 0; i < 128; i += 2) { in[i] = 1.0; in[i + 1] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -306,7 +315,8 @@ GST_START_TEST (test_type1_32_hp_22050hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gfloat *) map.data; rms = 0.0; for (i = 0; i < 128; i++) @@ -314,7 +324,7 @@ GST_START_TEST (test_type1_32_hp_22050hz) rms = sqrt (rms / 128.0); fail_unless (rms >= 0.9); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiocheblimit (audiocheblimit); @@ -332,6 +342,7 @@ GST_START_TEST (test_type1_64_lp_0hz) GstCaps *caps; gdouble *in, *res, rms; gint i; + GstMapInfo map; audiocheblimit = setup_audiocheblimit (); /* Set to lowpass */ @@ -346,10 +357,11 @@ GST_START_TEST (test_type1_64_lp_0hz) g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gdouble), 0); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gdouble *) map.data; for (i = 0; i < 128; i++) in[i] = 1.0; - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -362,7 +374,8 @@ GST_START_TEST (test_type1_64_lp_0hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gdouble *) map.data; rms = 0.0; for (i = 0; i < 128; i++) @@ -370,7 +383,7 @@ GST_START_TEST (test_type1_64_lp_0hz) rms = sqrt (rms / 128.0); fail_unless (rms >= 0.9); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiocheblimit (audiocheblimit); @@ -388,6 +401,7 @@ GST_START_TEST (test_type1_64_lp_22050hz) GstCaps *caps; gdouble *in, *res, rms; gint i; + GstMapInfo map; audiocheblimit = setup_audiocheblimit (); /* Set to lowpass */ @@ -402,12 +416,13 @@ GST_START_TEST (test_type1_64_lp_22050hz) g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gdouble), 0); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gdouble *) map.data; for (i = 0; i < 128; i += 2) { in[i] = 1.0; in[i + 1] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -420,7 +435,8 @@ GST_START_TEST (test_type1_64_lp_22050hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gdouble *) map.data; rms = 0.0; for (i = 0; i < 128; i++) @@ -428,7 +444,7 @@ GST_START_TEST (test_type1_64_lp_22050hz) rms = sqrt (rms / 128.0); fail_unless (rms <= 0.1); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiocheblimit (audiocheblimit); @@ -446,6 +462,7 @@ GST_START_TEST (test_type1_64_hp_0hz) GstCaps *caps; gdouble *in, *res, rms; gint i; + GstMapInfo map; audiocheblimit = setup_audiocheblimit (); /* Set to highpass */ @@ -460,10 +477,11 @@ GST_START_TEST (test_type1_64_hp_0hz) g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gdouble), 0); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gdouble *) map.data; for (i = 0; i < 128; i++) in[i] = 1.0; - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -476,7 +494,8 @@ GST_START_TEST (test_type1_64_hp_0hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gdouble *) map.data; rms = 0.0; for (i = 0; i < 128; i++) @@ -484,7 +503,7 @@ GST_START_TEST (test_type1_64_hp_0hz) rms = sqrt (rms / 128.0); fail_unless (rms <= 0.1); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiocheblimit (audiocheblimit); @@ -502,6 +521,7 @@ GST_START_TEST (test_type1_64_hp_22050hz) GstCaps *caps; gdouble *in, *res, rms; gint i; + GstMapInfo map; audiocheblimit = setup_audiocheblimit (); /* Set to highpass */ @@ -516,12 +536,13 @@ GST_START_TEST (test_type1_64_hp_22050hz) g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gdouble), 0); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gdouble *) map.data; for (i = 0; i < 128; i += 2) { in[i] = 1.0; in[i + 1] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -534,7 +555,8 @@ GST_START_TEST (test_type1_64_hp_22050hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gdouble *) map.data; rms = 0.0; for (i = 0; i < 128; i++) @@ -542,7 +564,7 @@ GST_START_TEST (test_type1_64_hp_22050hz) rms = sqrt (rms / 128.0); fail_unless (rms >= 0.9); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiocheblimit (audiocheblimit); @@ -560,6 +582,7 @@ GST_START_TEST (test_type2_32_lp_0hz) GstCaps *caps; gfloat *in, *res, rms; gint i; + GstMapInfo map; audiocheblimit = setup_audiocheblimit (); /* Set to lowpass */ @@ -574,10 +597,11 @@ GST_START_TEST (test_type2_32_lp_0hz) g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gfloat), 0); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gfloat *) map.data; for (i = 0; i < 128; i++) in[i] = 1.0; - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -590,7 +614,8 @@ GST_START_TEST (test_type2_32_lp_0hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gfloat *) map.data; rms = 0.0; for (i = 0; i < 128; i++) @@ -598,7 +623,7 @@ GST_START_TEST (test_type2_32_lp_0hz) rms = sqrt (rms / 128.0); fail_unless (rms >= 0.9); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiocheblimit (audiocheblimit); @@ -616,6 +641,7 @@ GST_START_TEST (test_type2_32_lp_22050hz) GstCaps *caps; gfloat *in, *res, rms; gint i; + GstMapInfo map; audiocheblimit = setup_audiocheblimit (); /* Set to lowpass */ @@ -630,12 +656,13 @@ GST_START_TEST (test_type2_32_lp_22050hz) g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gfloat), 0); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gfloat *) map.data; for (i = 0; i < 128; i += 2) { in[i] = 1.0; in[i + 1] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -648,7 +675,8 @@ GST_START_TEST (test_type2_32_lp_22050hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gfloat *) map.data; rms = 0.0; for (i = 0; i < 128; i++) @@ -656,7 +684,7 @@ GST_START_TEST (test_type2_32_lp_22050hz) rms = sqrt (rms / 128.0); fail_unless (rms <= 0.1); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiocheblimit (audiocheblimit); @@ -674,6 +702,7 @@ GST_START_TEST (test_type2_32_hp_0hz) GstCaps *caps; gfloat *in, *res, rms; gint i; + GstMapInfo map; audiocheblimit = setup_audiocheblimit (); /* Set to highpass */ @@ -688,10 +717,11 @@ GST_START_TEST (test_type2_32_hp_0hz) g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gfloat), 0); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gfloat *) map.data; for (i = 0; i < 128; i++) in[i] = 1.0; - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -704,7 +734,8 @@ GST_START_TEST (test_type2_32_hp_0hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gfloat *) map.data; rms = 0.0; for (i = 0; i < 128; i++) @@ -712,7 +743,7 @@ GST_START_TEST (test_type2_32_hp_0hz) rms = sqrt (rms / 128.0); fail_unless (rms <= 0.1); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiocheblimit (audiocheblimit); @@ -730,6 +761,7 @@ GST_START_TEST (test_type2_32_hp_22050hz) GstCaps *caps; gfloat *in, *res, rms; gint i; + GstMapInfo map; audiocheblimit = setup_audiocheblimit (); /* Set to highpass */ @@ -744,12 +776,13 @@ GST_START_TEST (test_type2_32_hp_22050hz) g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gfloat), 0); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gfloat *) map.data; for (i = 0; i < 128; i += 2) { in[i] = 1.0; in[i + 1] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -762,7 +795,8 @@ GST_START_TEST (test_type2_32_hp_22050hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gfloat *) map.data; rms = 0.0; for (i = 0; i < 128; i++) @@ -770,7 +804,7 @@ GST_START_TEST (test_type2_32_hp_22050hz) rms = sqrt (rms / 128.0); fail_unless (rms >= 0.9); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiocheblimit (audiocheblimit); @@ -788,6 +822,7 @@ GST_START_TEST (test_type2_64_lp_0hz) GstCaps *caps; gdouble *in, *res, rms; gint i; + GstMapInfo map; audiocheblimit = setup_audiocheblimit (); /* Set to lowpass */ @@ -802,10 +837,11 @@ GST_START_TEST (test_type2_64_lp_0hz) g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble)); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gdouble *) map.data; for (i = 0; i < 128; i++) in[i] = 1.0; - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -818,7 +854,8 @@ GST_START_TEST (test_type2_64_lp_0hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gdouble *) map.data; rms = 0.0; for (i = 0; i < 128; i++) @@ -826,7 +863,7 @@ GST_START_TEST (test_type2_64_lp_0hz) rms = sqrt (rms / 128.0); fail_unless (rms >= 0.9); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiocheblimit (audiocheblimit); @@ -844,6 +881,7 @@ GST_START_TEST (test_type2_64_lp_22050hz) GstCaps *caps; gdouble *in, *res, rms; gint i; + GstMapInfo map; audiocheblimit = setup_audiocheblimit (); /* Set to lowpass */ @@ -858,12 +896,13 @@ GST_START_TEST (test_type2_64_lp_22050hz) g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble)); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gdouble *) map.data; for (i = 0; i < 128; i += 2) { in[i] = 1.0; in[i + 1] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -876,7 +915,8 @@ GST_START_TEST (test_type2_64_lp_22050hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gdouble *) map.data; rms = 0.0; for (i = 0; i < 128; i++) @@ -884,7 +924,7 @@ GST_START_TEST (test_type2_64_lp_22050hz) rms = sqrt (rms / 128.0); fail_unless (rms <= 0.1); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiocheblimit (audiocheblimit); @@ -902,6 +942,7 @@ GST_START_TEST (test_type2_64_hp_0hz) GstCaps *caps; gdouble *in, *res, rms; gint i; + GstMapInfo map; audiocheblimit = setup_audiocheblimit (); /* Set to highpass */ @@ -916,10 +957,11 @@ GST_START_TEST (test_type2_64_hp_0hz) g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble)); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gdouble *) map.data; for (i = 0; i < 128; i++) in[i] = 1.0; - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -932,7 +974,8 @@ GST_START_TEST (test_type2_64_hp_0hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gdouble *) map.data; rms = 0.0; for (i = 0; i < 128; i++) @@ -940,7 +983,7 @@ GST_START_TEST (test_type2_64_hp_0hz) rms = sqrt (rms / 128.0); fail_unless (rms <= 0.1); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiocheblimit (audiocheblimit); @@ -958,6 +1001,7 @@ GST_START_TEST (test_type2_64_hp_22050hz) GstCaps *caps; gdouble *in, *res, rms; gint i; + GstMapInfo map; audiocheblimit = setup_audiocheblimit (); /* Set to highpass */ @@ -972,12 +1016,13 @@ GST_START_TEST (test_type2_64_hp_22050hz) g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble)); - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gdouble *) map.data; for (i = 0; i < 128; i += 2) { in[i] = 1.0; in[i + 1] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); fail_unless (gst_pad_set_caps (mysrcpad, caps)); @@ -990,7 +1035,8 @@ GST_START_TEST (test_type2_64_hp_22050hz) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gdouble *) map.data; rms = 0.0; for (i = 0; i < 128; i++) @@ -998,7 +1044,7 @@ GST_START_TEST (test_type2_64_hp_22050hz) rms = sqrt (rms / 128.0); fail_unless (rms >= 0.9); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); /* cleanup */ cleanup_audiocheblimit (audiocheblimit); diff --git a/tests/check/elements/audiofirfilter.c b/tests/check/elements/audiofirfilter.c index 972ed967af..c4abaf9c2b 100644 --- a/tests/check/elements/audiofirfilter.c +++ b/tests/check/elements/audiofirfilter.c @@ -88,12 +88,13 @@ on_handoff (GstElement * object, GstBuffer * buffer, GstPad * pad, gpointer user_data) { if (!have_data) { - gsize size; + GstMapInfo map; gdouble *data; - data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ); + gst_buffer_map (buffer, &map, GST_MAP_READ); + data = (gdouble *) map.data; - fail_unless (size > 5 * sizeof (gdouble)); + fail_unless (map.size > 5 * sizeof (gdouble)); fail_unless (data[0] == 0.0); fail_unless (data[1] == 0.0); fail_unless (data[2] == 0.0); @@ -101,7 +102,7 @@ on_handoff (GstElement * object, GstBuffer * buffer, GstPad * pad, fail_unless (data[4] == 0.0); fail_unless (data[5] != 0.0); - gst_buffer_unmap (buffer, data, size); + gst_buffer_unmap (buffer, &map); have_data = TRUE; } } diff --git a/tests/check/elements/audioiirfilter.c b/tests/check/elements/audioiirfilter.c index 7965b20999..9625795205 100644 --- a/tests/check/elements/audioiirfilter.c +++ b/tests/check/elements/audioiirfilter.c @@ -98,12 +98,13 @@ on_handoff (GstElement * object, GstBuffer * buffer, GstPad * pad, gpointer user_data) { if (!have_data) { - gsize size; + GstMapInfo map; gdouble *data; - data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ); + gst_buffer_map (buffer, &map, GST_MAP_READ); + data = (gdouble *) map.data; - fail_unless (size > 5 * sizeof (gdouble)); + fail_unless (map.size > 5 * sizeof (gdouble)); fail_unless (data[0] == 0.0); fail_unless (data[1] == 0.0); fail_unless (data[2] == 0.0); @@ -111,7 +112,7 @@ on_handoff (GstElement * object, GstBuffer * buffer, GstPad * pad, fail_unless (data[4] == 0.0); fail_unless (data[5] != 0.0); - gst_buffer_unmap (buffer, data, size); + gst_buffer_unmap (buffer, &map); have_data = TRUE; } } diff --git a/tests/check/elements/audioinvert.c b/tests/check/elements/audioinvert.c index f2dc6e8f74..4feae9b548 100644 --- a/tests/check/elements/audioinvert.c +++ b/tests/check/elements/audioinvert.c @@ -96,6 +96,7 @@ GST_START_TEST (test_passthrough) GstCaps *caps; gint16 in[4] = { 16384, -256, 128, -512 }; gint16 *res; + GstMapInfo map; invert = setup_invert (); fail_unless (gst_element_set_state (invert, @@ -116,10 +117,11 @@ GST_START_TEST (test_passthrough) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gint16 *) map.data; GST_INFO ("expected %+5d %+5d %+5d %+5d real %+5d %+5d %+5d %+5d", in[0], in[1], in[2], in[3], res[0], res[1], res[2], res[3]); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); fail_unless (gst_buffer_memcmp (outbuffer, 0, in, 8) == 0); @@ -137,6 +139,7 @@ GST_START_TEST (test_zero) gint16 in[4] = { 16384, -256, 128, -512 }; gint16 out[4] = { 0, 0, 0, 0 }; gint16 *res; + GstMapInfo map; invert = setup_invert (); g_object_set (G_OBJECT (invert), "degree", 0.5, NULL); @@ -158,10 +161,11 @@ GST_START_TEST (test_zero) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gint16 *) map.data; GST_INFO ("expected %+5d %+5d %+5d %+5d real %+5d %+5d %+5d %+5d", out[0], out[1], out[2], out[3], res[0], res[1], res[2], res[3]); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); fail_unless (gst_buffer_memcmp (outbuffer, 0, out, 8) == 0); @@ -179,6 +183,7 @@ GST_START_TEST (test_full_inverse) gint16 in[4] = { 16384, -256, 128, -512 }; gint16 out[4] = { -16385, 255, -129, 511 }; gint16 *res; + GstMapInfo map; invert = setup_invert (); g_object_set (G_OBJECT (invert), "degree", 1.0, NULL); @@ -200,10 +205,11 @@ GST_START_TEST (test_full_inverse) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gint16 *) map.data; GST_INFO ("expected %+5d %+5d %+5d %+5d real %+5d %+5d %+5d %+5d", out[0], out[1], out[2], out[3], res[0], res[1], res[2], res[3]); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); fail_unless (gst_buffer_memcmp (outbuffer, 0, out, 8) == 0); @@ -221,6 +227,7 @@ GST_START_TEST (test_25_inverse) gint16 in[4] = { 16384, -256, 128, -512 }; gint16 out[4] = { 8191, -128, 63, -256 }; gint16 *res; + GstMapInfo map; invert = setup_invert (); g_object_set (G_OBJECT (invert), "degree", 0.25, NULL); @@ -242,10 +249,11 @@ GST_START_TEST (test_25_inverse) fail_unless_equals_int (g_list_length (buffers), 1); fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gint16 *) map.data; GST_INFO ("expected %+5d %+5d %+5d %+5d real %+5d %+5d %+5d %+5d", out[0], out[1], out[2], out[3], res[0], res[1], res[2], res[3]); - gst_buffer_unmap (outbuffer, res, -1); + gst_buffer_unmap (outbuffer, &map); fail_unless (gst_buffer_memcmp (outbuffer, 0, out, 8) == 0); diff --git a/tests/check/elements/audiowsincband.c b/tests/check/elements/audiowsincband.c index 54ef447b44..6d1e6a1a09 100644 --- a/tests/check/elements/audiowsincband.c +++ b/tests/check/elements/audiowsincband.c @@ -102,6 +102,7 @@ GST_START_TEST (test_32_bp_0hz) GstCaps *caps; gfloat *in, *res, rms; gint i; + GstMapInfo map; GList *node; audiowsincband = setup_audiowsincband (); @@ -120,10 +121,11 @@ GST_START_TEST (test_32_bp_0hz) inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); GST_BUFFER_TIMESTAMP (inbuffer) = 0; - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gfloat *) map.data; for (i = 0; i < 1024; i++) in[i] = 1.0; - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32); gst_pad_set_caps (mysrcpad, caps); @@ -138,18 +140,20 @@ GST_START_TEST (test_32_bp_0hz) for (node = buffers; node; node = node->next) { gint buffer_length; - gsize size; fail_if ((outbuffer = (GstBuffer *) node->data) == NULL); - res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ); - buffer_length = size / sizeof (gfloat); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gfloat *) map.data; + buffer_length = map.size / sizeof (gfloat); rms = 0.0; for (i = 0; i < buffer_length; i++) rms += res[i] * res[i]; rms = sqrt (rms / buffer_length); fail_unless (rms <= 0.1); + + gst_buffer_unmap (outbuffer, &map); } /* cleanup */ @@ -168,6 +172,7 @@ GST_START_TEST (test_32_bp_11025hz) GstCaps *caps; gfloat *in, *res, rms; gint i; + GstMapInfo map; GList *node; audiowsincband = setup_audiowsincband (); @@ -185,14 +190,15 @@ GST_START_TEST (test_32_bp_11025hz) 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); GST_BUFFER_TIMESTAMP (inbuffer) = 0; - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gfloat *) map.data; for (i = 0; i < 1024; i += 4) { in[i] = 0.0; in[i + 1] = 1.0; in[i + 2] = 0.0; in[i + 3] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32); gst_pad_set_caps (mysrcpad, caps); @@ -207,12 +213,12 @@ GST_START_TEST (test_32_bp_11025hz) for (node = buffers; node; node = node->next) { gint buffer_length; - gsize size; fail_if ((outbuffer = (GstBuffer *) node->data) == NULL); - res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ); - buffer_length = size / sizeof (gfloat); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gfloat *) map.data; + buffer_length = map.size / sizeof (gfloat); rms = 0.0; for (i = 0; i < buffer_length; i++) rms += res[i] * res[i]; @@ -237,6 +243,7 @@ GST_START_TEST (test_32_bp_22050hz) GstCaps *caps; gfloat *in, *res, rms; gint i; + GstMapInfo map; GList *node; audiowsincband = setup_audiowsincband (); @@ -254,12 +261,13 @@ GST_START_TEST (test_32_bp_22050hz) 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); GST_BUFFER_TIMESTAMP (inbuffer) = 0; - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gfloat *) map.data; for (i = 0; i < 1024; i += 2) { in[i] = 1.0; in[i + 1] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32); gst_pad_set_caps (mysrcpad, caps); @@ -274,12 +282,12 @@ GST_START_TEST (test_32_bp_22050hz) for (node = buffers; node; node = node->next) { gint buffer_length; - gsize size; fail_if ((outbuffer = (GstBuffer *) node->data) == NULL); - res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ); - buffer_length = size / sizeof (gfloat); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gfloat *) map.data; + buffer_length = map.size / sizeof (gfloat); rms = 0.0; for (i = 0; i < buffer_length; i++) rms += res[i] * res[i]; @@ -303,6 +311,7 @@ GST_START_TEST (test_32_br_0hz) GstCaps *caps; gfloat *in, *res, rms; gint i; + GstMapInfo map; GList *node; audiowsincband = setup_audiowsincband (); @@ -320,10 +329,11 @@ GST_START_TEST (test_32_br_0hz) 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); GST_BUFFER_TIMESTAMP (inbuffer) = 0; - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gfloat *) map.data; for (i = 0; i < 1024; i++) in[i] = 1.0; - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32); gst_pad_set_caps (mysrcpad, caps); @@ -338,12 +348,12 @@ GST_START_TEST (test_32_br_0hz) for (node = buffers; node; node = node->next) { gint buffer_length; - gsize size; fail_if ((outbuffer = (GstBuffer *) node->data) == NULL); - res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ); - buffer_length = size / sizeof (gfloat); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gfloat *) map.data; + buffer_length = map.size / sizeof (gfloat); rms = 0.0; for (i = 0; i < buffer_length; i++) rms += res[i] * res[i]; @@ -367,6 +377,7 @@ GST_START_TEST (test_32_br_11025hz) GstCaps *caps; gfloat *in, *res, rms; gint i; + GstMapInfo map; GList *node; audiowsincband = setup_audiowsincband (); @@ -384,7 +395,8 @@ GST_START_TEST (test_32_br_11025hz) 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); GST_BUFFER_TIMESTAMP (inbuffer) = 0; - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gfloat *) map.data; for (i = 0; i < 1024; i += 4) { in[i] = 0.0; @@ -392,7 +404,7 @@ GST_START_TEST (test_32_br_11025hz) in[i + 2] = 0.0; in[i + 3] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32); gst_pad_set_caps (mysrcpad, caps); @@ -407,12 +419,12 @@ GST_START_TEST (test_32_br_11025hz) for (node = buffers; node; node = node->next) { gint buffer_length; - gsize size; fail_if ((outbuffer = (GstBuffer *) node->data) == NULL); - res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ); - buffer_length = size / sizeof (gfloat); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gfloat *) map.data; + buffer_length = map.size / sizeof (gfloat); rms = 0.0; for (i = 0; i < buffer_length; i++) rms += res[i] * res[i]; @@ -437,6 +449,7 @@ GST_START_TEST (test_32_br_22050hz) GstCaps *caps; gfloat *in, *res, rms; gint i; + GstMapInfo map; GList *node; audiowsincband = setup_audiowsincband (); @@ -454,12 +467,13 @@ GST_START_TEST (test_32_br_22050hz) 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); GST_BUFFER_TIMESTAMP (inbuffer) = 0; - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gfloat *) map.data; for (i = 0; i < 1024; i += 2) { in[i] = 1.0; in[i + 1] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32); gst_pad_set_caps (mysrcpad, caps); @@ -474,12 +488,12 @@ GST_START_TEST (test_32_br_22050hz) for (node = buffers; node; node = node->next) { gint buffer_length; - gsize size; fail_if ((outbuffer = (GstBuffer *) node->data) == NULL); - res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ); - buffer_length = size / sizeof (gfloat); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gfloat *) map.data; + buffer_length = map.size / sizeof (gfloat); rms = 0.0; for (i = 0; i < buffer_length; i++) rms += res[i] * res[i]; @@ -502,6 +516,7 @@ GST_START_TEST (test_32_small_buffer) GstCaps *caps; gfloat *in; gint i; + GstMapInfo map; audiowsincband = setup_audiowsincband (); /* Set to bandpass */ @@ -518,10 +533,11 @@ GST_START_TEST (test_32_small_buffer) 44100 / 4.0 + 44100 / 16.0, NULL); inbuffer = gst_buffer_new_and_alloc (20 * sizeof (gfloat)); GST_BUFFER_TIMESTAMP (inbuffer) = 0; - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gfloat *) map.data; for (i = 0; i < 20; i++) in[i] = 1.0; - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32); gst_pad_set_caps (mysrcpad, caps); @@ -558,6 +574,7 @@ GST_START_TEST (test_64_bp_0hz) GstCaps *caps; gdouble *in, *res, rms; gint i; + GstMapInfo map; GList *node; audiowsincband = setup_audiowsincband (); @@ -575,10 +592,11 @@ GST_START_TEST (test_64_bp_0hz) 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); GST_BUFFER_TIMESTAMP (inbuffer) = 0; - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gdouble *) map.data; for (i = 0; i < 1024; i++) in[i] = 1.0; - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64); gst_pad_set_caps (mysrcpad, caps); @@ -593,12 +611,12 @@ GST_START_TEST (test_64_bp_0hz) for (node = buffers; node; node = node->next) { gint buffer_length; - gsize size; fail_if ((outbuffer = (GstBuffer *) node->data) == NULL); - res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ); - buffer_length = size / sizeof (gfloat); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gdouble *) map.data; + buffer_length = map.size / sizeof (gdouble); rms = 0.0; for (i = 0; i < buffer_length; i++) rms += res[i] * res[i]; @@ -622,6 +640,7 @@ GST_START_TEST (test_64_bp_11025hz) GstCaps *caps; gdouble *in, *res, rms; gint i; + GstMapInfo map; GList *node; audiowsincband = setup_audiowsincband (); @@ -639,14 +658,15 @@ GST_START_TEST (test_64_bp_11025hz) 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); GST_BUFFER_TIMESTAMP (inbuffer) = 0; - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gdouble *) map.data; for (i = 0; i < 1024; i += 4) { in[i] = 0.0; in[i + 1] = 1.0; in[i + 2] = 0.0; in[i + 3] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64); gst_pad_set_caps (mysrcpad, caps); @@ -661,12 +681,12 @@ GST_START_TEST (test_64_bp_11025hz) for (node = buffers; node; node = node->next) { gint buffer_length; - gsize size; fail_if ((outbuffer = (GstBuffer *) node->data) == NULL); - res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ); - buffer_length = size / sizeof (gfloat); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gdouble *) map.data; + buffer_length = map.size / sizeof (gdouble); rms = 0.0; for (i = 0; i < buffer_length; i++) rms += res[i] * res[i]; @@ -691,6 +711,7 @@ GST_START_TEST (test_64_bp_22050hz) GstCaps *caps; gdouble *in, *res, rms; gint i; + GstMapInfo map; GList *node; audiowsincband = setup_audiowsincband (); @@ -708,12 +729,13 @@ GST_START_TEST (test_64_bp_22050hz) 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); GST_BUFFER_TIMESTAMP (inbuffer) = 0; - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gdouble *) map.data; for (i = 0; i < 1024; i += 2) { in[i] = 1.0; in[i + 1] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64); gst_pad_set_caps (mysrcpad, caps); @@ -728,12 +750,12 @@ GST_START_TEST (test_64_bp_22050hz) for (node = buffers; node; node = node->next) { gint buffer_length; - gsize size; fail_if ((outbuffer = (GstBuffer *) node->data) == NULL); - res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ); - buffer_length = size / sizeof (gfloat); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gdouble *) map.data; + buffer_length = map.size / sizeof (gdouble); rms = 0.0; for (i = 0; i < buffer_length; i++) rms += res[i] * res[i]; @@ -757,6 +779,7 @@ GST_START_TEST (test_64_br_0hz) GstCaps *caps; gdouble *in, *res, rms; gint i; + GstMapInfo map; GList *node; audiowsincband = setup_audiowsincband (); @@ -774,10 +797,11 @@ GST_START_TEST (test_64_br_0hz) 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); GST_BUFFER_TIMESTAMP (inbuffer) = 0; - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gdouble *) map.data; for (i = 0; i < 1024; i++) in[i] = 1.0; - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64); gst_pad_set_caps (mysrcpad, caps); @@ -792,12 +816,12 @@ GST_START_TEST (test_64_br_0hz) for (node = buffers; node; node = node->next) { gint buffer_length; - gsize size; fail_if ((outbuffer = (GstBuffer *) node->data) == NULL); - res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ); - buffer_length = size / sizeof (gfloat); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gdouble *) map.data; + buffer_length = map.size / sizeof (gdouble); rms = 0.0; for (i = 0; i < buffer_length; i++) rms += res[i] * res[i]; @@ -821,6 +845,7 @@ GST_START_TEST (test_64_br_11025hz) GstCaps *caps; gdouble *in, *res, rms; gint i; + GstMapInfo map; GList *node; audiowsincband = setup_audiowsincband (); @@ -838,7 +863,8 @@ GST_START_TEST (test_64_br_11025hz) 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); GST_BUFFER_TIMESTAMP (inbuffer) = 0; - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gdouble *) map.data; for (i = 0; i < 1024; i += 4) { in[i] = 0.0; @@ -846,7 +872,7 @@ GST_START_TEST (test_64_br_11025hz) in[i + 2] = 0.0; in[i + 3] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64); gst_pad_set_caps (mysrcpad, caps); @@ -861,12 +887,12 @@ GST_START_TEST (test_64_br_11025hz) for (node = buffers; node; node = node->next) { gint buffer_length; - gsize size; fail_if ((outbuffer = (GstBuffer *) node->data) == NULL); - res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ); - buffer_length = size / sizeof (gfloat); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gdouble *) map.data; + buffer_length = map.size / sizeof (gdouble); rms = 0.0; for (i = 0; i < buffer_length; i++) rms += res[i] * res[i]; @@ -891,6 +917,7 @@ GST_START_TEST (test_64_br_22050hz) GstCaps *caps; gdouble *in, *res, rms; gint i; + GstMapInfo map; GList *node; audiowsincband = setup_audiowsincband (); @@ -908,12 +935,13 @@ GST_START_TEST (test_64_br_22050hz) 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); GST_BUFFER_TIMESTAMP (inbuffer) = 0; - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gdouble *) map.data; for (i = 0; i < 1024; i += 2) { in[i] = 1.0; in[i + 1] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64); gst_pad_set_caps (mysrcpad, caps); @@ -928,12 +956,12 @@ GST_START_TEST (test_64_br_22050hz) for (node = buffers; node; node = node->next) { gint buffer_length; - gsize size; fail_if ((outbuffer = (GstBuffer *) node->data) == NULL); - res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ); - buffer_length = size / sizeof (gfloat); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gdouble *) map.data; + buffer_length = map.size / sizeof (gdouble); rms = 0.0; for (i = 0; i < buffer_length; i++) rms += res[i] * res[i]; @@ -956,6 +984,7 @@ GST_START_TEST (test_64_small_buffer) GstCaps *caps; gdouble *in; gint i; + GstMapInfo map; audiowsincband = setup_audiowsincband (); /* Set to bandpass */ @@ -972,10 +1001,11 @@ GST_START_TEST (test_64_small_buffer) 44100 / 4.0 + 44100 / 16.0, NULL); inbuffer = gst_buffer_new_and_alloc (20 * sizeof (gdouble)); GST_BUFFER_TIMESTAMP (inbuffer) = 0; - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gdouble *) map.data; for (i = 0; i < 20; i++) in[i] = 1.0; - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64); gst_pad_set_caps (mysrcpad, caps); diff --git a/tests/check/elements/audiowsinclimit.c b/tests/check/elements/audiowsinclimit.c index ca8af808e0..bb0ea130ac 100644 --- a/tests/check/elements/audiowsinclimit.c +++ b/tests/check/elements/audiowsinclimit.c @@ -102,6 +102,7 @@ GST_START_TEST (test_32_lp_0hz) GstCaps *caps; gfloat *in, *res, rms; gint i; + GstMapInfo map; GList *node; audiowsinclimit = setup_audiowsinclimit (); @@ -117,10 +118,11 @@ GST_START_TEST (test_32_lp_0hz) g_object_set (G_OBJECT (audiowsinclimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat)); GST_BUFFER_TIMESTAMP (inbuffer) = 0; - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gfloat *) map.data; for (i = 0; i < 128; i++) in[i] = 1.0; - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (AUDIO_WSINC_LIMIT_CAPS_STRING_32); gst_pad_set_caps (mysrcpad, caps); @@ -135,17 +137,17 @@ GST_START_TEST (test_32_lp_0hz) for (node = buffers; node; node = node->next) { gint buffer_length; - gsize size; fail_if ((outbuffer = (GstBuffer *) node->data) == NULL); - res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ); - buffer_length = size / sizeof (gfloat); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gfloat *) map.data; + buffer_length = map.size / sizeof (gfloat); rms = 0.0; for (i = 0; i < buffer_length; i++) rms += res[i] * res[i]; rms = sqrt (rms / buffer_length); - gst_buffer_unmap (outbuffer, res, size); + gst_buffer_unmap (outbuffer, &map); fail_unless (rms >= 0.9); } @@ -165,6 +167,7 @@ GST_START_TEST (test_32_lp_22050hz) GstCaps *caps; gfloat *in, *res, rms; gint i; + GstMapInfo map; GList *node; audiowsinclimit = setup_audiowsinclimit (); @@ -179,12 +182,13 @@ GST_START_TEST (test_32_lp_22050hz) g_object_set (G_OBJECT (audiowsinclimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat)); GST_BUFFER_TIMESTAMP (inbuffer) = 0; - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gfloat *) map.data; for (i = 0; i < 128; i += 2) { in[i] = 1.0; in[i + 1] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (AUDIO_WSINC_LIMIT_CAPS_STRING_32); gst_pad_set_caps (mysrcpad, caps); @@ -199,17 +203,17 @@ GST_START_TEST (test_32_lp_22050hz) for (node = buffers; node; node = node->next) { gint buffer_length; - gsize size; fail_if ((outbuffer = (GstBuffer *) node->data) == NULL); - res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ); - buffer_length = size / sizeof (gfloat); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gfloat *) map.data; + buffer_length = map.size / sizeof (gfloat); rms = 0.0; for (i = 0; i < buffer_length; i++) rms += res[i] * res[i]; rms = sqrt (rms / buffer_length); - gst_buffer_unmap (outbuffer, res, size); + gst_buffer_unmap (outbuffer, &map); fail_unless (rms <= 0.1); } @@ -229,6 +233,7 @@ GST_START_TEST (test_32_hp_0hz) GstCaps *caps; gfloat *in, *res, rms; gint i; + GstMapInfo map; GList *node; audiowsinclimit = setup_audiowsinclimit (); @@ -243,10 +248,11 @@ GST_START_TEST (test_32_hp_0hz) g_object_set (G_OBJECT (audiowsinclimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat)); GST_BUFFER_TIMESTAMP (inbuffer) = 0; - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gfloat *) map.data; for (i = 0; i < 128; i++) in[i] = 1.0; - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (AUDIO_WSINC_LIMIT_CAPS_STRING_32); gst_pad_set_caps (mysrcpad, caps); @@ -261,17 +267,17 @@ GST_START_TEST (test_32_hp_0hz) for (node = buffers; node; node = node->next) { gint buffer_length; - gsize size; fail_if ((outbuffer = (GstBuffer *) node->data) == NULL); - res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ); - buffer_length = size / sizeof (gfloat); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gfloat *) map.data; + buffer_length = map.size / sizeof (gfloat); rms = 0.0; for (i = 0; i < buffer_length; i++) rms += res[i] * res[i]; rms = sqrt (rms / buffer_length); - gst_buffer_unmap (outbuffer, res, size); + gst_buffer_unmap (outbuffer, &map); fail_unless (rms <= 0.1); } @@ -291,6 +297,7 @@ GST_START_TEST (test_32_hp_22050hz) GstCaps *caps; gfloat *in, *res, rms; gint i; + GstMapInfo map; GList *node; audiowsinclimit = setup_audiowsinclimit (); @@ -305,12 +312,13 @@ GST_START_TEST (test_32_hp_22050hz) g_object_set (G_OBJECT (audiowsinclimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat)); GST_BUFFER_TIMESTAMP (inbuffer) = 0; - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gfloat *) map.data; for (i = 0; i < 128; i += 2) { in[i] = 1.0; in[i + 1] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (AUDIO_WSINC_LIMIT_CAPS_STRING_32); gst_pad_set_caps (mysrcpad, caps); @@ -326,17 +334,17 @@ GST_START_TEST (test_32_hp_22050hz) for (node = buffers; node; node = node->next) { gint buffer_length; - gsize size; fail_if ((outbuffer = (GstBuffer *) node->data) == NULL); - res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ); - buffer_length = size / sizeof (gfloat); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gfloat *) map.data; + buffer_length = map.size / sizeof (gfloat); rms = 0.0; for (i = 0; i < buffer_length; i++) rms += res[i] * res[i]; rms = sqrt (rms / buffer_length); - gst_buffer_unmap (outbuffer, res, size); + gst_buffer_unmap (outbuffer, &map); fail_unless (rms >= 0.9); } @@ -355,6 +363,7 @@ GST_START_TEST (test_32_small_buffer) GstCaps *caps; gfloat *in; gint i; + GstMapInfo map; audiowsinclimit = setup_audiowsinclimit (); /* Set to lowpass */ @@ -368,10 +377,11 @@ GST_START_TEST (test_32_small_buffer) g_object_set (G_OBJECT (audiowsinclimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (20 * sizeof (gfloat)); GST_BUFFER_TIMESTAMP (inbuffer) = 0; - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gfloat *) map.data; for (i = 0; i < 20; i++) in[i] = 1.0; - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (AUDIO_WSINC_LIMIT_CAPS_STRING_32); gst_pad_set_caps (mysrcpad, caps); @@ -401,6 +411,7 @@ GST_START_TEST (test_64_lp_0hz) GstCaps *caps; gdouble *in, *res, rms; gint i; + GstMapInfo map; GList *node; audiowsinclimit = setup_audiowsinclimit (); @@ -416,10 +427,11 @@ GST_START_TEST (test_64_lp_0hz) g_object_set (G_OBJECT (audiowsinclimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble)); GST_BUFFER_TIMESTAMP (inbuffer) = 0; - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gdouble *) map.data; for (i = 0; i < 128; i++) in[i] = 1.0; - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (AUDIO_WSINC_LIMIT_CAPS_STRING_64); gst_pad_set_caps (mysrcpad, caps); @@ -434,17 +446,17 @@ GST_START_TEST (test_64_lp_0hz) for (node = buffers; node; node = node->next) { gint buffer_length; - gsize size; fail_if ((outbuffer = (GstBuffer *) node->data) == NULL); - res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ); - buffer_length = size / sizeof (gfloat); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gdouble *) map.data; + buffer_length = map.size / sizeof (gdouble); rms = 0.0; for (i = 0; i < buffer_length; i++) rms += res[i] * res[i]; rms = sqrt (rms / buffer_length); - gst_buffer_unmap (outbuffer, res, size); + gst_buffer_unmap (outbuffer, &map); fail_unless (rms >= 0.9); } @@ -464,6 +476,7 @@ GST_START_TEST (test_64_lp_22050hz) GstCaps *caps; gdouble *in, *res, rms; gint i; + GstMapInfo map; GList *node; audiowsinclimit = setup_audiowsinclimit (); @@ -478,12 +491,13 @@ GST_START_TEST (test_64_lp_22050hz) g_object_set (G_OBJECT (audiowsinclimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble)); GST_BUFFER_TIMESTAMP (inbuffer) = 0; - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gdouble *) map.data; for (i = 0; i < 128; i += 2) { in[i] = 1.0; in[i + 1] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (AUDIO_WSINC_LIMIT_CAPS_STRING_64); gst_pad_set_caps (mysrcpad, caps); @@ -498,17 +512,17 @@ GST_START_TEST (test_64_lp_22050hz) for (node = buffers; node; node = node->next) { gint buffer_length; - gsize size; fail_if ((outbuffer = (GstBuffer *) node->data) == NULL); - res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ); - buffer_length = size / sizeof (gfloat); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gdouble *) map.data; + buffer_length = map.size / sizeof (gdouble); rms = 0.0; for (i = 0; i < buffer_length; i++) rms += res[i] * res[i]; rms = sqrt (rms / buffer_length); - gst_buffer_unmap (outbuffer, res, size); + gst_buffer_unmap (outbuffer, &map); fail_unless (rms <= 0.1); } @@ -528,6 +542,7 @@ GST_START_TEST (test_64_hp_0hz) GstCaps *caps; gdouble *in, *res, rms; gint i; + GstMapInfo map; GList *node; audiowsinclimit = setup_audiowsinclimit (); @@ -542,10 +557,11 @@ GST_START_TEST (test_64_hp_0hz) g_object_set (G_OBJECT (audiowsinclimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble)); GST_BUFFER_TIMESTAMP (inbuffer) = 0; - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gdouble *) map.data; for (i = 0; i < 128; i++) in[i] = 1.0; - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (AUDIO_WSINC_LIMIT_CAPS_STRING_64); gst_pad_set_caps (mysrcpad, caps); @@ -560,17 +576,17 @@ GST_START_TEST (test_64_hp_0hz) for (node = buffers; node; node = node->next) { gint buffer_length; - gsize size; fail_if ((outbuffer = (GstBuffer *) node->data) == NULL); - res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ); - buffer_length = size / sizeof (gfloat); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gdouble *) map.data; + buffer_length = map.size / sizeof (gdouble); rms = 0.0; for (i = 0; i < buffer_length; i++) rms += res[i] * res[i]; rms = sqrt (rms / buffer_length); - gst_buffer_unmap (outbuffer, res, size); + gst_buffer_unmap (outbuffer, &map); fail_unless (rms <= 0.1); } @@ -590,6 +606,7 @@ GST_START_TEST (test_64_hp_22050hz) GstCaps *caps; gdouble *in, *res, rms; gint i; + GstMapInfo map; GList *node; audiowsinclimit = setup_audiowsinclimit (); @@ -604,12 +621,13 @@ GST_START_TEST (test_64_hp_22050hz) g_object_set (G_OBJECT (audiowsinclimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble)); GST_BUFFER_TIMESTAMP (inbuffer) = 0; - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gdouble *) map.data; for (i = 0; i < 128; i += 2) { in[i] = 1.0; in[i + 1] = -1.0; } - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (AUDIO_WSINC_LIMIT_CAPS_STRING_64); gst_pad_set_caps (mysrcpad, caps); @@ -625,17 +643,17 @@ GST_START_TEST (test_64_hp_22050hz) for (node = buffers; node; node = node->next) { gint buffer_length; - gsize size; fail_if ((outbuffer = (GstBuffer *) node->data) == NULL); - res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ); - buffer_length = size / sizeof (gfloat); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + res = (gdouble *) map.data; + buffer_length = map.size / sizeof (gdouble); rms = 0.0; for (i = 0; i < buffer_length; i++) rms += res[i] * res[i]; rms = sqrt (rms / buffer_length); - gst_buffer_unmap (outbuffer, res, size); + gst_buffer_unmap (outbuffer, &map); fail_unless (rms >= 0.9); } @@ -654,6 +672,7 @@ GST_START_TEST (test_64_small_buffer) GstCaps *caps; gdouble *in; gint i; + GstMapInfo map; audiowsinclimit = setup_audiowsinclimit (); /* Set to lowpass */ @@ -667,10 +686,11 @@ GST_START_TEST (test_64_small_buffer) g_object_set (G_OBJECT (audiowsinclimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (20 * sizeof (gdouble)); GST_BUFFER_TIMESTAMP (inbuffer) = 0; - in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuffer, &map, GST_MAP_WRITE); + in = (gdouble *) map.data; for (i = 0; i < 20; i++) in[i] = 1.0; - gst_buffer_unmap (inbuffer, in, -1); + gst_buffer_unmap (inbuffer, &map); caps = gst_caps_from_string (AUDIO_WSINC_LIMIT_CAPS_STRING_64); gst_pad_set_caps (mysrcpad, caps); diff --git a/tests/check/elements/avimux.c b/tests/check/elements/avimux.c index a55aaad6d6..9d2f2696d8 100644 --- a/tests/check/elements/avimux.c +++ b/tests/check/elements/avimux.c @@ -186,10 +186,13 @@ check_avimux_pad (GstStaticPadTemplate * srctemplate, switch (i) { case 0:{ /* check riff header */ /* avi header */ + GstMapInfo map; gsize size; - guint8 *data, *orig; + guint8 *data; - data = orig = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ); + gst_buffer_map (outbuffer, &map, GST_MAP_READ); + data = map.data; + size = map.size; fail_unless (memcmp (data, data0, sizeof (data0)) == 0); fail_unless (memcmp (data + 8, data1, sizeof (data1)) == 0); @@ -200,12 +203,12 @@ check_avimux_pad (GstStaticPadTemplate * srctemplate, fail_unless (memcmp (data + 8, data4, sizeof (data4)) == 0); fail_unless (memcmp (data + 76, data5, sizeof (data5)) == 0); /* avi data header */ - data = orig; + data = map.data; data += size - 12; fail_unless (memcmp (data, data6, sizeof (data6)) == 0); data += 8; fail_unless (memcmp (data, data7, sizeof (data7)) == 0); - gst_buffer_unmap (outbuffer, orig, size); + gst_buffer_unmap (outbuffer, &map); break; } case 1: /* chunk header */ diff --git a/tests/check/elements/deinterlace.c b/tests/check/elements/deinterlace.c index 667509b717..ee67002e00 100644 --- a/tests/check/elements/deinterlace.c +++ b/tests/check/elements/deinterlace.c @@ -172,16 +172,18 @@ setup_test_pipeline (gint mode, GstCaps * infiltercaps, GstCaps * outfiltercaps, static gboolean test_buffer_equals (GstBuffer * buf_a, GstBuffer * buf_b) { - gsize s1, s2; - gpointer d1, d2; + GstMapInfo m1, m2; gboolean res = FALSE; - d1 = gst_buffer_map (buf_a, &s1, NULL, GST_MAP_READ); - d2 = gst_buffer_map (buf_b, &s2, NULL, GST_MAP_READ); + gst_buffer_map (buf_a, &m1, GST_MAP_READ); + gst_buffer_map (buf_b, &m2, GST_MAP_READ); - if (s1 == s2) { - res = memcmp (d1, d2, s1) == 0; + if (m1.size == m2.size) { + res = memcmp (m1.data, m2.data, m1.size) == 0; } + gst_buffer_unmap (buf_a, &m1); + gst_buffer_unmap (buf_b, &m2); + return res; } diff --git a/tests/check/elements/deinterleave.c b/tests/check/elements/deinterleave.c index cafe834fe0..237899ebce 100644 --- a/tests/check/elements/deinterleave.c +++ b/tests/check/elements/deinterleave.c @@ -23,6 +23,7 @@ #include #include +#include GST_START_TEST (test_create_and_unref) { @@ -78,12 +79,13 @@ static GstFlowReturn deinterleave_chain_func (GstPad * pad, GstObject * parent, GstBuffer * buffer) { gint i; - gsize size; + GstMapInfo map; gfloat *indata; fail_unless (GST_IS_BUFFER (buffer)); - indata = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ); - fail_unless_equals_int (size, 48000 * sizeof (gfloat)); + gst_buffer_map (buffer, &map, GST_MAP_READ); + indata = (gfloat *) map.data; + fail_unless_equals_int (map.size, 48000 * sizeof (gfloat)); fail_unless (indata != NULL); if (strcmp (GST_PAD_NAME (pad), "sink0") == 0) { @@ -95,7 +97,7 @@ deinterleave_chain_func (GstPad * pad, GstObject * parent, GstBuffer * buffer) } else { g_assert_not_reached (); } - gst_buffer_unmap (buffer, indata, size); + gst_buffer_unmap (buffer, &map); gst_buffer_unref (buffer); return GST_FLOW_OK; @@ -130,6 +132,7 @@ GST_START_TEST (test_2_channels) GstBuffer *inbuf; GstCaps *caps; gfloat *indata; + GstMapInfo map; mysinkpads = g_new0 (GstPad *, 2); nsinkpads = 0; @@ -159,12 +162,13 @@ GST_START_TEST (test_2_channels) GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS); inbuf = gst_buffer_new_and_alloc (2 * 48000 * sizeof (gfloat)); - indata = gst_buffer_map (inbuf, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuf, &map, GST_MAP_WRITE); + indata = (gfloat *) map.data; for (i = 0; i < 2 * 48000; i += 2) { indata[i] = -1.0; indata[i + 1] = 1.0; } - gst_buffer_unmap (inbuf, indata, -1); + gst_buffer_unmap (inbuf, &map); gst_pad_set_caps (mysrcpad, caps); fail_unless (gst_pad_push (mysrcpad, inbuf) == GST_FLOW_OK); @@ -191,6 +195,7 @@ GST_START_TEST (test_2_channels_1_linked) GstBuffer *inbuf; GstCaps *caps; gfloat *indata; + GstMapInfo map; nsinkpads = 0; mysinkpads = g_new0 (GstPad *, 2); @@ -220,12 +225,13 @@ GST_START_TEST (test_2_channels_1_linked) GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS); inbuf = gst_buffer_new_and_alloc (2 * 48000 * sizeof (gfloat)); - indata = gst_buffer_map (inbuf, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuf, &map, GST_MAP_WRITE); + indata = (gfloat *) map.data; for (i = 0; i < 2 * 48000; i += 2) { indata[i] = -1.0; indata[i + 1] = 1.0; } - gst_buffer_unmap (inbuf, indata, -1); + gst_buffer_unmap (inbuf, &map); gst_pad_set_caps (mysrcpad, caps); fail_unless (gst_pad_push (mysrcpad, inbuf) == GST_FLOW_OK); @@ -252,6 +258,7 @@ GST_START_TEST (test_2_channels_caps_change) gint i; GstBuffer *inbuf; gfloat *indata; + GstMapInfo map; nsinkpads = 0; mysinkpads = g_new0 (GstPad *, 2); @@ -281,12 +288,13 @@ GST_START_TEST (test_2_channels_caps_change) GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS); inbuf = gst_buffer_new_and_alloc (2 * 48000 * sizeof (gfloat)); - indata = gst_buffer_map (inbuf, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuf, &map, GST_MAP_WRITE); + indata = (gfloat *) map.data; for (i = 0; i < 2 * 48000; i += 2) { indata[i] = -1.0; indata[i + 1] = 1.0; } - gst_buffer_unmap (inbuf, indata, -1); + gst_buffer_unmap (inbuf, &map); gst_pad_set_caps (mysrcpad, caps); fail_unless (gst_pad_push (mysrcpad, inbuf) == GST_FLOW_OK); @@ -295,12 +303,13 @@ GST_START_TEST (test_2_channels_caps_change) gst_pad_set_caps (mysrcpad, caps2); inbuf = gst_buffer_new_and_alloc (2 * 48000 * sizeof (gfloat)); - indata = gst_buffer_map (inbuf, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuf, &map, GST_MAP_WRITE); + indata = (gfloat *) map.data; for (i = 0; i < 2 * 48000; i += 2) { indata[i] = -1.0; indata[i + 1] = 1.0; } - gst_buffer_unmap (inbuf, indata, -1); + gst_buffer_unmap (inbuf, &map); gst_pad_set_caps (mysrcpad, caps2); /* Should work fine because the caps changed in a compatible way */ @@ -312,13 +321,14 @@ GST_START_TEST (test_2_channels_caps_change) gst_pad_set_caps (mysrcpad, caps2); inbuf = gst_buffer_new_and_alloc (3 * 48000 * sizeof (gfloat)); - indata = gst_buffer_map (inbuf, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (inbuf, &map, GST_MAP_WRITE); + indata = (gfloat *) map.data; for (i = 0; i < 3 * 48000; i += 3) { indata[i] = -1.0; indata[i + 1] = 1.0; indata[i + 2] = 0.0; } - gst_buffer_unmap (inbuf, indata, -1); + gst_buffer_unmap (inbuf, &map); gst_pad_set_caps (mysrcpad, caps2); /* Should break because the caps changed in an incompatible way */ @@ -351,6 +361,7 @@ static void set_channel_positions (GstCaps * caps, int channels, GstAudioChannelPosition * channelpositions) { +#if 0 GValue chanpos = { 0 }; GValue pos = { 0 }; GstStructure *structure = gst_caps_get_structure (caps, 0); @@ -367,6 +378,7 @@ set_channel_positions (GstCaps * caps, int channels, gst_structure_set_value (structure, "channel-positions", &chanpos); g_value_unset (&chanpos); +#endif } static void @@ -410,13 +422,15 @@ static GstPadProbeReturn float_buffer_check_probe (GstPad * pad, GstPadProbeInfo * info, gpointer userdata) { + GstMapInfo map; gfloat *data; - gsize size; guint padnum, numpads; guint num, i; GstCaps *caps; GstStructure *s; +#if 0 GstAudioChannelPosition *pos; +#endif gint channels; GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER (info); @@ -431,13 +445,16 @@ float_buffer_check_probe (GstPad * pad, GstPadProbeInfo * info, fail_unless (gst_structure_get_int (s, "channels", &channels)); fail_unless_equals_int (channels, 1); fail_unless (gst_structure_has_field (s, "channel-positions")); +#if 0 pos = gst_audio_get_channel_positions (s); fail_unless (pos != NULL && pos[0] == GST_AUDIO_CHANNEL_POSITION_NONE); g_free (pos); +#endif gst_caps_unref (caps); - data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ); - num = size / sizeof (gfloat); + gst_buffer_map (buffer, &map, GST_MAP_READ); + data = (gfloat *) map.data; + num = map.size / sizeof (gfloat); /* Check buffer content */ for (i = 0; i < num; ++i) { @@ -452,7 +469,7 @@ float_buffer_check_probe (GstPad * pad, GstPadProbeInfo * info, /* check that the first channel is on pad src0, the second on src1 etc. */ fail_unless_equals_int (rest, padnum); } - gst_buffer_unmap (buffer, data, size); + gst_buffer_unmap (buffer, &map); return GST_PAD_PROBE_OK; /* don't drop data */ }