Skip to content

Commit

Permalink
CEA-708: Fix delayed presentation of some captions.
Browse files Browse the repository at this point in the history
Patch from argilo@gmail.com (received with thanks) - see #10273 for
details. Fixes a number of test streams with no obvious regressions.

Closes #10273

Cherry picker from master f8312c3
  • Loading branch information
Mark Kendall committed Jan 22, 2012
1 parent 4627dc9 commit af6364b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
9 changes: 7 additions & 2 deletions mythtv/libs/libmythtv/avformatdecoder.cpp
Expand Up @@ -2577,14 +2577,19 @@ void AvFormatDecoder::DecodeDTVCC(const uint8_t *buf, uint len)
{
uint cc_code = buf[2+(cur*3)];
bool cc_valid = cc_code & 0x04;
if (!cc_valid)
continue;

uint data1 = buf[3+(cur*3)];
uint data2 = buf[4+(cur*3)];
uint data = (data2 << 8) | data1;
uint cc_type = cc_code & 0x03;

if (!cc_valid)
{
if (cc_type >= 0x2)
ccd708->decode_cc_null();
continue;
}

if (cc_type <= 0x1) // EIA-608 field-1/2
{
if (cc608_good_parity(cc608_parity_table, data))
Expand Down
7 changes: 7 additions & 0 deletions mythtv/libs/libmythtv/cc708decoder.cpp
Expand Up @@ -62,6 +62,13 @@ void CC708Decoder::decode_cc_data(uint cc_type, uint data1, uint data2)
}
}

void CC708Decoder::decode_cc_null(void)
{
if (partialPacket.size && reader)
parse_cc_packet(reader, &partialPacket, last_seen);
partialPacket.size = 0;
}

void CC708Decoder::services(uint seconds, bool seen[64]) const
{
time_t now = time(NULL);
Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmythtv/cc708decoder.h
Expand Up @@ -32,6 +32,7 @@ class CC708Decoder
~CC708Decoder() {}

void decode_cc_data(uint cc_type, uint data1, uint data2);
void decode_cc_null(void);

/// \return Services seen in last few seconds as specified.
void services(uint seconds, bool[64]) const;
Expand Down

0 comments on commit af6364b

Please sign in to comment.