static GstBuffer *
create_buffer (guint8 * data, gsize size)
{
- GstBuffer * buf = gst_buffer_new_wrapped_full (GST_MEMORY_FLAG_READONLY,
- data, size, 0, size, NULL, NULL);
+ GstBuffer *buf = gst_buffer_new_wrapped_full (GST_MEMORY_FLAG_READONLY,
+ data, size, 0, size, NULL, NULL);
GST_BUFFER_PTS (buf) = GST_CLOCK_TIME_NONE;
GST_BUFFER_DTS (buf) = GST_CLOCK_TIME_NONE;
GST_BUFFER_DURATION (buf) = GST_CLOCK_TIME_NONE;
static void
flvdemux_pad_added (GstElement * flvdemux, GstPad * srcpad, GstHarness * h)
{
- (void)flvdemux;
+ (void) flvdemux;
gst_harness_add_element_src_pad (h, srcpad);
}
GST_START_TEST (test_speex)
{
guint8 flv_header0[] = {
- 0x46, 0x4c, 0x56, 0x01, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x00
+ 0x46, 0x4c, 0x56, 0x01, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x00
};
guint8 flv_header1[] = {
- 0x12, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x02, 0x00, 0x0a, 0x6f, 0x6e,
- 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x0c, 0x61,
- 0x75, 0x64, 0x69, 0x6f, 0x63, 0x6f, 0x64, 0x65,
- 0x63, 0x69, 0x64, 0x00, 0x40, 0x26, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x6d, 0x65,
- 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x63, 0x72,
- 0x65, 0x61, 0x74, 0x6f, 0x72, 0x02, 0x00, 0x13,
- 0x47, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x65,
- 0x72, 0x20, 0x46, 0x4c, 0x56, 0x20, 0x6d, 0x75,
- 0x78, 0x65, 0x72, 0x00, 0x0c, 0x63, 0x72, 0x65,
- 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x64, 0x61, 0x74,
- 0x65, 0x02, 0x00, 0x18, 0x57, 0x65, 0x64, 0x20,
- 0x53, 0x65, 0x70, 0x20, 0x32, 0x33, 0x20, 0x31,
- 0x30, 0x3a, 0x34, 0x39, 0x3a, 0x35, 0x36, 0x20,
- 0x32, 0x30, 0x31, 0x35, 0x00, 0x00, 0x09, 0x00,
- 0x00, 0x00, 0x87,
+ 0x12, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x02, 0x00, 0x0a, 0x6f, 0x6e,
+ 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x0c, 0x61,
+ 0x75, 0x64, 0x69, 0x6f, 0x63, 0x6f, 0x64, 0x65,
+ 0x63, 0x69, 0x64, 0x00, 0x40, 0x26, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x6d, 0x65,
+ 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x63, 0x72,
+ 0x65, 0x61, 0x74, 0x6f, 0x72, 0x02, 0x00, 0x13,
+ 0x47, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x65,
+ 0x72, 0x20, 0x46, 0x4c, 0x56, 0x20, 0x6d, 0x75,
+ 0x78, 0x65, 0x72, 0x00, 0x0c, 0x63, 0x72, 0x65,
+ 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x64, 0x61, 0x74,
+ 0x65, 0x02, 0x00, 0x18, 0x57, 0x65, 0x64, 0x20,
+ 0x53, 0x65, 0x70, 0x20, 0x32, 0x33, 0x20, 0x31,
+ 0x30, 0x3a, 0x34, 0x39, 0x3a, 0x35, 0x36, 0x20,
+ 0x32, 0x30, 0x31, 0x35, 0x00, 0x00, 0x09, 0x00,
+ 0x00, 0x00, 0x87,
};
guint8 speex_header0[] = {
- 0x08, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0xb2, 0x53, 0x70, 0x65, 0x65,
- 0x78, 0x20, 0x20, 0x20, 0x31, 0x2e, 0x32, 0x72,
- 0x63, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00,
- 0x80, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0x40, 0x01, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5c,
+ 0x08, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xb2, 0x53, 0x70, 0x65, 0x65,
+ 0x78, 0x20, 0x20, 0x20, 0x31, 0x2e, 0x32, 0x72,
+ 0x63, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00,
+ 0x80, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0x40, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5c,
};
guint8 speex_header1[] = {
- 0x08, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0xb2, 0x1f, 0x00, 0x00, 0x00,
- 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x20,
- 0x77, 0x69, 0x74, 0x68, 0x20, 0x47, 0x53, 0x74,
- 0x72, 0x65, 0x61, 0x6d, 0x65, 0x72, 0x20, 0x53,
- 0x70, 0x65, 0x65, 0x78, 0x65, 0x6e, 0x63, 0x00,
- 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x34,
+ 0x08, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xb2, 0x1f, 0x00, 0x00, 0x00,
+ 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x20,
+ 0x77, 0x69, 0x74, 0x68, 0x20, 0x47, 0x53, 0x74,
+ 0x72, 0x65, 0x61, 0x6d, 0x65, 0x72, 0x20, 0x53,
+ 0x70, 0x65, 0x65, 0x78, 0x65, 0x6e, 0x63, 0x00,
+ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x34,
};
guint8 buffer[] = {
- 0x08, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0xb2, 0x36, 0x9d, 0x1b, 0x9a,
- 0x20, 0x00, 0x01, 0x68, 0xe8, 0xe8, 0xe8, 0xe8,
- 0xe8, 0xe8, 0xe8, 0x84, 0x00, 0xb4, 0x74, 0x74,
- 0x74, 0x74, 0x74, 0x74, 0x74, 0x42, 0x00, 0x5a,
- 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x21,
- 0x00, 0x2d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d,
- 0x1d, 0x1b, 0x3b, 0x60, 0xab, 0xab, 0xab, 0xab,
- 0xab, 0x0a, 0xba, 0xba, 0xba, 0xba, 0xb0, 0xab,
- 0xab, 0xab, 0xab, 0xab, 0x0a, 0xba, 0xba, 0xba,
- 0xba, 0xb7, 0x00, 0x00, 0x00, 0x52,
+ 0x08, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xb2, 0x36, 0x9d, 0x1b, 0x9a,
+ 0x20, 0x00, 0x01, 0x68, 0xe8, 0xe8, 0xe8, 0xe8,
+ 0xe8, 0xe8, 0xe8, 0x84, 0x00, 0xb4, 0x74, 0x74,
+ 0x74, 0x74, 0x74, 0x74, 0x74, 0x42, 0x00, 0x5a,
+ 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x21,
+ 0x00, 0x2d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d,
+ 0x1d, 0x1b, 0x3b, 0x60, 0xab, 0xab, 0xab, 0xab,
+ 0xab, 0x0a, 0xba, 0xba, 0xba, 0xba, 0xb0, 0xab,
+ 0xab, 0xab, 0xab, 0xab, 0x0a, 0xba, 0xba, 0xba,
+ 0xba, 0xb7, 0x00, 0x00, 0x00, 0x52,
};
- GstHarness * h = gst_harness_new_with_padnames ("flvdemux", "sink", NULL);
+ GstHarness *h = gst_harness_new_with_padnames ("flvdemux", "sink", NULL);
gst_harness_set_src_caps_str (h, "video/x-flv");
g_signal_connect (h->element, "pad-added",
G_CALLBACK (flvdemux_pad_added), h);
- gst_harness_push (h, create_buffer (flv_header0, sizeof (flv_header0)));
- gst_harness_push (h, create_buffer (flv_header1, sizeof (flv_header1)));
+ gst_harness_push (h, create_buffer (flv_header0, sizeof (flv_header0)));
+ gst_harness_push (h, create_buffer (flv_header1, sizeof (flv_header1)));
gst_harness_push (h, create_buffer (speex_header0, sizeof (speex_header0)));
gst_harness_push (h, create_buffer (speex_header1, sizeof (speex_header1)));
- gst_harness_push (h, create_buffer (buffer, sizeof (buffer)));
+ gst_harness_push (h, create_buffer (buffer, sizeof (buffer)));
{
- GstCaps * caps;
- const GstStructure * s;
+ GstCaps *caps;
+ const GstStructure *s;
const GValue *streamheader;
const GValue *header;
const GValue *vorbiscomment;
create_buffer (guint8 * data, gsize size,
GstClockTime timestamp, GstClockTime duration)
{
- GstBuffer * buf = gst_buffer_new_wrapped_full (GST_MEMORY_FLAG_READONLY,
- data, size, 0, size, NULL, NULL);
+ GstBuffer *buf = gst_buffer_new_wrapped_full (GST_MEMORY_FLAG_READONLY,
+ data, size, 0, size, NULL, NULL);
GST_BUFFER_PTS (buf) = timestamp;
GST_BUFFER_DTS (buf) = timestamp;
GST_BUFFER_DURATION (buf) = duration;
GST_START_TEST (test_speex_streamable)
{
- GstBuffer * buf;
+ GstBuffer *buf;
GstMapInfo map = GST_MAP_INFO_INIT;
guint8 header0[] = {
- 0x53, 0x70, 0x65, 0x65, 0x78, 0x20, 0x20, 0x20,
- 0x31, 0x2e, 0x32, 0x72, 0x63, 0x31, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x50, 0x00, 0x00, 0x00, 0x80, 0x3e, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
- 0x40, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ 0x53, 0x70, 0x65, 0x65, 0x78, 0x20, 0x20, 0x20,
+ 0x31, 0x2e, 0x32, 0x72, 0x63, 0x31, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x50, 0x00, 0x00, 0x00, 0x80, 0x3e, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0x40, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
guint8 header1[] = {
- 0x1f, 0x00, 0x00, 0x00, 0x45, 0x6e, 0x63, 0x6f,
- 0x64, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68,
- 0x20, 0x47, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d,
- 0x65, 0x72, 0x20, 0x53, 0x70, 0x65, 0x65, 0x78,
- 0x65, 0x6e, 0x63, 0x00, 0x00, 0x00, 0x00, 0x01
+ 0x1f, 0x00, 0x00, 0x00, 0x45, 0x6e, 0x63, 0x6f,
+ 0x64, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68,
+ 0x20, 0x47, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d,
+ 0x65, 0x72, 0x20, 0x53, 0x70, 0x65, 0x65, 0x78,
+ 0x65, 0x6e, 0x63, 0x00, 0x00, 0x00, 0x00, 0x01
};
guint8 buffer[] = {
- 0x36, 0x9d, 0x1b, 0x9a, 0x20, 0x00, 0x01, 0x68,
- 0xe8, 0xe8, 0xe8, 0xe8, 0xe8, 0xe8, 0xe8, 0x84,
- 0x00, 0xb4, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74,
- 0x74, 0x42, 0x00, 0x5a, 0x3a, 0x3a, 0x3a, 0x3a,
- 0x3a, 0x3a, 0x3a, 0x21, 0x00, 0x2d, 0x1d, 0x1d,
- 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1b, 0x3b, 0x60,
- 0xab, 0xab, 0xab, 0xab, 0xab, 0x0a, 0xba, 0xba,
- 0xba, 0xba, 0xb0, 0xab, 0xab, 0xab, 0xab, 0xab,
- 0x0a, 0xba, 0xba, 0xba, 0xba, 0xb7
+ 0x36, 0x9d, 0x1b, 0x9a, 0x20, 0x00, 0x01, 0x68,
+ 0xe8, 0xe8, 0xe8, 0xe8, 0xe8, 0xe8, 0xe8, 0x84,
+ 0x00, 0xb4, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74,
+ 0x74, 0x42, 0x00, 0x5a, 0x3a, 0x3a, 0x3a, 0x3a,
+ 0x3a, 0x3a, 0x3a, 0x21, 0x00, 0x2d, 0x1d, 0x1d,
+ 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1b, 0x3b, 0x60,
+ 0xab, 0xab, 0xab, 0xab, 0xab, 0x0a, 0xba, 0xba,
+ 0xba, 0xba, 0xb0, 0xab, 0xab, 0xab, 0xab, 0xab,
+ 0x0a, 0xba, 0xba, 0xba, 0xba, 0xb7
};
- GstCaps * caps = gst_caps_new_simple ("audio/x-speex",
+ GstCaps *caps = gst_caps_new_simple ("audio/x-speex",
"rate", G_TYPE_INT, 16000,
"channels", G_TYPE_INT, 1,
NULL);
const GstClockTime duration_ms = 20;
const GstClockTime duration = duration_ms * GST_MSECOND;
- GstHarness * h = gst_harness_new_with_padnames ("flvmux", "audio", "src");
+ GstHarness *h = gst_harness_new_with_padnames ("flvmux", "audio", "src");
gst_harness_set_src_caps (h, caps);
g_object_set (h->element, "streamable", 1, NULL);
/* push speex data */
gst_harness_push (h, create_buffer (buffer, sizeof (buffer),
- base_time, duration));
+ base_time, duration));
- /* push speex data 2*/
+ /* push speex data 2 */
gst_harness_push (h, create_buffer (buffer, sizeof (buffer),
- base_time + duration, duration));
+ base_time + duration, duration));
/* pull out stream-start event */
gst_event_unref (gst_harness_pull_event (h));
/* pull out segment event and verify we are using GST_FORMAT_TIME */
{
- GstEvent * event = gst_harness_pull_event (h);
- const GstSegment * segment;
+ GstEvent *event = gst_harness_pull_event (h);
+ const GstSegment *segment;
gst_event_parse_segment (event, &segment);
fail_unless_equals_int (GST_FORMAT_TIME, segment->format);
gst_event_unref (event);
fail_unless_equals_uint64 (base_time, GST_BUFFER_DTS (buf));
fail_unless_equals_uint64 (duration, GST_BUFFER_DURATION (buf));
fail_unless_equals_uint64 (GST_BUFFER_OFFSET_NONE, GST_BUFFER_OFFSET (buf));
- fail_unless_equals_uint64 (GST_BUFFER_OFFSET_NONE, GST_BUFFER_OFFSET_END (buf));
+ fail_unless_equals_uint64 (GST_BUFFER_OFFSET_NONE,
+ GST_BUFFER_OFFSET_END (buf));
gst_buffer_map (buf, &map, GST_MAP_READ);
/* 0x08 means it is audio */
fail_unless_equals_int (0x08, map.data[0]);
fail_unless_equals_uint64 (base_time + duration, GST_BUFFER_DTS (buf));
fail_unless_equals_uint64 (duration, GST_BUFFER_DURATION (buf));
fail_unless_equals_uint64 (GST_BUFFER_OFFSET_NONE, GST_BUFFER_OFFSET (buf));
- fail_unless_equals_uint64 (GST_BUFFER_OFFSET_NONE, GST_BUFFER_OFFSET_END (buf));
+ fail_unless_equals_uint64 (GST_BUFFER_OFFSET_NONE,
+ GST_BUFFER_OFFSET_END (buf));
gst_buffer_map (buf, &map, GST_MAP_READ);
/* 0x08 means it is audio */
fail_unless_equals_int (0x08, map.data[0]);
gst_harness_teardown (h);
}
+
GST_END_TEST;
static Suite *