mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-19 16:21:17 +00:00
ccconverter: split temporary storage into 3
Instead of storing the raw cc_data, store the 2 cea608 fields individually as well as the ccp data. Simply copying the input cc_data to the output cc_data violates a number of requirements in the cea708 specification. The most prominent being, that cea608 triples must be placed at the beginning of each cdp. We also need to comply with the framerate-dpendent limits for both the cea608 and the ccp data which may involve splitting or merging some cea608 data but not ccp data or vice versa. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1116>
This commit is contained in:
parent
3417a1709c
commit
7ed0bc539f
3 changed files with 1016 additions and 348 deletions
File diff suppressed because it is too large
Load diff
|
@ -41,6 +41,7 @@ typedef struct _GstCCConverter GstCCConverter;
|
|||
typedef struct _GstCCConverterClass GstCCConverterClass;
|
||||
|
||||
#define MAX_CDP_PACKET_LEN 256
|
||||
#define MAX_CEA608_LEN 32
|
||||
|
||||
struct _GstCCConverter
|
||||
{
|
||||
|
@ -58,8 +59,12 @@ struct _GstCCConverter
|
|||
/* for framerate differences, we need to keep previous/next frames in order
|
||||
* to split/merge data across multiple input or output buffers. The data is
|
||||
* stored as cc_data */
|
||||
guint8 scratch[MAX_CDP_PACKET_LEN];
|
||||
guint scratch_len;
|
||||
guint8 scratch_cea608_1[MAX_CEA608_LEN];
|
||||
guint scratch_cea608_1_len;
|
||||
guint8 scratch_cea608_2[MAX_CEA608_LEN];
|
||||
guint scratch_cea608_2_len;
|
||||
guint8 scratch_ccp[MAX_CDP_PACKET_LEN];
|
||||
guint scratch_ccp_len;
|
||||
|
||||
guint input_frames;
|
||||
guint output_frames;
|
||||
|
|
|
@ -330,14 +330,17 @@ GST_START_TEST (convert_cea608_s334_1a_cea708_cdp)
|
|||
{
|
||||
const guint8 in[] = { 0x80, 0x80, 0x80, 0x00, 0x80, 0x80 };
|
||||
const guint8 out[] =
|
||||
{ 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x00, 0x72, 0xea, 0xfc, 0x80, 0x80,
|
||||
{ 0x96, 0x69, 0x49, 0x5f, 0x43, 0x00, 0x00, 0x72, 0xf4, 0xfc, 0x80, 0x80,
|
||||
0xfd, 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, 0x74, 0x00, 0x00, 0x7b
|
||||
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, 0xd3
|
||||
};
|
||||
check_conversion (in, sizeof (in), out, sizeof (out),
|
||||
"closedcaption/x-cea-608,format=(string)s334-1a,framerate=(fraction)60/1",
|
||||
"closedcaption/x-cea-708,format=(string)cdp", NULL, NULL);
|
||||
"closedcaption/x-cea-608,format=(string)s334-1a,framerate=(fraction)30/1",
|
||||
"closedcaption/x-cea-708,format=(string)cdp,framerate=(fraction)30/1",
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
@ -446,12 +449,12 @@ GST_START_TEST (convert_cea708_cdp_cea708_cdp_double_framerate)
|
|||
{
|
||||
/* tests that packets are split exactly in half when doubling the framerate */
|
||||
const guint8 in1[] =
|
||||
{ 0x96, 0x69, 0x49, 0x5f, 0x43, 0x00, 0x00, 0x72, 0xf4, 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, 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, 0x74, 0x00, 0x00, 0xd2
|
||||
{ 0x96, 0x69, 0x49, 0x5f, 0x43, 0x00, 0x00, 0x72, 0xf4, 0xfc, 0x01, 0x02,
|
||||
0xfc, 0x03, 0x04, 0xfe, 0x05, 0x06, 0xfe, 0x07, 0x08, 0xfe, 0x09, 0x0a,
|
||||
0xfe, 0x0b, 0x0c, 0xfe, 0x0d, 0x0e, 0xfe, 0x0f, 0x10, 0xfe, 0x11, 0x12,
|
||||
0xfe, 0x13, 0x14, 0xfe, 0x15, 0x16, 0xfe, 0x17, 0x18, 0xfe, 0x19, 0x1a,
|
||||
0xfe, 0x1b, 0x1c, 0xfe, 0x1d, 0x1e, 0xfe, 0x1f, 0x20, 0xfe, 0x21, 0x22,
|
||||
0xfe, 0x23, 0x24, 0xfe, 0x25, 0x26, 0xfe, 0x27, 0x28, 0x74, 0x00, 0x00, 0xd2
|
||||
};
|
||||
const guint8 *in[] = { in1 };
|
||||
guint in_len[] = { sizeof (in1) };
|
||||
|
@ -459,16 +462,16 @@ GST_START_TEST (convert_cea708_cdp_cea708_cdp_double_framerate)
|
|||
const GstVideoTimeCode *in_tc[] = { &in_tc1 };
|
||||
|
||||
const guint8 out1[] = { 0x96, 0x69, 0x30, 0x8f, 0xc3, 0x00, 0x00, 0x71, 0xd0,
|
||||
0xa0, 0x30, 0x00, 0x72, 0xea, 0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe,
|
||||
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, 0xd2
|
||||
0xa0, 0x30, 0x00, 0x72, 0xea, 0xfc, 0x01, 0x02, 0xfe, 0x05, 0x06, 0xfe,
|
||||
0x07, 0x08, 0xfe, 0x09, 0x0a, 0xfe, 0x0b, 0x0c, 0xfe, 0x0d, 0x0e, 0xfe,
|
||||
0x0f, 0x10, 0xfe, 0x11, 0x12, 0xfe, 0x13, 0x14, 0xfe, 0x15, 0x16, 0x74,
|
||||
0x00, 0x00, 0xbe
|
||||
};
|
||||
const guint8 out2[] = { 0x96, 0x69, 0x30, 0x8f, 0xc3, 0x00, 0x01, 0x71, 0xd0,
|
||||
0xa0, 0x30, 0x10, 0x72, 0xea, 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, 0xdc
|
||||
0xa0, 0x30, 0x10, 0x72, 0xea, 0xfc, 0x03, 0x04, 0xfe, 0x17, 0x18, 0xfe,
|
||||
0x19, 0x1a, 0xfe, 0x1b, 0x1c, 0xfe, 0x1d, 0x1e, 0xfe, 0x1f, 0x20, 0xfe,
|
||||
0x21, 0x22, 0xfe, 0x23, 0x24, 0xfe, 0x25, 0x26, 0xfe, 0x27, 0x28, 0x74,
|
||||
0x00, 0x01, 0x64
|
||||
};
|
||||
const guint8 *out[] = { out1, out2 };
|
||||
guint out_len[] = { sizeof (out1), sizeof (out2) };
|
||||
|
@ -504,14 +507,14 @@ GST_START_TEST (convert_cea708_cdp_cea708_cdp_half_framerate)
|
|||
/* tests that two input packets are merged together when halving the
|
||||
* framerate. With cc_data compaction! */
|
||||
const guint8 in1[] = { 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x00, 0x72, 0xea,
|
||||
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, 0x74, 0x00, 0x00, 0x7a
|
||||
0xfc, 0x01, 0x02, 0xfe, 0x03, 0x04, 0xfe, 0x05, 0x06, 0xfe, 0x07, 0x08,
|
||||
0xfe, 0x09, 0x0a, 0xfe, 0x0b, 0x0c, 0xfe, 0x0d, 0x0e, 0xfe, 0x0f, 0x10,
|
||||
0xfe, 0x11, 0x12, 0xfe, 0x13, 0x14, 0x74, 0x00, 0x00, 0x7a
|
||||
};
|
||||
const guint8 in2[] = { 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x01, 0x72, 0xea,
|
||||
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, 0x74, 0x00, 0x01, 0x70
|
||||
0xfc, 0x14, 0x15, 0xfe, 0x16, 0x17, 0xfe, 0x18, 0x19, 0xfe, 0x1a, 0x1b,
|
||||
0xfe, 0x1c, 0x1d, 0xfe, 0x1e, 0x1f, 0xfe, 0x20, 0x21, 0xfe, 0x22, 0x23,
|
||||
0xfe, 0x24, 0x25, 0xfe, 0x26, 0x27, 0x74, 0x00, 0x01, 0x70
|
||||
};
|
||||
const guint8 *in[] = { in1, in2 };
|
||||
guint in_len[] = { sizeof (in1), sizeof (in2) };
|
||||
|
@ -520,12 +523,12 @@ GST_START_TEST (convert_cea708_cdp_cea708_cdp_half_framerate)
|
|||
|
||||
const guint8 out1[] =
|
||||
{ 0x96, 0x69, 0x4e, 0x5f, 0xc3, 0x00, 0x00, 0x71, 0xd0, 0xa0, 0x30, 0x00,
|
||||
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, 0xf8, 0x00, 0x00, 0xf8,
|
||||
0x00, 0x00, 0x74, 0x00, 0x00, 0x2e
|
||||
0x72, 0xf4, 0xfc, 0x01, 0x02, 0xfc, 0x14, 0x15, 0xfe, 0x03, 0x04, 0xfe,
|
||||
0x05, 0x06, 0xfe, 0x07, 0x08, 0xfe, 0x09, 0x0a, 0xfe, 0x0b, 0x0c, 0xfe,
|
||||
0x0d, 0x0e, 0xfe, 0x0f, 0x10, 0xfe, 0x11, 0x12, 0xfe, 0x13, 0x14, 0xfe,
|
||||
0x16, 0x17, 0xfe, 0x18, 0x19, 0xfe, 0x1a, 0x1b, 0xfe, 0x1c, 0x1d, 0xfe,
|
||||
0x1e, 0x1f, 0xfe, 0x20, 0x21, 0xfe, 0x22, 0x23, 0xfe, 0x24, 0x25, 0xfe,
|
||||
0x26, 0x27, 0x74, 0x00, 0x00, 0xb2
|
||||
};
|
||||
const guint8 *out[] = { out1 };
|
||||
guint out_len[] = { sizeof (out1) };
|
||||
|
@ -558,13 +561,13 @@ GST_END_TEST;
|
|||
|
||||
GST_START_TEST (convert_cea708_cdp_cea708_cdp_max_merge)
|
||||
{
|
||||
/* check that a low framerate packet can be split into 3 high framerate
|
||||
/* check that 3 high framerate packets can be merged into 1 low framerate
|
||||
* packets with the extra data on the third input packet being placed at the
|
||||
* beginning of the second output packet */
|
||||
const guint8 in1[] = { 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x00, 0x72, 0xea,
|
||||
0xfc, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
|
||||
0xfe, 0x00, 0x00, 0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
|
||||
0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x74, 0x00, 0x00, 0x7a
|
||||
0xfc, 0x01, 0x02, 0xfe, 0x03, 0x04, 0xfe, 0x05, 0x06, 0xfe, 0x07, 0x08,
|
||||
0xfe, 0x09, 0x0a, 0xfe, 0x0b, 0x0c, 0xfe, 0x0d, 0x0e, 0xfe, 0x0f, 0x10,
|
||||
0xfe, 0x11, 0x12, 0xfe, 0x13, 0x14, 0x74, 0x00, 0x00, 0x7a
|
||||
};
|
||||
/* enough input to fully cover two output packets. Extra is discarded */
|
||||
const guint8 *in[] = { in1, in1, in1, in1, in1, in1, in1 };
|
||||
|
@ -574,24 +577,24 @@ GST_START_TEST (convert_cea708_cdp_cea708_cdp_max_merge)
|
|||
};
|
||||
|
||||
const guint8 out1[] =
|
||||
{ 0x96, 0x69, 0x58, 0x1f, 0x43, 0x00, 0x00, 0x72, 0xf9, 0xfc, 0x80, 0x80,
|
||||
0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
|
||||
0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
|
||||
0xfe, 0x00, 0x00, 0xfc, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
|
||||
0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00,
|
||||
0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfc, 0x80, 0x80,
|
||||
0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
|
||||
0x74, 0x00, 0x00, 0xa0
|
||||
{ 0x96, 0x69, 0x58, 0x1f, 0x43, 0x00, 0x00, 0x72, 0xf9, 0xfc, 0x01, 0x02,
|
||||
0xfc, 0x01, 0x02, 0xfc, 0x01, 0x02, 0xfe, 0x03, 0x04, 0xfe, 0x05, 0x06,
|
||||
0xfe, 0x07, 0x08, 0xfe, 0x09, 0x0a, 0xfe, 0x0b, 0x0c, 0xfe, 0x0d, 0x0e,
|
||||
0xfe, 0x0f, 0x10, 0xfe, 0x11, 0x12, 0xfe, 0x13, 0x14, 0xfe, 0x03, 0x04,
|
||||
0xfe, 0x05, 0x06, 0xfe, 0x07, 0x08, 0xfe, 0x09, 0x0a, 0xfe, 0x0b, 0x0c,
|
||||
0xfe, 0x0d, 0x0e, 0xfe, 0x0f, 0x10, 0xfe, 0x11, 0x12, 0xfe, 0x13, 0x14,
|
||||
0xfe, 0x03, 0x04, 0xfe, 0x05, 0x06, 0xfe, 0x07, 0x08, 0xfe, 0x09, 0x0a,
|
||||
0x74, 0x00, 0x00, 0xc5
|
||||
};
|
||||
const guint8 out2[] =
|
||||
{ 0x96, 0x69, 0x58, 0x1f, 0x43, 0x00, 0x01, 0x72, 0xf9, 0xfe, 0x80, 0x80,
|
||||
0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
|
||||
0xfc, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
|
||||
0xfe, 0x00, 0x00, 0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
|
||||
0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfc, 0x80, 0x80, 0xfe, 0x00, 0x00,
|
||||
0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x80, 0x80,
|
||||
0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
|
||||
0x74, 0x00, 0x01, 0x9c
|
||||
{ 0x96, 0x69, 0x58, 0x1f, 0x43, 0x00, 0x01, 0x72, 0xf9, 0xfc, 0x01, 0x02,
|
||||
0xfc, 0x01, 0x02, 0xfc, 0x01, 0x02, 0xfe, 0x0b, 0x0c, 0xfe, 0x0d, 0x0e,
|
||||
0xfe, 0x0f, 0x10, 0xfe, 0x11, 0x12, 0xfe, 0x13, 0x14, 0xfe, 0x03, 0x04,
|
||||
0xfe, 0x05, 0x06, 0xfe, 0x07, 0x08, 0xfe, 0x09, 0x0a, 0xfe, 0x0b, 0x0c,
|
||||
0xfe, 0x0d, 0x0e, 0xfe, 0x0f, 0x10, 0xfe, 0x11, 0x12, 0xfe, 0x13, 0x14,
|
||||
0xfe, 0x03, 0x04, 0xfe, 0x05, 0x06, 0xfe, 0x07, 0x08, 0xfe, 0x09, 0x0a,
|
||||
0xfe, 0x0b, 0x0c, 0xfe, 0x0d, 0x0e, 0xfe, 0x0f, 0x10, 0xfe, 0x11, 0x12,
|
||||
0x74, 0x00, 0x01, 0x83
|
||||
};
|
||||
const guint8 *out[] = { out1, out2 };
|
||||
guint out_len[] = { sizeof (out1), sizeof (out2) };
|
||||
|
@ -609,37 +612,37 @@ GST_START_TEST (convert_cea708_cdp_cea708_cdp_max_split)
|
|||
/* test that a low framerate stream produces multiple output packets for a
|
||||
* high framerate */
|
||||
const guint8 in1[] =
|
||||
{ 0x96, 0x69, 0x58, 0x1f, 0x43, 0x00, 0x00, 0x72, 0xf9, 0xfc, 0x80, 0x80,
|
||||
0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
|
||||
0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
|
||||
0xfe, 0x00, 0x00, 0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00,
|
||||
0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
|
||||
0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x80, 0x80,
|
||||
0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
|
||||
{ 0x96, 0x69, 0x58, 0x1f, 0x43, 0x00, 0x00, 0x72, 0xf9, 0xfc, 0x01, 0x02,
|
||||
0xfc, 0x03, 0x04, 0xfc, 0x05, 0x06, 0xfe, 0x07, 0x08, 0xfe, 0x09, 0x0a,
|
||||
0xfe, 0x0b, 0x0c, 0xfe, 0x0d, 0x0e, 0xfe, 0x0f, 0x10, 0xfe, 0x11, 0x12,
|
||||
0xfe, 0x13, 0x14, 0xfe, 0x15, 0x16, 0xfe, 0x17, 0x18, 0xfe, 0x19, 0x1a,
|
||||
0xfe, 0x1b, 0x1c, 0xfe, 0x1d, 0x1e, 0xfe, 0x1f, 0x20, 0xfe, 0x21, 0x22,
|
||||
0xfe, 0x23, 0x24, 0xfe, 0x25, 0x26, 0xfe, 0x27, 0x28, 0xfe, 0x29, 0x2a,
|
||||
0xfe, 0x2b, 0x2c, 0xfe, 0x2d, 0x2e, 0xfe, 0x2f, 0x30, 0xfe, 0x31, 0x32,
|
||||
0x74, 0x00, 0x00, 0x12
|
||||
};
|
||||
const guint8 *in[] = { in1, in1 };
|
||||
guint in_len[] = { sizeof (in1), sizeof (in1) };
|
||||
|
||||
const guint8 out1[] = { 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x00, 0x72, 0xea,
|
||||
0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
|
||||
0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
|
||||
0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x74, 0x00, 0x00, 0x4a
|
||||
0xfc, 0x01, 0x02, 0xfe, 0x07, 0x08, 0xfe, 0x09, 0x0a, 0xfe, 0x0b, 0x0c,
|
||||
0xfe, 0x0d, 0x0e, 0xfe, 0x0f, 0x10, 0xfe, 0x11, 0x12, 0xfe, 0x13, 0x14,
|
||||
0xfe, 0x15, 0x16, 0xfe, 0x17, 0x18, 0x74, 0x00, 0x00, 0x30
|
||||
};
|
||||
const guint8 out2[] = { 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x01, 0x72, 0xea,
|
||||
0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
|
||||
0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
|
||||
0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x74, 0x00, 0x01, 0x48
|
||||
0xfc, 0x03, 0x04, 0xfe, 0x19, 0x1a, 0xfe, 0x1b, 0x1c, 0xfe, 0x1d, 0x1e,
|
||||
0xfe, 0x1f, 0x20, 0xfe, 0x21, 0x22, 0xfe, 0x23, 0x24, 0xfe, 0x25, 0x26,
|
||||
0xfe, 0x27, 0x28, 0xfe, 0x29, 0x2a, 0x74, 0x00, 0x01, 0xe6
|
||||
};
|
||||
const guint8 out3[] = { 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x02, 0x72, 0xea,
|
||||
0xfe, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
|
||||
0xfe, 0x00, 0x00, 0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00,
|
||||
0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x74, 0x00, 0x02, 0x46
|
||||
0xfc, 0x05, 0x06, 0xfe, 0x2b, 0x2c, 0xfe, 0x2d, 0x2e, 0xfe, 0x2f, 0x30,
|
||||
0xfe, 0x31, 0x32, 0xfe, 0x07, 0x08, 0xfe, 0x09, 0x0a, 0xfe, 0x0b, 0x0c,
|
||||
0xfe, 0x0d, 0x0e, 0xfe, 0x0f, 0x10, 0x74, 0x00, 0x02, 0x54
|
||||
};
|
||||
const guint8 out4[] = { 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x03, 0x72, 0xea,
|
||||
0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
|
||||
0xfe, 0x00, 0x00, 0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00,
|
||||
0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x74, 0x00, 0x03, 0x44
|
||||
0xfc, 0x01, 0x02, 0xfe, 0x11, 0x12, 0xfe, 0x13, 0x14, 0xfe, 0x15, 0x16,
|
||||
0xfe, 0x17, 0x18, 0xfe, 0x19, 0x1a, 0xfe, 0x1b, 0x1c, 0xfe, 0x1d, 0x1e,
|
||||
0xfe, 0x1f, 0x20, 0xfe, 0x21, 0x22, 0x74, 0x00, 0x03, 0x76
|
||||
};
|
||||
const guint8 *out[] = { out1, out2, out3, out4 };
|
||||
guint out_len[] =
|
||||
|
@ -658,32 +661,32 @@ GST_START_TEST (convert_cea708_cdp_cea708_cdp_max_split_eos)
|
|||
/* test that a low framerate stream produces multiple output packets for a
|
||||
* high framerate and that an EOS will push the pending data */
|
||||
const guint8 in1[] =
|
||||
{ 0x96, 0x69, 0x58, 0x1f, 0x43, 0x00, 0x00, 0x72, 0xf9, 0xfc, 0x80, 0x80,
|
||||
0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
|
||||
0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
|
||||
0xfe, 0x00, 0x00, 0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00,
|
||||
0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
|
||||
0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x80, 0x80,
|
||||
0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
|
||||
{ 0x96, 0x69, 0x58, 0x1f, 0x43, 0x00, 0x00, 0x72, 0xf9, 0xfc, 0x01, 0x02,
|
||||
0xfc, 0x03, 0x04, 0xfc, 0x05, 0x06, 0xfe, 0x07, 0x08, 0xfe, 0x09, 0x0a,
|
||||
0xfe, 0x0b, 0x0c, 0xfe, 0x0d, 0x0e, 0xfe, 0x0f, 0x10, 0xfe, 0x11, 0x12,
|
||||
0xfe, 0x13, 0x14, 0xfe, 0x15, 0x16, 0xfe, 0x17, 0x18, 0xfe, 0x19, 0x1a,
|
||||
0xfe, 0x1b, 0x1c, 0xfe, 0x1d, 0x1e, 0xfe, 0x1f, 0x20, 0xfe, 0x21, 0x22,
|
||||
0xfe, 0x23, 0x24, 0xfe, 0x25, 0x26, 0xfe, 0x27, 0x28, 0xfe, 0x29, 0x2a,
|
||||
0xfe, 0x2b, 0x2c, 0xfe, 0x2d, 0x2e, 0xfe, 0x2f, 0x30, 0xfe, 0x31, 0x32,
|
||||
0x74, 0x00, 0x00, 0x12
|
||||
};
|
||||
const guint8 *in[] = { in1 };
|
||||
guint in_len[] = { sizeof (in1) };
|
||||
|
||||
const guint8 out1[] = { 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x00, 0x72, 0xea,
|
||||
0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
|
||||
0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
|
||||
0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x74, 0x00, 0x00, 0x4a
|
||||
0xfc, 0x01, 0x02, 0xfe, 0x07, 0x08, 0xfe, 0x09, 0x0a, 0xfe, 0x0b, 0x0c,
|
||||
0xfe, 0x0d, 0x0e, 0xfe, 0x0f, 0x10, 0xfe, 0x11, 0x12, 0xfe, 0x13, 0x14,
|
||||
0xfe, 0x15, 0x16, 0xfe, 0x17, 0x18, 0x74, 0x00, 0x00, 0x30
|
||||
};
|
||||
const guint8 out2[] = { 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x01, 0x72, 0xea,
|
||||
0xfc, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
|
||||
0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
|
||||
0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x74, 0x00, 0x01, 0x48
|
||||
0xfc, 0x03, 0x04, 0xfe, 0x19, 0x1a, 0xfe, 0x1b, 0x1c, 0xfe, 0x1d, 0x1e,
|
||||
0xfe, 0x1f, 0x20, 0xfe, 0x21, 0x22, 0xfe, 0x23, 0x24, 0xfe, 0x25, 0x26,
|
||||
0xfe, 0x27, 0x28, 0xfe, 0x29, 0x2a, 0x74, 0x00, 0x01, 0xe6
|
||||
};
|
||||
const guint8 out3[] = { 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x02, 0x72, 0xea,
|
||||
0xfe, 0x80, 0x80, 0xfe, 0x80, 0x80, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
|
||||
0xfe, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00,
|
||||
0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x74, 0x00, 0x02, 0x62
|
||||
0xfc, 0x05, 0x06, 0xfe, 0x2b, 0x2c, 0xfe, 0x2d, 0x2e, 0xfe, 0x2f, 0x30,
|
||||
0xfe, 0x31, 0x32, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00,
|
||||
0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x74, 0x00, 0x02, 0xe5
|
||||
};
|
||||
const guint8 *out[] = { out1, out2, out3 };
|
||||
guint out_len[] = { sizeof (out1), sizeof (out2), sizeof (out3) };
|
||||
|
@ -752,6 +755,132 @@ GST_START_TEST (convert_cea708_cdp_cea708_cdp_from_drop_frame_scaling)
|
|||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (convert_cea708_cc_data_cea708_cdp_double_framerate)
|
||||
{
|
||||
const guint8 in1[] = { 0xfc, 0x80, 0x81, 0xfc, 0x82, 0x83, 0xfe, 0x84, 0x85 };
|
||||
const guint8 in2[] = { 0xfc, 0x86, 0x87, 0xfc, 0x88, 0x89, 0xfe, 0x8a, 0x8b };
|
||||
const guint8 *in[] = { in1, in2 };
|
||||
guint in_len[] = { sizeof (in1), sizeof (in2) };
|
||||
const guint8 out1[] =
|
||||
{ 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x00, 0x72, 0xea, 0xfc, 0x80, 0x81,
|
||||
0xfe, 0x84, 0x85, 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, 0x70
|
||||
};
|
||||
const guint8 out2[] =
|
||||
{ 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x01, 0x72, 0xea, 0xfc, 0x82, 0x83,
|
||||
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, 0x79
|
||||
};
|
||||
const guint8 out3[] =
|
||||
{ 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x02, 0x72, 0xea, 0xfc, 0x86, 0x87,
|
||||
0xfe, 0x8a, 0x8b, 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, 0x02, 0x54
|
||||
};
|
||||
const guint8 out4[] =
|
||||
{ 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x03, 0x72, 0xea, 0xfc, 0x88, 0x89,
|
||||
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, 0x03, 0x69
|
||||
};
|
||||
const guint8 *out[] = { out1, out2, out3, out4, };
|
||||
guint out_len[] =
|
||||
{ sizeof (out1), sizeof (out2), sizeof (out3), sizeof (out4), };
|
||||
check_conversion_multiple (G_N_ELEMENTS (in_len), in, in_len,
|
||||
G_N_ELEMENTS (out_len), out, out_len,
|
||||
"closedcaption/x-cea-708,format=(string)cc_data,framerate=(fraction)30/1",
|
||||
"closedcaption/x-cea-708,format=(string)cdp,framerate=(fraction)60/1",
|
||||
NULL, NULL, 0);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (convert_cea608_raw_cea708_cdp_double_framerate)
|
||||
{
|
||||
const guint8 in1[] = { 0x80, 0x81, 0x82, 0x83 };
|
||||
const guint8 in2[] = { 0x84, 0x85, 0x86, 0x87 };
|
||||
const guint8 *in[] = { in1, in2 };
|
||||
guint in_len[] = { sizeof (in1), sizeof (in2) };
|
||||
const guint8 out1[] =
|
||||
{ 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x00, 0x72, 0xea, 0xfc, 0x80, 0x81,
|
||||
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, 0x7f
|
||||
};
|
||||
const guint8 out2[] =
|
||||
{ 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x01, 0x72, 0xea, 0xfc, 0x82, 0x83,
|
||||
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, 0x79
|
||||
};
|
||||
const guint8 out3[] =
|
||||
{ 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x02, 0x72, 0xea, 0xfc, 0x84, 0x85,
|
||||
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, 0x02, 0x73
|
||||
};
|
||||
const guint8 out4[] =
|
||||
{ 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x03, 0x72, 0xea, 0xfc, 0x86, 0x87,
|
||||
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, 0x03, 0x6d
|
||||
};
|
||||
const guint8 *out[] = { out1, out2, out3, out4, };
|
||||
guint out_len[] =
|
||||
{ sizeof (out1), sizeof (out2), sizeof (out3), sizeof (out4), };
|
||||
check_conversion_multiple (G_N_ELEMENTS (in_len), in, in_len,
|
||||
G_N_ELEMENTS (out_len), out, out_len,
|
||||
"closedcaption/x-cea-608,format=(string)raw,framerate=(fraction)30/1",
|
||||
"closedcaption/x-cea-708,format=(string)cdp,framerate=(fraction)60/1",
|
||||
NULL, NULL, 0);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (convert_cea608_s334_1a_cea708_cdp_double_framerate)
|
||||
{
|
||||
const guint8 in1[] = { 0x80, 0x80, 0x81, 0x00, 0x82, 0x83 };
|
||||
const guint8 in2[] = { 0x80, 0x84, 0x85, 0x00, 0x86, 0x87 };
|
||||
const guint8 *in[] = { in1, in2 };
|
||||
guint in_len[] = { sizeof (in1), sizeof (in2) };
|
||||
const guint8 out1[] =
|
||||
{ 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x00, 0x72, 0xea, 0xfc, 0x80, 0x81,
|
||||
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, 0x7f
|
||||
};
|
||||
const guint8 out2[] =
|
||||
{ 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x01, 0x72, 0xea, 0xfd, 0x82, 0x83,
|
||||
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, 0x78
|
||||
};
|
||||
const guint8 out3[] =
|
||||
{ 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x02, 0x72, 0xea, 0xfc, 0x84, 0x85,
|
||||
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, 0x02, 0x73
|
||||
};
|
||||
const guint8 out4[] =
|
||||
{ 0x96, 0x69, 0x2b, 0x8f, 0x43, 0x00, 0x03, 0x72, 0xea, 0xfd, 0x86, 0x87,
|
||||
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, 0x03, 0x6c
|
||||
};
|
||||
const guint8 *out[] = { out1, out2, out3, out4, };
|
||||
guint out_len[] =
|
||||
{ sizeof (out1), sizeof (out2), sizeof (out3), sizeof (out4), };
|
||||
check_conversion_multiple (G_N_ELEMENTS (in_len), in, in_len,
|
||||
G_N_ELEMENTS (out_len), out, out_len,
|
||||
"closedcaption/x-cea-608,format=(string)s334-1a,framerate=(fraction)30/1",
|
||||
"closedcaption/x-cea-708,format=(string)cdp,framerate=(fraction)60/1",
|
||||
NULL, NULL, 0);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
static Suite *
|
||||
ccextractor_suite (void)
|
||||
{
|
||||
|
@ -783,6 +912,9 @@ ccextractor_suite (void)
|
|||
tcase_add_test (tc, convert_cea708_cdp_cea708_cdp_max_split);
|
||||
tcase_add_test (tc, convert_cea708_cdp_cea708_cdp_max_split_eos);
|
||||
tcase_add_test (tc, convert_cea708_cdp_cea708_cdp_from_drop_frame_scaling);
|
||||
tcase_add_test (tc, convert_cea708_cc_data_cea708_cdp_double_framerate);
|
||||
tcase_add_test (tc, convert_cea608_raw_cea708_cdp_double_framerate);
|
||||
tcase_add_test (tc, convert_cea608_s334_1a_cea708_cdp_double_framerate);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue