[vlc-commits] demux: ts: Check PAT for duplicate programs (fix #13970)

Francois Cartegnie git at videolan.org
Fri Feb 20 20:01:51 CET 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Feb 18 17:54:27 2015 +0100| [92c1541c1c7903c57b4a2231a20f4ead9b3e4da4] | committer: Francois Cartegnie

demux: ts: Check PAT for duplicate programs (fix #13970)

refs issues/TS/dreambox.ts
Some Dreambox produced streams have patched PAT
setting all programs pid to the recorded's.

Reject that PAT and guess content from probing then.

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

 modules/demux/ts.c |   20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/modules/demux/ts.c b/modules/demux/ts.c
index 2532c88..162ab62 100644
--- a/modules/demux/ts.c
+++ b/modules/demux/ts.c
@@ -5304,6 +5304,24 @@ static void PMTCallBack( void *data, dvbpsi_pmt_t *p_pmt )
         free( pp_clean );
 }
 
+static int PATCheck( demux_t *p_demux, dvbpsi_pat_t *p_pat )
+{
+    /* Some Dreambox streams have all PMT set to same pid */
+    int i_prev_pid = -1;
+    for( dvbpsi_pat_program_t * p_program = p_pat->p_first_program;
+         p_program != NULL;
+         p_program = p_program->p_next )
+    {
+        if( p_program->i_pid == i_prev_pid )
+        {
+            msg_Warn( p_demux, "PAT check failed: duplicate program pid %d", i_prev_pid );
+            return VLC_EGENERIC;
+        }
+        i_prev_pid = p_program->i_pid;
+    }
+    return VLC_SUCCESS;
+}
+
 static void PATCallBack( void *data, dvbpsi_pat_t *p_pat )
 {
     demux_t              *p_demux = data;
@@ -5316,7 +5334,7 @@ static void PATCallBack( void *data, dvbpsi_pat_t *p_pat )
     if( ( pat->psi->i_pat_version != -1 &&
             ( !p_pat->b_current_next ||
               p_pat->i_version == pat->psi->i_pat_version ) ) ||
-        p_sys->b_user_pmt )
+        p_sys->b_user_pmt || PATCheck( p_demux, p_pat ) )
     {
         dvbpsi_DeletePAT( p_pat );
         return;



More information about the vlc-commits mailing list