mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +00:00
rganalysis: Fix event handling in unit test
This commit is contained in:
parent
0e76ed510c
commit
4d81538090
1 changed files with 100 additions and 84 deletions
|
@ -226,12 +226,40 @@ send_flush_events (GstElement * element)
|
||||||
gboolean res;
|
gboolean res;
|
||||||
GstPad *pad;
|
GstPad *pad;
|
||||||
|
|
||||||
pad = gst_element_get_static_pad (element, "sink");
|
pad = mysrcpad;
|
||||||
res = gst_pad_send_event (pad, gst_event_new_flush_start ());
|
res = gst_pad_push_event (pad, gst_event_new_flush_start ());
|
||||||
fail_unless (res, "flush-start even not handledt");
|
fail_unless (res, "flush-start even not handledt");
|
||||||
res = gst_pad_send_event (pad, gst_event_new_flush_stop (TRUE));
|
res = gst_pad_push_event (pad, gst_event_new_flush_stop (TRUE));
|
||||||
fail_unless (res, "flush-stop event not handled");
|
fail_unless (res, "flush-stop event not handled");
|
||||||
gst_object_unref (pad);
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
send_stream_start_event (GstElement * element)
|
||||||
|
{
|
||||||
|
gboolean res;
|
||||||
|
GstPad *pad;
|
||||||
|
|
||||||
|
pad = mysrcpad;
|
||||||
|
res = gst_pad_push_event (pad, gst_event_new_stream_start ("test"));
|
||||||
|
fail_unless (res, "STREAM_START event not handled");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
send_caps_event (const gchar * format, gint sample_rate, gint channels)
|
||||||
|
{
|
||||||
|
GstCaps *caps;
|
||||||
|
|
||||||
|
caps = gst_caps_new_simple ("audio/x-raw",
|
||||||
|
"format", G_TYPE_STRING, format,
|
||||||
|
"rate", G_TYPE_INT, sample_rate, "channels", G_TYPE_INT, channels,
|
||||||
|
"layout", G_TYPE_STRING, "interleaved", NULL);
|
||||||
|
if (channels == 2) {
|
||||||
|
gst_caps_set_simple (caps,
|
||||||
|
"channel-mask", GST_TYPE_BITMASK,
|
||||||
|
G_GUINT64_CONSTANT (0x0000000000000003), NULL);
|
||||||
|
}
|
||||||
|
gst_pad_set_caps (mysrcpad, caps);
|
||||||
|
gst_caps_unref (caps);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -241,21 +269,20 @@ send_segment_event (GstElement * element)
|
||||||
gboolean res;
|
gboolean res;
|
||||||
GstPad *pad;
|
GstPad *pad;
|
||||||
|
|
||||||
pad = gst_element_get_static_pad (element, "sink");
|
pad = mysrcpad;
|
||||||
gst_segment_init (&segment, GST_FORMAT_TIME);
|
gst_segment_init (&segment, GST_FORMAT_TIME);
|
||||||
res = gst_pad_send_event (pad, gst_event_new_segment (&segment));
|
res = gst_pad_push_event (pad, gst_event_new_segment (&segment));
|
||||||
fail_unless (res, "SEGMENT event not handled");
|
fail_unless (res, "SEGMENT event not handled");
|
||||||
gst_object_unref (pad);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
send_eos_event (GstElement * element)
|
send_eos_event (GstElement * element)
|
||||||
{
|
{
|
||||||
GstBus *bus = gst_element_get_bus (element);
|
GstBus *bus = gst_element_get_bus (element);
|
||||||
GstPad *pad = gst_element_get_static_pad (element, "sink");
|
GstPad *pad = mysrcpad;
|
||||||
gboolean res;
|
gboolean res;
|
||||||
|
|
||||||
res = gst_pad_send_event (pad, gst_event_new_eos ());
|
res = gst_pad_push_event (pad, gst_event_new_eos ());
|
||||||
fail_unless (res, "EOS event not handled");
|
fail_unless (res, "EOS event not handled");
|
||||||
|
|
||||||
/* There is no sink element, so _we_ post the EOS message on the bus here. Of
|
/* There is no sink element, so _we_ post the EOS message on the bus here. Of
|
||||||
|
@ -265,19 +292,16 @@ send_eos_event (GstElement * element)
|
||||||
fail_unless (gst_bus_post (bus, gst_message_new_eos (NULL)));
|
fail_unless (gst_bus_post (bus, gst_message_new_eos (NULL)));
|
||||||
|
|
||||||
gst_object_unref (bus);
|
gst_object_unref (bus);
|
||||||
gst_object_unref (pad);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
send_tag_event (GstElement * element, GstTagList * tag_list)
|
send_tag_event (GstElement * element, GstTagList * tag_list)
|
||||||
{
|
{
|
||||||
GstPad *pad = gst_element_get_static_pad (element, "sink");
|
GstPad *pad = mysrcpad;
|
||||||
GstEvent *event = gst_event_new_tag (tag_list);
|
GstEvent *event = gst_event_new_tag (tag_list);
|
||||||
|
|
||||||
fail_unless (gst_pad_send_event (pad, event),
|
fail_unless (gst_pad_push_event (pad, event),
|
||||||
"Cannot send TAG event: Not handled.");
|
"Cannot send TAG event: Not handled.");
|
||||||
|
|
||||||
gst_object_unref (pad);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -407,7 +431,6 @@ 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));
|
||||||
GstMapInfo map;
|
GstMapInfo map;
|
||||||
gfloat *data;
|
gfloat *data;
|
||||||
GstCaps *caps;
|
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
gst_buffer_map (buf, &map, GST_MAP_WRITE);
|
gst_buffer_map (buf, &map, GST_MAP_WRITE);
|
||||||
|
@ -416,13 +439,6 @@ test_buffer_const_float_mono (gint sample_rate, gsize n_frames, gfloat value)
|
||||||
*data++ = value;
|
*data++ = value;
|
||||||
gst_buffer_unmap (buf, &map);
|
gst_buffer_unmap (buf, &map);
|
||||||
|
|
||||||
caps = gst_caps_new_simple ("audio/x-raw",
|
|
||||||
"format", G_TYPE_STRING, GST_AUDIO_NE (F32),
|
|
||||||
"rate", G_TYPE_INT, sample_rate, "channels", G_TYPE_INT, 1,
|
|
||||||
"layout", G_TYPE_STRING, "interleaved", NULL);
|
|
||||||
gst_pad_set_caps (mysrcpad, caps);
|
|
||||||
gst_caps_unref (caps);
|
|
||||||
|
|
||||||
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
|
@ -435,7 +451,6 @@ test_buffer_const_float_stereo (gint sample_rate, gsize n_frames,
|
||||||
GstBuffer *buf = gst_buffer_new_and_alloc (n_frames * sizeof (gfloat) * 2);
|
GstBuffer *buf = gst_buffer_new_and_alloc (n_frames * sizeof (gfloat) * 2);
|
||||||
GstMapInfo map;
|
GstMapInfo map;
|
||||||
gfloat *data;
|
gfloat *data;
|
||||||
GstCaps *caps;
|
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
gst_buffer_map (buf, &map, GST_MAP_WRITE);
|
gst_buffer_map (buf, &map, GST_MAP_WRITE);
|
||||||
|
@ -446,15 +461,6 @@ test_buffer_const_float_stereo (gint sample_rate, gsize n_frames,
|
||||||
}
|
}
|
||||||
gst_buffer_unmap (buf, &map);
|
gst_buffer_unmap (buf, &map);
|
||||||
|
|
||||||
caps = gst_caps_new_simple ("audio/x-raw",
|
|
||||||
"format", G_TYPE_STRING, GST_AUDIO_NE (F32),
|
|
||||||
"layout", G_TYPE_STRING, "interleaved",
|
|
||||||
"rate", G_TYPE_INT, sample_rate,
|
|
||||||
"channels", G_TYPE_INT, 2,
|
|
||||||
"channel-mask", GST_TYPE_BITMASK, (gint64) 0x3, NULL);
|
|
||||||
gst_pad_set_caps (mysrcpad, caps);
|
|
||||||
gst_caps_unref (caps);
|
|
||||||
|
|
||||||
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
|
@ -467,7 +473,6 @@ test_buffer_const_int16_mono (gint sample_rate, gint depth, gsize n_frames,
|
||||||
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 *data;
|
||||||
GstMapInfo map;
|
GstMapInfo map;
|
||||||
GstCaps *caps;
|
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
gst_buffer_map (buf, &map, GST_MAP_WRITE);
|
gst_buffer_map (buf, &map, GST_MAP_WRITE);
|
||||||
|
@ -476,13 +481,6 @@ test_buffer_const_int16_mono (gint sample_rate, gint depth, gsize n_frames,
|
||||||
*data++ = value;
|
*data++ = value;
|
||||||
gst_buffer_unmap (buf, &map);
|
gst_buffer_unmap (buf, &map);
|
||||||
|
|
||||||
caps = gst_caps_new_simple ("audio/x-raw",
|
|
||||||
"format", G_TYPE_STRING, GST_AUDIO_NE (S16),
|
|
||||||
"layout", G_TYPE_STRING, "interleaved",
|
|
||||||
"rate", G_TYPE_INT, sample_rate, "channels", G_TYPE_INT, 1, NULL);
|
|
||||||
gst_pad_set_caps (mysrcpad, caps);
|
|
||||||
gst_caps_unref (caps);
|
|
||||||
|
|
||||||
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
|
@ -495,7 +493,6 @@ test_buffer_const_int16_stereo (gint sample_rate, gint depth, gsize n_frames,
|
||||||
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 *data;
|
||||||
GstMapInfo map;
|
GstMapInfo map;
|
||||||
GstCaps *caps;
|
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
gst_buffer_map (buf, &map, GST_MAP_WRITE);
|
gst_buffer_map (buf, &map, GST_MAP_WRITE);
|
||||||
|
@ -506,14 +503,6 @@ test_buffer_const_int16_stereo (gint sample_rate, gint depth, gsize n_frames,
|
||||||
}
|
}
|
||||||
gst_buffer_unmap (buf, &map);
|
gst_buffer_unmap (buf, &map);
|
||||||
|
|
||||||
caps = gst_caps_new_simple ("audio/x-raw",
|
|
||||||
"format", G_TYPE_STRING, GST_AUDIO_NE (S16),
|
|
||||||
"layout", G_TYPE_STRING, "interleaved",
|
|
||||||
"rate", G_TYPE_INT, sample_rate, "channels", G_TYPE_INT, 2,
|
|
||||||
"channel-mask", GST_TYPE_BITMASK, (gint64) 0x3, NULL);
|
|
||||||
gst_pad_set_caps (mysrcpad, caps);
|
|
||||||
gst_caps_unref (caps);
|
|
||||||
|
|
||||||
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
|
@ -529,7 +518,6 @@ test_buffer_square_float_mono (gint * accumulator, gint sample_rate,
|
||||||
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 *data;
|
||||||
GstMapInfo map;
|
GstMapInfo map;
|
||||||
GstCaps *caps;
|
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
gst_buffer_map (buf, &map, GST_MAP_WRITE);
|
gst_buffer_map (buf, &map, GST_MAP_WRITE);
|
||||||
|
@ -545,13 +533,6 @@ test_buffer_square_float_mono (gint * accumulator, gint sample_rate,
|
||||||
}
|
}
|
||||||
gst_buffer_unmap (buf, &map);
|
gst_buffer_unmap (buf, &map);
|
||||||
|
|
||||||
caps = gst_caps_new_simple ("audio/x-raw",
|
|
||||||
"format", G_TYPE_STRING, GST_AUDIO_NE (F32),
|
|
||||||
"layout", G_TYPE_STRING, "interleaved",
|
|
||||||
"rate", G_TYPE_INT, sample_rate, "channels", G_TYPE_INT, 1, NULL);
|
|
||||||
gst_pad_set_caps (mysrcpad, caps);
|
|
||||||
gst_caps_unref (caps);
|
|
||||||
|
|
||||||
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
|
@ -564,7 +545,6 @@ test_buffer_square_float_stereo (gint * accumulator, gint sample_rate,
|
||||||
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 *data;
|
||||||
GstMapInfo map;
|
GstMapInfo map;
|
||||||
GstCaps *caps;
|
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
gst_buffer_map (buf, &map, GST_MAP_WRITE);
|
gst_buffer_map (buf, &map, GST_MAP_WRITE);
|
||||||
|
@ -583,14 +563,6 @@ test_buffer_square_float_stereo (gint * accumulator, gint sample_rate,
|
||||||
}
|
}
|
||||||
gst_buffer_unmap (buf, &map);
|
gst_buffer_unmap (buf, &map);
|
||||||
|
|
||||||
caps = gst_caps_new_simple ("audio/x-raw",
|
|
||||||
"format", G_TYPE_STRING, GST_AUDIO_NE (F32),
|
|
||||||
"layout", G_TYPE_STRING, "interleaved",
|
|
||||||
"rate", G_TYPE_INT, sample_rate, "channels", G_TYPE_INT, 2,
|
|
||||||
"channel-mask", GST_TYPE_BITMASK, (gint64) 0x3, NULL);
|
|
||||||
gst_pad_set_caps (mysrcpad, caps);
|
|
||||||
gst_caps_unref (caps);
|
|
||||||
|
|
||||||
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
|
@ -603,7 +575,6 @@ test_buffer_square_int16_mono (gint * accumulator, gint sample_rate,
|
||||||
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 *data;
|
||||||
GstMapInfo map;
|
GstMapInfo map;
|
||||||
GstCaps *caps;
|
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
gst_buffer_map (buf, &map, GST_MAP_WRITE);
|
gst_buffer_map (buf, &map, GST_MAP_WRITE);
|
||||||
|
@ -619,13 +590,6 @@ test_buffer_square_int16_mono (gint * accumulator, gint sample_rate,
|
||||||
}
|
}
|
||||||
gst_buffer_unmap (buf, &map);
|
gst_buffer_unmap (buf, &map);
|
||||||
|
|
||||||
caps = gst_caps_new_simple ("audio/x-raw",
|
|
||||||
"format", G_TYPE_STRING, GST_AUDIO_NE (S16),
|
|
||||||
"layout", G_TYPE_STRING, "interleaved",
|
|
||||||
"rate", G_TYPE_INT, sample_rate, "channels", G_TYPE_INT, 1, NULL);
|
|
||||||
gst_pad_set_caps (mysrcpad, caps);
|
|
||||||
gst_caps_unref (caps);
|
|
||||||
|
|
||||||
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
|
@ -638,7 +602,6 @@ test_buffer_square_int16_stereo (gint * accumulator, gint sample_rate,
|
||||||
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 *data;
|
||||||
GstMapInfo map;
|
GstMapInfo map;
|
||||||
GstCaps *caps;
|
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
gst_buffer_map (buf, &map, GST_MAP_WRITE);
|
gst_buffer_map (buf, &map, GST_MAP_WRITE);
|
||||||
|
@ -657,14 +620,6 @@ test_buffer_square_int16_stereo (gint * accumulator, gint sample_rate,
|
||||||
}
|
}
|
||||||
gst_buffer_unmap (buf, &map);
|
gst_buffer_unmap (buf, &map);
|
||||||
|
|
||||||
caps = gst_caps_new_simple ("audio/x-raw",
|
|
||||||
"format", G_TYPE_STRING, GST_AUDIO_NE (S16),
|
|
||||||
"layout", G_TYPE_STRING, "interleaved",
|
|
||||||
"rate", G_TYPE_INT, sample_rate, "channels", G_TYPE_INT, 2,
|
|
||||||
"channel-mask", GST_TYPE_BITMASK, (gint64) 0x3, NULL);
|
|
||||||
gst_pad_set_caps (mysrcpad, caps);
|
|
||||||
gst_caps_unref (caps);
|
|
||||||
|
|
||||||
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
ASSERT_BUFFER_REFCOUNT (buf, "buf", 1);
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
|
@ -703,6 +658,7 @@ GST_START_TEST (test_no_buffer_album_1)
|
||||||
set_playing_state (element);
|
set_playing_state (element);
|
||||||
|
|
||||||
/* Single track: */
|
/* Single track: */
|
||||||
|
send_stream_start_event (element);
|
||||||
send_segment_event (element);
|
send_segment_event (element);
|
||||||
send_eos_event (element);
|
send_eos_event (element);
|
||||||
poll_eos (element);
|
poll_eos (element);
|
||||||
|
@ -766,7 +722,7 @@ GST_START_TEST (test_no_buffer_album_2)
|
||||||
set_playing_state (element);
|
set_playing_state (element);
|
||||||
|
|
||||||
/* No buffer for the first track. */
|
/* No buffer for the first track. */
|
||||||
|
send_stream_start_event (element);
|
||||||
send_segment_event (element);
|
send_segment_event (element);
|
||||||
send_eos_event (element);
|
send_eos_event (element);
|
||||||
/* No tags should be posted, there was nothing to analyze: */
|
/* No tags should be posted, there was nothing to analyze: */
|
||||||
|
@ -776,6 +732,7 @@ GST_START_TEST (test_no_buffer_album_2)
|
||||||
/* A test waveform with known gain result as second track: */
|
/* A test waveform with known gain result as second track: */
|
||||||
|
|
||||||
send_flush_events (element);
|
send_flush_events (element);
|
||||||
|
send_caps_event (GST_AUDIO_NE (F32), 44100, 1);
|
||||||
send_segment_event (element);
|
send_segment_event (element);
|
||||||
for (i = 20; i--;)
|
for (i = 20; i--;)
|
||||||
push_buffer (test_buffer_square_float_mono (&accumulator, 44100, 512,
|
push_buffer (test_buffer_square_float_mono (&accumulator, 44100, 512,
|
||||||
|
@ -815,6 +772,8 @@ GST_START_TEST (test_empty_buffers)
|
||||||
set_playing_state (element);
|
set_playing_state (element);
|
||||||
|
|
||||||
/* Single track: */
|
/* Single track: */
|
||||||
|
send_stream_start_event (element);
|
||||||
|
send_caps_event (GST_AUDIO_NE (F32), 44100, 2);
|
||||||
send_segment_event (element);
|
send_segment_event (element);
|
||||||
push_buffer (test_buffer_const_float_stereo (44100, 0, 0.0, 0.0));
|
push_buffer (test_buffer_const_float_stereo (44100, 0, 0.0, 0.0));
|
||||||
send_eos_event (element);
|
send_eos_event (element);
|
||||||
|
@ -875,6 +834,8 @@ GST_START_TEST (test_peak_float)
|
||||||
GstTagList *tag_list;
|
GstTagList *tag_list;
|
||||||
|
|
||||||
set_playing_state (element);
|
set_playing_state (element);
|
||||||
|
send_stream_start_event (element);
|
||||||
|
send_caps_event (GST_AUDIO_NE (F32), 8000, 2);
|
||||||
send_segment_event (element);
|
send_segment_event (element);
|
||||||
push_buffer (test_buffer_const_float_stereo (8000, 512, -1.369, 0.0));
|
push_buffer (test_buffer_const_float_stereo (8000, 512, -1.369, 0.0));
|
||||||
send_eos_event (element);
|
send_eos_event (element);
|
||||||
|
@ -893,6 +854,7 @@ GST_START_TEST (test_peak_float)
|
||||||
|
|
||||||
/* Mono. */
|
/* Mono. */
|
||||||
send_flush_events (element);
|
send_flush_events (element);
|
||||||
|
send_caps_event (GST_AUDIO_NE (F32), 8000, 1);
|
||||||
send_segment_event (element);
|
send_segment_event (element);
|
||||||
push_buffer (test_buffer_const_float_mono (8000, 512, -1.369));
|
push_buffer (test_buffer_const_float_mono (8000, 512, -1.369));
|
||||||
send_eos_event (element);
|
send_eos_event (element);
|
||||||
|
@ -913,6 +875,8 @@ GST_START_TEST (test_peak_int16_16)
|
||||||
set_playing_state (element);
|
set_playing_state (element);
|
||||||
|
|
||||||
/* Half amplitude. */
|
/* Half amplitude. */
|
||||||
|
send_stream_start_event (element);
|
||||||
|
send_caps_event (GST_AUDIO_NE (S16), 8000, 2);
|
||||||
send_segment_event (element);
|
send_segment_event (element);
|
||||||
push_buffer (test_buffer_const_int16_stereo (8000, 16, 512, 1 << 14, 0));
|
push_buffer (test_buffer_const_int16_stereo (8000, 16, 512, 1 << 14, 0));
|
||||||
send_eos_event (element);
|
send_eos_event (element);
|
||||||
|
@ -922,6 +886,7 @@ GST_START_TEST (test_peak_int16_16)
|
||||||
|
|
||||||
/* Swapped channels. */
|
/* Swapped channels. */
|
||||||
send_flush_events (element);
|
send_flush_events (element);
|
||||||
|
send_caps_event (GST_AUDIO_NE (S16), 8000, 2);
|
||||||
send_segment_event (element);
|
send_segment_event (element);
|
||||||
push_buffer (test_buffer_const_int16_stereo (8000, 16, 512, 0, 1 << 14));
|
push_buffer (test_buffer_const_int16_stereo (8000, 16, 512, 0, 1 << 14));
|
||||||
send_eos_event (element);
|
send_eos_event (element);
|
||||||
|
@ -931,6 +896,7 @@ GST_START_TEST (test_peak_int16_16)
|
||||||
|
|
||||||
/* Mono. */
|
/* Mono. */
|
||||||
send_flush_events (element);
|
send_flush_events (element);
|
||||||
|
send_caps_event (GST_AUDIO_NE (S16), 8000, 1);
|
||||||
send_segment_event (element);
|
send_segment_event (element);
|
||||||
push_buffer (test_buffer_const_int16_mono (8000, 16, 512, 1 << 14));
|
push_buffer (test_buffer_const_int16_mono (8000, 16, 512, 1 << 14));
|
||||||
send_eos_event (element);
|
send_eos_event (element);
|
||||||
|
@ -940,6 +906,7 @@ GST_START_TEST (test_peak_int16_16)
|
||||||
|
|
||||||
/* Half amplitude, negative variant. */
|
/* Half amplitude, negative variant. */
|
||||||
send_flush_events (element);
|
send_flush_events (element);
|
||||||
|
send_caps_event (GST_AUDIO_NE (S16), 8000, 2);
|
||||||
send_segment_event (element);
|
send_segment_event (element);
|
||||||
push_buffer (test_buffer_const_int16_stereo (8000, 16, 512, -1 << 14, 0));
|
push_buffer (test_buffer_const_int16_stereo (8000, 16, 512, -1 << 14, 0));
|
||||||
send_eos_event (element);
|
send_eos_event (element);
|
||||||
|
@ -949,6 +916,7 @@ GST_START_TEST (test_peak_int16_16)
|
||||||
|
|
||||||
/* Swapped channels. */
|
/* Swapped channels. */
|
||||||
send_flush_events (element);
|
send_flush_events (element);
|
||||||
|
send_caps_event (GST_AUDIO_NE (S16), 8000, 2);
|
||||||
send_segment_event (element);
|
send_segment_event (element);
|
||||||
push_buffer (test_buffer_const_int16_stereo (8000, 16, 512, 0, -1 << 14));
|
push_buffer (test_buffer_const_int16_stereo (8000, 16, 512, 0, -1 << 14));
|
||||||
send_eos_event (element);
|
send_eos_event (element);
|
||||||
|
@ -958,6 +926,7 @@ GST_START_TEST (test_peak_int16_16)
|
||||||
|
|
||||||
/* Mono. */
|
/* Mono. */
|
||||||
send_flush_events (element);
|
send_flush_events (element);
|
||||||
|
send_caps_event (GST_AUDIO_NE (S16), 8000, 1);
|
||||||
send_segment_event (element);
|
send_segment_event (element);
|
||||||
push_buffer (test_buffer_const_int16_mono (8000, 16, 512, -1 << 14));
|
push_buffer (test_buffer_const_int16_mono (8000, 16, 512, -1 << 14));
|
||||||
send_eos_event (element);
|
send_eos_event (element);
|
||||||
|
@ -972,6 +941,7 @@ GST_START_TEST (test_peak_int16_16)
|
||||||
* -32768! */
|
* -32768! */
|
||||||
|
|
||||||
send_flush_events (element);
|
send_flush_events (element);
|
||||||
|
send_caps_event (GST_AUDIO_NE (S16), 8000, 2);
|
||||||
send_segment_event (element);
|
send_segment_event (element);
|
||||||
push_buffer (test_buffer_const_int16_stereo (8000, 16, 512, 32767, 0));
|
push_buffer (test_buffer_const_int16_stereo (8000, 16, 512, 32767, 0));
|
||||||
send_eos_event (element);
|
send_eos_event (element);
|
||||||
|
@ -981,6 +951,7 @@ GST_START_TEST (test_peak_int16_16)
|
||||||
|
|
||||||
/* Swapped channels. */
|
/* Swapped channels. */
|
||||||
send_flush_events (element);
|
send_flush_events (element);
|
||||||
|
send_caps_event (GST_AUDIO_NE (S16), 8000, 2);
|
||||||
send_segment_event (element);
|
send_segment_event (element);
|
||||||
push_buffer (test_buffer_const_int16_stereo (8000, 16, 512, 0, 32767));
|
push_buffer (test_buffer_const_int16_stereo (8000, 16, 512, 0, 32767));
|
||||||
send_eos_event (element);
|
send_eos_event (element);
|
||||||
|
@ -990,6 +961,7 @@ GST_START_TEST (test_peak_int16_16)
|
||||||
|
|
||||||
/* Mono. */
|
/* Mono. */
|
||||||
send_flush_events (element);
|
send_flush_events (element);
|
||||||
|
send_caps_event (GST_AUDIO_NE (S16), 8000, 1);
|
||||||
send_segment_event (element);
|
send_segment_event (element);
|
||||||
push_buffer (test_buffer_const_int16_mono (8000, 16, 512, 32767));
|
push_buffer (test_buffer_const_int16_mono (8000, 16, 512, 32767));
|
||||||
send_eos_event (element);
|
send_eos_event (element);
|
||||||
|
@ -1000,6 +972,7 @@ GST_START_TEST (test_peak_int16_16)
|
||||||
|
|
||||||
/* Negative variant, reaching 1.0. */
|
/* Negative variant, reaching 1.0. */
|
||||||
send_flush_events (element);
|
send_flush_events (element);
|
||||||
|
send_caps_event (GST_AUDIO_NE (S16), 8000, 2);
|
||||||
send_segment_event (element);
|
send_segment_event (element);
|
||||||
push_buffer (test_buffer_const_int16_stereo (8000, 16, 512, -32768, 0));
|
push_buffer (test_buffer_const_int16_stereo (8000, 16, 512, -32768, 0));
|
||||||
send_eos_event (element);
|
send_eos_event (element);
|
||||||
|
@ -1009,6 +982,7 @@ GST_START_TEST (test_peak_int16_16)
|
||||||
|
|
||||||
/* Swapped channels. */
|
/* Swapped channels. */
|
||||||
send_flush_events (element);
|
send_flush_events (element);
|
||||||
|
send_caps_event (GST_AUDIO_NE (S16), 8000, 2);
|
||||||
send_segment_event (element);
|
send_segment_event (element);
|
||||||
push_buffer (test_buffer_const_int16_stereo (8000, 16, 512, 0, -32768));
|
push_buffer (test_buffer_const_int16_stereo (8000, 16, 512, 0, -32768));
|
||||||
send_eos_event (element);
|
send_eos_event (element);
|
||||||
|
@ -1018,6 +992,7 @@ GST_START_TEST (test_peak_int16_16)
|
||||||
|
|
||||||
/* Mono. */
|
/* Mono. */
|
||||||
send_flush_events (element);
|
send_flush_events (element);
|
||||||
|
send_caps_event (GST_AUDIO_NE (S16), 8000, 1);
|
||||||
send_segment_event (element);
|
send_segment_event (element);
|
||||||
push_buffer (test_buffer_const_int16_mono (8000, 16, 512, -32768));
|
push_buffer (test_buffer_const_int16_mono (8000, 16, 512, -32768));
|
||||||
send_eos_event (element);
|
send_eos_event (element);
|
||||||
|
@ -1038,6 +1013,8 @@ GST_START_TEST (test_peak_album)
|
||||||
g_object_set (element, "num-tracks", 2, NULL);
|
g_object_set (element, "num-tracks", 2, NULL);
|
||||||
set_playing_state (element);
|
set_playing_state (element);
|
||||||
|
|
||||||
|
send_stream_start_event (element);
|
||||||
|
send_caps_event (GST_AUDIO_NE (F32), 8000, 2);
|
||||||
send_segment_event (element);
|
send_segment_event (element);
|
||||||
push_buffer (test_buffer_const_float_stereo (8000, 1024, 1.0, 0.0));
|
push_buffer (test_buffer_const_float_stereo (8000, 1024, 1.0, 0.0));
|
||||||
send_eos_event (element);
|
send_eos_event (element);
|
||||||
|
@ -1115,6 +1092,8 @@ GST_START_TEST (test_peak_track_album)
|
||||||
|
|
||||||
set_playing_state (element);
|
set_playing_state (element);
|
||||||
|
|
||||||
|
send_stream_start_event (element);
|
||||||
|
send_caps_event (GST_AUDIO_NE (F32), 8000, 1);
|
||||||
send_segment_event (element);
|
send_segment_event (element);
|
||||||
push_buffer (test_buffer_const_float_mono (8000, 1024, 1.0));
|
push_buffer (test_buffer_const_float_mono (8000, 1024, 1.0));
|
||||||
send_eos_event (element);
|
send_eos_event (element);
|
||||||
|
@ -1152,6 +1131,8 @@ GST_START_TEST (test_peak_album_abort_to_track)
|
||||||
g_object_set (element, "num-tracks", 2, NULL);
|
g_object_set (element, "num-tracks", 2, NULL);
|
||||||
set_playing_state (element);
|
set_playing_state (element);
|
||||||
|
|
||||||
|
send_stream_start_event (element);
|
||||||
|
send_caps_event (GST_AUDIO_NE (F32), 8000, 2);
|
||||||
send_segment_event (element);
|
send_segment_event (element);
|
||||||
push_buffer (test_buffer_const_float_stereo (8000, 1024, 1.0, 0.0));
|
push_buffer (test_buffer_const_float_stereo (8000, 1024, 1.0, 0.0));
|
||||||
send_eos_event (element);
|
send_eos_event (element);
|
||||||
|
@ -1189,6 +1170,8 @@ GST_START_TEST (test_gain_album)
|
||||||
|
|
||||||
/* The three tracks are constructed such that if any of these is in fact
|
/* The three tracks are constructed such that if any of these is in fact
|
||||||
* ignored for the album gain, the album gain will differ. */
|
* ignored for the album gain, the album gain will differ. */
|
||||||
|
send_stream_start_event (element);
|
||||||
|
send_caps_event (GST_AUDIO_NE (F32), 44100, 2);
|
||||||
send_segment_event (element);
|
send_segment_event (element);
|
||||||
accumulator = 0;
|
accumulator = 0;
|
||||||
for (i = 8; i--;)
|
for (i = 8; i--;)
|
||||||
|
@ -1248,6 +1231,8 @@ 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);
|
||||||
|
|
||||||
|
send_stream_start_event (element);
|
||||||
|
send_caps_event (GST_AUDIO_NE (F32), 44100, 2);
|
||||||
send_segment_event (element);
|
send_segment_event (element);
|
||||||
tag_list = gst_tag_list_new_empty ();
|
tag_list = gst_tag_list_new_empty ();
|
||||||
/* Provided values are totally arbitrary. */
|
/* Provided values are totally arbitrary. */
|
||||||
|
@ -1290,6 +1275,8 @@ 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);
|
||||||
|
|
||||||
|
send_stream_start_event (element);
|
||||||
|
send_caps_event (GST_AUDIO_NE (F32), 44100, 2);
|
||||||
send_segment_event (element);
|
send_segment_event (element);
|
||||||
tag_list = gst_tag_list_new_empty ();
|
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,
|
||||||
|
@ -1343,6 +1330,8 @@ GST_START_TEST (test_forced_after_data)
|
||||||
g_object_set (element, "forced", FALSE, NULL);
|
g_object_set (element, "forced", FALSE, NULL);
|
||||||
set_playing_state (element);
|
set_playing_state (element);
|
||||||
|
|
||||||
|
send_stream_start_event (element);
|
||||||
|
send_caps_event (GST_AUDIO_NE (F32), 8000, 2);
|
||||||
send_segment_event (element);
|
send_segment_event (element);
|
||||||
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));
|
||||||
|
@ -1385,6 +1374,8 @@ 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);
|
||||||
|
|
||||||
|
send_stream_start_event (element);
|
||||||
|
send_caps_event (GST_AUDIO_NE (F32), 44100, 2);
|
||||||
send_segment_event (element);
|
send_segment_event (element);
|
||||||
tag_list = gst_tag_list_new_empty ();
|
tag_list = gst_tag_list_new_empty ();
|
||||||
/* Provided values are totally arbitrary. */
|
/* Provided values are totally arbitrary. */
|
||||||
|
@ -1447,6 +1438,8 @@ 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);
|
||||||
|
|
||||||
|
send_stream_start_event (element);
|
||||||
|
send_caps_event (GST_AUDIO_NE (F32), 8000, 2);
|
||||||
send_segment_event (element);
|
send_segment_event (element);
|
||||||
tag_list = gst_tag_list_new_empty ();
|
tag_list = gst_tag_list_new_empty ();
|
||||||
/* Provided values are totally arbitrary. */
|
/* Provided values are totally arbitrary. */
|
||||||
|
@ -1501,6 +1494,8 @@ GST_START_TEST (test_forced_album_no_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);
|
||||||
|
|
||||||
|
send_stream_start_event (element);
|
||||||
|
send_caps_event (GST_AUDIO_NE (F32), 8000, 2);
|
||||||
send_segment_event (element);
|
send_segment_event (element);
|
||||||
for (i = 20; i--;)
|
for (i = 20; i--;)
|
||||||
push_buffer (test_buffer_square_float_stereo (&accumulator, 8000, 512, 0.25,
|
push_buffer (test_buffer_square_float_stereo (&accumulator, 8000, 512, 0.25,
|
||||||
|
@ -1553,6 +1548,8 @@ GST_START_TEST (test_forced_abort_album_no_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);
|
||||||
|
|
||||||
|
send_stream_start_event (element);
|
||||||
|
send_caps_event (GST_AUDIO_NE (F32), 8000, 2);
|
||||||
send_segment_event (element);
|
send_segment_event (element);
|
||||||
for (i = 20; i--;)
|
for (i = 20; i--;)
|
||||||
push_buffer (test_buffer_square_float_stereo (&accumulator, 8000, 512, 0.25,
|
push_buffer (test_buffer_square_float_stereo (&accumulator, 8000, 512, 0.25,
|
||||||
|
@ -1598,6 +1595,8 @@ GST_START_TEST (test_reference_level)
|
||||||
|
|
||||||
set_playing_state (element);
|
set_playing_state (element);
|
||||||
|
|
||||||
|
send_stream_start_event (element);
|
||||||
|
send_caps_event (GST_AUDIO_NE (F32), 44100, 2);
|
||||||
send_segment_event (element);
|
send_segment_event (element);
|
||||||
for (i = 20; i--;)
|
for (i = 20; i--;)
|
||||||
push_buffer (test_buffer_square_float_stereo (&accumulator, 44100, 512,
|
push_buffer (test_buffer_square_float_stereo (&accumulator, 44100, 512,
|
||||||
|
@ -1661,19 +1660,24 @@ GST_START_TEST (test_all_formats)
|
||||||
gint i, j;
|
gint i, j;
|
||||||
|
|
||||||
set_playing_state (element);
|
set_playing_state (element);
|
||||||
|
send_stream_start_event (element);
|
||||||
for (i = G_N_ELEMENTS (supported_rates); i--;) {
|
for (i = G_N_ELEMENTS (supported_rates); i--;) {
|
||||||
send_flush_events (element);
|
send_flush_events (element);
|
||||||
|
send_caps_event (GST_AUDIO_NE (F32), supported_rates[i].sample_rate, 2);
|
||||||
send_segment_event (element);
|
send_segment_event (element);
|
||||||
accumulator = 0;
|
accumulator = 0;
|
||||||
for (j = 0; j < 4; j++)
|
for (j = 0; j < 4; j++)
|
||||||
push_buffer (test_buffer_square_float_stereo (&accumulator,
|
push_buffer (test_buffer_square_float_stereo (&accumulator,
|
||||||
supported_rates[i].sample_rate, 512, 0.25, 0.25));
|
supported_rates[i].sample_rate, 512, 0.25, 0.25));
|
||||||
|
send_caps_event (GST_AUDIO_NE (F32), supported_rates[i].sample_rate, 1);
|
||||||
for (j = 0; j < 3; j++)
|
for (j = 0; j < 3; j++)
|
||||||
push_buffer (test_buffer_square_float_mono (&accumulator,
|
push_buffer (test_buffer_square_float_mono (&accumulator,
|
||||||
supported_rates[i].sample_rate, 512, 0.25));
|
supported_rates[i].sample_rate, 512, 0.25));
|
||||||
|
send_caps_event (GST_AUDIO_NE (S16), supported_rates[i].sample_rate, 2);
|
||||||
for (j = 0; j < 4; j++)
|
for (j = 0; j < 4; j++)
|
||||||
push_buffer (test_buffer_square_int16_stereo (&accumulator,
|
push_buffer (test_buffer_square_int16_stereo (&accumulator,
|
||||||
supported_rates[i].sample_rate, 16, 512, 1 << 13, 1 << 13));
|
supported_rates[i].sample_rate, 16, 512, 1 << 13, 1 << 13));
|
||||||
|
send_caps_event (GST_AUDIO_NE (S16), supported_rates[i].sample_rate, 1);
|
||||||
for (j = 0; j < 3; j++)
|
for (j = 0; j < 3; j++)
|
||||||
push_buffer (test_buffer_square_int16_mono (&accumulator,
|
push_buffer (test_buffer_square_int16_mono (&accumulator,
|
||||||
supported_rates[i].sample_rate, 16, 512, 1 << 13));
|
supported_rates[i].sample_rate, 16, 512, 1 << 13));
|
||||||
|
@ -1703,6 +1707,9 @@ GST_END_TEST;
|
||||||
gint i; \
|
gint i; \
|
||||||
\
|
\
|
||||||
set_playing_state (element); \
|
set_playing_state (element); \
|
||||||
|
send_stream_start_event (element); \
|
||||||
|
send_caps_event (GST_AUDIO_NE (F32), sample_rate, 1); \
|
||||||
|
send_segment_event (element); \
|
||||||
\
|
\
|
||||||
for (i = 0; i < 20; i++) \
|
for (i = 0; i < 20; i++) \
|
||||||
push_buffer (test_buffer_square_float_mono (&accumulator, \
|
push_buffer (test_buffer_square_float_mono (&accumulator, \
|
||||||
|
@ -1728,6 +1735,9 @@ GST_END_TEST;
|
||||||
gint i; \
|
gint i; \
|
||||||
\
|
\
|
||||||
set_playing_state (element); \
|
set_playing_state (element); \
|
||||||
|
send_stream_start_event (element); \
|
||||||
|
send_caps_event (GST_AUDIO_NE (F32), sample_rate, 2); \
|
||||||
|
send_segment_event (element); \
|
||||||
\
|
\
|
||||||
for (i = 0; i < 20; i++) \
|
for (i = 0; i < 20; i++) \
|
||||||
push_buffer (test_buffer_square_float_stereo (&accumulator, \
|
push_buffer (test_buffer_square_float_stereo (&accumulator, \
|
||||||
|
@ -1753,6 +1763,9 @@ GST_END_TEST;
|
||||||
gint i; \
|
gint i; \
|
||||||
\
|
\
|
||||||
set_playing_state (element); \
|
set_playing_state (element); \
|
||||||
|
send_stream_start_event (element); \
|
||||||
|
send_caps_event (GST_AUDIO_NE (S16), sample_rate, 1); \
|
||||||
|
send_segment_event (element); \
|
||||||
\
|
\
|
||||||
for (i = 0; i < 20; i++) \
|
for (i = 0; i < 20; i++) \
|
||||||
push_buffer (test_buffer_square_int16_mono (&accumulator, \
|
push_buffer (test_buffer_square_int16_mono (&accumulator, \
|
||||||
|
@ -1779,6 +1792,9 @@ GST_END_TEST;
|
||||||
gint i; \
|
gint i; \
|
||||||
\
|
\
|
||||||
set_playing_state (element); \
|
set_playing_state (element); \
|
||||||
|
send_stream_start_event (element); \
|
||||||
|
send_caps_event (GST_AUDIO_NE (S16), sample_rate, 2); \
|
||||||
|
send_segment_event (element); \
|
||||||
\
|
\
|
||||||
for (i = 0; i < 20; i++) \
|
for (i = 0; i < 20; i++) \
|
||||||
push_buffer (test_buffer_square_int16_stereo (&accumulator, \
|
push_buffer (test_buffer_square_int16_stereo (&accumulator, \
|
||||||
|
|
Loading…
Reference in a new issue