[vlc-commits] demux: ts: unify all si tables pid structs

Francois Cartegnie git at videolan.org
Thu Mar 3 18:16:17 CET 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Mar  2 16:59:43 2016 +0100| [48ff2237906a1924160fdd0d5a091c6c6f9f6430] | committer: Francois Cartegnie

demux: ts: unify all si tables pid structs

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

 modules/demux/mpeg/ts.c                 |   14 ++++++--------
 modules/demux/mpeg/ts_pid.c             |   16 ++++++----------
 modules/demux/mpeg/ts_pid.h             |    6 ++----
 modules/demux/mpeg/ts_psi.c             |    4 ++--
 modules/demux/mpeg/ts_psi_eit.c         |   18 +++++++++---------
 modules/demux/mpeg/ts_streams.c         |   24 ++++++++++++------------
 modules/demux/mpeg/ts_streams.h         |    6 +++---
 modules/demux/mpeg/ts_streams_private.h |    9 ++++-----
 8 files changed, 44 insertions(+), 53 deletions(-)

diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index 5f41ebe..7235272 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -426,9 +426,9 @@ static int Open( vlc_object_t *p_this )
 
     if( p_sys->b_dvb_meta )
     {
-          if( !PIDSetup( p_demux, TYPE_SDT, GetPID(p_sys, TS_SI_SDT_PID), NULL ) ||
-              !PIDSetup( p_demux, TYPE_EIT, GetPID(p_sys, TS_SI_EIT_PID), NULL ) ||
-              !PIDSetup( p_demux, TYPE_TDT, GetPID(p_sys, TS_SI_TDT_PID), NULL ) )
+          if( !PIDSetup( p_demux, TYPE_SI, GetPID(p_sys, TS_SI_SDT_PID), NULL ) ||
+              !PIDSetup( p_demux, TYPE_SI, GetPID(p_sys, TS_SI_EIT_PID), NULL ) ||
+              !PIDSetup( p_demux, TYPE_SI, GetPID(p_sys, TS_SI_TDT_PID), NULL ) )
           {
               PIDRelease( p_demux, GetPID(p_sys, TS_SI_SDT_PID) );
               PIDRelease( p_demux, GetPID(p_sys, TS_SI_EIT_PID) );
@@ -709,11 +709,9 @@ static int Demux( demux_t *p_demux )
             b_frame = ProcessTSPacket( p_demux, p_pid, p_pkt );
             break;
 
-        case TYPE_SDT:
-        case TYPE_TDT:
-        case TYPE_EIT:
-            if( p_sys->b_dvb_meta && p_pid->u.p_psi->handle->p_decoder )
-                dvbpsi_packet_push( p_pid->u.p_psi->handle, p_pkt->p_buffer );
+        case TYPE_SI:
+            if( p_sys->b_dvb_meta && p_pid->u.p_si->handle->p_decoder )
+                dvbpsi_packet_push( p_pid->u.p_si->handle, p_pkt->p_buffer );
             block_Release( p_pkt );
             break;
 
diff --git a/modules/demux/mpeg/ts_pid.c b/modules/demux/mpeg/ts_pid.c
index ffb9781..5622cfa 100644
--- a/modules/demux/mpeg/ts_pid.c
+++ b/modules/demux/mpeg/ts_pid.c
@@ -166,12 +166,10 @@ bool PIDSetup( demux_t *p_demux, ts_pid_type_t i_type, ts_pid_t *pid, ts_pid_t *
                 return false;
             break;
 
-        case TYPE_SDT:
-        case TYPE_TDT:
-        case TYPE_EIT:
+        case TYPE_SI:
             PIDReset( pid );
-            pid->u.p_psi = ts_psi_New( p_demux );
-            if( !pid->u.p_psi )
+            pid->u.p_si = ts_si_New( p_demux );
+            if( !pid->u.p_si )
                 return false;
             break;
 
@@ -245,11 +243,9 @@ void PIDRelease( demux_t *p_demux, ts_pid_t *pid )
             pid->u.p_pes = NULL;
             break;
 
-        case TYPE_SDT:
-        case TYPE_TDT:
-        case TYPE_EIT:
-            ts_psi_Del( p_demux, pid->u.p_psi );
-            pid->u.p_psi = NULL;
+        case TYPE_SI:
+            ts_si_Del( p_demux, pid->u.p_si );
+            pid->u.p_si = NULL;
             break;
 
         case TYPE_PSIP:
diff --git a/modules/demux/mpeg/ts_pid.h b/modules/demux/mpeg/ts_pid.h
index b14efc0..10fe25a 100644
--- a/modules/demux/mpeg/ts_pid.h
+++ b/modules/demux/mpeg/ts_pid.h
@@ -32,9 +32,7 @@ typedef enum
     TYPE_PAT,
     TYPE_PMT,
     TYPE_PES,
-    TYPE_SDT,
-    TYPE_TDT,
-    TYPE_EIT,
+    TYPE_SI,
     TYPE_PSIP,
 } ts_pid_type_t;
 
@@ -65,7 +63,7 @@ struct ts_pid_t
         ts_pat_t    *p_pat;
         ts_pmt_t    *p_pmt;
         ts_pes_t    *p_pes;
-        ts_psi_t    *p_psi;
+        ts_si_t     *p_si;
         ts_psip_t   *p_psip;
     } u;
 
diff --git a/modules/demux/mpeg/ts_psi.c b/modules/demux/mpeg/ts_psi.c
index ee7b382..f57b9ee 100644
--- a/modules/demux/mpeg/ts_psi.c
+++ b/modules/demux/mpeg/ts_psi.c
@@ -124,9 +124,9 @@ void PATCallBack( void *data, dvbpsi_pat_t *p_dvbpsipat )
     if( p_pat->i_version == -1 && p_sys->b_dvb_meta )
     {
         ts_pid_t *sdtpid = GetPID(p_sys, TS_SI_SDT_PID);
-        if( sdtpid->type == TYPE_SDT )
+        if( sdtpid->type == TYPE_SI )
         {
-            (void) ts_attach_SI_Tables_Decoders( sdtpid->u.p_psi->handle, sdtpid );
+            (void) ts_attach_SI_Tables_Decoders( sdtpid->u.p_si->handle, sdtpid );
         }
     }
 
diff --git a/modules/demux/mpeg/ts_psi_eit.c b/modules/demux/mpeg/ts_psi_eit.c
index 48979fc..674944a 100644
--- a/modules/demux/mpeg/ts_psi_eit.c
+++ b/modules/demux/mpeg/ts_psi_eit.c
@@ -122,26 +122,26 @@ static void SDTCallBack( demux_t *p_demux, dvbpsi_sdt_t *p_sdt )
 
     if( p_sys->es_creation != CREATE_ES ||
        !p_sdt->b_current_next ||
-        p_sdt->i_version == sdt->u.p_psi->i_version )
+        p_sdt->i_version == sdt->u.p_si->i_version )
     {
         dvbpsi_sdt_delete( p_sdt );
         return;
     }
 
-    if( sdt->u.p_psi->i_version == -1 )
+    if( sdt->u.p_si->i_version == -1 )
     {
         ts_pid_t *eitpid = GetPID(p_sys, TS_SI_EIT_PID);
-        if( eitpid->type == TYPE_EIT &&
-           !dvbpsi_decoder_present( eitpid->u.p_psi->handle ) )
+        if( eitpid->type == TYPE_SI &&
+           !dvbpsi_decoder_present( eitpid->u.p_si->handle ) )
         {
-            dvbpsi_AttachDemux( eitpid->u.p_psi->handle, SINewTableCallBack, eitpid );
+            dvbpsi_AttachDemux( eitpid->u.p_si->handle, SINewTableCallBack, eitpid );
         }
 
         ts_pid_t *tdtpid = GetPID(p_sys, TS_SI_TDT_PID);
-        if( tdtpid->type == TYPE_TDT &&
-           !dvbpsi_decoder_present( tdtpid->u.p_psi->handle ) )
+        if( tdtpid->type == TYPE_SI &&
+           !dvbpsi_decoder_present( tdtpid->u.p_si->handle ) )
         {
-            dvbpsi_AttachDemux( tdtpid->u.p_psi->handle, SINewTableCallBack, tdtpid );
+            dvbpsi_AttachDemux( tdtpid->u.p_si->handle, SINewTableCallBack, tdtpid );
         }
     }
 
@@ -268,7 +268,7 @@ static void SDTCallBack( demux_t *p_demux, dvbpsi_sdt_t *p_sdt )
         vlc_meta_Delete( p_meta );
     }
 
-    sdt->u.p_psi->i_version = p_sdt->i_version;
+    sdt->u.p_si->i_version = p_sdt->i_version;
     dvbpsi_sdt_delete( p_sdt );
 }
 
diff --git a/modules/demux/mpeg/ts_streams.c b/modules/demux/mpeg/ts_streams.c
index b0962ae..9d03961 100644
--- a/modules/demux/mpeg/ts_streams.c
+++ b/modules/demux/mpeg/ts_streams.c
@@ -297,30 +297,30 @@ void ts_pes_Del( demux_t *p_demux, ts_pes_t *pes )
     free( pes );
 }
 
-ts_psi_t *ts_psi_New( demux_t *p_demux )
+ts_si_t *ts_si_New( demux_t *p_demux )
 {
-    ts_psi_t *psi = malloc( sizeof( ts_psi_t ) );
-    if( !psi )
+    ts_si_t *si = malloc( sizeof( ts_si_t ) );
+    if( !si )
         return NULL;
 
-    if( !handle_Init( p_demux, &psi->handle ) )
+    if( !handle_Init( p_demux, &si->handle ) )
     {
-        free( psi );
+        free( si );
         return NULL;
     }
 
-    psi->i_version  = -1;
+    si->i_version  = -1;
 
-    return psi;
+    return si;
 }
 
-void ts_psi_Del( demux_t *p_demux, ts_psi_t *psi )
+void ts_si_Del( demux_t *p_demux, ts_si_t *si )
 {
     VLC_UNUSED(p_demux);
-    if( dvbpsi_decoder_present( psi->handle ) )
-        dvbpsi_DetachDemux( psi->handle );
-    dvbpsi_delete( psi->handle );
-    free( psi );
+    if( dvbpsi_decoder_present( si->handle ) )
+        dvbpsi_DetachDemux( si->handle );
+    dvbpsi_delete( si->handle );
+    free( si );
 }
 
 void ts_psip_Del( demux_t *p_demux, ts_psip_t *psip )
diff --git a/modules/demux/mpeg/ts_streams.h b/modules/demux/mpeg/ts_streams.h
index 96bef87..69a5971 100644
--- a/modules/demux/mpeg/ts_streams.h
+++ b/modules/demux/mpeg/ts_streams.h
@@ -23,7 +23,7 @@ typedef struct ts_pes_es_t ts_pes_es_t;
 typedef struct ts_pat_t ts_pat_t;
 typedef struct ts_pmt_t ts_pmt_t;
 typedef struct ts_pes_t ts_pes_t;
-typedef struct ts_psi_t ts_psi_t;
+typedef struct ts_si_t  ts_si_t;
 typedef struct ts_psip_t ts_psip_t;
 
 /* Structs */
@@ -43,8 +43,8 @@ size_t ts_pes_Count_es( const ts_pes_es_t *, bool, const ts_pmt_t * );
 ts_pes_t *ts_pes_New( demux_t *, ts_pmt_t * );
 void ts_pes_Del( demux_t *, ts_pes_t * );
 
-ts_psi_t *ts_psi_New( demux_t * );
-void ts_psi_Del( demux_t *, ts_psi_t * );
+ts_si_t *ts_si_New( demux_t * );
+void ts_si_Del( demux_t *, ts_si_t * );
 
 ts_psip_t *ts_psip_New( demux_t * );
 void ts_psip_Del( demux_t *, ts_psip_t * );
diff --git a/modules/demux/mpeg/ts_streams_private.h b/modules/demux/mpeg/ts_streams_private.h
index cdbfec5..727c97d 100644
--- a/modules/demux/mpeg/ts_streams_private.h
+++ b/modules/demux/mpeg/ts_streams_private.h
@@ -114,13 +114,12 @@ struct ts_pes_t
     } sl;
 };
 
+typedef struct ts_si_context_t ts_si_context_t;
 
-struct ts_psi_t
+struct ts_si_t
 {
-    /* for special PAT/SDT case */
-    dvbpsi_t       *handle; /* PAT/SDT/EIT */
-    int             i_version;
-
+    dvbpsi_t *handle;
+    int       i_version;
 };
 
 typedef struct ts_psip_context_t ts_psip_context_t;



More information about the vlc-commits mailing list