[vlc-commits] demux: ts: simplify component tag matching

Francois Cartegnie git at videolan.org
Sun Oct 30 14:06:17 CET 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Oct 29 15:18:33 2016 +0200| [7d903c541845635a6da02124ab7c4c0265b4d4f6] | committer: Francois Cartegnie

demux: ts: simplify component tag matching

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

 modules/demux/mpeg/ts_psi.c | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/modules/demux/mpeg/ts_psi.c b/modules/demux/mpeg/ts_psi.c
index 02ebf97..023a2d3 100644
--- a/modules/demux/mpeg/ts_psi.c
+++ b/modules/demux/mpeg/ts_psi.c
@@ -324,8 +324,8 @@ static bool PMTEsHasRegistration( demux_t *p_demux,
     return !memcmp( p_dr->p_data, psz_tag, 4 );
 }
 
-static bool PMTEsHasComponentTag( const dvbpsi_pmt_es_t *p_es,
-                                  int i_component_tag )
+static bool PMTEsHasComponentTagBetween( const dvbpsi_pmt_es_t *p_es,
+                                         uint8_t i_low, uint8_t i_high )
 {
     dvbpsi_descriptor_t *p_dr = PMTEsFindDescriptor( p_es, 0x52 );
     if( !p_dr )
@@ -334,7 +334,7 @@ static bool PMTEsHasComponentTag( const dvbpsi_pmt_es_t *p_es,
     if( !p_si )
         return false;
 
-    return p_si->i_component_tag == i_component_tag;
+    return p_si->i_component_tag >= i_low && p_si->i_component_tag <= i_high;
 }
 
 static void SetupISO14496Descriptors( demux_t *p_demux, ts_pes_t *p_pes,
@@ -877,23 +877,15 @@ static void PMTSetupEs0x06( demux_t *p_demux, ts_pes_t *p_pes,
         /* and check that it maps to something ARIB STD B14 Table 5.1/5.2 */
         if ( p_dr && p_dr->i_length >= 2 )
         {
-            if( !memcmp( p_dr->p_data, "\x00\x08", 2 ) &&  (
-                    PMTEsHasComponentTag( p_dvbpsies, 0x30 ) ||
-                    PMTEsHasComponentTag( p_dvbpsies, 0x31 ) ||
-                    PMTEsHasComponentTag( p_dvbpsies, 0x32 ) ||
-                    PMTEsHasComponentTag( p_dvbpsies, 0x33 ) ||
-                    PMTEsHasComponentTag( p_dvbpsies, 0x34 ) ||
-                    PMTEsHasComponentTag( p_dvbpsies, 0x35 ) ||
-                    PMTEsHasComponentTag( p_dvbpsies, 0x36 ) ||
-                    PMTEsHasComponentTag( p_dvbpsies, 0x37 ) ) )
+            if( !memcmp( p_dr->p_data, "\x00\x08", 2 ) &&
+                PMTEsHasComponentTagBetween( p_dvbpsies, 0x30, 0x37 ) )
             {
                 es_format_Init( p_fmt, SPU_ES, VLC_CODEC_ARIB_A );
                 p_fmt->psz_language = strndup ( "jpn", 3 );
                 p_fmt->psz_description = strdup( _("ARIB subtitles") );
             }
-            else if( !memcmp( p_dr->p_data, "\x00\x12", 2 ) && (
-                     PMTEsHasComponentTag( p_dvbpsies, 0x87 ) ||
-                     PMTEsHasComponentTag( p_dvbpsies, 0x88 ) ) )
+            else if( !memcmp( p_dr->p_data, "\x00\x12", 2 ) &&
+                     PMTEsHasComponentTagBetween( p_dvbpsies, 0x87, 0x88 ) )
             {
                 es_format_Init( p_fmt, SPU_ES, VLC_CODEC_ARIB_C );
                 p_fmt->psz_language = strndup ( "jpn", 3 );



More information about the vlc-commits mailing list