VLC Player ignores teletext framing code transmitted in DVB PES packets
VLC Player currently ignores the teletext framing code transmitted in DVB PES packets (transport stream). Although framing code 0x27 (transmitted inverted as 0xE4 in PES) is specified for teletext, VLC does not check that value and sends all packets from PES to ZVBI decoder. This causes that also packets with erroneous framing code are sent to decoder. In most cases those are decoded as packet 1/2, causing the second text line on the screen to be overwritten with spaces. To solve the problem, I propose to slightly modify the while block within the Decode function in zvbi.c to only use packets with correct framing code. The modified while block would look like this:
/*****************************************************************************
* Decode:
*****************************************************************************/
static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
while( p_block->i_buffer >= 2 )
{
int i_id = p_block->p_buffer[0];
unsigned i_size = p_block->p_buffer[1];
if( 2 + i_size > p_block->i_buffer )
break;
if( ( i_id == 0x02 || i_id == 0x03 ) && i_size >= 44 && i_lines < MAX_SLICES )
{
if(p_block->p_buffer[3] == 0xE4 ) /* framing_code */
{
unsigned line_offset = p_block->p_buffer[2] & 0x1f;
unsigned field_parity = p_block->p_buffer[2] & 0x20;
p_sliced[i_lines].id = VBI_SLICED_TELETEXT_B;
if( line_offset > 0 )
p_sliced[i_lines].line = line_offset + (field_parity ? 0 : 313);
else
p_sliced[i_lines].line = 0;
for( int i = 0; i < 42; i++ )
p_sliced[i_lines].data[i] = vbi_rev8( p_block->p_buffer[4 + i] );
i_lines++;
}
}
p_block->i_buffer -= 2 + i_size;
p_block->p_buffer += 2 + i_size;
}
I can provide a TS file which can be used to repeat this problem and to check whether it is corrected by the above code modification.