}
static gsize
-extract_608_field_from_cc_data (const guint8 * ccdata, gsize ccdata_size,
+extract_608_field_from_s334_1a (const guint8 * ccdata, gsize ccdata_size,
guint field, guint8 ** res)
{
guint8 *storage;
/* Iterate over the ccdata and put the corresponding tuples for the given field
* in the storage */
for (i = 0; i < ccdata_size; i += 3) {
- if ((field == 1 && ccdata[i * 3] == 0xfc) ||
- (field == 2 && ccdata[i * 3] == 0xfd)) {
+ if ((field == 1 && (ccdata[i * 3] & 0x80)) ||
+ (field == 2 && !(ccdata[i * 3] & 0x80))) {
GST_DEBUG ("Storing matching cc for field %d : 0x%02x 0x%02x", field,
ccdata[i * 3 + 1], ccdata[i * 3 + 2]);
if (res_size >= storage_size) {
gsize write_offs = 0;
cdat_size =
- extract_608_field_from_cc_data (inmap.data, inmap.size, 1, &cdat);
+ extract_608_field_from_s334_1a (inmap.data, inmap.size, 1, &cdat);
cdt2_size =
- extract_608_field_from_cc_data (inmap.data, inmap.size, 2, &cdt2);
+ extract_608_field_from_s334_1a (inmap.data, inmap.size, 2, &cdt2);
if (cdat_size)
total_size += cdat_size + 8;
structure = gst_caps_get_structure (caps, 0);
- /* We know we only handle 608,format=cc_data and 708,format=cdp */
+ /* We know we only handle 608,format=s334-1a and 708,format=cdp */
if (gst_structure_has_name (structure, "closedcaption/x-cea-608")) {
fourcc_entry = FOURCC_c608;
} else if (gst_structure_has_name (structure, "closedcaption/x-cea-708")) {
}
static guint8 *
-convert_to_ccdata (const guint8 * ccpair, guint8 ccpair_size, guint field,
+convert_to_s334_1a (const guint8 * ccpair, guint8 ccpair_size, guint field,
gsize * res)
{
guint8 *storage;
*res = ccpair_size / 2 * 3;
storage = g_malloc (*res);
for (i = 0; i * 2 < ccpair_size; i += 1) {
+ /* FIXME: Use line offset 0 as we simply can't know here */
if (field == 1)
- storage[i * 3] = 0xfc;
+ storage[i * 3] = 0x80 | 0x00;
else
- storage[i * 3] = 0xfd;
+ storage[i * 3] = 0x00 | 0x00;
storage[i * 3 + 1] = ccpair[i * 2];
storage[i * 3 + 2] = ccpair[i * 2 + 1];
}
goto invalid_cdat;
}
- /* Convert to cc_data triplet */
+ /* Convert to S334-1 Annex A byte triplet */
if (fourcc == FOURCC_cdat)
- cdat = convert_to_ccdata (data + 8, atom_length - 8, 1, &cdat_size);
+ cdat = convert_to_s334_1a (data + 8, atom_length - 8, 1, &cdat_size);
else
- cdt2 = convert_to_ccdata (data + 8, atom_length - 8, 2, &cdt2_size);
+ cdt2 = convert_to_s334_1a (data + 8, atom_length - 8, 2, &cdt2_size);
GST_DEBUG_OBJECT (stream->pad, "size:%" G_GSIZE_FORMAT " atom_length:%u",
size, atom_length);
if (fourcc == FOURCC_cdat) {
if (cdat == NULL)
cdat =
- convert_to_ccdata (data + atom_length + 8,
+ convert_to_s334_1a (data + atom_length + 8,
new_atom_length - 8, 1, &cdat_size);
else
GST_WARNING_OBJECT (stream->pad,
} else {
if (cdt2 == NULL)
cdt2 =
- convert_to_ccdata (data + atom_length + 8,
+ convert_to_s334_1a (data + atom_length + 8,
new_atom_length - 8, 2, &cdt2_size);
else
GST_WARNING_OBJECT (stream->pad,
_codec ("CEA 608 Closed Caption");
caps =
gst_caps_new_simple ("closedcaption/x-cea-608", "format",
- G_TYPE_STRING, "cc_data", NULL);
+ G_TYPE_STRING, "s334-1a", NULL);
stream->need_process = TRUE;
break;
case FOURCC_c708: