Skip to content

mcc encoder improperly handles cdp sequence numbers #1709

@programmerjake

Description

@programmerjake

the mcc encoder currently tries to use 8 bits split across two bytes, which is incorrect. the correct way to handle it is to use a 16-bit counter:

buff_ptr[8] = (uint8)((ctx->cdp_hdr_seq & 0xF0) >> 8);
buff_ptr[9] = (uint8)(ctx->cdp_hdr_seq & 0x0F);
buff_ptr[10] = CC_DATA_ID;
buff_ptr[11] = cc_count | 0xE0;
memcpy(&buff_ptr[12], cc_data, data_size);
uint8 *data_ptr = &buff_ptr[data_size + 12];
data_ptr[0] = CDP_FOOTER_ID;
data_ptr[1] = (uint8)((ctx->cdp_hdr_seq & 0xF0) >> 8);
data_ptr[2] = (uint8)(ctx->cdp_hdr_seq & 0x0F);

according to the specification: https://pub.smpte.org/latest/st334-2/st0334-2-2015.pdf

cdp_hdr_sequence_cntr – This is an unsigned 16-bit integer which shall be set to a value of 1 plus the value
of cdp_hdr_sequence_cntr in the previous CDP. The value of this counter shall wrap from 65535 to 0. For the
first CDP in a sequence of CDPs, cdp_hdr_sequence_cntr may be set to any 16-bit value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions