mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-02 21:48:55 +00:00
test: make more unit tests compile
This commit is contained in:
parent
08d8b81005
commit
06b3c265b8
14 changed files with 350 additions and 391 deletions
|
@ -233,6 +233,16 @@ elements_audiowsincband_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORM
|
||||||
elements_audiowsinclimit_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
|
elements_audiowsinclimit_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
|
||||||
elements_audiowsinclimit_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMINOR) $(LDADD)
|
elements_audiowsinclimit_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMINOR) $(LDADD)
|
||||||
|
|
||||||
|
elements_equalizer_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
|
||||||
|
elements_equalizer_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMINOR) $(LDADD)
|
||||||
|
|
||||||
|
elements_rganalysis_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
|
||||||
|
elements_rganalysis_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMINOR) $(LDADD)
|
||||||
|
elements_rglimiter_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
|
||||||
|
elements_rglimiter_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMINOR) $(LDADD)
|
||||||
|
elements_rgvolume_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
|
||||||
|
elements_rgvolume_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMINOR) $(LDADD)
|
||||||
|
|
||||||
elements_cmmldec_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
|
elements_cmmldec_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
|
||||||
elements_cmmlenc_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
|
elements_cmmlenc_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
|
||||||
|
|
||||||
|
@ -246,6 +256,9 @@ elements_deinterleave_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMIN
|
||||||
elements_interleave_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
|
elements_interleave_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
|
||||||
elements_interleave_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMINOR) $(LDADD)
|
elements_interleave_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMINOR) $(LDADD)
|
||||||
|
|
||||||
|
elements_level_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
|
||||||
|
elements_level_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMINOR) $(LDADD)
|
||||||
|
|
||||||
elements_imagefreeze_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(AM_CFLAGS)
|
elements_imagefreeze_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(AM_CFLAGS)
|
||||||
elements_imagefreeze_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_MAJORMINOR) $(GST_BASE_LIBS) $(LDADD)
|
elements_imagefreeze_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_MAJORMINOR) $(GST_BASE_LIBS) $(LDADD)
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
#include <gst/audio/audio.h>
|
||||||
#include <gst/base/gstbasetransform.h>
|
#include <gst/base/gstbasetransform.h>
|
||||||
#include <gst/check/gstcheck.h>
|
#include <gst/check/gstcheck.h>
|
||||||
|
|
||||||
|
@ -31,28 +32,25 @@
|
||||||
* get_peer, and then remove references in every test function */
|
* get_peer, and then remove references in every test function */
|
||||||
GstPad *mysrcpad, *mysinkpad;
|
GstPad *mysrcpad, *mysinkpad;
|
||||||
|
|
||||||
#define EQUALIZER_CAPS_STRING \
|
#define EQUALIZER_CAPS_STRING \
|
||||||
"audio/x-raw-float, " \
|
"audio/x-raw, " \
|
||||||
"channels = (int) 1, " \
|
"format = (string) "GST_AUDIO_NE (F64) ", " \
|
||||||
"rate = (int) 48000, " \
|
"channels = (int) 1, " \
|
||||||
"endianness = (int) BYTE_ORDER, " \
|
"rate = (int) 48000"
|
||||||
"width = (int) 64" \
|
|
||||||
|
|
||||||
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||||
GST_PAD_SINK,
|
GST_PAD_SINK,
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_STATIC_CAPS ("audio/x-raw-float, "
|
GST_STATIC_CAPS ("audio/x-raw, "
|
||||||
"channels = (int) 1, "
|
"format = (string) " GST_AUDIO_NE (F64) ", "
|
||||||
"rate = (int) 48000, "
|
"channels = (int) 1, " "rate = (int) 48000")
|
||||||
"endianness = (int) BYTE_ORDER, " "width = (int) 64 ")
|
|
||||||
);
|
);
|
||||||
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
|
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
GST_PAD_SRC,
|
GST_PAD_SRC,
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_STATIC_CAPS ("audio/x-raw-float, "
|
GST_STATIC_CAPS ("audio/x-raw, "
|
||||||
"channels = (int) 1, "
|
"format = (string) " GST_AUDIO_NE (F64) ", "
|
||||||
"rate = (int) 48000, "
|
"channels = (int) 1, " "rate = (int) 48000")
|
||||||
"endianness = (int) BYTE_ORDER, " "width = (int) 64 ")
|
|
||||||
);
|
);
|
||||||
|
|
||||||
static GstElement *
|
static GstElement *
|
||||||
|
@ -105,12 +103,13 @@ GST_START_TEST (test_equalizer_5bands_passthrough)
|
||||||
"could not set to playing");
|
"could not set to playing");
|
||||||
|
|
||||||
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
|
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
|
||||||
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
|
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
in[i] = g_random_double_range (-1.0, 1.0);
|
in[i] = g_random_double_range (-1.0, 1.0);
|
||||||
|
gst_buffer_unmap (inbuffer, in, -1);
|
||||||
|
|
||||||
caps = gst_caps_from_string (EQUALIZER_CAPS_STRING);
|
caps = gst_caps_from_string (EQUALIZER_CAPS_STRING);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
gst_pad_set_caps (mysrcpad, caps);
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
|
@ -120,10 +119,11 @@ GST_START_TEST (test_equalizer_5bands_passthrough)
|
||||||
/* ... and puts a new buffer on the global list */
|
/* ... and puts a new buffer on the global list */
|
||||||
fail_unless (g_list_length (buffers) == 1);
|
fail_unless (g_list_length (buffers) == 1);
|
||||||
|
|
||||||
res = (gdouble *) GST_BUFFER_DATA (GST_BUFFER (buffers->data));
|
res = gst_buffer_map (GST_BUFFER (buffers->data), NULL, NULL, GST_MAP_READ);
|
||||||
|
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
fail_unless_equals_float (in[i], res[i]);
|
fail_unless_equals_float (in[i], res[i]);
|
||||||
|
gst_buffer_unmap (GST_BUFFER (buffers->data), res, -1);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_equalizer (equalizer);
|
cleanup_equalizer (equalizer);
|
||||||
|
@ -159,9 +159,10 @@ GST_START_TEST (test_equalizer_5bands_minus_24)
|
||||||
"could not set to playing");
|
"could not set to playing");
|
||||||
|
|
||||||
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
|
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
|
||||||
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
|
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
in[i] = g_random_double_range (-1.0, 1.0);
|
in[i] = g_random_double_range (-1.0, 1.0);
|
||||||
|
gst_buffer_unmap (inbuffer, in, -1);
|
||||||
|
|
||||||
rms_in = 0.0;
|
rms_in = 0.0;
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
|
@ -169,7 +170,7 @@ GST_START_TEST (test_equalizer_5bands_minus_24)
|
||||||
rms_in = sqrt (rms_in / 1024);
|
rms_in = sqrt (rms_in / 1024);
|
||||||
|
|
||||||
caps = gst_caps_from_string (EQUALIZER_CAPS_STRING);
|
caps = gst_caps_from_string (EQUALIZER_CAPS_STRING);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
gst_pad_set_caps (mysrcpad, caps);
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
|
@ -179,12 +180,13 @@ GST_START_TEST (test_equalizer_5bands_minus_24)
|
||||||
/* ... and puts a new buffer on the global list */
|
/* ... and puts a new buffer on the global list */
|
||||||
fail_unless (g_list_length (buffers) == 1);
|
fail_unless (g_list_length (buffers) == 1);
|
||||||
|
|
||||||
res = (gdouble *) GST_BUFFER_DATA (GST_BUFFER (buffers->data));
|
res = gst_buffer_map (GST_BUFFER (buffers->data), NULL, NULL, GST_MAP_READ);
|
||||||
|
|
||||||
rms_out = 0.0;
|
rms_out = 0.0;
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
rms_out += res[i] * res[i];
|
rms_out += res[i] * res[i];
|
||||||
rms_out = sqrt (rms_out / 1024);
|
rms_out = sqrt (rms_out / 1024);
|
||||||
|
gst_buffer_unmap (GST_BUFFER (buffers->data), res, -1);
|
||||||
|
|
||||||
fail_unless (rms_in > rms_out);
|
fail_unless (rms_in > rms_out);
|
||||||
|
|
||||||
|
@ -222,9 +224,10 @@ GST_START_TEST (test_equalizer_5bands_plus_12)
|
||||||
"could not set to playing");
|
"could not set to playing");
|
||||||
|
|
||||||
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
|
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
|
||||||
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
|
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
in[i] = g_random_double_range (-1.0, 1.0);
|
in[i] = g_random_double_range (-1.0, 1.0);
|
||||||
|
gst_buffer_unmap (inbuffer, in, -1);
|
||||||
|
|
||||||
rms_in = 0.0;
|
rms_in = 0.0;
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
|
@ -232,7 +235,7 @@ GST_START_TEST (test_equalizer_5bands_plus_12)
|
||||||
rms_in = sqrt (rms_in / 1024);
|
rms_in = sqrt (rms_in / 1024);
|
||||||
|
|
||||||
caps = gst_caps_from_string (EQUALIZER_CAPS_STRING);
|
caps = gst_caps_from_string (EQUALIZER_CAPS_STRING);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
gst_pad_set_caps (mysrcpad, caps);
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
|
@ -242,12 +245,13 @@ GST_START_TEST (test_equalizer_5bands_plus_12)
|
||||||
/* ... and puts a new buffer on the global list */
|
/* ... and puts a new buffer on the global list */
|
||||||
fail_unless (g_list_length (buffers) == 1);
|
fail_unless (g_list_length (buffers) == 1);
|
||||||
|
|
||||||
res = (gdouble *) GST_BUFFER_DATA (GST_BUFFER (buffers->data));
|
res = gst_buffer_map (GST_BUFFER (buffers->data), NULL, NULL, GST_MAP_READ);
|
||||||
|
|
||||||
rms_out = 0.0;
|
rms_out = 0.0;
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
rms_out += res[i] * res[i];
|
rms_out += res[i] * res[i];
|
||||||
rms_out = sqrt (rms_out / 1024);
|
rms_out = sqrt (rms_out / 1024);
|
||||||
|
gst_buffer_unmap (GST_BUFFER (buffers->data), res, -1);
|
||||||
|
|
||||||
fail_unless (rms_in < rms_out);
|
fail_unless (rms_in < rms_out);
|
||||||
|
|
||||||
|
|
|
@ -229,11 +229,13 @@ GST_START_TEST (test_parse_flac_detect_stream)
|
||||||
fail_unless (G_VALUE_TYPE (bufval) == GST_TYPE_BUFFER);
|
fail_unless (G_VALUE_TYPE (bufval) == GST_TYPE_BUFFER);
|
||||||
buf = g_value_peek_pointer (bufval);
|
buf = g_value_peek_pointer (bufval);
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
fail_unless (GST_BUFFER_SIZE (buf) == sizeof (streaminfo_header));
|
fail_unless (gst_buffer_get_size (buf) == sizeof (streaminfo_header));
|
||||||
fail_unless (memcmp (buf, streaminfo_header, sizeof (streaminfo_header)));
|
fail_unless (gst_buffer_memcmp (buf, 0, streaminfo_header,
|
||||||
|
sizeof (streaminfo_header)));
|
||||||
} else if (i == 1) {
|
} else if (i == 1) {
|
||||||
fail_unless (GST_BUFFER_SIZE (buf) == sizeof (comment_header));
|
fail_unless (gst_buffer_get_size (buf) == sizeof (comment_header));
|
||||||
fail_unless (memcmp (buf, comment_header, sizeof (comment_header)));
|
fail_unless (gst_buffer_memcmp (buf, 0, comment_header,
|
||||||
|
sizeof (comment_header)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,24 +244,6 @@ GST_START_TEST (test_parse_flac_detect_stream)
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
||||||
GST_START_TEST (test_parse_flac_set_index)
|
|
||||||
{
|
|
||||||
GstElement *parse;
|
|
||||||
GstIndex *idx;
|
|
||||||
|
|
||||||
idx = gst_index_factory_make ("memindex");
|
|
||||||
if (idx == NULL)
|
|
||||||
return;
|
|
||||||
parse = gst_element_factory_make ("flacparse", NULL);
|
|
||||||
fail_unless (parse != NULL);
|
|
||||||
gst_object_ref_sink (idx);
|
|
||||||
gst_element_set_index (parse, GST_INDEX (idx));
|
|
||||||
gst_object_unref (idx);
|
|
||||||
gst_object_unref (parse);
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_END_TEST;
|
|
||||||
|
|
||||||
static Suite *
|
static Suite *
|
||||||
flacparse_suite (void)
|
flacparse_suite (void)
|
||||||
{
|
{
|
||||||
|
@ -275,7 +259,6 @@ flacparse_suite (void)
|
||||||
|
|
||||||
/* Other tests */
|
/* Other tests */
|
||||||
tcase_add_test (tc_chain, test_parse_flac_detect_stream);
|
tcase_add_test (tc_chain, test_parse_flac_detect_stream);
|
||||||
tcase_add_test (tc_chain, test_parse_flac_set_index);
|
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,8 +55,6 @@ handoff_cb (GstElement * element, GstBuffer * buf, GstPad * pad,
|
||||||
{
|
{
|
||||||
*p_counter += 1;
|
*p_counter += 1;
|
||||||
GST_LOG ("counter = %d", *p_counter);
|
GST_LOG ("counter = %d", *p_counter);
|
||||||
|
|
||||||
fail_unless (GST_BUFFER_CAPS (buf) != NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -42,8 +42,6 @@ handoff_cb (GstElement * element, GstBuffer * buf, GstPad * pad,
|
||||||
{
|
{
|
||||||
*p_counter += 1;
|
*p_counter += 1;
|
||||||
GST_LOG ("counter = %d", *p_counter);
|
GST_LOG ("counter = %d", *p_counter);
|
||||||
|
|
||||||
fail_unless (GST_BUFFER_CAPS (buf) != NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -140,11 +140,11 @@ push_data (const guint8 * data, int len, GstCaps * caps, gint64 offset)
|
||||||
GstFlowReturn res;
|
GstFlowReturn res;
|
||||||
GstBuffer *buffer = gst_buffer_new_and_alloc (len);
|
GstBuffer *buffer = gst_buffer_new_and_alloc (len);
|
||||||
|
|
||||||
memcpy (GST_BUFFER_DATA (buffer), data, len);
|
gst_buffer_fill (buffer, 0, data, len);
|
||||||
gst_buffer_set_caps (buffer, caps);
|
|
||||||
|
|
||||||
GST_BUFFER_OFFSET (buffer) = offset;
|
GST_BUFFER_OFFSET (buffer) = offset;
|
||||||
|
|
||||||
|
gst_pad_set_caps (srcpad, caps);
|
||||||
res = gst_pad_push (srcpad, buffer);
|
res = gst_pad_push (srcpad, buffer);
|
||||||
|
|
||||||
fail_unless (res == GST_FLOW_OK, "Failed pushing buffer: %d", res);
|
fail_unless (res == GST_FLOW_OK, "Failed pushing buffer: %d", res);
|
||||||
|
@ -228,9 +228,6 @@ GST_START_TEST (test_first_buf_offset_when_merged_for_typefinding)
|
||||||
/* first buffer should have offset 0 even after it was merged with 2nd buf */
|
/* first buffer should have offset 0 even after it was merged with 2nd buf */
|
||||||
fail_unless (GST_BUFFER_OFFSET (GST_BUFFER_CAST (buffers->data)) == 0);
|
fail_unless (GST_BUFFER_OFFSET (GST_BUFFER_CAST (buffers->data)) == 0);
|
||||||
|
|
||||||
/* first buffer should have caps set */
|
|
||||||
fail_unless (GST_BUFFER_CAPS (GST_BUFFER_CAST (buffers->data)) != NULL);
|
|
||||||
|
|
||||||
gst_caps_unref (icy_caps);
|
gst_caps_unref (icy_caps);
|
||||||
|
|
||||||
cleanup_icydemux ();
|
cleanup_icydemux ();
|
||||||
|
|
|
@ -125,11 +125,17 @@ GST_START_TEST (test_imagefreeze_0_1)
|
||||||
GMainLoop *loop;
|
GMainLoop *loop;
|
||||||
guint n_buffers = G_MAXUINT;
|
guint n_buffers = G_MAXUINT;
|
||||||
guint bus_watch = 0;
|
guint bus_watch = 0;
|
||||||
|
GstVideoInfo i1, i2;
|
||||||
|
|
||||||
caps1 =
|
gst_video_info_init (&i1);
|
||||||
gst_video_format_new_caps (GST_VIDEO_FORMAT_xRGB, 640, 480, 25, 1, 1, 1);
|
gst_video_info_set_format (&i1, GST_VIDEO_FORMAT_xRGB, 640, 480);
|
||||||
caps2 =
|
i1.fps_n = 25;
|
||||||
gst_video_format_new_caps (GST_VIDEO_FORMAT_xRGB, 640, 480, 0, 1, 1, 1);
|
i1.fps_d = 1;
|
||||||
|
caps1 = gst_video_info_to_caps (&i1);
|
||||||
|
|
||||||
|
gst_video_info_init (&i2);
|
||||||
|
gst_video_info_set_format (&i2, GST_VIDEO_FORMAT_xRGB, 640, 480);
|
||||||
|
caps2 = gst_video_info_to_caps (&i2);
|
||||||
|
|
||||||
pipeline =
|
pipeline =
|
||||||
setup_imagefreeze (caps1, caps2, G_CALLBACK (sink_handoff_cb_0_1),
|
setup_imagefreeze (caps1, caps2, G_CALLBACK (sink_handoff_cb_0_1),
|
||||||
|
@ -188,11 +194,19 @@ GST_START_TEST (test_imagefreeze_25_1_0ms_400ms)
|
||||||
GMainLoop *loop;
|
GMainLoop *loop;
|
||||||
guint n_buffers = G_MAXUINT;
|
guint n_buffers = G_MAXUINT;
|
||||||
guint bus_watch = 0;
|
guint bus_watch = 0;
|
||||||
|
GstVideoInfo i1, i2;
|
||||||
|
|
||||||
caps1 =
|
gst_video_info_init (&i1);
|
||||||
gst_video_format_new_caps (GST_VIDEO_FORMAT_xRGB, 640, 480, 25, 1, 1, 1);
|
gst_video_info_set_format (&i1, GST_VIDEO_FORMAT_xRGB, 640, 480);
|
||||||
caps2 =
|
i1.fps_n = 25;
|
||||||
gst_video_format_new_caps (GST_VIDEO_FORMAT_xRGB, 640, 480, 25, 1, 1, 1);
|
i1.fps_d = 1;
|
||||||
|
caps1 = gst_video_info_to_caps (&i1);
|
||||||
|
|
||||||
|
gst_video_info_init (&i2);
|
||||||
|
gst_video_info_set_format (&i2, GST_VIDEO_FORMAT_xRGB, 640, 480);
|
||||||
|
i2.fps_n = 25;
|
||||||
|
i2.fps_d = 1;
|
||||||
|
caps2 = gst_video_info_to_caps (&i2);
|
||||||
|
|
||||||
pipeline =
|
pipeline =
|
||||||
setup_imagefreeze (caps1, caps2,
|
setup_imagefreeze (caps1, caps2,
|
||||||
|
@ -260,11 +274,19 @@ GST_START_TEST (test_imagefreeze_25_1_200ms_400ms)
|
||||||
GMainLoop *loop;
|
GMainLoop *loop;
|
||||||
guint n_buffers = G_MAXUINT;
|
guint n_buffers = G_MAXUINT;
|
||||||
guint bus_watch = 0;
|
guint bus_watch = 0;
|
||||||
|
GstVideoInfo i1, i2;
|
||||||
|
|
||||||
caps1 =
|
gst_video_info_init (&i1);
|
||||||
gst_video_format_new_caps (GST_VIDEO_FORMAT_xRGB, 640, 480, 25, 1, 1, 1);
|
gst_video_info_set_format (&i1, GST_VIDEO_FORMAT_xRGB, 640, 480);
|
||||||
caps2 =
|
i1.fps_n = 25;
|
||||||
gst_video_format_new_caps (GST_VIDEO_FORMAT_xRGB, 640, 480, 25, 1, 1, 1);
|
i1.fps_d = 1;
|
||||||
|
caps1 = gst_video_info_to_caps (&i1);
|
||||||
|
|
||||||
|
gst_video_info_init (&i2);
|
||||||
|
gst_video_info_set_format (&i2, GST_VIDEO_FORMAT_xRGB, 640, 480);
|
||||||
|
i2.fps_n = 25;
|
||||||
|
i2.fps_d = 1;
|
||||||
|
caps2 = gst_video_info_to_caps (&i2);
|
||||||
|
|
||||||
pipeline =
|
pipeline =
|
||||||
setup_imagefreeze (caps1, caps2,
|
setup_imagefreeze (caps1, caps2,
|
||||||
|
@ -332,11 +354,19 @@ GST_START_TEST (test_imagefreeze_25_1_400ms_0ms)
|
||||||
GMainLoop *loop;
|
GMainLoop *loop;
|
||||||
guint n_buffers = G_MAXUINT;
|
guint n_buffers = G_MAXUINT;
|
||||||
guint bus_watch = 0;
|
guint bus_watch = 0;
|
||||||
|
GstVideoInfo i1, i2;
|
||||||
|
|
||||||
caps1 =
|
gst_video_info_init (&i1);
|
||||||
gst_video_format_new_caps (GST_VIDEO_FORMAT_xRGB, 640, 480, 25, 1, 1, 1);
|
gst_video_info_set_format (&i1, GST_VIDEO_FORMAT_xRGB, 640, 480);
|
||||||
caps2 =
|
i1.fps_n = 25;
|
||||||
gst_video_format_new_caps (GST_VIDEO_FORMAT_xRGB, 640, 480, 25, 1, 1, 1);
|
i1.fps_d = 1;
|
||||||
|
caps1 = gst_video_info_to_caps (&i1);
|
||||||
|
|
||||||
|
gst_video_info_init (&i2);
|
||||||
|
gst_video_info_set_format (&i2, GST_VIDEO_FORMAT_xRGB, 640, 480);
|
||||||
|
i2.fps_n = 25;
|
||||||
|
i2.fps_d = 1;
|
||||||
|
caps2 = gst_video_info_to_caps (&i2);
|
||||||
|
|
||||||
pipeline =
|
pipeline =
|
||||||
setup_imagefreeze (caps1, caps2,
|
setup_imagefreeze (caps1, caps2,
|
||||||
|
@ -415,11 +445,19 @@ GST_START_TEST (test_imagefreeze_25_1_220ms_380ms)
|
||||||
GMainLoop *loop;
|
GMainLoop *loop;
|
||||||
guint n_buffers = G_MAXUINT;
|
guint n_buffers = G_MAXUINT;
|
||||||
guint bus_watch = 0;
|
guint bus_watch = 0;
|
||||||
|
GstVideoInfo i1, i2;
|
||||||
|
|
||||||
caps1 =
|
gst_video_info_init (&i1);
|
||||||
gst_video_format_new_caps (GST_VIDEO_FORMAT_xRGB, 640, 480, 25, 1, 1, 1);
|
gst_video_info_set_format (&i1, GST_VIDEO_FORMAT_xRGB, 640, 480);
|
||||||
caps2 =
|
i1.fps_n = 25;
|
||||||
gst_video_format_new_caps (GST_VIDEO_FORMAT_xRGB, 640, 480, 25, 1, 1, 1);
|
i1.fps_d = 1;
|
||||||
|
caps1 = gst_video_info_to_caps (&i1);
|
||||||
|
|
||||||
|
gst_video_info_init (&i2);
|
||||||
|
gst_video_info_set_format (&i2, GST_VIDEO_FORMAT_xRGB, 640, 480);
|
||||||
|
i2.fps_n = 25;
|
||||||
|
i2.fps_d = 1;
|
||||||
|
caps2 = gst_video_info_to_caps (&i2);
|
||||||
|
|
||||||
pipeline =
|
pipeline =
|
||||||
setup_imagefreeze (caps1, caps2,
|
setup_imagefreeze (caps1, caps2,
|
||||||
|
@ -460,104 +498,6 @@ GST_START_TEST (test_imagefreeze_25_1_220ms_380ms)
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
||||||
static GstBuffer *test_buffer = NULL;
|
|
||||||
|
|
||||||
static GstFlowReturn
|
|
||||||
test_bufferalloc (GstPad * pad, guint64 offset, guint size, GstCaps * caps,
|
|
||||||
GstBuffer ** buf)
|
|
||||||
{
|
|
||||||
fail_if (test_buffer != NULL);
|
|
||||||
|
|
||||||
test_buffer = gst_buffer_new_and_alloc (size);
|
|
||||||
gst_buffer_set_caps (test_buffer, caps);
|
|
||||||
|
|
||||||
*buf = gst_buffer_ref (test_buffer);
|
|
||||||
|
|
||||||
return GST_FLOW_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
sink_handoff_cb_bufferalloc (GstElement * object, GstBuffer * buffer,
|
|
||||||
GstPad * pad, gpointer user_data)
|
|
||||||
{
|
|
||||||
guint *n_buffers = (guint *) user_data;
|
|
||||||
|
|
||||||
if (*n_buffers == G_MAXUINT)
|
|
||||||
return;
|
|
||||||
|
|
||||||
fail_unless (buffer->parent != NULL);
|
|
||||||
fail_unless (test_buffer != NULL);
|
|
||||||
fail_unless (buffer->parent == test_buffer);
|
|
||||||
|
|
||||||
*n_buffers = *n_buffers + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_START_TEST (test_imagefreeze_bufferalloc)
|
|
||||||
{
|
|
||||||
GstElement *pipeline;
|
|
||||||
GstElement *sink;
|
|
||||||
GstPad *sinkpad;
|
|
||||||
GstCaps *caps1, *caps2;
|
|
||||||
GstBus *bus;
|
|
||||||
GMainLoop *loop;
|
|
||||||
guint n_buffers = G_MAXUINT;
|
|
||||||
guint bus_watch = 0;
|
|
||||||
|
|
||||||
caps1 =
|
|
||||||
gst_video_format_new_caps (GST_VIDEO_FORMAT_xRGB, 640, 480, 25, 1, 1, 1);
|
|
||||||
caps2 =
|
|
||||||
gst_video_format_new_caps (GST_VIDEO_FORMAT_xRGB, 640, 480, 25, 1, 1, 1);
|
|
||||||
|
|
||||||
pipeline =
|
|
||||||
setup_imagefreeze (caps1, caps2, G_CALLBACK (sink_handoff_cb_bufferalloc),
|
|
||||||
&n_buffers);
|
|
||||||
|
|
||||||
sink = gst_bin_get_by_name (GST_BIN (pipeline), "sink");
|
|
||||||
fail_unless (sink != NULL);
|
|
||||||
sinkpad = gst_element_get_static_pad (sink, "sink");
|
|
||||||
fail_unless (sinkpad != NULL);
|
|
||||||
gst_pad_set_bufferalloc_function (sinkpad, test_bufferalloc);
|
|
||||||
gst_object_unref (sinkpad);
|
|
||||||
gst_object_unref (sink);
|
|
||||||
|
|
||||||
loop = g_main_loop_new (NULL, TRUE);
|
|
||||||
fail_unless (loop != NULL);
|
|
||||||
|
|
||||||
bus = gst_element_get_bus (pipeline);
|
|
||||||
fail_unless (bus != NULL);
|
|
||||||
bus_watch = gst_bus_add_watch (bus, bus_handler, loop);
|
|
||||||
gst_object_unref (bus);
|
|
||||||
|
|
||||||
fail_unless_equals_int (gst_element_set_state (pipeline, GST_STATE_PAUSED),
|
|
||||||
GST_STATE_CHANGE_SUCCESS);
|
|
||||||
|
|
||||||
fail_unless (gst_element_seek (pipeline, 1.0, GST_FORMAT_TIME,
|
|
||||||
GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET, 0, GST_SEEK_TYPE_SET,
|
|
||||||
400 * GST_MSECOND));
|
|
||||||
|
|
||||||
n_buffers = 0;
|
|
||||||
fail_unless_equals_int (gst_element_set_state (pipeline, GST_STATE_PLAYING),
|
|
||||||
GST_STATE_CHANGE_SUCCESS);
|
|
||||||
|
|
||||||
g_main_loop_run (loop);
|
|
||||||
|
|
||||||
fail_unless (test_buffer != NULL);
|
|
||||||
fail_unless (n_buffers >= 1);
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
|
||||||
|
|
||||||
gst_buffer_unref (test_buffer);
|
|
||||||
test_buffer = NULL;
|
|
||||||
|
|
||||||
gst_object_unref (pipeline);
|
|
||||||
g_main_loop_unref (loop);
|
|
||||||
gst_caps_unref (caps1);
|
|
||||||
gst_caps_unref (caps2);
|
|
||||||
g_source_remove (bus_watch);
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_END_TEST;
|
|
||||||
|
|
||||||
GST_START_TEST (test_imagefreeze_eos)
|
GST_START_TEST (test_imagefreeze_eos)
|
||||||
{
|
{
|
||||||
GstElement *pipeline;
|
GstElement *pipeline;
|
||||||
|
@ -568,11 +508,19 @@ GST_START_TEST (test_imagefreeze_eos)
|
||||||
GstFormat fmt = GST_FORMAT_TIME;
|
GstFormat fmt = GST_FORMAT_TIME;
|
||||||
gint64 position;
|
gint64 position;
|
||||||
guint bus_watch = 0;
|
guint bus_watch = 0;
|
||||||
|
GstVideoInfo i1, i2;
|
||||||
|
|
||||||
caps1 =
|
gst_video_info_init (&i1);
|
||||||
gst_video_format_new_caps (GST_VIDEO_FORMAT_xRGB, 640, 480, 25, 1, 1, 1);
|
gst_video_info_set_format (&i1, GST_VIDEO_FORMAT_xRGB, 640, 480);
|
||||||
caps2 =
|
i1.fps_n = 25;
|
||||||
gst_video_format_new_caps (GST_VIDEO_FORMAT_xRGB, 640, 480, 25, 1, 1, 1);
|
i1.fps_d = 1;
|
||||||
|
caps1 = gst_video_info_to_caps (&i1);
|
||||||
|
|
||||||
|
gst_video_info_init (&i2);
|
||||||
|
gst_video_info_set_format (&i2, GST_VIDEO_FORMAT_xRGB, 640, 480);
|
||||||
|
i2.fps_n = 25;
|
||||||
|
i2.fps_d = 1;
|
||||||
|
caps2 = gst_video_info_to_caps (&i2);
|
||||||
|
|
||||||
pipeline = setup_imagefreeze (caps1, caps2, NULL, NULL);
|
pipeline = setup_imagefreeze (caps1, caps2, NULL, NULL);
|
||||||
|
|
||||||
|
@ -600,7 +548,7 @@ GST_START_TEST (test_imagefreeze_eos)
|
||||||
|
|
||||||
g_main_loop_run (loop);
|
g_main_loop_run (loop);
|
||||||
|
|
||||||
fail_unless (gst_element_query_position (src, &fmt, &position));
|
fail_unless (gst_element_query_position (src, fmt, &position));
|
||||||
fail_unless_equals_uint64 (position, 40 * GST_MSECOND);
|
fail_unless_equals_uint64 (position, 40 * GST_MSECOND);
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
gst_element_set_state (pipeline, GST_STATE_NULL);
|
||||||
|
@ -631,7 +579,6 @@ imagefreeze_suite (void)
|
||||||
tcase_add_test (tc_chain, test_imagefreeze_25_1_400ms_0ms);
|
tcase_add_test (tc_chain, test_imagefreeze_25_1_400ms_0ms);
|
||||||
tcase_add_test (tc_chain, test_imagefreeze_25_1_220ms_380ms);
|
tcase_add_test (tc_chain, test_imagefreeze_25_1_220ms_380ms);
|
||||||
|
|
||||||
tcase_add_test (tc_chain, test_imagefreeze_bufferalloc);
|
|
||||||
tcase_add_test (tc_chain, test_imagefreeze_eos);
|
tcase_add_test (tc_chain, test_imagefreeze_eos);
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
|
|
|
@ -74,48 +74,44 @@ static gfloat input[2];
|
||||||
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||||
GST_PAD_SINK,
|
GST_PAD_SINK,
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_STATIC_CAPS ("audio/x-raw-float, "
|
GST_STATIC_CAPS ("audio/x-raw, "
|
||||||
"width = (int) 32, "
|
"format = (string) " GST_AUDIO_NE (F32) ", "
|
||||||
"channels = (int) 2, "
|
"channels = (int) 2, " "rate = (int) 48000"));
|
||||||
"rate = (int) 48000, " "endianness = (int) BYTE_ORDER"));
|
|
||||||
|
|
||||||
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
|
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
GST_PAD_SRC,
|
GST_PAD_SRC,
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_STATIC_CAPS ("audio/x-raw-float, "
|
GST_STATIC_CAPS ("audio/x-raw, "
|
||||||
"width = (int) 32, "
|
"format = (string) " GST_AUDIO_NE (F32) ", "
|
||||||
"channels = (int) 1, "
|
"channels = (int) 1, " "rate = (int) 48000"));
|
||||||
"rate = (int) 48000, " "endianness = (int) BYTE_ORDER"));
|
|
||||||
|
|
||||||
#define CAPS_48khz \
|
#define CAPS_48khz \
|
||||||
"audio/x-raw-float, " \
|
"audio/x-raw, " \
|
||||||
"width = (int) 32, " \
|
"format = (string) " GST_AUDIO_NE (F32) ", " \
|
||||||
"channels = (int) 1, " \
|
"channels = (int) 1, " \
|
||||||
"rate = (int) 48000, " \
|
"rate = (int) 48000"
|
||||||
"endianness = (int) BYTE_ORDER"
|
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
interleave_chain_func (GstPad * pad, GstBuffer * buffer)
|
interleave_chain_func (GstPad * pad, GstObject * parent, GstBuffer * buffer)
|
||||||
{
|
{
|
||||||
|
gsize size;
|
||||||
gfloat *outdata;
|
gfloat *outdata;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
fail_unless (GST_IS_BUFFER (buffer));
|
fail_unless (GST_IS_BUFFER (buffer));
|
||||||
fail_unless_equals_int (GST_BUFFER_SIZE (buffer),
|
outdata = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
|
||||||
48000 * 2 * sizeof (gfloat));
|
fail_unless_equals_int (size, 48000 * 2 * sizeof (gfloat));
|
||||||
fail_unless (GST_BUFFER_DATA (buffer) != NULL);
|
fail_unless (outdata != NULL);
|
||||||
|
|
||||||
outdata = (gfloat *) GST_BUFFER_DATA (buffer);
|
|
||||||
|
|
||||||
for (i = 0; i < 48000 * 2; i += 2) {
|
for (i = 0; i < 48000 * 2; i += 2) {
|
||||||
fail_unless_equals_float (outdata[i], input[0]);
|
fail_unless_equals_float (outdata[i], input[0]);
|
||||||
fail_unless_equals_float (outdata[i + 1], input[1]);
|
fail_unless_equals_float (outdata[i + 1], input[1]);
|
||||||
}
|
}
|
||||||
|
gst_buffer_unmap (buffer, outdata, size);
|
||||||
|
gst_buffer_unref (buffer);
|
||||||
|
|
||||||
have_data++;
|
have_data++;
|
||||||
|
|
||||||
gst_buffer_unref (buffer);
|
|
||||||
|
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,32 +184,34 @@ GST_START_TEST (test_interleave_2ch)
|
||||||
|
|
||||||
input[0] = -1.0;
|
input[0] = -1.0;
|
||||||
inbuf = gst_buffer_new_and_alloc (48000 * sizeof (gfloat));
|
inbuf = gst_buffer_new_and_alloc (48000 * sizeof (gfloat));
|
||||||
indata = (gfloat *) GST_BUFFER_DATA (inbuf);
|
indata = gst_buffer_map (inbuf, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 48000; i++)
|
for (i = 0; i < 48000; i++)
|
||||||
indata[i] = -1.0;
|
indata[i] = -1.0;
|
||||||
gst_buffer_set_caps (inbuf, caps);
|
gst_buffer_unmap (inbuf, indata, -1);
|
||||||
|
gst_pad_set_caps (mysrcpads[0], caps);
|
||||||
fail_unless (gst_pad_push (mysrcpads[0], inbuf) == GST_FLOW_OK);
|
fail_unless (gst_pad_push (mysrcpads[0], inbuf) == GST_FLOW_OK);
|
||||||
|
|
||||||
input[1] = 1.0;
|
input[1] = 1.0;
|
||||||
inbuf = gst_buffer_new_and_alloc (48000 * sizeof (gfloat));
|
inbuf = gst_buffer_new_and_alloc (48000 * sizeof (gfloat));
|
||||||
indata = (gfloat *) GST_BUFFER_DATA (inbuf);
|
indata = gst_buffer_map (inbuf, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 48000; i++)
|
for (i = 0; i < 48000; i++)
|
||||||
indata[i] = 1.0;
|
indata[i] = 1.0;
|
||||||
gst_buffer_set_caps (inbuf, caps);
|
gst_buffer_unmap (inbuf, indata, -1);
|
||||||
|
gst_pad_set_caps (mysrcpads[1], caps);
|
||||||
fail_unless (gst_pad_push (mysrcpads[1], inbuf) == GST_FLOW_OK);
|
fail_unless (gst_pad_push (mysrcpads[1], inbuf) == GST_FLOW_OK);
|
||||||
|
|
||||||
inbuf = gst_buffer_new_and_alloc (48000 * sizeof (gfloat));
|
inbuf = gst_buffer_new_and_alloc (48000 * sizeof (gfloat));
|
||||||
indata = (gfloat *) GST_BUFFER_DATA (inbuf);
|
indata = gst_buffer_map (inbuf, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 48000; i++)
|
for (i = 0; i < 48000; i++)
|
||||||
indata[i] = -1.0;
|
indata[i] = -1.0;
|
||||||
gst_buffer_set_caps (inbuf, caps);
|
gst_buffer_unmap (inbuf, indata, -1);
|
||||||
fail_unless (gst_pad_push (mysrcpads[0], inbuf) == GST_FLOW_OK);
|
fail_unless (gst_pad_push (mysrcpads[0], inbuf) == GST_FLOW_OK);
|
||||||
|
|
||||||
inbuf = gst_buffer_new_and_alloc (48000 * sizeof (gfloat));
|
inbuf = gst_buffer_new_and_alloc (48000 * sizeof (gfloat));
|
||||||
indata = (gfloat *) GST_BUFFER_DATA (inbuf);
|
indata = gst_buffer_map (inbuf, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 48000; i++)
|
for (i = 0; i < 48000; i++)
|
||||||
indata[i] = 1.0;
|
indata[i] = 1.0;
|
||||||
gst_buffer_set_caps (inbuf, caps);
|
gst_buffer_unmap (inbuf, indata, -1);
|
||||||
fail_unless (gst_pad_push (mysrcpads[1], inbuf) == GST_FLOW_OK);
|
fail_unless (gst_pad_push (mysrcpads[1], inbuf) == GST_FLOW_OK);
|
||||||
|
|
||||||
fail_unless (have_data == 2);
|
fail_unless (have_data == 2);
|
||||||
|
@ -309,18 +307,20 @@ GST_START_TEST (test_interleave_2ch_1eos)
|
||||||
|
|
||||||
input[0] = -1.0;
|
input[0] = -1.0;
|
||||||
inbuf = gst_buffer_new_and_alloc (48000 * sizeof (gfloat));
|
inbuf = gst_buffer_new_and_alloc (48000 * sizeof (gfloat));
|
||||||
indata = (gfloat *) GST_BUFFER_DATA (inbuf);
|
indata = gst_buffer_map (inbuf, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 48000; i++)
|
for (i = 0; i < 48000; i++)
|
||||||
indata[i] = -1.0;
|
indata[i] = -1.0;
|
||||||
gst_buffer_set_caps (inbuf, caps);
|
gst_buffer_unmap (inbuf, indata, -1);
|
||||||
|
gst_pad_set_caps (mysrcpads[0], caps);
|
||||||
fail_unless (gst_pad_push (mysrcpads[0], inbuf) == GST_FLOW_OK);
|
fail_unless (gst_pad_push (mysrcpads[0], inbuf) == GST_FLOW_OK);
|
||||||
|
|
||||||
input[1] = 1.0;
|
input[1] = 1.0;
|
||||||
inbuf = gst_buffer_new_and_alloc (48000 * sizeof (gfloat));
|
inbuf = gst_buffer_new_and_alloc (48000 * sizeof (gfloat));
|
||||||
indata = (gfloat *) GST_BUFFER_DATA (inbuf);
|
indata = gst_buffer_map (inbuf, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 48000; i++)
|
for (i = 0; i < 48000; i++)
|
||||||
indata[i] = 1.0;
|
indata[i] = 1.0;
|
||||||
gst_buffer_set_caps (inbuf, caps);
|
gst_buffer_unmap (inbuf, indata, -1);
|
||||||
|
gst_pad_set_caps (mysrcpads[1], caps);
|
||||||
fail_unless (gst_pad_push (mysrcpads[1], inbuf) == GST_FLOW_OK);
|
fail_unless (gst_pad_push (mysrcpads[1], inbuf) == GST_FLOW_OK);
|
||||||
|
|
||||||
input[0] = 0.0;
|
input[0] = 0.0;
|
||||||
|
@ -328,10 +328,10 @@ GST_START_TEST (test_interleave_2ch_1eos)
|
||||||
|
|
||||||
input[1] = 1.0;
|
input[1] = 1.0;
|
||||||
inbuf = gst_buffer_new_and_alloc (48000 * sizeof (gfloat));
|
inbuf = gst_buffer_new_and_alloc (48000 * sizeof (gfloat));
|
||||||
indata = (gfloat *) GST_BUFFER_DATA (inbuf);
|
indata = gst_buffer_map (inbuf, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 48000; i++)
|
for (i = 0; i < 48000; i++)
|
||||||
indata[i] = 1.0;
|
indata[i] = 1.0;
|
||||||
gst_buffer_set_caps (inbuf, caps);
|
gst_buffer_unmap (inbuf, indata, -1);
|
||||||
fail_unless (gst_pad_push (mysrcpads[1], inbuf) == GST_FLOW_OK);
|
fail_unless (gst_pad_push (mysrcpads[1], inbuf) == GST_FLOW_OK);
|
||||||
|
|
||||||
fail_unless (have_data == 2);
|
fail_unless (have_data == 2);
|
||||||
|
@ -366,15 +366,14 @@ src_handoff_float32 (GstElement * element, GstBuffer * buffer, GstPad * pad,
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gfloat *data;
|
gfloat *data;
|
||||||
gint i;
|
gint i;
|
||||||
|
gsize size;
|
||||||
|
|
||||||
if (GST_PAD_CAPS (pad))
|
caps = gst_pad_get_current_caps (pad);
|
||||||
caps = gst_caps_ref (GST_PAD_CAPS (pad));
|
|
||||||
else {
|
if (caps == NULL) {
|
||||||
caps = gst_caps_new_simple ("audio/x-raw-float",
|
caps = gst_caps_new_simple ("audio/x-raw",
|
||||||
"width", G_TYPE_INT, 32,
|
"format", G_TYPE_STRING, GST_AUDIO_NE (F32),
|
||||||
"channels", G_TYPE_INT, 1,
|
"channels", G_TYPE_INT, 1, "rate", G_TYPE_INT, 48000, NULL);
|
||||||
"rate", G_TYPE_INT, 48000, "endianness", G_TYPE_INT, G_BYTE_ORDER,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
if (n == 2) {
|
if (n == 2) {
|
||||||
GstAudioChannelPosition pos[1] =
|
GstAudioChannelPosition pos[1] =
|
||||||
|
@ -387,20 +386,18 @@ src_handoff_float32 (GstElement * element, GstBuffer * buffer, GstPad * pad,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data = g_new (gfloat, 48000);
|
size = 48000 * sizeof (gfloat);
|
||||||
GST_BUFFER_MALLOCDATA (buffer) = (guint8 *) data;
|
data = g_malloc (size);
|
||||||
GST_BUFFER_DATA (buffer) = (guint8 *) data;
|
for (i = 0; i < 48000; i++)
|
||||||
GST_BUFFER_SIZE (buffer) = 48000 * sizeof (gfloat);
|
data[i] = (n % 2 == 0) ? -1.0 : 1.0;
|
||||||
|
|
||||||
|
gst_buffer_take_memory (buffer, -1, gst_memory_new_wrapped (0, data, g_free,
|
||||||
|
size, 0, size));
|
||||||
|
|
||||||
GST_BUFFER_OFFSET (buffer) = GST_BUFFER_OFFSET_NONE;
|
GST_BUFFER_OFFSET (buffer) = GST_BUFFER_OFFSET_NONE;
|
||||||
GST_BUFFER_TIMESTAMP (buffer) = GST_CLOCK_TIME_NONE;
|
GST_BUFFER_TIMESTAMP (buffer) = GST_CLOCK_TIME_NONE;
|
||||||
GST_BUFFER_OFFSET_END (buffer) = GST_BUFFER_OFFSET_NONE;
|
GST_BUFFER_OFFSET_END (buffer) = GST_BUFFER_OFFSET_NONE;
|
||||||
GST_BUFFER_DURATION (buffer) = GST_SECOND;
|
GST_BUFFER_DURATION (buffer) = GST_SECOND;
|
||||||
|
|
||||||
GST_BUFFER_CAPS (buffer) = caps;
|
|
||||||
|
|
||||||
for (i = 0; i < 48000; i++)
|
|
||||||
data[i] = (n % 2 == 0) ? -1.0 : 1.0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -408,19 +405,20 @@ sink_handoff_float32 (GstElement * element, GstBuffer * buffer, GstPad * pad,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
|
gsize size;
|
||||||
gfloat *data;
|
gfloat *data;
|
||||||
GstCaps *caps;
|
GstCaps *caps, *ccaps;
|
||||||
gint n = GPOINTER_TO_INT (user_data);
|
gint n = GPOINTER_TO_INT (user_data);
|
||||||
|
|
||||||
fail_unless (GST_IS_BUFFER (buffer));
|
fail_unless (GST_IS_BUFFER (buffer));
|
||||||
fail_unless_equals_int (GST_BUFFER_SIZE (buffer),
|
data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
|
||||||
48000 * 2 * sizeof (gfloat));
|
|
||||||
|
fail_unless_equals_int (size, 48000 * 2 * sizeof (gfloat));
|
||||||
fail_unless_equals_int (GST_BUFFER_DURATION (buffer), GST_SECOND);
|
fail_unless_equals_int (GST_BUFFER_DURATION (buffer), GST_SECOND);
|
||||||
|
|
||||||
caps = gst_caps_new_simple ("audio/x-raw-float",
|
caps = gst_caps_new_simple ("audio/x-raw",
|
||||||
"width", G_TYPE_INT, 32,
|
"format", G_TYPE_STRING, GST_AUDIO_NE (F32),
|
||||||
"channels", G_TYPE_INT, 2,
|
"channels", G_TYPE_INT, 2, "rate", G_TYPE_INT, 48000, NULL);
|
||||||
"rate", G_TYPE_INT, 48000, "endianness", G_TYPE_INT, G_BYTE_ORDER, NULL);
|
|
||||||
|
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
GstAudioChannelPosition pos[2] =
|
GstAudioChannelPosition pos[2] =
|
||||||
|
@ -438,15 +436,16 @@ sink_handoff_float32 (GstElement * element, GstBuffer * buffer, GstPad * pad,
|
||||||
gst_audio_set_channel_positions (gst_caps_get_structure (caps, 0), pos);
|
gst_audio_set_channel_positions (gst_caps_get_structure (caps, 0), pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
fail_unless (gst_caps_is_equal (caps, GST_BUFFER_CAPS (buffer)));
|
ccaps = gst_pad_get_current_caps (pad);
|
||||||
|
fail_unless (gst_caps_is_equal (caps, ccaps));
|
||||||
|
gst_caps_unref (ccaps);
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
data = (gfloat *) GST_BUFFER_DATA (buffer);
|
|
||||||
|
|
||||||
for (i = 0; i < 48000 * 2; i += 2) {
|
for (i = 0; i < 48000 * 2; i += 2) {
|
||||||
fail_unless_equals_float (data[i], -1.0);
|
fail_unless_equals_float (data[i], -1.0);
|
||||||
fail_unless_equals_float (data[i + 1], 1.0);
|
fail_unless_equals_float (data[i + 1], 1.0);
|
||||||
}
|
}
|
||||||
|
gst_buffer_unmap (buffer, data, size);
|
||||||
|
|
||||||
have_data++;
|
have_data++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
#include <gst/audio/audio.h>
|
||||||
#include <gst/check/gstcheck.h>
|
#include <gst/check/gstcheck.h>
|
||||||
|
|
||||||
gboolean have_eos = FALSE;
|
gboolean have_eos = FALSE;
|
||||||
|
@ -107,13 +108,14 @@ GST_START_TEST (test_int16)
|
||||||
|
|
||||||
/* create a fake 0.1 sec buffer with a half-amplitude block signal */
|
/* create a fake 0.1 sec buffer with a half-amplitude block signal */
|
||||||
inbuffer = gst_buffer_new_and_alloc (400);
|
inbuffer = gst_buffer_new_and_alloc (400);
|
||||||
data = (gint16 *) GST_BUFFER_DATA (inbuffer);
|
data = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (j = 0; j < 200; ++j) {
|
for (j = 0; j < 200; ++j) {
|
||||||
*data = 16536;
|
*data = 16536;
|
||||||
++data;
|
++data;
|
||||||
}
|
}
|
||||||
|
gst_buffer_unmap (inbuffer, data, -1);
|
||||||
caps = gst_caps_from_string (LEVEL_CAPS_STRING);
|
caps = gst_caps_from_string (LEVEL_CAPS_STRING);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
gst_pad_set_caps (mysrcpad, caps);
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
|
@ -204,15 +206,16 @@ GST_START_TEST (test_int16_panned)
|
||||||
|
|
||||||
/* create a fake 0.1 sec buffer with a half-amplitude block signal */
|
/* create a fake 0.1 sec buffer with a half-amplitude block signal */
|
||||||
inbuffer = gst_buffer_new_and_alloc (400);
|
inbuffer = gst_buffer_new_and_alloc (400);
|
||||||
data = (gint16 *) GST_BUFFER_DATA (inbuffer);
|
data = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (j = 0; j < 100; ++j) {
|
for (j = 0; j < 100; ++j) {
|
||||||
*data = 0;
|
*data = 0;
|
||||||
++data;
|
++data;
|
||||||
*data = 16536;
|
*data = 16536;
|
||||||
++data;
|
++data;
|
||||||
}
|
}
|
||||||
|
gst_buffer_unmap (inbuffer, data, -1);
|
||||||
caps = gst_caps_from_string (LEVEL_CAPS_STRING);
|
caps = gst_caps_from_string (LEVEL_CAPS_STRING);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
gst_pad_set_caps (mysrcpad, caps);
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
|
|
|
@ -174,17 +174,17 @@ GST_START_TEST (test_multifilesink_key_unit)
|
||||||
sink = gst_element_get_static_pad (mfs, "sink");
|
sink = gst_element_get_static_pad (mfs, "sink");
|
||||||
buf = gst_buffer_new_and_alloc (4);
|
buf = gst_buffer_new_and_alloc (4);
|
||||||
|
|
||||||
memcpy (GST_BUFFER_DATA (buf), "foo", 4);
|
gst_buffer_fill (buf, 0, "foo", 4);
|
||||||
fail_if (gst_pad_chain (sink, gst_buffer_ref (buf)) != GST_FLOW_OK);
|
fail_if (gst_pad_chain (sink, gst_buffer_ref (buf)) != GST_FLOW_OK);
|
||||||
|
|
||||||
memcpy (GST_BUFFER_DATA (buf), "bar", 4);
|
gst_buffer_fill (buf, 0, "bar", 4);
|
||||||
fail_if (gst_pad_chain (sink, gst_buffer_ref (buf)) != GST_FLOW_OK);
|
fail_if (gst_pad_chain (sink, gst_buffer_ref (buf)) != GST_FLOW_OK);
|
||||||
|
|
||||||
fail_unless (gst_pad_send_event (sink,
|
fail_unless (gst_pad_send_event (sink,
|
||||||
gst_video_event_new_downstream_force_key_unit (GST_CLOCK_TIME_NONE,
|
gst_video_event_new_downstream_force_key_unit (GST_CLOCK_TIME_NONE,
|
||||||
GST_CLOCK_TIME_NONE, GST_CLOCK_TIME_NONE, TRUE, 1)));
|
GST_CLOCK_TIME_NONE, GST_CLOCK_TIME_NONE, TRUE, 1)));
|
||||||
|
|
||||||
memcpy (GST_BUFFER_DATA (buf), "baz", 4);
|
gst_buffer_fill (buf, 0, "baz", 4);
|
||||||
fail_if (gst_pad_chain (sink, buf) != GST_FLOW_OK);
|
fail_if (gst_pad_chain (sink, buf) != GST_FLOW_OK);
|
||||||
|
|
||||||
fail_if (gst_element_set_state (mfs,
|
fail_if (gst_element_set_state (mfs,
|
||||||
|
|
|
@ -202,7 +202,7 @@ check_qtmux_pad (GstStaticPadTemplate * srctemplate, const gchar * sinkname,
|
||||||
|
|
||||||
inbuffer = gst_buffer_new_and_alloc (1);
|
inbuffer = gst_buffer_new_and_alloc (1);
|
||||||
caps = gst_caps_copy (gst_pad_get_pad_template_caps (mysrcpad));
|
caps = gst_caps_copy (gst_pad_get_pad_template_caps (mysrcpad));
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
gst_pad_set_caps (mysrcpad, caps);
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
|
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
|
||||||
GST_BUFFER_DURATION (inbuffer) = 40 * GST_MSECOND;
|
GST_BUFFER_DURATION (inbuffer) = 40 * GST_MSECOND;
|
||||||
|
@ -225,24 +225,23 @@ check_qtmux_pad (GstStaticPadTemplate * srctemplate, const gchar * sinkname,
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
/* ftyp header */
|
/* ftyp header */
|
||||||
guint8 *data = GST_BUFFER_DATA (outbuffer);
|
fail_unless (gst_buffer_get_size (outbuffer) >= 20);
|
||||||
|
fail_unless (gst_buffer_memcmp (outbuffer, 0, data0,
|
||||||
fail_unless (GST_BUFFER_SIZE (outbuffer) >= 20);
|
sizeof (data0)) == 0);
|
||||||
fail_unless (memcmp (data, data0, sizeof (data0)) == 0);
|
fail_unless (gst_buffer_memcmp (outbuffer, 16, data0 + 8, 4) == 0);
|
||||||
fail_unless (memcmp (data + 16, data0 + 8, 4) == 0);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1: /* mdat header */
|
case 1: /* mdat header */
|
||||||
fail_unless (GST_BUFFER_SIZE (outbuffer) == 16);
|
fail_unless (gst_buffer_get_size (outbuffer) == 16);
|
||||||
fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), data1, sizeof (data1))
|
fail_unless (gst_buffer_memcmp (outbuffer, 0, data1, sizeof (data1))
|
||||||
== 0);
|
== 0);
|
||||||
break;
|
break;
|
||||||
case 2: /* buffer we put in */
|
case 2: /* buffer we put in */
|
||||||
fail_unless (GST_BUFFER_SIZE (outbuffer) == 1);
|
fail_unless (gst_buffer_get_size (outbuffer) == 1);
|
||||||
break;
|
break;
|
||||||
case 3: /* moov */
|
case 3: /* moov */
|
||||||
fail_unless (GST_BUFFER_SIZE (outbuffer) > 8);
|
fail_unless (gst_buffer_get_size (outbuffer) > 8);
|
||||||
fail_unless (memcmp (GST_BUFFER_DATA (outbuffer) + 4, data2,
|
fail_unless (gst_buffer_memcmp (outbuffer, 4, data2,
|
||||||
sizeof (data2)) == 0);
|
sizeof (data2)) == 0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -285,7 +284,7 @@ check_qtmux_pad_fragmented (GstStaticPadTemplate * srctemplate,
|
||||||
|
|
||||||
inbuffer = gst_buffer_new_and_alloc (1);
|
inbuffer = gst_buffer_new_and_alloc (1);
|
||||||
caps = gst_caps_copy (gst_pad_get_pad_template_caps (mysrcpad));
|
caps = gst_caps_copy (gst_pad_get_pad_template_caps (mysrcpad));
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
gst_pad_set_caps (mysrcpad, caps);
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
|
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
|
||||||
GST_BUFFER_DURATION (inbuffer) = 40 * GST_MSECOND;
|
GST_BUFFER_DURATION (inbuffer) = 40 * GST_MSECOND;
|
||||||
|
@ -309,34 +308,33 @@ check_qtmux_pad_fragmented (GstStaticPadTemplate * srctemplate,
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
/* ftyp header */
|
/* ftyp header */
|
||||||
guint8 *data = GST_BUFFER_DATA (outbuffer);
|
fail_unless (gst_buffer_get_size (outbuffer) >= 20);
|
||||||
|
fail_unless (gst_buffer_memcmp (outbuffer, 0, data0,
|
||||||
fail_unless (GST_BUFFER_SIZE (outbuffer) >= 20);
|
sizeof (data0)) == 0);
|
||||||
fail_unless (memcmp (data, data0, sizeof (data0)) == 0);
|
fail_unless (gst_buffer_memcmp (outbuffer, 16, data0 + 8, 4) == 0);
|
||||||
fail_unless (memcmp (data + 16, data0 + 8, 4) == 0);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1: /* moov */
|
case 1: /* moov */
|
||||||
fail_unless (GST_BUFFER_SIZE (outbuffer) > 8);
|
fail_unless (gst_buffer_get_size (outbuffer) > 8);
|
||||||
fail_unless (memcmp (GST_BUFFER_DATA (outbuffer) + 4, data2,
|
fail_unless (gst_buffer_memcmp (outbuffer, 4, data2,
|
||||||
sizeof (data2)) == 0);
|
sizeof (data2)) == 0);
|
||||||
break;
|
break;
|
||||||
case 2: /* moof */
|
case 2: /* moof */
|
||||||
fail_unless (GST_BUFFER_SIZE (outbuffer) > 8);
|
fail_unless (gst_buffer_get_size (outbuffer) > 8);
|
||||||
fail_unless (memcmp (GST_BUFFER_DATA (outbuffer) + 4, data3,
|
fail_unless (gst_buffer_memcmp (outbuffer, 4, data3,
|
||||||
sizeof (data3)) == 0);
|
sizeof (data3)) == 0);
|
||||||
break;
|
break;
|
||||||
case 3: /* mdat header */
|
case 3: /* mdat header */
|
||||||
fail_unless (GST_BUFFER_SIZE (outbuffer) == 8);
|
fail_unless (gst_buffer_get_size (outbuffer) == 8);
|
||||||
fail_unless (memcmp (GST_BUFFER_DATA (outbuffer) + 4, data1,
|
fail_unless (gst_buffer_memcmp (outbuffer, 4, data1,
|
||||||
sizeof (data1)) == 0);
|
sizeof (data1)) == 0);
|
||||||
break;
|
break;
|
||||||
case 4: /* buffer we put in */
|
case 4: /* buffer we put in */
|
||||||
fail_unless (GST_BUFFER_SIZE (outbuffer) == 1);
|
fail_unless (gst_buffer_get_size (outbuffer) == 1);
|
||||||
break;
|
break;
|
||||||
case 5: /* mfra */
|
case 5: /* mfra */
|
||||||
fail_unless (GST_BUFFER_SIZE (outbuffer) > 8);
|
fail_unless (gst_buffer_get_size (outbuffer) > 8);
|
||||||
fail_unless (memcmp (GST_BUFFER_DATA (outbuffer) + 4, data4,
|
fail_unless (gst_buffer_memcmp (outbuffer, 4, data4,
|
||||||
sizeof (data4)) == 0);
|
sizeof (data4)) == 0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -510,7 +508,7 @@ GST_START_TEST (test_reuse)
|
||||||
inbuffer = gst_buffer_new_and_alloc (1);
|
inbuffer = gst_buffer_new_and_alloc (1);
|
||||||
fail_unless (inbuffer != NULL);
|
fail_unless (inbuffer != NULL);
|
||||||
caps = gst_caps_copy (gst_pad_get_pad_template_caps (mysrcpad));
|
caps = gst_caps_copy (gst_pad_get_pad_template_caps (mysrcpad));
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
gst_pad_set_caps (mysrcpad, caps);
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
|
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
|
||||||
GST_BUFFER_DURATION (inbuffer) = 40 * GST_MSECOND;
|
GST_BUFFER_DURATION (inbuffer) = 40 * GST_MSECOND;
|
||||||
|
@ -532,7 +530,7 @@ create_qtmux_profile (const gchar * variant)
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
|
|
||||||
if (variant == NULL) {
|
if (variant == NULL) {
|
||||||
caps = gst_caps_new_simple ("video/quicktime", NULL);
|
caps = gst_caps_new_empty_simple ("video/quicktime");
|
||||||
} else {
|
} else {
|
||||||
caps = gst_caps_new_simple ("video/quicktime",
|
caps = gst_caps_new_simple ("video/quicktime",
|
||||||
"variant", G_TYPE_STRING, variant, NULL);
|
"variant", G_TYPE_STRING, variant, NULL);
|
||||||
|
@ -607,10 +605,10 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||||
|
|
||||||
static GType test_mp3_enc_get_type (void);
|
static GType test_mp3_enc_get_type (void);
|
||||||
|
|
||||||
GST_BOILERPLATE (TestMp3Enc, test_mp3_enc, GstElement, GST_TYPE_ELEMENT);
|
G_DEFINE_TYPE (TestMp3Enc, test_mp3_enc, GST_TYPE_ELEMENT);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_mp3_enc_base_init (gpointer klass)
|
test_mp3_enc_class_init (TestMp3EncClass * klass)
|
||||||
{
|
{
|
||||||
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
||||||
|
|
||||||
|
@ -624,13 +622,7 @@ test_mp3_enc_base_init (gpointer klass)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_mp3_enc_class_init (TestMp3EncClass * klass)
|
test_mp3_enc_init (TestMp3Enc * mp3enc)
|
||||||
{
|
|
||||||
/* doesn't actually need to do anything for this test */
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
test_mp3_enc_init (TestMp3Enc * mp3enc, TestMp3EncClass * klass)
|
|
||||||
{
|
{
|
||||||
GstPad *pad;
|
GstPad *pad;
|
||||||
|
|
||||||
|
@ -683,7 +675,7 @@ GST_START_TEST (test_encodebin_mp4mux)
|
||||||
"fakemp3enc", "fakemp3enc", plugin_init, VERSION, "LGPL",
|
"fakemp3enc", "fakemp3enc", plugin_init, VERSION, "LGPL",
|
||||||
"gst-plugins-good", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);
|
"gst-plugins-good", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);
|
||||||
|
|
||||||
feature = gst_default_registry_find_feature ("testmp3enc",
|
feature = gst_registry_find_feature (gst_registry_get (), "testmp3enc",
|
||||||
GST_TYPE_ELEMENT_FACTORY);
|
GST_TYPE_ELEMENT_FACTORY);
|
||||||
gst_plugin_feature_set_rank (feature, GST_RANK_PRIMARY + 100);
|
gst_plugin_feature_set_rank (feature, GST_RANK_PRIMARY + 100);
|
||||||
|
|
||||||
|
@ -708,7 +700,7 @@ GST_START_TEST (test_encodebin_mp4mux)
|
||||||
|
|
||||||
/* make sure we got mp4mux for variant=iso */
|
/* make sure we got mp4mux for variant=iso */
|
||||||
GST_INFO ("muxer: %s", G_OBJECT_TYPE_NAME (mux));
|
GST_INFO ("muxer: %s", G_OBJECT_TYPE_NAME (mux));
|
||||||
fail_unless_equals_string (GST_PLUGIN_FEATURE_NAME (f), "mp4mux");
|
fail_unless_equals_string (GST_OBJECT_NAME (f), "mp4mux");
|
||||||
}
|
}
|
||||||
gst_object_unref (mux);
|
gst_object_unref (mux);
|
||||||
gst_object_unref (enc);
|
gst_object_unref (enc);
|
||||||
|
@ -736,7 +728,7 @@ extract_tags (const gchar * location, GstTagList ** taglist)
|
||||||
!= GST_STATE_CHANGE_FAILURE);
|
!= GST_STATE_CHANGE_FAILURE);
|
||||||
|
|
||||||
if (*taglist == NULL) {
|
if (*taglist == NULL) {
|
||||||
*taglist = gst_tag_list_new ();
|
*taglist = gst_tag_list_new_empty ();
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
@ -803,13 +795,13 @@ test_average_bitrate_custom (const gchar * elementname,
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
inbuffer = gst_buffer_new_and_alloc (bytes[i]);
|
inbuffer = gst_buffer_new_and_alloc (bytes[i]);
|
||||||
caps = gst_caps_copy (gst_pad_get_pad_template_caps (mysrcpad));
|
caps = gst_caps_copy (gst_pad_get_pad_template_caps (mysrcpad));
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
gst_pad_set_caps (mysrcpad, caps);
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
GST_BUFFER_TIMESTAMP (inbuffer) = total_duration;
|
GST_BUFFER_TIMESTAMP (inbuffer) = total_duration;
|
||||||
GST_BUFFER_DURATION (inbuffer) = (GstClockTime) durations[i];
|
GST_BUFFER_DURATION (inbuffer) = (GstClockTime) durations[i];
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
total_bytes += GST_BUFFER_SIZE (inbuffer);
|
total_bytes += gst_buffer_get_size (inbuffer);
|
||||||
total_duration += GST_BUFFER_DURATION (inbuffer);
|
total_duration += GST_BUFFER_DURATION (inbuffer);
|
||||||
fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
|
fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <gst/check/gstcheck.h>
|
#include <gst/check/gstcheck.h>
|
||||||
|
#include <gst/audio/audio.h>
|
||||||
|
|
||||||
/* For ease of programming we use globals to keep refs for our floating src and
|
/* For ease of programming we use globals to keep refs for our floating src and
|
||||||
* sink pads we create; otherwise we always have to do get_pad, get_peer, and
|
* sink pads we create; otherwise we always have to do get_pad, get_peer, and
|
||||||
|
@ -123,17 +124,13 @@ get_expected_gain (guint sample_rate)
|
||||||
"rate = (int) { 8000, 11025, 12000, 16000, 22050, " \
|
"rate = (int) { 8000, 11025, 12000, 16000, 22050, " \
|
||||||
"24000, 32000, 44100, 48000 }"
|
"24000, 32000, 44100, 48000 }"
|
||||||
|
|
||||||
#define RG_ANALYSIS_CAPS_TEMPLATE_STRING \
|
#define RG_ANALYSIS_CAPS_TEMPLATE_STRING \
|
||||||
"audio/x-raw-float, " \
|
"audio/x-raw, " \
|
||||||
"width = (int) 32, " \
|
"format = (string) "GST_AUDIO_NE (F32) ", " \
|
||||||
"endianness = (int) BYTE_ORDER, " \
|
REPLAY_GAIN_CAPS \
|
||||||
REPLAY_GAIN_CAPS \
|
"; " \
|
||||||
"; " \
|
"audio/x-raw, " \
|
||||||
"audio/x-raw-int, " \
|
"format = (string) "GST_AUDIO_NE (S16) ", " \
|
||||||
"width = (int) 16, " \
|
|
||||||
"depth = (int) [ 1, 16 ], " \
|
|
||||||
"signed = (boolean) true, " \
|
|
||||||
"endianness = (int) BYTE_ORDER, " \
|
|
||||||
REPLAY_GAIN_CAPS
|
REPLAY_GAIN_CAPS
|
||||||
|
|
||||||
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||||
|
@ -352,17 +349,19 @@ static GstBuffer *
|
||||||
test_buffer_const_float_mono (gint sample_rate, gsize n_frames, gfloat value)
|
test_buffer_const_float_mono (gint sample_rate, gsize n_frames, gfloat value)
|
||||||
{
|
{
|
||||||
GstBuffer *buf = gst_buffer_new_and_alloc (n_frames * sizeof (gfloat));
|
GstBuffer *buf = gst_buffer_new_and_alloc (n_frames * sizeof (gfloat));
|
||||||
gfloat *data = (gfloat *) GST_BUFFER_DATA (buf);
|
gfloat *data, *orig;
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
|
data = orig = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = n_frames; i--;)
|
for (i = n_frames; i--;)
|
||||||
*data++ = value;
|
*data++ = value;
|
||||||
|
gst_buffer_unmap (buf, orig, -1);
|
||||||
|
|
||||||
caps = gst_caps_new_simple ("audio/x-raw-float",
|
caps = gst_caps_new_simple ("audio/x-raw",
|
||||||
"rate", G_TYPE_INT, sample_rate, "channels", G_TYPE_INT, 1,
|
"format", G_TYPE_STRING, GST_AUDIO_NE (F32),
|
||||||
"endianness", G_TYPE_INT, G_BYTE_ORDER, "width", G_TYPE_INT, 32, NULL);
|
"rate", G_TYPE_INT, sample_rate, "channels", G_TYPE_INT, 1, NULL);
|
||||||
gst_buffer_set_caps (buf, caps);
|
gst_pad_set_caps (mysrcpad, caps);
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
||||||
|
@ -375,19 +374,21 @@ test_buffer_const_float_stereo (gint sample_rate, gsize n_frames,
|
||||||
gfloat value_l, gfloat value_r)
|
gfloat value_l, gfloat value_r)
|
||||||
{
|
{
|
||||||
GstBuffer *buf = gst_buffer_new_and_alloc (n_frames * sizeof (gfloat) * 2);
|
GstBuffer *buf = gst_buffer_new_and_alloc (n_frames * sizeof (gfloat) * 2);
|
||||||
gfloat *data = (gfloat *) GST_BUFFER_DATA (buf);
|
gfloat *data, *orig;
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
|
data = orig = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = n_frames; i--;) {
|
for (i = n_frames; i--;) {
|
||||||
*data++ = value_l;
|
*data++ = value_l;
|
||||||
*data++ = value_r;
|
*data++ = value_r;
|
||||||
}
|
}
|
||||||
|
gst_buffer_unmap (buf, orig, -1);
|
||||||
|
|
||||||
caps = gst_caps_new_simple ("audio/x-raw-float",
|
caps = gst_caps_new_simple ("audio/x-raw",
|
||||||
"rate", G_TYPE_INT, sample_rate, "channels", G_TYPE_INT, 2,
|
"format", G_TYPE_STRING, GST_AUDIO_NE (F32),
|
||||||
"endianness", G_TYPE_INT, G_BYTE_ORDER, "width", G_TYPE_INT, 32, NULL);
|
"rate", G_TYPE_INT, sample_rate, "channels", G_TYPE_INT, 2, NULL);
|
||||||
gst_buffer_set_caps (buf, caps);
|
gst_pad_set_caps (mysrcpad, caps);
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
||||||
|
@ -400,18 +401,19 @@ test_buffer_const_int16_mono (gint sample_rate, gint depth, gsize n_frames,
|
||||||
gint16 value)
|
gint16 value)
|
||||||
{
|
{
|
||||||
GstBuffer *buf = gst_buffer_new_and_alloc (n_frames * sizeof (gint16));
|
GstBuffer *buf = gst_buffer_new_and_alloc (n_frames * sizeof (gint16));
|
||||||
gint16 *data = (gint16 *) GST_BUFFER_DATA (buf);
|
gint16 *data, *orig;
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
|
data = orig = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = n_frames; i--;)
|
for (i = n_frames; i--;)
|
||||||
*data++ = value;
|
*data++ = value;
|
||||||
|
gst_buffer_unmap (buf, orig, -1);
|
||||||
|
|
||||||
caps = gst_caps_new_simple ("audio/x-raw-int",
|
caps = gst_caps_new_simple ("audio/x-raw",
|
||||||
"rate", G_TYPE_INT, sample_rate, "channels", G_TYPE_INT, 1,
|
"format", G_TYPE_STRING, GST_AUDIO_NE (S16),
|
||||||
"endianness", G_TYPE_INT, G_BYTE_ORDER, "signed", G_TYPE_BOOLEAN, TRUE,
|
"rate", G_TYPE_INT, sample_rate, "channels", G_TYPE_INT, 1, NULL);
|
||||||
"width", G_TYPE_INT, 16, "depth", G_TYPE_INT, depth, NULL);
|
gst_pad_set_caps (mysrcpad, caps);
|
||||||
gst_buffer_set_caps (buf, caps);
|
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
||||||
|
@ -424,20 +426,21 @@ test_buffer_const_int16_stereo (gint sample_rate, gint depth, gsize n_frames,
|
||||||
gint16 value_l, gint16 value_r)
|
gint16 value_l, gint16 value_r)
|
||||||
{
|
{
|
||||||
GstBuffer *buf = gst_buffer_new_and_alloc (n_frames * sizeof (gint16) * 2);
|
GstBuffer *buf = gst_buffer_new_and_alloc (n_frames * sizeof (gint16) * 2);
|
||||||
gint16 *data = (gint16 *) GST_BUFFER_DATA (buf);
|
gint16 *data, *orig;
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
|
data = orig = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = n_frames; i--;) {
|
for (i = n_frames; i--;) {
|
||||||
*data++ = value_l;
|
*data++ = value_l;
|
||||||
*data++ = value_r;
|
*data++ = value_r;
|
||||||
}
|
}
|
||||||
|
gst_buffer_unmap (buf, orig, -1);
|
||||||
|
|
||||||
caps = gst_caps_new_simple ("audio/x-raw-int",
|
caps = gst_caps_new_simple ("audio/x-raw",
|
||||||
"rate", G_TYPE_INT, sample_rate, "channels", G_TYPE_INT, 2,
|
"format", G_TYPE_STRING, GST_AUDIO_NE (S16),
|
||||||
"endianness", G_TYPE_INT, G_BYTE_ORDER, "signed", G_TYPE_BOOLEAN, TRUE,
|
"rate", G_TYPE_INT, sample_rate, "channels", G_TYPE_INT, 2, NULL);
|
||||||
"width", G_TYPE_INT, 16, "depth", G_TYPE_INT, depth, NULL);
|
gst_pad_set_caps (mysrcpad, caps);
|
||||||
gst_buffer_set_caps (buf, caps);
|
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
||||||
|
@ -453,10 +456,11 @@ test_buffer_square_float_mono (gint * accumulator, gint sample_rate,
|
||||||
gsize n_frames, gfloat value)
|
gsize n_frames, gfloat value)
|
||||||
{
|
{
|
||||||
GstBuffer *buf = gst_buffer_new_and_alloc (n_frames * sizeof (gfloat));
|
GstBuffer *buf = gst_buffer_new_and_alloc (n_frames * sizeof (gfloat));
|
||||||
gfloat *data = (gfloat *) GST_BUFFER_DATA (buf);
|
gfloat *data, *orig;
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
|
data = orig = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = n_frames; i--;) {
|
for (i = n_frames; i--;) {
|
||||||
*accumulator += 1;
|
*accumulator += 1;
|
||||||
*accumulator %= 96;
|
*accumulator %= 96;
|
||||||
|
@ -466,11 +470,12 @@ test_buffer_square_float_mono (gint * accumulator, gint sample_rate,
|
||||||
else
|
else
|
||||||
*data++ = -value;
|
*data++ = -value;
|
||||||
}
|
}
|
||||||
|
gst_buffer_unmap (buf, orig, -1);
|
||||||
|
|
||||||
caps = gst_caps_new_simple ("audio/x-raw-float",
|
caps = gst_caps_new_simple ("audio/x-raw",
|
||||||
"rate", G_TYPE_INT, sample_rate, "channels", G_TYPE_INT, 1,
|
"format", G_TYPE_STRING, GST_AUDIO_NE (F32),
|
||||||
"endianness", G_TYPE_INT, G_BYTE_ORDER, "width", G_TYPE_INT, 32, NULL);
|
"rate", G_TYPE_INT, sample_rate, "channels", G_TYPE_INT, 1, NULL);
|
||||||
gst_buffer_set_caps (buf, caps);
|
gst_pad_set_caps (mysrcpad, caps);
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
||||||
|
@ -483,10 +488,11 @@ test_buffer_square_float_stereo (gint * accumulator, gint sample_rate,
|
||||||
gsize n_frames, gfloat value_l, gfloat value_r)
|
gsize n_frames, gfloat value_l, gfloat value_r)
|
||||||
{
|
{
|
||||||
GstBuffer *buf = gst_buffer_new_and_alloc (n_frames * sizeof (gfloat) * 2);
|
GstBuffer *buf = gst_buffer_new_and_alloc (n_frames * sizeof (gfloat) * 2);
|
||||||
gfloat *data = (gfloat *) GST_BUFFER_DATA (buf);
|
gfloat *data, *orig;
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
|
data = orig = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = n_frames; i--;) {
|
for (i = n_frames; i--;) {
|
||||||
*accumulator += 1;
|
*accumulator += 1;
|
||||||
*accumulator %= 96;
|
*accumulator %= 96;
|
||||||
|
@ -499,11 +505,12 @@ test_buffer_square_float_stereo (gint * accumulator, gint sample_rate,
|
||||||
*data++ = -value_r;
|
*data++ = -value_r;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
gst_buffer_unmap (buf, orig, -1);
|
||||||
|
|
||||||
caps = gst_caps_new_simple ("audio/x-raw-float",
|
caps = gst_caps_new_simple ("audio/x-raw",
|
||||||
"rate", G_TYPE_INT, sample_rate, "channels", G_TYPE_INT, 2,
|
"format", G_TYPE_STRING, GST_AUDIO_NE (F32),
|
||||||
"endianness", G_TYPE_INT, G_BYTE_ORDER, "width", G_TYPE_INT, 32, NULL);
|
"rate", G_TYPE_INT, sample_rate, "channels", G_TYPE_INT, 2, NULL);
|
||||||
gst_buffer_set_caps (buf, caps);
|
gst_pad_set_caps (mysrcpad, caps);
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
||||||
|
@ -516,10 +523,11 @@ test_buffer_square_int16_mono (gint * accumulator, gint sample_rate,
|
||||||
gint depth, gsize n_frames, gint16 value)
|
gint depth, gsize n_frames, gint16 value)
|
||||||
{
|
{
|
||||||
GstBuffer *buf = gst_buffer_new_and_alloc (n_frames * sizeof (gint16));
|
GstBuffer *buf = gst_buffer_new_and_alloc (n_frames * sizeof (gint16));
|
||||||
gint16 *data = (gint16 *) GST_BUFFER_DATA (buf);
|
gint16 *data, *orig;
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
|
data = orig = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = n_frames; i--;) {
|
for (i = n_frames; i--;) {
|
||||||
*accumulator += 1;
|
*accumulator += 1;
|
||||||
*accumulator %= 96;
|
*accumulator %= 96;
|
||||||
|
@ -529,12 +537,12 @@ test_buffer_square_int16_mono (gint * accumulator, gint sample_rate,
|
||||||
else
|
else
|
||||||
*data++ = -MAX (value, -32767);
|
*data++ = -MAX (value, -32767);
|
||||||
}
|
}
|
||||||
|
gst_buffer_unmap (buf, orig, -1);
|
||||||
|
|
||||||
caps = gst_caps_new_simple ("audio/x-raw-int",
|
caps = gst_caps_new_simple ("audio/x-raw",
|
||||||
"rate", G_TYPE_INT, sample_rate, "channels", G_TYPE_INT, 1,
|
"format", G_TYPE_STRING, GST_AUDIO_NE (S16),
|
||||||
"endianness", G_TYPE_INT, G_BYTE_ORDER, "signed", G_TYPE_BOOLEAN, TRUE,
|
"rate", G_TYPE_INT, sample_rate, "channels", G_TYPE_INT, 1, NULL);
|
||||||
"width", G_TYPE_INT, 16, "depth", G_TYPE_INT, depth, NULL);
|
gst_pad_set_caps (mysrcpad, caps);
|
||||||
gst_buffer_set_caps (buf, caps);
|
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
||||||
|
@ -547,10 +555,11 @@ test_buffer_square_int16_stereo (gint * accumulator, gint sample_rate,
|
||||||
gint depth, gsize n_frames, gint16 value_l, gint16 value_r)
|
gint depth, gsize n_frames, gint16 value_l, gint16 value_r)
|
||||||
{
|
{
|
||||||
GstBuffer *buf = gst_buffer_new_and_alloc (n_frames * sizeof (gint16) * 2);
|
GstBuffer *buf = gst_buffer_new_and_alloc (n_frames * sizeof (gint16) * 2);
|
||||||
gint16 *data = (gint16 *) GST_BUFFER_DATA (buf);
|
gint16 *data, *orig;
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
|
data = orig = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = n_frames; i--;) {
|
for (i = n_frames; i--;) {
|
||||||
*accumulator += 1;
|
*accumulator += 1;
|
||||||
*accumulator %= 96;
|
*accumulator %= 96;
|
||||||
|
@ -563,12 +572,12 @@ test_buffer_square_int16_stereo (gint * accumulator, gint sample_rate,
|
||||||
*data++ = -MAX (value_r, -32767);
|
*data++ = -MAX (value_r, -32767);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
gst_buffer_unmap (buf, orig, -1);
|
||||||
|
|
||||||
caps = gst_caps_new_simple ("audio/x-raw-int",
|
caps = gst_caps_new_simple ("audio/x-raw",
|
||||||
"rate", G_TYPE_INT, sample_rate, "channels", G_TYPE_INT, 2,
|
"format", G_TYPE_STRING, GST_AUDIO_NE (S16),
|
||||||
"endianness", G_TYPE_INT, G_BYTE_ORDER, "signed", G_TYPE_BOOLEAN, TRUE,
|
"rate", G_TYPE_INT, sample_rate, "channels", G_TYPE_INT, 2, NULL);
|
||||||
"width", G_TYPE_INT, 16, "depth", G_TYPE_INT, depth, NULL);
|
gst_pad_set_caps (mysrcpad, caps);
|
||||||
gst_buffer_set_caps (buf, caps);
|
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
||||||
|
@ -1179,7 +1188,7 @@ GST_START_TEST (test_forced)
|
||||||
g_object_set (element, "forced", FALSE, NULL);
|
g_object_set (element, "forced", FALSE, NULL);
|
||||||
set_playing_state (element);
|
set_playing_state (element);
|
||||||
|
|
||||||
tag_list = gst_tag_list_new ();
|
tag_list = gst_tag_list_new_empty ();
|
||||||
/* Provided values are totally arbitrary. */
|
/* Provided values are totally arbitrary. */
|
||||||
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND,
|
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND,
|
||||||
GST_TAG_TRACK_PEAK, 1.0, GST_TAG_TRACK_GAIN, 2.21, NULL);
|
GST_TAG_TRACK_PEAK, 1.0, GST_TAG_TRACK_GAIN, 2.21, NULL);
|
||||||
|
@ -1219,12 +1228,12 @@ GST_START_TEST (test_forced_separate)
|
||||||
g_object_set (element, "forced", FALSE, NULL);
|
g_object_set (element, "forced", FALSE, NULL);
|
||||||
set_playing_state (element);
|
set_playing_state (element);
|
||||||
|
|
||||||
tag_list = gst_tag_list_new ();
|
tag_list = gst_tag_list_new_empty ();
|
||||||
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND, GST_TAG_TRACK_GAIN, 2.21,
|
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND, GST_TAG_TRACK_GAIN, 2.21,
|
||||||
NULL);
|
NULL);
|
||||||
send_tag_event (element, tag_list);
|
send_tag_event (element, tag_list);
|
||||||
|
|
||||||
tag_list = gst_tag_list_new ();
|
tag_list = gst_tag_list_new_empty ();
|
||||||
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND, GST_TAG_TRACK_PEAK, 1.0,
|
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND, GST_TAG_TRACK_PEAK, 1.0,
|
||||||
NULL);
|
NULL);
|
||||||
send_tag_event (element, tag_list);
|
send_tag_event (element, tag_list);
|
||||||
|
@ -1273,7 +1282,7 @@ GST_START_TEST (test_forced_after_data)
|
||||||
for (i = 20; i--;)
|
for (i = 20; i--;)
|
||||||
push_buffer (test_buffer_const_float_stereo (8000, 512, 0.5, 0.5));
|
push_buffer (test_buffer_const_float_stereo (8000, 512, 0.5, 0.5));
|
||||||
|
|
||||||
tag_list = gst_tag_list_new ();
|
tag_list = gst_tag_list_new_empty ();
|
||||||
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND,
|
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND,
|
||||||
GST_TAG_TRACK_PEAK, 1.0, GST_TAG_TRACK_GAIN, 2.21, NULL);
|
GST_TAG_TRACK_PEAK, 1.0, GST_TAG_TRACK_GAIN, 2.21, NULL);
|
||||||
send_tag_event (element, tag_list);
|
send_tag_event (element, tag_list);
|
||||||
|
@ -1309,7 +1318,7 @@ GST_START_TEST (test_forced_album)
|
||||||
g_object_set (element, "forced", FALSE, NULL);
|
g_object_set (element, "forced", FALSE, NULL);
|
||||||
set_playing_state (element);
|
set_playing_state (element);
|
||||||
|
|
||||||
tag_list = gst_tag_list_new ();
|
tag_list = gst_tag_list_new_empty ();
|
||||||
/* Provided values are totally arbitrary. */
|
/* Provided values are totally arbitrary. */
|
||||||
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND,
|
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND,
|
||||||
GST_TAG_TRACK_PEAK, 1.0, GST_TAG_TRACK_GAIN, 2.21, NULL);
|
GST_TAG_TRACK_PEAK, 1.0, GST_TAG_TRACK_GAIN, 2.21, NULL);
|
||||||
|
@ -1366,7 +1375,7 @@ GST_START_TEST (test_forced_album_skip)
|
||||||
g_object_set (element, "forced", FALSE, "num-tracks", 2, NULL);
|
g_object_set (element, "forced", FALSE, "num-tracks", 2, NULL);
|
||||||
set_playing_state (element);
|
set_playing_state (element);
|
||||||
|
|
||||||
tag_list = gst_tag_list_new ();
|
tag_list = gst_tag_list_new_empty ();
|
||||||
/* Provided values are totally arbitrary. */
|
/* Provided values are totally arbitrary. */
|
||||||
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND,
|
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND,
|
||||||
GST_TAG_TRACK_PEAK, 0.75, GST_TAG_TRACK_GAIN, 2.21,
|
GST_TAG_TRACK_PEAK, 0.75, GST_TAG_TRACK_GAIN, 2.21,
|
||||||
|
@ -1428,7 +1437,7 @@ GST_START_TEST (test_forced_album_no_skip)
|
||||||
|
|
||||||
/* The second track has indeed full tags, but although being not forced, this
|
/* The second track has indeed full tags, but although being not forced, this
|
||||||
* one has to be processed because album processing is on. */
|
* one has to be processed because album processing is on. */
|
||||||
tag_list = gst_tag_list_new ();
|
tag_list = gst_tag_list_new_empty ();
|
||||||
/* Provided values are totally arbitrary. */
|
/* Provided values are totally arbitrary. */
|
||||||
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND,
|
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND,
|
||||||
GST_TAG_TRACK_PEAK, 0.75, GST_TAG_TRACK_GAIN, 2.21,
|
GST_TAG_TRACK_PEAK, 0.75, GST_TAG_TRACK_GAIN, 2.21,
|
||||||
|
@ -1479,7 +1488,7 @@ GST_START_TEST (test_forced_abort_album_no_skip)
|
||||||
g_object_set (element, "num-tracks", 0, NULL);
|
g_object_set (element, "num-tracks", 0, NULL);
|
||||||
|
|
||||||
/* Processing a track that has to be skipped. */
|
/* Processing a track that has to be skipped. */
|
||||||
tag_list = gst_tag_list_new ();
|
tag_list = gst_tag_list_new_empty ();
|
||||||
/* Provided values are totally arbitrary. */
|
/* Provided values are totally arbitrary. */
|
||||||
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND,
|
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND,
|
||||||
GST_TAG_TRACK_PEAK, 0.75, GST_TAG_TRACK_GAIN, 2.21,
|
GST_TAG_TRACK_PEAK, 0.75, GST_TAG_TRACK_GAIN, 2.21,
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <gst/check/gstcheck.h>
|
#include <gst/check/gstcheck.h>
|
||||||
|
#include <gst/audio/audio.h>
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
@ -29,11 +30,10 @@
|
||||||
* get_peer, and then remove references in every test function */
|
* get_peer, and then remove references in every test function */
|
||||||
static GstPad *mysrcpad, *mysinkpad;
|
static GstPad *mysrcpad, *mysinkpad;
|
||||||
|
|
||||||
#define RG_LIMITER_CAPS_TEMPLATE_STRING \
|
#define RG_LIMITER_CAPS_TEMPLATE_STRING \
|
||||||
"audio/x-raw-float, " \
|
"audio/x-raw, " \
|
||||||
"width = (int) 32, " \
|
"format = (string) "GST_AUDIO_NE (F32) ", " \
|
||||||
"endianness = (int) BYTE_ORDER, " \
|
"channels = (int) [ 1, MAX ], " \
|
||||||
"channels = (int) [ 1, MAX ], " \
|
|
||||||
"rate = (int) [ 1, MAX ]"
|
"rate = (int) [ 1, MAX ]"
|
||||||
|
|
||||||
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||||
|
@ -104,12 +104,12 @@ create_test_buffer (void)
|
||||||
GstBuffer *buf = gst_buffer_new_and_alloc (sizeof (test_input));
|
GstBuffer *buf = gst_buffer_new_and_alloc (sizeof (test_input));
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
|
|
||||||
memcpy (GST_BUFFER_DATA (buf), test_input, sizeof (test_input));
|
gst_buffer_fill (buf, 0, test_input, sizeof (test_input));
|
||||||
|
|
||||||
caps = gst_caps_new_simple ("audio/x-raw-float",
|
caps = gst_caps_new_simple ("audio/x-raw",
|
||||||
"rate", G_TYPE_INT, 44100, "channels", G_TYPE_INT, 1,
|
"rate", G_TYPE_INT, 44100, "channels", G_TYPE_INT, 1,
|
||||||
"endianness", G_TYPE_INT, G_BYTE_ORDER, "width", G_TYPE_INT, 32, NULL);
|
"format", G_TYPE_STRING, GST_AUDIO_NE (F32), NULL);
|
||||||
gst_buffer_set_caps (buf, caps);
|
gst_pad_set_caps (mysrcpad, caps);
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
||||||
|
@ -120,14 +120,19 @@ create_test_buffer (void)
|
||||||
static void
|
static void
|
||||||
verify_test_buffer (GstBuffer * buf)
|
verify_test_buffer (GstBuffer * buf)
|
||||||
{
|
{
|
||||||
gfloat *output = (gfloat *) GST_BUFFER_DATA (buf);
|
gsize size;
|
||||||
|
gfloat *output;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
fail_unless (GST_BUFFER_SIZE (buf) == sizeof (test_output));
|
output = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
|
||||||
|
fail_unless (size == sizeof (test_output));
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (test_input); i++)
|
for (i = 0; i < G_N_ELEMENTS (test_input); i++)
|
||||||
fail_unless (ABS (output[i] - test_output[i]) < 1.e-6,
|
fail_unless (ABS (output[i] - test_output[i]) < 1.e-6,
|
||||||
"Incorrect output value %.6f for input %.2f, expected %.6f",
|
"Incorrect output value %.6f for input %.2f, expected %.6f",
|
||||||
output[i], test_input[i], test_output[i]);
|
output[i], test_input[i], test_output[i]);
|
||||||
|
|
||||||
|
gst_buffer_unmap (buf, output, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Start of tests. */
|
/* Start of tests. */
|
||||||
|
@ -209,6 +214,8 @@ GST_START_TEST (test_gap)
|
||||||
{
|
{
|
||||||
GstElement *element = setup_rglimiter ();
|
GstElement *element = setup_rglimiter ();
|
||||||
GstBuffer *buf, *out_buf;
|
GstBuffer *buf, *out_buf;
|
||||||
|
gpointer d1, d2;
|
||||||
|
gsize s1, s2;
|
||||||
|
|
||||||
set_playing_state (element);
|
set_playing_state (element);
|
||||||
|
|
||||||
|
@ -223,12 +230,17 @@ GST_START_TEST (test_gap)
|
||||||
/* Verify that the baseclass does not lift the GAP flag: */
|
/* Verify that the baseclass does not lift the GAP flag: */
|
||||||
fail_unless (GST_BUFFER_FLAG_IS_SET (out_buf, GST_BUFFER_FLAG_GAP));
|
fail_unless (GST_BUFFER_FLAG_IS_SET (out_buf, GST_BUFFER_FLAG_GAP));
|
||||||
|
|
||||||
g_assert (GST_BUFFER_SIZE (out_buf) == GST_BUFFER_SIZE (buf));
|
d1 = gst_buffer_map (out_buf, &s1, NULL, GST_MAP_READ);
|
||||||
|
d2 = gst_buffer_map (buf, &s2, NULL, GST_MAP_READ);
|
||||||
|
|
||||||
|
g_assert (s1 == s2);
|
||||||
/* We cheated by passing an input buffer with non-silence that has the GAP
|
/* We cheated by passing an input buffer with non-silence that has the GAP
|
||||||
* flag set. The element cannot know that however and must have skipped
|
* flag set. The element cannot know that however and must have skipped
|
||||||
* adjusting the buffer because of the flag, which we can easily verify: */
|
* adjusting the buffer because of the flag, which we can easily verify: */
|
||||||
fail_if (memcmp (GST_BUFFER_DATA (out_buf),
|
fail_if (memcmp (d1, d2, s1) != 0);
|
||||||
GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (out_buf)) != 0);
|
|
||||||
|
gst_buffer_unmap (out_buf, d1, s1);
|
||||||
|
gst_buffer_unmap (buf, d2, s2);
|
||||||
|
|
||||||
cleanup_rglimiter (element);
|
cleanup_rglimiter (element);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <gst/check/gstcheck.h>
|
#include <gst/check/gstcheck.h>
|
||||||
|
#include <gst/audio/audio.h>
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
@ -31,11 +32,10 @@ GList *events = NULL;
|
||||||
* then remove references in every test function */
|
* then remove references in every test function */
|
||||||
static GstPad *mysrcpad, *mysinkpad;
|
static GstPad *mysrcpad, *mysinkpad;
|
||||||
|
|
||||||
#define RG_VOLUME_CAPS_TEMPLATE_STRING \
|
#define RG_VOLUME_CAPS_TEMPLATE_STRING \
|
||||||
"audio/x-raw-float, " \
|
"audio/x-raw, " \
|
||||||
"width = (int) 32, " \
|
"format = (string) "GST_AUDIO_NE (F32) ", " \
|
||||||
"endianness = (int) BYTE_ORDER, " \
|
"channels = (int) [ 1, MAX ], " \
|
||||||
"channels = (int) [ 1, MAX ], " \
|
|
||||||
"rate = (int) [ 1, MAX ]"
|
"rate = (int) [ 1, MAX ]"
|
||||||
|
|
||||||
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||||
|
@ -52,7 +52,7 @@ static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
/* gstcheck sets up a chain function that appends buffers to a global list.
|
/* gstcheck sets up a chain function that appends buffers to a global list.
|
||||||
* This is our equivalent of that for event handling. */
|
* This is our equivalent of that for event handling. */
|
||||||
static gboolean
|
static gboolean
|
||||||
event_func (GstPad * pad, GstEvent * event)
|
event_func (GstPad * pad, GstObject * parent, GstEvent * event)
|
||||||
{
|
{
|
||||||
events = g_list_append (events, event);
|
events = g_list_append (events, event);
|
||||||
|
|
||||||
|
@ -173,13 +173,14 @@ test_buffer_new (gfloat value)
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
buf = gst_buffer_new_and_alloc (8 * sizeof (gfloat));
|
buf = gst_buffer_new_and_alloc (8 * sizeof (gfloat));
|
||||||
data = (gfloat *) GST_BUFFER_DATA (buf);
|
data = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
data[i] = value;
|
data[i] = value;
|
||||||
|
gst_buffer_unmap (buf, data, -1);
|
||||||
|
|
||||||
caps = gst_caps_from_string ("audio/x-raw-float, "
|
caps = gst_caps_from_string ("audio/x-raw-float, "
|
||||||
"rate = 8000, channels = 1, endianness = BYTE_ORDER, width = 32");
|
"rate = 8000, channels = 1, endianness = BYTE_ORDER, width = 32");
|
||||||
gst_buffer_set_caps (buf, caps);
|
gst_pad_set_caps (mysrcpad, caps);
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
||||||
|
@ -204,6 +205,7 @@ static void
|
||||||
fail_unless_result_gain (GstElement * element, gdouble expected_gain)
|
fail_unless_result_gain (GstElement * element, gdouble expected_gain)
|
||||||
{
|
{
|
||||||
GstBuffer *input_buf, *output_buf;
|
GstBuffer *input_buf, *output_buf;
|
||||||
|
gfloat *data;
|
||||||
gfloat input_sample, output_sample;
|
gfloat input_sample, output_sample;
|
||||||
gdouble gain, prop_gain;
|
gdouble gain, prop_gain;
|
||||||
gboolean is_passthrough, expect_passthrough;
|
gboolean is_passthrough, expect_passthrough;
|
||||||
|
@ -227,16 +229,18 @@ fail_unless_result_gain (GstElement * element, gdouble expected_gain)
|
||||||
|
|
||||||
buffers = g_list_remove (buffers, output_buf);
|
buffers = g_list_remove (buffers, output_buf);
|
||||||
ASSERT_BUFFER_REFCOUNT (output_buf, "output_buf", 1);
|
ASSERT_BUFFER_REFCOUNT (output_buf, "output_buf", 1);
|
||||||
fail_unless_equals_int (GST_BUFFER_SIZE (output_buf), 8 * sizeof (gfloat));
|
|
||||||
|
|
||||||
output_sample = *((gfloat *) GST_BUFFER_DATA (output_buf));
|
fail_unless_equals_int (gst_buffer_get_size (output_buf),
|
||||||
|
8 * sizeof (gfloat));
|
||||||
|
|
||||||
|
data = gst_buffer_map (output_buf, NULL, NULL, GST_MAP_READ);
|
||||||
|
|
||||||
|
output_sample = *data;
|
||||||
fail_if (output_sample == 0.0, "First output sample is zero");
|
fail_if (output_sample == 0.0, "First output sample is zero");
|
||||||
for (i = 1; i < 8; i++) {
|
for (i = 1; i < 8; i++) {
|
||||||
gfloat output = ((gfloat *) GST_BUFFER_DATA (output_buf))[i];
|
fail_unless (output_sample == data[i], "Output samples not uniform");
|
||||||
|
|
||||||
fail_unless (output_sample == output, "Output samples not uniform");
|
|
||||||
};
|
};
|
||||||
|
gst_buffer_unmap (output_buf, data, -1);
|
||||||
|
|
||||||
gain = 20. * log10 (output_sample / input_sample);
|
gain = 20. * log10 (output_sample / input_sample);
|
||||||
fail_unless (MATCH_GAIN (gain, expected_gain),
|
fail_unless (MATCH_GAIN (gain, expected_gain),
|
||||||
|
@ -288,7 +292,7 @@ GST_START_TEST (test_events)
|
||||||
|
|
||||||
set_playing_state (element);
|
set_playing_state (element);
|
||||||
|
|
||||||
tag_list = gst_tag_list_new ();
|
tag_list = gst_tag_list_new_empty ();
|
||||||
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE,
|
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE,
|
||||||
GST_TAG_TRACK_GAIN, +4.95, GST_TAG_TRACK_PEAK, 0.59463,
|
GST_TAG_TRACK_GAIN, +4.95, GST_TAG_TRACK_PEAK, 0.59463,
|
||||||
GST_TAG_ALBUM_GAIN, -1.54, GST_TAG_ALBUM_PEAK, 0.693415,
|
GST_TAG_ALBUM_GAIN, -1.54, GST_TAG_ALBUM_PEAK, 0.693415,
|
||||||
|
@ -305,7 +309,7 @@ GST_START_TEST (test_events)
|
||||||
|
|
||||||
/* Same as above, but with a non-writable event. */
|
/* Same as above, but with a non-writable event. */
|
||||||
|
|
||||||
tag_list = gst_tag_list_new ();
|
tag_list = gst_tag_list_new_empty ();
|
||||||
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE,
|
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE,
|
||||||
GST_TAG_TRACK_GAIN, +4.95, GST_TAG_TRACK_PEAK, 0.59463,
|
GST_TAG_TRACK_GAIN, +4.95, GST_TAG_TRACK_PEAK, 0.59463,
|
||||||
GST_TAG_ALBUM_GAIN, -1.54, GST_TAG_ALBUM_PEAK, 0.693415,
|
GST_TAG_ALBUM_GAIN, -1.54, GST_TAG_ALBUM_PEAK, 0.693415,
|
||||||
|
@ -336,7 +340,7 @@ GST_START_TEST (test_simple)
|
||||||
"pre-amp", -6.00, "fallback-gain", +1.23, NULL);
|
"pre-amp", -6.00, "fallback-gain", +1.23, NULL);
|
||||||
set_playing_state (element);
|
set_playing_state (element);
|
||||||
|
|
||||||
tag_list = gst_tag_list_new ();
|
tag_list = gst_tag_list_new_empty ();
|
||||||
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE,
|
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE,
|
||||||
GST_TAG_TRACK_GAIN, -3.45, GST_TAG_TRACK_PEAK, 1.0,
|
GST_TAG_TRACK_GAIN, -3.45, GST_TAG_TRACK_PEAK, 1.0,
|
||||||
GST_TAG_ALBUM_GAIN, +2.09, GST_TAG_ALBUM_PEAK, 1.0, NULL);
|
GST_TAG_ALBUM_GAIN, +2.09, GST_TAG_ALBUM_PEAK, 1.0, NULL);
|
||||||
|
@ -346,7 +350,7 @@ GST_START_TEST (test_simple)
|
||||||
|
|
||||||
g_object_set (element, "album-mode", TRUE, NULL);
|
g_object_set (element, "album-mode", TRUE, NULL);
|
||||||
|
|
||||||
tag_list = gst_tag_list_new ();
|
tag_list = gst_tag_list_new_empty ();
|
||||||
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE,
|
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE,
|
||||||
GST_TAG_TRACK_GAIN, -3.45, GST_TAG_TRACK_PEAK, 1.0,
|
GST_TAG_TRACK_GAIN, -3.45, GST_TAG_TRACK_PEAK, 1.0,
|
||||||
GST_TAG_ALBUM_GAIN, +2.09, GST_TAG_ALBUM_PEAK, 1.0, NULL);
|
GST_TAG_ALBUM_GAIN, +2.09, GST_TAG_ALBUM_PEAK, 1.0, NULL);
|
||||||
|
@ -376,7 +380,7 @@ GST_START_TEST (test_fallback_gain)
|
||||||
"pre-amp", -6.00, "fallback-gain", -3.00, NULL);
|
"pre-amp", -6.00, "fallback-gain", -3.00, NULL);
|
||||||
set_playing_state (element);
|
set_playing_state (element);
|
||||||
|
|
||||||
tag_list = gst_tag_list_new ();
|
tag_list = gst_tag_list_new_empty ();
|
||||||
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE,
|
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE,
|
||||||
GST_TAG_TRACK_GAIN, +3.5, GST_TAG_TRACK_PEAK, 1.0,
|
GST_TAG_TRACK_GAIN, +3.5, GST_TAG_TRACK_PEAK, 1.0,
|
||||||
GST_TAG_ALBUM_GAIN, -0.5, GST_TAG_ALBUM_PEAK, 1.0, NULL);
|
GST_TAG_ALBUM_GAIN, -0.5, GST_TAG_ALBUM_PEAK, 1.0, NULL);
|
||||||
|
@ -419,7 +423,7 @@ GST_START_TEST (test_fallback_track)
|
||||||
"pre-amp", -6.00, "fallback-gain", +1.23, NULL);
|
"pre-amp", -6.00, "fallback-gain", +1.23, NULL);
|
||||||
set_playing_state (element);
|
set_playing_state (element);
|
||||||
|
|
||||||
tag_list = gst_tag_list_new ();
|
tag_list = gst_tag_list_new_empty ();
|
||||||
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE,
|
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE,
|
||||||
GST_TAG_TRACK_GAIN, +2.11, GST_TAG_TRACK_PEAK, 1.0, NULL);
|
GST_TAG_TRACK_GAIN, +2.11, GST_TAG_TRACK_PEAK, 1.0, NULL);
|
||||||
fail_unless (send_tag_event (element, gst_event_new_tag (tag_list)) == NULL);
|
fail_unless (send_tag_event (element, gst_event_new_tag (tag_list)) == NULL);
|
||||||
|
@ -444,7 +448,7 @@ GST_START_TEST (test_fallback_album)
|
||||||
"pre-amp", -6.00, "fallback-gain", +1.23, NULL);
|
"pre-amp", -6.00, "fallback-gain", +1.23, NULL);
|
||||||
set_playing_state (element);
|
set_playing_state (element);
|
||||||
|
|
||||||
tag_list = gst_tag_list_new ();
|
tag_list = gst_tag_list_new_empty ();
|
||||||
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE,
|
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE,
|
||||||
GST_TAG_ALBUM_GAIN, +3.73, GST_TAG_ALBUM_PEAK, 1.0, NULL);
|
GST_TAG_ALBUM_GAIN, +3.73, GST_TAG_ALBUM_PEAK, 1.0, NULL);
|
||||||
fail_unless (send_tag_event (element, gst_event_new_tag (tag_list)) == NULL);
|
fail_unless (send_tag_event (element, gst_event_new_tag (tag_list)) == NULL);
|
||||||
|
@ -466,7 +470,7 @@ GST_START_TEST (test_headroom)
|
||||||
"pre-amp", +0.00, "fallback-gain", +1.23, NULL);
|
"pre-amp", +0.00, "fallback-gain", +1.23, NULL);
|
||||||
set_playing_state (element);
|
set_playing_state (element);
|
||||||
|
|
||||||
tag_list = gst_tag_list_new ();
|
tag_list = gst_tag_list_new_empty ();
|
||||||
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE,
|
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE,
|
||||||
GST_TAG_TRACK_GAIN, +3.50, GST_TAG_TRACK_PEAK, 1.0, NULL);
|
GST_TAG_TRACK_GAIN, +3.50, GST_TAG_TRACK_PEAK, 1.0, NULL);
|
||||||
fail_unless (send_tag_event (element, gst_event_new_tag (tag_list)) == NULL);
|
fail_unless (send_tag_event (element, gst_event_new_tag (tag_list)) == NULL);
|
||||||
|
@ -475,7 +479,7 @@ GST_START_TEST (test_headroom)
|
||||||
send_eos_event (element);
|
send_eos_event (element);
|
||||||
|
|
||||||
g_object_set (element, "headroom", +2.00, NULL);
|
g_object_set (element, "headroom", +2.00, NULL);
|
||||||
tag_list = gst_tag_list_new ();
|
tag_list = gst_tag_list_new_empty ();
|
||||||
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE,
|
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE,
|
||||||
GST_TAG_TRACK_GAIN, +9.18, GST_TAG_TRACK_PEAK, 0.687149, NULL);
|
GST_TAG_TRACK_GAIN, +9.18, GST_TAG_TRACK_PEAK, 0.687149, NULL);
|
||||||
fail_unless (send_tag_event (element, gst_event_new_tag (tag_list)) == NULL);
|
fail_unless (send_tag_event (element, gst_event_new_tag (tag_list)) == NULL);
|
||||||
|
@ -485,7 +489,7 @@ GST_START_TEST (test_headroom)
|
||||||
send_eos_event (element);
|
send_eos_event (element);
|
||||||
|
|
||||||
g_object_set (element, "album-mode", TRUE, NULL);
|
g_object_set (element, "album-mode", TRUE, NULL);
|
||||||
tag_list = gst_tag_list_new ();
|
tag_list = gst_tag_list_new_empty ();
|
||||||
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE,
|
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE,
|
||||||
GST_TAG_ALBUM_GAIN, +5.50, GST_TAG_ALBUM_PEAK, 1.0, NULL);
|
GST_TAG_ALBUM_GAIN, +5.50, GST_TAG_ALBUM_PEAK, 1.0, NULL);
|
||||||
fail_unless (send_tag_event (element, gst_event_new_tag (tag_list)) == NULL);
|
fail_unless (send_tag_event (element, gst_event_new_tag (tag_list)) == NULL);
|
||||||
|
@ -508,7 +512,7 @@ GST_START_TEST (test_reference_level)
|
||||||
"headroom", +0.00, "pre-amp", +0.00, "fallback-gain", +1.23, NULL);
|
"headroom", +0.00, "pre-amp", +0.00, "fallback-gain", +1.23, NULL);
|
||||||
set_playing_state (element);
|
set_playing_state (element);
|
||||||
|
|
||||||
tag_list = gst_tag_list_new ();
|
tag_list = gst_tag_list_new_empty ();
|
||||||
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE,
|
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE,
|
||||||
GST_TAG_TRACK_GAIN, 0.00, GST_TAG_TRACK_PEAK, 0.2,
|
GST_TAG_TRACK_GAIN, 0.00, GST_TAG_TRACK_PEAK, 0.2,
|
||||||
GST_TAG_REFERENCE_LEVEL, 83., NULL);
|
GST_TAG_REFERENCE_LEVEL, 83., NULL);
|
||||||
|
@ -521,7 +525,7 @@ GST_START_TEST (test_reference_level)
|
||||||
|
|
||||||
/* Same as above, but with album gain. */
|
/* Same as above, but with album gain. */
|
||||||
|
|
||||||
tag_list = gst_tag_list_new ();
|
tag_list = gst_tag_list_new_empty ();
|
||||||
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE,
|
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE,
|
||||||
GST_TAG_TRACK_GAIN, 1.23, GST_TAG_TRACK_PEAK, 0.1,
|
GST_TAG_TRACK_GAIN, 1.23, GST_TAG_TRACK_PEAK, 0.1,
|
||||||
GST_TAG_ALBUM_GAIN, 0.00, GST_TAG_ALBUM_PEAK, 0.2,
|
GST_TAG_ALBUM_GAIN, 0.00, GST_TAG_ALBUM_PEAK, 0.2,
|
||||||
|
|
Loading…
Reference in a new issue