[vlc-commits] demux: ts: replace if/else with switch

Francois Cartegnie git at videolan.org
Sun Apr 13 11:49:51 CEST 2014


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Apr 13 11:42:53 2014 +0200| [362eb37462d9ba9ffd010094bad6c7a41830a455] | committer: Francois Cartegnie

demux: ts: replace if/else with switch

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

 modules/demux/ts.c |   53 +++++++++++++++++++++++++---------------------------
 1 file changed, 25 insertions(+), 28 deletions(-)

diff --git a/modules/demux/ts.c b/modules/demux/ts.c
index 85100f5..5e2d3f5 100644
--- a/modules/demux/ts.c
+++ b/modules/demux/ts.c
@@ -4084,39 +4084,36 @@ static void PMTCallBack( void *data, dvbpsi_pmt_t *p_pmt )
         pid->i_pid          = p_es->i_pid;
         pid->b_seen         = p_sys->pid[p_es->i_pid].b_seen;
 
-        if( p_es->i_type == 0x10 || p_es->i_type == 0x11 ||
-            p_es->i_type == 0x12 || p_es->i_type == 0x0f )
+        switch( p_es->i_type )
         {
+        case 0x10:
+        case 0x11:
+        case 0x12:
+        case 0x0f:
             PMTSetupEsISO14496( p_demux, pid, prg, p_es );
-        }
-        else if( p_es->i_type == 0x06 )
-        {
+            break;
+        case 0x06:
             PMTSetupEs0x06( p_demux, pid, p_es );
-        }
-        else if( p_es->i_type == 0xEA )
-        {
-            PMTSetupEs0xEA( p_demux, pid, p_es );
-        }
-        else if( p_es->i_type == 0xd1 )
-        {
-            PMTSetupEs0xD1( p_demux, pid, p_es );
-        }
-        else if( p_es->i_type == 0xa0 )
-        {
-            PMTSetupEs0xA0( p_demux, pid, p_es );
-        }
-        else if ( p_es->i_type == 0x83 )
-        {
+            break;
+        case 0x83:
             /* LPCM (audio) */
             PMTSetupEs0x83( p_pmt, pid );
-        }
-        else if( registration_type == TS_REGISTRATION_HDMV )
-        {
-            PMTSetupEsHDMV( pid, p_es );
-        }
-        else if( p_es->i_type >= 0x80 )
-        {
-            PMTSetupEsRegistration( p_demux, pid, p_es );
+            break;
+        case 0xa0:
+            PMTSetupEs0xA0( p_demux, pid, p_es );
+            break;
+        case 0xd1:
+            PMTSetupEs0xD1( p_demux, pid, p_es );
+            break;
+        case 0xEA:
+            PMTSetupEs0xEA( p_demux, pid, p_es );
+            break;
+        default:
+            if( registration_type == TS_REGISTRATION_HDMV )
+                PMTSetupEsHDMV( pid, p_es );
+            else if( p_es->i_type >= 0x80 )
+                PMTSetupEsRegistration( p_demux, pid, p_es );
+            break;
         }
 
         if( pid->es->fmt.i_cat == AUDIO_ES ||



More information about the vlc-commits mailing list