[vlc-commits] demux: ts: move PAT creation to psi

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


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Mar  2 17:44:11 2016 +0100| [a985c6f61847001b3362cfce1d0ae1257cf07683] | committer: Francois Cartegnie

demux: ts: move PAT creation to psi

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

 modules/demux/mpeg/ts.c     |    2 +-
 modules/demux/mpeg/ts_psi.c |   12 ++++++++++--
 modules/demux/mpeg/ts_psi.h |    5 +++--
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index 7235272..2ca7785 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -416,7 +416,7 @@ static int Open( vlc_object_t *p_this )
         free( p_sys );
         return VLC_ENOMEM;
     }
-    if( !dvbpsi_pat_attach( patpid->u.p_pat->handle, PATCallBack, p_demux ) )
+    if( !ts_psi_PAT_Attach( patpid, p_demux ) )
     {
         PIDRelease( p_demux, patpid );
         vlc_mutex_destroy( &p_sys->csa_lock );
diff --git a/modules/demux/mpeg/ts_psi.c b/modules/demux/mpeg/ts_psi.c
index f57b9ee..95c3aa1 100644
--- a/modules/demux/mpeg/ts_psi.c
+++ b/modules/demux/mpeg/ts_psi.c
@@ -55,6 +55,7 @@
 #include <assert.h>
 
 static void PIDFillFormat( demux_t *, ts_pes_t *p_pes, int i_stream_type, ts_es_data_type_t * );
+static void PMTCallBack( void *data, dvbpsi_pmt_t *p_dvbpsipmt );
 
 static void ValidateDVBMeta( demux_t *p_demux, int i_pid )
 {
@@ -92,7 +93,7 @@ static int PATCheck( demux_t *p_demux, dvbpsi_pat_t *p_pat )
     return VLC_SUCCESS;
 }
 
-void PATCallBack( void *data, dvbpsi_pat_t *p_dvbpsipat )
+static void PATCallBack( void *data, dvbpsi_pat_t *p_dvbpsipat )
 {
     demux_t              *p_demux = data;
     demux_sys_t          *p_sys = p_demux->p_sys;
@@ -1390,7 +1391,7 @@ static void FillPESFromDvbpsiES( demux_t *p_demux,
         p_pes->p_es->fmt.i_id = p_dvbpsies->i_pid;
 }
 
-void PMTCallBack( void *data, dvbpsi_pmt_t *p_dvbpsipmt )
+static void PMTCallBack( void *data, dvbpsi_pmt_t *p_dvbpsipmt )
 {
     demux_t      *p_demux = data;
     demux_sys_t  *p_sys = p_demux->p_sys;
@@ -1828,3 +1829,10 @@ error:
     free( psz_dup );
     return VLC_EGENERIC;
 }
+
+bool ts_psi_PAT_Attach( ts_pid_t *patpid, void *cbdata )
+{
+    if( unlikely(patpid->type != TYPE_PAT || patpid->i_pid != TS_PSI_PAT_PID) )
+        return false;
+    return dvbpsi_pat_attach( patpid->u.p_pat->handle, PATCallBack, cbdata );
+}
diff --git a/modules/demux/mpeg/ts_psi.h b/modules/demux/mpeg/ts_psi.h
index 9926ae4..62c1286 100644
--- a/modules/demux/mpeg/ts_psi.h
+++ b/modules/demux/mpeg/ts_psi.h
@@ -19,6 +19,8 @@
 #ifndef VLC_TS_PSI_H
 #define VLC_TS_PSI_H
 
+#include "ts_pid_fwd.h"
+
 typedef enum
 {
     TS_PMT_REGISTRATION_NONE = 0,
@@ -27,8 +29,7 @@ typedef enum
     TS_PMT_REGISTRATION_ARIB,
 } ts_pmt_registration_type_t;
 
-void PATCallBack( void *, dvbpsi_pat_t * );
-void PMTCallBack( void *, dvbpsi_pmt_t * );
+bool ts_psi_PAT_Attach( ts_pid_t *, void * );
 
 int UserPmt( demux_t *p_demux, const char * );
 



More information about the vlc-commits mailing list