ccconvert: compact input cc_data where possible

Skip over padding cc_data triples.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1116>
This commit is contained in:
Matthew Waters 2020-03-17 17:23:44 +11:00 committed by GStreamer Merge Bot
parent 7d028af675
commit 3417a1709c
2 changed files with 163 additions and 78 deletions

View File

@ -502,6 +502,46 @@ interpolate_time_code_with_framerate (GstCCConverter * self,
return TRUE; return TRUE;
} }
/* remove padding bytes from a cc_data packet. Returns the length of the new
* data in @cc_data */
static guint
compact_cc_data (guint8 * cc_data, guint cc_data_len)
{
gboolean started_ccp = FALSE;
guint out_len = 0;
guint i;
if (cc_data_len % 3 != 0) {
GST_WARNING ("Invalid cc_data buffer size");
cc_data_len = cc_data_len - (cc_data_len % 3);
}
for (i = 0; i < cc_data_len / 3; i++) {
gboolean cc_valid = (cc_data[i * 3] & 0x04) == 0x04;
guint8 cc_type = cc_data[i * 3] & 0x03;
if (!started_ccp && cc_valid && (cc_type == 0x00 || cc_type == 0x01)) {
/* skip over 608 data */
cc_data[out_len++] = cc_data[i * 3];
cc_data[out_len++] = cc_data[i * 3 + 1];
cc_data[out_len++] = cc_data[i * 3 + 2];
continue;
}
if (cc_type & 0x10)
started_ccp = TRUE;
if (!cc_valid)
continue;
cc_data[out_len++] = cc_data[i * 3];
cc_data[out_len++] = cc_data[i * 3 + 1];
cc_data[out_len++] = cc_data[i * 3 + 2];
}
return out_len;
}
/* takes cc_data and cc_data_len and attempts to fit it into a hypothetical /* takes cc_data and cc_data_len and attempts to fit it into a hypothetical
* output packet. Any leftover data is stored for later addition. Returns * output packet. Any leftover data is stored for later addition. Returns
* the number of bytes of @cc_data to place in a new output packet */ * the number of bytes of @cc_data to place in a new output packet */
@ -572,7 +612,7 @@ fit_and_scale_cc_data (GstCCConverter * self,
GST_DEBUG_OBJECT (self, "holding cc_data of len %u until next input " GST_DEBUG_OBJECT (self, "holding cc_data of len %u until next input "
"buffer", self->scratch_len); "buffer", self->scratch_len);
memcpy (self->scratch, cc_data, self->scratch_len); memcpy (self->scratch, cc_data, self->scratch_len);
return 0; return -1;
} else if (rate_cmp != 0) { } else if (rate_cmp != 0) {
/* we are changing the framerate and may overflow the max output packet /* we are changing the framerate and may overflow the max output packet
* size. Split them where necessary. */ * size. Split them where necessary. */
@ -834,6 +874,7 @@ cdp_to_cc_data (GstCCConverter * self, GstBuffer * inbuf, guint8 * out,
cc_data_len / 3); cc_data_len / 3);
cc_data_len = 3 * (*out_fps_entry)->max_cc_count; cc_data_len = 3 * (*out_fps_entry)->max_cc_count;
} }
cc_data_len = compact_cc_data (&out[len], cc_data_len);
len += cc_data_len; len += cc_data_len;
gst_buffer_unmap (inbuf, &in); gst_buffer_unmap (inbuf, &in);
@ -928,7 +969,8 @@ convert_cea608_raw_cea708_cdp (GstCCConverter * self, GstBuffer * inbuf,
GstBuffer * outbuf) GstBuffer * outbuf)
{ {
GstMapInfo in, out; GstMapInfo in, out;
guint i, n, len; guint i, n;
gint len;
guint8 cc_data[MAX_CDP_PACKET_LEN]; guint8 cc_data[MAX_CDP_PACKET_LEN];
const GstVideoTimeCodeMeta *tc_meta; const GstVideoTimeCodeMeta *tc_meta;
const struct cdp_fps_entry *fps_entry; const struct cdp_fps_entry *fps_entry;
@ -964,10 +1006,12 @@ convert_cea608_raw_cea708_cdp (GstCCConverter * self, GstBuffer * inbuf,
len = fit_and_scale_cc_data (self, NULL, fps_entry, cc_data, len = fit_and_scale_cc_data (self, NULL, fps_entry, cc_data,
n * 3, tc_meta ? &tc_meta->tc : NULL); n * 3, tc_meta ? &tc_meta->tc : NULL);
if (len > 0) { if (len >= 0) {
len = len =
convert_cea708_cc_data_cea708_cdp_internal (self, cc_data, len, convert_cea708_cc_data_cea708_cdp_internal (self, cc_data, len,
out.data, out.size, &self->current_output_timecode, fps_entry); out.data, out.size, &self->current_output_timecode, fps_entry);
} else {
len = 0;
} }
gst_buffer_unmap (inbuf, &in); gst_buffer_unmap (inbuf, &in);
@ -1060,7 +1104,8 @@ convert_cea608_s334_1a_cea708_cdp (GstCCConverter * self, GstBuffer * inbuf,
GstBuffer * outbuf) GstBuffer * outbuf)
{ {
GstMapInfo in, out; GstMapInfo in, out;
guint i, n, len; guint i, n;
gint len;
guint8 cc_data[MAX_CDP_PACKET_LEN]; guint8 cc_data[MAX_CDP_PACKET_LEN];
const GstVideoTimeCodeMeta *tc_meta; const GstVideoTimeCodeMeta *tc_meta;
const struct cdp_fps_entry *fps_entry; const struct cdp_fps_entry *fps_entry;
@ -1095,10 +1140,12 @@ convert_cea608_s334_1a_cea708_cdp (GstCCConverter * self, GstBuffer * inbuf,
len = fit_and_scale_cc_data (self, NULL, fps_entry, cc_data, len = fit_and_scale_cc_data (self, NULL, fps_entry, cc_data,
n * 3, tc_meta ? &tc_meta->tc : NULL); n * 3, tc_meta ? &tc_meta->tc : NULL);
if (len > 0) { if (len >= 0) {
len = len =
convert_cea708_cc_data_cea708_cdp_internal (self, cc_data, len, convert_cea708_cc_data_cea708_cdp_internal (self, cc_data, len,
out.data, out.size, &self->current_output_timecode, fps_entry); out.data, out.size, &self->current_output_timecode, fps_entry);
} else {
len = 0;
} }
gst_buffer_unmap (inbuf, &in); gst_buffer_unmap (inbuf, &in);
@ -1201,7 +1248,7 @@ convert_cea708_cc_data_cea708_cdp (GstCCConverter * self, GstBuffer * inbuf,
{ {
GstMapInfo in, out; GstMapInfo in, out;
guint n; guint n;
guint len; gint len;
const GstVideoTimeCodeMeta *tc_meta; const GstVideoTimeCodeMeta *tc_meta;
const struct cdp_fps_entry *fps_entry; const struct cdp_fps_entry *fps_entry;
@ -1229,10 +1276,12 @@ convert_cea708_cc_data_cea708_cdp (GstCCConverter * self, GstBuffer * inbuf,
len = fit_and_scale_cc_data (self, NULL, fps_entry, in.data, len = fit_and_scale_cc_data (self, NULL, fps_entry, in.data,
in.size, tc_meta ? &tc_meta->tc : NULL); in.size, tc_meta ? &tc_meta->tc : NULL);
if (len > 0) { if (len >= 0) {
len = len =
convert_cea708_cc_data_cea708_cdp_internal (self, in.data, len, convert_cea708_cc_data_cea708_cdp_internal (self, in.data, len,
out.data, out.size, &self->current_output_timecode, fps_entry); out.data, out.size, &self->current_output_timecode, fps_entry);
} else {
len = 0;
} }
gst_buffer_unmap (inbuf, &in); gst_buffer_unmap (inbuf, &in);
@ -1249,7 +1298,8 @@ convert_cea708_cdp_cea608_raw (GstCCConverter * self, GstBuffer * inbuf,
{ {
GstMapInfo out; GstMapInfo out;
GstVideoTimeCode tc = GST_VIDEO_TIME_CODE_INIT; GstVideoTimeCode tc = GST_VIDEO_TIME_CODE_INIT;
guint i, len = 0, cea608 = 0; guint i, cea608 = 0;
gint len = 0;
const struct cdp_fps_entry *in_fps_entry = NULL, *out_fps_entry; const struct cdp_fps_entry *in_fps_entry = NULL, *out_fps_entry;
guint8 cc_data[MAX_CDP_PACKET_LEN] = { 0, }; guint8 cc_data[MAX_CDP_PACKET_LEN] = { 0, };
@ -1301,7 +1351,8 @@ convert_cea708_cdp_cea608_s334_1a (GstCCConverter * self, GstBuffer * inbuf,
{ {
GstMapInfo out; GstMapInfo out;
GstVideoTimeCode tc = GST_VIDEO_TIME_CODE_INIT; GstVideoTimeCode tc = GST_VIDEO_TIME_CODE_INIT;
guint i, len = 0, cea608 = 0; guint i, cea608 = 0;
gint len = 0;
const struct cdp_fps_entry *in_fps_entry = NULL, *out_fps_entry; const struct cdp_fps_entry *in_fps_entry = NULL, *out_fps_entry;
guint8 cc_data[MAX_CDP_PACKET_LEN] = { 0, }; guint8 cc_data[MAX_CDP_PACKET_LEN] = { 0, };
@ -1350,7 +1401,7 @@ convert_cea708_cdp_cea708_cc_data (GstCCConverter * self, GstBuffer * inbuf,
{ {
GstMapInfo out; GstMapInfo out;
GstVideoTimeCode tc = GST_VIDEO_TIME_CODE_INIT; GstVideoTimeCode tc = GST_VIDEO_TIME_CODE_INIT;
guint len = 0; gint len = 0;
const struct cdp_fps_entry *in_fps_entry = NULL, *out_fps_entry; const struct cdp_fps_entry *in_fps_entry = NULL, *out_fps_entry;
guint8 cc_data[MAX_CDP_PACKET_LEN] = { 0, }; guint8 cc_data[MAX_CDP_PACKET_LEN] = { 0, };
@ -1364,11 +1415,13 @@ convert_cea708_cdp_cea708_cc_data (GstCCConverter * self, GstBuffer * inbuf,
len = fit_and_scale_cc_data (self, in_fps_entry, out_fps_entry, cc_data, len, len = fit_and_scale_cc_data (self, in_fps_entry, out_fps_entry, cc_data, len,
&tc); &tc);
if (len > 0) { if (len >= 0) {
gst_buffer_map (outbuf, &out, GST_MAP_WRITE); gst_buffer_map (outbuf, &out, GST_MAP_WRITE);
memcpy (out.data, cc_data, len); memcpy (out.data, cc_data, len);
gst_buffer_unmap (outbuf, &out); gst_buffer_unmap (outbuf, &out);
self->output_frames++; self->output_frames++;
} else {
len = 0;
} }
if (self->current_output_timecode.config.fps_n != 0 if (self->current_output_timecode.config.fps_n != 0
@ -1389,7 +1442,7 @@ convert_cea708_cdp_cea708_cdp (GstCCConverter * self, GstBuffer * inbuf,
{ {
GstMapInfo out; GstMapInfo out;
GstVideoTimeCode tc = GST_VIDEO_TIME_CODE_INIT; GstVideoTimeCode tc = GST_VIDEO_TIME_CODE_INIT;
guint len = 0; gint len = 0;
const struct cdp_fps_entry *in_fps_entry = NULL, *out_fps_entry; const struct cdp_fps_entry *in_fps_entry = NULL, *out_fps_entry;
guint8 cc_data[MAX_CDP_PACKET_LEN] = { 0, }; guint8 cc_data[MAX_CDP_PACKET_LEN] = { 0, };
@ -1403,7 +1456,7 @@ convert_cea708_cdp_cea708_cdp (GstCCConverter * self, GstBuffer * inbuf,
len = fit_and_scale_cc_data (self, in_fps_entry, out_fps_entry, cc_data, len, len = fit_and_scale_cc_data (self, in_fps_entry, out_fps_entry, cc_data, len,
&tc); &tc);
if (len > 0) { if (len >= 0) {
gst_buffer_map (outbuf, &out, GST_MAP_WRITE); gst_buffer_map (outbuf, &out, GST_MAP_WRITE);
len = len =
convert_cea708_cc_data_cea708_cdp_internal (self, cc_data, len, convert_cea708_cc_data_cea708_cdp_internal (self, cc_data, len,
@ -1411,6 +1464,8 @@ convert_cea708_cdp_cea708_cdp (GstCCConverter * self, GstBuffer * inbuf,
gst_buffer_unmap (outbuf, &out); gst_buffer_unmap (outbuf, &out);
self->output_frames++; self->output_frames++;
} else {
len = 0;
} }
gst_buffer_set_size (outbuf, len); gst_buffer_set_size (outbuf, len);
@ -1570,6 +1625,36 @@ gst_cc_converter_transform_meta (GstBaseTransform * base, GstBuffer * outbuf,
meta, inbuf); meta, inbuf);
} }
static gboolean
can_generate_output (GstCCConverter * self)
{
int input_frame_n, input_frame_d, output_frame_n, output_frame_d;
int output_time_cmp;
if (self->in_fps_n == 0 || self->out_fps_n == 0)
return FALSE;
/* compute the relative frame count for each */
if (!gst_util_fraction_multiply (self->in_fps_d, self->in_fps_n,
self->input_frames, 1, &input_frame_n, &input_frame_d))
/* we should never overflow */
g_assert_not_reached ();
if (!gst_util_fraction_multiply (self->out_fps_d, self->out_fps_n,
self->output_frames + 1, 1, &output_frame_n, &output_frame_d))
/* we should never overflow */
g_assert_not_reached ();
output_time_cmp = gst_util_fraction_compare (input_frame_n, input_frame_d,
output_frame_n, output_frame_d);
/* if the next output frame is at or before the current input frame */
if (output_time_cmp >= 0)
return TRUE;
return FALSE;
}
static GstFlowReturn static GstFlowReturn
gst_cc_converter_generate_output (GstBaseTransform * base, GstBuffer ** outbuf) gst_cc_converter_generate_output (GstBaseTransform * base, GstBuffer ** outbuf)
{ {
@ -1580,7 +1665,7 @@ gst_cc_converter_generate_output (GstBaseTransform * base, GstBuffer ** outbuf)
*outbuf = NULL; *outbuf = NULL;
base->queued_buf = NULL; base->queued_buf = NULL;
if (!inbuf && self->scratch_len == 0) { if (!inbuf && !can_generate_output (self)) {
return GST_FLOW_OK; return GST_FLOW_OK;
} }
@ -1630,7 +1715,7 @@ gst_cc_converter_sink_event (GstBaseTransform * trans, GstEvent * event)
case GST_EVENT_EOS: case GST_EVENT_EOS:
GST_DEBUG_OBJECT (self, "received EOS"); GST_DEBUG_OBJECT (self, "received EOS");
while (self->scratch_len > 0) { while (self->scratch_len > 0 || can_generate_output (self)) {
GstBuffer *outbuf; GstBuffer *outbuf;
GstFlowReturn ret; GstFlowReturn ret;

View File

@ -459,16 +459,16 @@ GST_START_TEST (convert_cea708_cdp_cea708_cdp_double_framerate)
const GstVideoTimeCode *in_tc[] = { &in_tc1 }; const GstVideoTimeCode *in_tc[] = { &in_tc1 };
const guint8 out1[] = { 0x96, 0x69, 0x30, 0x8f, 0xc3, 0x00, 0x00, 0x71, 0xd0, const guint8 out1[] = { 0x96, 0x69, 0x30, 0x8f, 0xc3, 0x00, 0x00, 0x71, 0xd0,
0xa0, 0x30, 0x00, 0x72, 0xea, 0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xf8, 0xa0, 0x30, 0x00, 0x72, 0xea, 0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe,
0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfc, 0x00, 0x00, 0xfc, 0x00, 0x00, 0xfc, 0x00, 0x00, 0xf8,
0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x74, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x74,
0x00, 0x00, 0xe4 0x00, 0x00, 0xd2
}; };
const guint8 out2[] = { 0x96, 0x69, 0x30, 0x8f, 0xc3, 0x00, 0x01, 0x71, 0xd0, const guint8 out2[] = { 0x96, 0x69, 0x30, 0x8f, 0xc3, 0x00, 0x01, 0x71, 0xd0,
0xa0, 0x30, 0x10, 0x72, 0xea, 0xfe, 0x00, 0x00, 0xfc, 0x00, 0x00, 0xfc, 0xa0, 0x30, 0x10, 0x72, 0xea, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8,
0x00, 0x00, 0xfc, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8,
0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x74, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x74,
0x00, 0x01, 0xca 0x00, 0x01, 0xdc
}; };
const guint8 *out[] = { out1, out2 }; const guint8 *out[] = { out1, out2 };
guint out_len[] = { sizeof (out1), sizeof (out2) }; guint out_len[] = { sizeof (out1), sizeof (out2) };
@ -502,14 +502,14 @@ GST_END_TEST;
GST_START_TEST (convert_cea708_cdp_cea708_cdp_half_framerate) GST_START_TEST (convert_cea708_cdp_cea708_cdp_half_framerate)
{ {
/* tests that two input packets are merged together when halving the /* tests that two input packets are merged together when halving the
* framerate */ * framerate. With cc_data compaction! */
const guint8 in1[] = { 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x00, 0x72, 0xea, const guint8 in1[] = { 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x00, 0x72, 0xea,
0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00,
0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00,
0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x74, 0x00, 0x00, 0x7a 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x74, 0x00, 0x00, 0x7a
}; };
const guint8 in2[] = { 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x01, 0x72, 0xea, const guint8 in2[] = { 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x01, 0x72, 0xea,
0xfe, 0x00, 0x00, 0xfc, 0x00, 0x00, 0xfc, 0x00, 0x00, 0xfc, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfc, 0x00, 0x00, 0xfc, 0x00, 0x00, 0xf8, 0x00, 0x00,
0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00,
0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x74, 0x00, 0x01, 0x70 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x74, 0x00, 0x01, 0x70
}; };
@ -520,12 +520,12 @@ GST_START_TEST (convert_cea708_cdp_cea708_cdp_half_framerate)
const guint8 out1[] = const guint8 out1[] =
{ 0x96, 0x69, 0x4e, 0x5f, 0xc3, 0x00, 0x00, 0x71, 0xd0, 0xa0, 0x30, 0x00, { 0x96, 0x69, 0x4e, 0x5f, 0xc3, 0x00, 0x00, 0x71, 0xd0, 0xa0, 0x30, 0x00,
0x72, 0xf4, 0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xf8, 0x00, 0x00, 0xf8, 0x72, 0xf4, 0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfc,
0x00, 0x00, 0xfc, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8,
0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8,
0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfc,
0x00, 0x00, 0xfc, 0x00, 0x00, 0xfc, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8,
0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8,
0x00, 0x00, 0x74, 0x00, 0x00, 0x2a 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8,
0x00, 0x00, 0x74, 0x00, 0x00, 0x2e
}; };
const guint8 *out[] = { out1 }; const guint8 *out[] = { out1 };
guint out_len[] = { sizeof (out1) }; guint out_len[] = { sizeof (out1) };
@ -562,9 +562,9 @@ GST_START_TEST (convert_cea708_cdp_cea708_cdp_max_merge)
* packets with the extra data on the third input packet being placed at the * packets with the extra data on the third input packet being placed at the
* beginning of the second output packet */ * beginning of the second output packet */
const guint8 in1[] = { 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x00, 0x72, 0xea, const guint8 in1[] = { 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x00, 0x72, 0xea,
0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfc, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x74, 0x00, 0x00, 0x7a 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x74, 0x00, 0x00, 0x7a
}; };
/* enough input to fully cover two output packets. Extra is discarded */ /* enough input to fully cover two output packets. Extra is discarded */
const guint8 *in[] = { in1, in1, in1, in1, in1, in1, in1 }; const guint8 *in[] = { in1, in1, in1, in1, in1, in1, in1 };
@ -575,23 +575,23 @@ GST_START_TEST (convert_cea708_cdp_cea708_cdp_max_merge)
const guint8 out1[] = const guint8 out1[] =
{ 0x96, 0x69, 0x58, 0x1f, 0x43, 0x00, 0x00, 0x72, 0xf9, 0xfc, 0x80, 0x80, { 0x96, 0x69, 0x58, 0x1f, 0x43, 0x00, 0x00, 0x72, 0xf9, 0xfc, 0x80, 0x80,
0xfe, 0x80, 0x80, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
0xf8, 0x00, 0x00, 0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xf8, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfc, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00,
0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfc, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfc, 0x80, 0x80,
0xfe, 0x80, 0x80, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
0x74, 0x00, 0x00, 0x12 0x74, 0x00, 0x00, 0xa0
}; };
const guint8 out2[] = const guint8 out2[] =
{ 0x96, 0x69, 0x58, 0x1f, 0x43, 0x00, 0x01, 0x72, 0xf9, 0xf8, 0x00, 0x00, { 0x96, 0x69, 0x58, 0x1f, 0x43, 0x00, 0x01, 0x72, 0xf9, 0xfe, 0x80, 0x80,
0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfc, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfc, 0x80, 0x80, 0xfe, 0x00, 0x00,
0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x80, 0x80,
0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
0x74, 0x00, 0x01, 0x1a 0x74, 0x00, 0x01, 0x9c
}; };
const guint8 *out[] = { out1, out2 }; const guint8 *out[] = { out1, out2 };
guint out_len[] = { sizeof (out1), sizeof (out2) }; guint out_len[] = { sizeof (out1), sizeof (out2) };
@ -610,36 +610,36 @@ GST_START_TEST (convert_cea708_cdp_cea708_cdp_max_split)
* high framerate */ * high framerate */
const guint8 in1[] = const guint8 in1[] =
{ 0x96, 0x69, 0x58, 0x1f, 0x43, 0x00, 0x00, 0x72, 0xf9, 0xfc, 0x80, 0x80, { 0x96, 0x69, 0x58, 0x1f, 0x43, 0x00, 0x00, 0x72, 0xf9, 0xfc, 0x80, 0x80,
0xfe, 0x80, 0x80, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
0xf8, 0x00, 0x00, 0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xf8, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00,
0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfc, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x80, 0x80,
0xfe, 0x80, 0x80, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
0x74, 0x00, 0x00, 0x12 0x74, 0x00, 0x00, 0x12
}; };
const guint8 *in[] = { in1, in1 }; const guint8 *in[] = { in1, in1 };
guint in_len[] = { sizeof (in1), sizeof (in1) }; guint in_len[] = { sizeof (in1), sizeof (in1) };
const guint8 out1[] = { 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x00, 0x72, 0xea, const guint8 out1[] = { 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x00, 0x72, 0xea,
0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x74, 0x00, 0x00, 0x7a 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x74, 0x00, 0x00, 0x4a
}; };
const guint8 out2[] = { 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x01, 0x72, 0xea, const guint8 out2[] = { 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x01, 0x72, 0xea,
0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x74, 0x00, 0x01, 0x78 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x74, 0x00, 0x01, 0x48
}; };
const guint8 out3[] = { 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x02, 0x72, 0xea, const guint8 out3[] = { 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x02, 0x72, 0xea,
0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfe, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
0xf8, 0x00, 0x00, 0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xf8, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00,
0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x74, 0x00, 0x02, 0x6c 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x74, 0x00, 0x02, 0x46
}; };
const guint8 out4[] = { 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x03, 0x72, 0xea, const guint8 out4[] = { 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x03, 0x72, 0xea,
0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
0xf8, 0x00, 0x00, 0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xf8, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00,
0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x74, 0x00, 0x03, 0x74 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x74, 0x00, 0x03, 0x44
}; };
const guint8 *out[] = { out1, out2, out3, out4 }; const guint8 *out[] = { out1, out2, out3, out4 };
guint out_len[] = guint out_len[] =
@ -659,31 +659,31 @@ GST_START_TEST (convert_cea708_cdp_cea708_cdp_max_split_eos)
* high framerate and that an EOS will push the pending data */ * high framerate and that an EOS will push the pending data */
const guint8 in1[] = const guint8 in1[] =
{ 0x96, 0x69, 0x58, 0x1f, 0x43, 0x00, 0x00, 0x72, 0xf9, 0xfc, 0x80, 0x80, { 0x96, 0x69, 0x58, 0x1f, 0x43, 0x00, 0x00, 0x72, 0xf9, 0xfc, 0x80, 0x80,
0xfe, 0x80, 0x80, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
0xf8, 0x00, 0x00, 0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xf8, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00,
0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfc, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x80, 0x80,
0xfe, 0x80, 0x80, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
0x74, 0x00, 0x00, 0x12 0x74, 0x00, 0x00, 0x12
}; };
const guint8 *in[] = { in1 }; const guint8 *in[] = { in1 };
guint in_len[] = { sizeof (in1) }; guint in_len[] = { sizeof (in1) };
const guint8 out1[] = { 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x00, 0x72, 0xea, const guint8 out1[] = { 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x00, 0x72, 0xea,
0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x74, 0x00, 0x00, 0x7a 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x74, 0x00, 0x00, 0x4a
}; };
const guint8 out2[] = { 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x01, 0x72, 0xea, const guint8 out2[] = { 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x01, 0x72, 0xea,
0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x74, 0x00, 0x01, 0x78 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x74, 0x00, 0x01, 0x48
}; };
const guint8 out3[] = { 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x02, 0x72, 0xea, const guint8 out3[] = { 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x02, 0x72, 0xea,
0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfe, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
0xf9, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00,
0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x74, 0x00, 0x02, 0x75 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x74, 0x00, 0x02, 0x62
}; };
const guint8 *out[] = { out1, out2, out3 }; const guint8 *out[] = { out1, out2, out3 };
guint out_len[] = { sizeof (out1), sizeof (out2), sizeof (out3) }; guint out_len[] = { sizeof (out1), sizeof (out2), sizeof (out3) };