[vlc-commits] TS Mux: simplify SDT parsing

Rafaël Carré git at videolan.org
Fri Feb 10 08:26:48 CET 2012


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Fri Feb 10 02:20:58 2012 -0500| [bd134cba394f7dd6e750a00961814a18f66322ce] | committer: Rafaël Carré

TS Mux: simplify SDT parsing

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

 modules/mux/mpeg/ts.c |   22 ++++++++--------------
 1 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/modules/mux/mpeg/ts.c b/modules/mux/mpeg/ts.c
index c2bacbe..2be8300 100644
--- a/modules/mux/mpeg/ts.c
+++ b/modules/mux/mpeg/ts.c
@@ -583,23 +583,17 @@ static int Open( vlc_object_t *p_this )
 
         char *psz_sdttoken = sdtdesc;
 
-        for (int i = 0; psz_sdttoken; i++)
+        for (int i = 0; i < MAX_PMT * 2 && psz_sdttoken; i++)
         {
+            sdt_desc_t *sdt = &p_sys->sdt_descriptors[i/2];
             char *psz_end = strchr( psz_sdttoken, ',' );
-            if( psz_end != NULL )
-            {
+            if ( psz_end )
                 *psz_end++ = '\0';
-            }
-            if ( !(i % 2) )
-            {
-                p_sys->sdt_descriptors[i/2].psz_provider
-                    = strdup(psz_sdttoken);
-            }
+
+            if (i % 2)
+                sdt->psz_service_name = strdup(psz_sdttoken);
             else
-            {
-                p_sys->sdt_descriptors[i/2].psz_service_name
-                    = strdup(psz_sdttoken);
-            }
+                sdt->psz_provider = strdup(psz_sdttoken);
 
             psz_sdttoken = psz_end;
         }
@@ -608,7 +602,7 @@ static int Open( vlc_object_t *p_this )
 
     p_sys->b_data_alignment = var_GetBool( p_mux, SOUT_CFG_PREFIX "alignment" );
 
-    char *pgrpmt = var_GetNonEmptyString( p_mux, SOUT_CFG_PREFIX "program-pmt" );
+    char *pgrpmt = var_GetNonEmptyString(p_mux, SOUT_CFG_PREFIX "program-pmt");
     if( pgrpmt )
     {
         char *psz = pgrpmt;



More information about the vlc-commits mailing list