Commit dafc3a9d authored by François Cartegnie's avatar François Cartegnie 🤞

demux: hls: better check for ID3 header

parent 754fa914
......@@ -106,10 +106,18 @@ static uint32_t ReadID3Size(const uint8_t *p_buffer)
(( (uint32_t)p_buffer[0] & 0x7F ) << 21);
}
static bool IsID3Tag(const uint8_t *p_buffer)
{
return( memcmp(p_buffer, "ID3", 3) == 0 &&
p_buffer[3] < 0xFF &&
p_buffer[4] < 0xFF &&
((GetDWBE(&p_buffer[6]) & 0x80808080) == 0) );
}
block_t * HLSStream::checkBlock(block_t *p_block, bool b_first)
{
if(b_first && p_block &&
p_block->i_buffer >= 10 && !memcmp(p_block->p_buffer, "ID3", 3))
p_block->i_buffer >= 10 && IsID3Tag(p_block->p_buffer))
{
uint32_t size = ReadID3Size(&p_block->p_buffer[6]);
size = __MIN(p_block->i_buffer, size + 10);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment