Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
mpegts: mpegts_table_dispatch() handle MT_CRC correctly, fixes #2897
  • Loading branch information
perexg committed May 27, 2015
1 parent 22b2ed9 commit b5f23b3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/input/mpegts/mpegts_table.c
Expand Up @@ -82,26 +82,28 @@ void
mpegts_table_dispatch
( const uint8_t *sec, size_t r, void *aux )
{
int tid, len, ret;
int tid, len, crc_len, ret;
mpegts_table_t *mt = aux;

if(mt->mt_destroyed)
return;

tid = sec[0];
len = ((sec[1] & 0x0f) << 8) | sec[2];

/* Check table mask */
if((tid & mt->mt_mask) != mt->mt_table)
return;

len = ((sec[1] & 0x0f) << 8) | sec[2];
crc_len = (mt->mt_flags & MT_CRC) ? 4 : 0;

/* Pass with tableid / len in data */
if (mt->mt_flags & MT_FULL)
ret = mt->mt_callback(mt, sec, len+3, tid);
ret = mt->mt_callback(mt, sec, len+3-crc_len, tid);

/* Pass w/out tableid/len in data */
else
ret = mt->mt_callback(mt, sec+3, len, tid);
ret = mt->mt_callback(mt, sec+3, len-crc_len, tid);

/* Good */
if(ret >= 0)
Expand Down

0 comments on commit b5f23b3

Please sign in to comment.