[vlc-commits] mux: ts: add sdt even if names are empty

Francois Cartegnie git at videolan.org
Mon Apr 25 14:41:18 CEST 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Apr 25 14:40:09 2016 +0200| [43fc6ee125ebf59fdfa662f2337a686303bdf74c] | committer: Francois Cartegnie

mux: ts: add sdt even if names are empty

as it contains service type

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

 modules/mux/mpeg/tables.c |   19 +++++++++----------
 modules/mux/mpeg/ts.c     |    3 ---
 2 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/modules/mux/mpeg/tables.c b/modules/mux/mpeg/tables.c
index 7ff07b2..8ade82c 100644
--- a/modules/mux/mpeg/tables.c
+++ b/modules/mux/mpeg/tables.c
@@ -535,25 +535,24 @@ void BuildPMT( dvbpsi_t *p_dvbpsi, vlc_object_t *p_object,
             const char *psz_sdtprov = p_sdt->desc[i].psz_provider;
             const char *psz_sdtserv = p_sdt->desc[i].psz_service_name;
 
-            if( !psz_sdtprov || !psz_sdtserv )
-                continue;
-            size_t provlen = VLC_CLIP(strlen(psz_sdtprov), 0, 255);
-            size_t servlen = VLC_CLIP(strlen(psz_sdtserv), 0, 255);
+            size_t i_prov = (psz_sdtprov) ? __MIN(255, strlen(psz_sdtprov)) : 0;
+            size_t i_serv = (psz_sdtserv) ? __MIN(255, strlen(psz_sdtserv)) : 0;
 
-            uint8_t psz_sdt_desc[3 + provlen + servlen];
+            uint8_t psz_sdt_desc[4 + i_prov + i_serv];
 
+            /* mapped service type according to es types */
             psz_sdt_desc[0] = pi_service_types[i];
 
             /* service provider name length */
-            psz_sdt_desc[1] = (char)provlen;
-            memcpy( &psz_sdt_desc[2], psz_sdtprov, provlen );
+            psz_sdt_desc[1] = i_prov;
+            memcpy( &psz_sdt_desc[2], psz_sdtprov, i_prov );
 
             /* service name length */
-            psz_sdt_desc[ 2 + provlen ] = (char)servlen;
-            memcpy( &psz_sdt_desc[3+provlen], psz_sdtserv, servlen );
+            psz_sdt_desc[ 2 + i_prov ] = i_serv;
+            memcpy( &psz_sdt_desc[3+i_prov], psz_sdtserv, i_serv );
 
             dvbpsi_sdt_service_descriptor_add( p_service, 0x48,
-                                               (3 + provlen + servlen),
+                                               (3 + i_prov + i_serv),
                                                psz_sdt_desc );
         }
         free( pi_service_types );
diff --git a/modules/mux/mpeg/ts.c b/modules/mux/mpeg/ts.c
index b20a40c..f8e8447 100644
--- a/modules/mux/mpeg/ts.c
+++ b/modules/mux/mpeg/ts.c
@@ -334,7 +334,6 @@ struct sout_mux_sys_t
 
     dvbpsi_t        *p_dvbpsi;
     bool            b_es_id_pid;
-    bool            b_sdt;
     int             i_pid_video;
     int             i_pid_audio;
     int             i_pid_spu;
@@ -606,8 +605,6 @@ static int Open( vlc_object_t *p_this )
     /* Syntax is provider_sdt1,service_name_sdt1,provider_sdt2,service_name_sdt2... */
     if( sdtdesc )
     {
-        p_sys->b_sdt = true;
-
         char *psz_sdttoken = sdtdesc;
 
         for (int i = 0; i < MAX_SDT_DESC * 2 && psz_sdttoken; i++)



More information about the vlc-commits mailing list