[vlc-commits] demux: ts: simplify CAM setting

Francois Cartegnie git at videolan.org
Thu Mar 10 11:53:30 CET 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Mar 10 11:49:50 2016 +0100| [994b93c5a66dc8f1998718723a6aff6d04a4434d] | committer: Francois Cartegnie

demux: ts: simplify CAM setting

And comment

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

 modules/demux/mpeg/ts_psi.c |   23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/modules/demux/mpeg/ts_psi.c b/modules/demux/mpeg/ts_psi.c
index 56d77c8..9403554 100644
--- a/modules/demux/mpeg/ts_psi.c
+++ b/modules/demux/mpeg/ts_psi.c
@@ -1604,21 +1604,20 @@ static void PMTCallBack( void *data, dvbpsi_pmt_t *p_dvbpsipmt )
     }
 
     /* Set CAM descrambling */
-    if( !ProgramIsSelected( p_sys, p_pmt->i_number ) )
-    {
-        dvbpsi_pmt_delete( p_dvbpsipmt );
-    }
-    else if( stream_Control( p_sys->stream, STREAM_SET_PRIVATE_ID_CA,
-                             p_dvbpsipmt ) != VLC_SUCCESS )
+    if( ProgramIsSelected( p_sys, p_pmt->i_number ) )
     {
-        if ( p_sys->standard == TS_STANDARD_ARIB && !p_sys->arib.b25stream )
+        /* DTV/CAM takes ownership of p_dvbpsipmt on success */
+        if( stream_Control( p_sys->stream, STREAM_SET_PRIVATE_ID_CA, p_dvbpsipmt ) != VLC_SUCCESS )
         {
-            p_sys->arib.b25stream = stream_FilterNew( p_demux->s, "aribcam" );
-            p_sys->stream = ( p_sys->arib.b25stream ) ? p_sys->arib.b25stream : p_demux->s;
-            if (!p_sys->arib.b25stream)
-                dvbpsi_pmt_delete( p_dvbpsipmt );
-        } else dvbpsi_pmt_delete( p_dvbpsipmt );
+            if ( p_sys->standard == TS_STANDARD_ARIB && !p_sys->arib.b25stream )
+            {
+                p_sys->arib.b25stream = stream_FilterNew( p_demux->s, "aribcam" );
+                p_sys->stream = ( p_sys->arib.b25stream ) ? p_sys->arib.b25stream : p_demux->s;
+            }
+            dvbpsi_pmt_delete( p_dvbpsipmt );
+        }
     }
+    else dvbpsi_pmt_delete( p_dvbpsipmt );
 
      /* Add arbitrary PID from here */
     if ( p_sys->standard == TS_STANDARD_ATSC )



More information about the vlc-commits mailing list