[libdvbpsi-devel] TOT CRC Problem
Angelo Schiavone
angelo.schiavone at gmail.com
Wed Jan 23 14:23:46 CET 2013
Hi Jean-Paul,
thanks for your attention,
Here is my actual solution which does not break those sections which have
section_indicator set to 0 and do not have a CRC32 field
bool dvbpsi_ValidPSISection(dvbpsi_psi_section_t* p_section)
{
// TOT has table_id 0x73
if ( (p_section->p_data[0]==0x73) || p_section->b_syntax_indicator)
{
/* Check the CRC_32 if b_syntax_indicator is false */
uint32_t i_crc = 0xffffffff;
uint8_t* p_byte = p_section->p_data;
while(p_byte < p_section->p_payload_end + 4)
{
i_crc = (i_crc << 8) ^ dvbpsi_crc32_table[(i_crc >> 24) ^
(*p_byte)];
p_byte++;
}
if (i_crc == 0)
return true;
else
return false;
}
else
{
/* No check to do if b_syntax_indicator is false */
return false;
}
}
Anyway, i'm gonna patch everything on git.
Currently I found problem in decoding NIT CAT BAT TOT.
thanks
2013/1/23 Jean-Paul Saman <jpsaman at videolan.org>
> HI Angelo,
>
> Thank you for bringing this to my attention.
>
> On Tue, Jan 22, 2013 at 12:20 PM, Angelo Schiavone <
> angelo.schiavone at gmail.com> wrote:
>
>> Hi guys, it's me again.
>> I found a bug in libdvbpsi TOT table decoding.
>> Every time a TOT occurres in my transport stream the library throws a CRC
>> error even if the CRC is correct.
>> That's because "dvbpsi_ValidPSISection" always return false since TOT
>> tables have "section_syntax_indicator" set to 0
>> but it has a CRC field.
>> TOT has section_syntax_indicator==0 and CRC field (ETSI EN 300 468
>> clause 5.2.6) but the dvbpsi_ValidPSISection function assumes that any table
>> which have "section_syntax_indicator" set to 0 has no CRC field, thus it
>> returns false, which comes to TOT crc error.
>>
>>
> Removing this check will break RST, ST and DIT tables, both have
> section_indicator set to 0 and do not have a CRC32 field.
> The change should be a little more intelligent, then that and properly
> reviewed and tested.
>
> Kind regards,
>
> Jean-Paul Saman.
>
>
>>
>> bool dvbpsi_ValidPSISection(dvbpsi_psi_section_t* p_section)
>>
>> {
>>
>> if (p_section->b_syntax_indicator)
>>
>> {
>>
>> /* Check the CRC_32 if b_syntax_indicator is false */
>>
>> uint32_t i_crc = 0xffffffff;
>>
>> uint8_t* p_byte = p_section->p_data;
>>
>> while(p_byte < p_section->p_payload_end + 4)
>>
>> {
>>
>> i_crc = (i_crc << 8) ^ dvbpsi_crc32_table[(i_crc >> 24) ^ (*p_byte)];
>>
>> p_byte++;
>>
>> }
>>
>> if (i_crc == 0)
>>
>> return true;
>>
>> else
>>
>> return false;
>>
>> }
>>
>> else
>>
>> {
>>
>> /* No check to do if b_syntax_indicator is false */
>>
>> return false;
>>
>> }
>>
>> }
>>
>>
>>
>> _______________________________________________
>> libdvbpsi-devel mailing list
>> libdvbpsi-devel at videolan.org
>> http://mailman.videolan.org/listinfo/libdvbpsi-devel
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/libdvbpsi-devel/attachments/20130123/0edb178b/attachment-0001.html>
More information about the libdvbpsi-devel
mailing list