[vlc-commits] fix teletext framing code in DVB PES packets ignored

Miha Sokolov git at videolan.org
Wed Mar 25 15:17:51 CET 2015


vlc/vlc-2.2 | branch: master | Miha Sokolov <newsletter at fab-online.com> | Fri Mar 20 09:38:51 2015 +0000| [b17f116b2a2feee7f14d5c266337224f65c25cb3] | committer: Jean-Baptiste Kempf

fix teletext framing code in DVB PES packets ignored

Check the teletext framing code in PES buffer for each of the received lines
and only copy those with correct framing code (p_block->p_buffer[3]) to the
p_sliced buffer that is later forwarded to ZVBI vbi_decode. Invalid lines
will not reach vbi_decode anymore.

When also packets with erroneous framing code are sent to vbi_decode (often
0x00 with some noise), in most cases those are decoded as packet 1/2,
causing the second text line on the teletext page to be overwritten with
spaces. So we need to avoid sending such packets with invalid framing code
to vbi_decode.

Close #14191

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit 20c15610261c4a61d6f5408653124ec23f622c37)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=b17f116b2a2feee7f14d5c266337224f65c25cb3
---

 modules/codec/zvbi.c |   25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/modules/codec/zvbi.c b/modules/codec/zvbi.c
index 6a63439..b967f00 100644
--- a/modules/codec/zvbi.c
+++ b/modules/codec/zvbi.c
@@ -331,17 +331,20 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
 
             if( ( i_id == 0x02 || i_id == 0x03 ) && i_size >= 44 && i_lines < MAX_SLICES )
             {
-                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++;
+                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;



More information about the vlc-commits mailing list