[vlc-commits] input/stream: remove STREAM_CONTROL_ACCESS and simplify

Rémi Denis-Courmont git at videolan.org
Sun Aug 25 12:09:42 CEST 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Aug 25 13:04:39 2013 +0300| [ddb88bf1a7b0396404d394726499af6eebba6c37] | committer: Rémi Denis-Courmont

input/stream: remove STREAM_CONTROL_ACCESS and simplify

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

 include/vlc_stream.h           |    9 ++++-----
 modules/access/zip/zipstream.c |    1 -
 modules/demux/asf/asf.c        |    2 +-
 modules/demux/ts.c             |    8 ++++----
 src/input/stream.c             |   20 ++++++--------------
 src/input/stream_demux.c       |    4 +++-
 src/input/stream_memory.c      |    8 +++++---
 7 files changed, 23 insertions(+), 29 deletions(-)

diff --git a/include/vlc_stream.h b/include/vlc_stream.h
index f77a843..50a42c3 100644
--- a/include/vlc_stream.h
+++ b/include/vlc_stream.h
@@ -99,11 +99,6 @@ enum stream_query_e
 
     STREAM_GET_SIZE,            /**< arg1= uint64_t *     res=cannot fail (0 if no sense)*/
 
-    /* Special for direct access control from demuxer.
-     * XXX: avoid using it by all means */
-    STREAM_CONTROL_ACCESS,  /* arg1= int i_access_query, args   res: can fail
-                             if access unreachable or access control answer */
-
     /* You should update size of source if any and then update size 
      * FIXME find a way to avoid it */
     STREAM_UPDATE_SIZE,
@@ -120,6 +115,10 @@ enum stream_query_e
 
     /* XXX only data read through stream_Read/Block will be recorded */
     STREAM_SET_RECORD_STATE,     /**< arg1=bool, arg2=const char *psz_ext (if arg1 is true)  res=can fail */
+
+    STREAM_SET_PRIVATE_ID_STATE = 0x1000, /* arg1= int i_private_data, bool b_selected    res=can fail */
+    STREAM_SET_PRIVATE_ID_CA,             /* arg1= int i_program_number, uint16_t i_vpid, uint16_t i_apid1, uint16_t i_apid2, uint16_t i_apid3, uint8_t i_length, uint8_t *p_data */
+    STREAM_GET_PRIVATE_ID_STATE,          /* arg1=int i_private_data arg2=bool *          res=can fail */
 };
 
 VLC_API int stream_Read( stream_t *s, void *p_read, int i_read );
diff --git a/modules/access/zip/zipstream.c b/modules/access/zip/zipstream.c
index 2791925..b27fe00 100644
--- a/modules/access/zip/zipstream.c
+++ b/modules/access/zip/zipstream.c
@@ -322,7 +322,6 @@ static int Control( stream_t *s, int i_query, va_list args )
             return VLC_EGENERIC;
 
         case STREAM_UPDATE_SIZE:
-        case STREAM_CONTROL_ACCESS:
         case STREAM_CAN_SEEK:
         case STREAM_CAN_FASTSEEK:
         case STREAM_SET_RECORD_STATE:
diff --git a/modules/demux/asf/asf.c b/modules/demux/asf/asf.c
index 05bb108..cbf8b43 100644
--- a/modules/demux/asf/asf.c
+++ b/modules/demux/asf/asf.c
@@ -789,7 +789,7 @@ static int DemuxInit( demux_t *p_demux )
         tk->p_frame = NULL;
 
         /* Check (in case of mms) if this track is selected (ie will receive data) */
-        if( !stream_Control( p_demux->s, STREAM_CONTROL_ACCESS, ACCESS_GET_PRIVATE_ID_STATE,
+        if( !stream_Control( p_demux->s, STREAM_GET_PRIVATE_ID_STATE,
                              p_sp->i_stream_number, &b_access_selected ) &&
             !b_access_selected )
         {
diff --git a/modules/demux/ts.c b/modules/demux/ts.c
index a9bc15d..4c279f7 100644
--- a/modules/demux/ts.c
+++ b/modules/demux/ts.c
@@ -1359,8 +1359,8 @@ static int SetPIDFilter( demux_t *p_demux, int i_pid, bool b_selected )
     if( !p_sys->b_access_control )
         return VLC_EGENERIC;
 
-    return stream_Control( p_demux->s, STREAM_CONTROL_ACCESS,
-                           ACCESS_SET_PRIVATE_ID_STATE, i_pid, b_selected );
+    return stream_Control( p_demux->s, STREAM_SET_PRIVATE_ID_STATE,
+                           i_pid, b_selected );
 }
 
 static void SetPrgFilter( demux_t *p_demux, int i_prg_id, bool b_selected )
@@ -4181,8 +4181,8 @@ static void PMTCallBack( void *data, dvbpsi_pmt_t *p_pmt )
 
     /* Set CAM descrambling */
     if( !ProgramIsSelected( p_demux, prg->i_number )
-     || stream_Control( p_demux->s, STREAM_CONTROL_ACCESS,
-                        ACCESS_SET_PRIVATE_ID_CA, p_pmt ) != VLC_SUCCESS )
+     || stream_Control( p_demux->s, STREAM_SET_PRIVATE_ID_CA,
+                        p_pmt ) != VLC_SUCCESS )
         dvbpsi_DeletePMT( p_pmt );
 
     for( int i = 0; i < i_clean; i++ )
diff --git a/src/input/stream.c b/src/input/stream.c
index 15b02df..9236f05 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -561,6 +561,9 @@ static int AStreamControl( stream_t *s, int i_query, va_list args )
     static_control_match(SET_PAUSE_STATE);
     static_control_match(SET_TITLE);
     static_control_match(SET_SEEKPOINT);
+    static_control_match(SET_PRIVATE_ID_STATE);
+    static_control_match(SET_PRIVATE_ID_CA);
+    static_control_match(GET_PRIVATE_ID_STATE);
 
     switch( i_query )
     {
@@ -573,6 +576,9 @@ static int AStreamControl( stream_t *s, int i_query, va_list args )
         case STREAM_GET_CONTENT_TYPE:
         case STREAM_GET_SIGNAL:
         case STREAM_SET_PAUSE_STATE:
+        case STREAM_SET_PRIVATE_ID_STATE:
+        case STREAM_SET_PRIVATE_ID_CA:
+        case STREAM_GET_PRIVATE_ID_STATE:
             return access_vaControl( p_access, i_query, args );
 
         case STREAM_GET_SIZE:
@@ -609,20 +615,6 @@ static int AStreamControl( stream_t *s, int i_query, va_list args )
             }
         }
 
-        case STREAM_CONTROL_ACCESS:
-        {
-            int i_int = (int) va_arg( args, int );
-            if( i_int != ACCESS_SET_PRIVATE_ID_STATE &&
-                i_int != ACCESS_SET_PRIVATE_ID_CA &&
-                i_int != ACCESS_GET_PRIVATE_ID_STATE )
-            {
-                msg_Err( s, "Hey, what are you thinking ?"
-                            "DON'T USE STREAM_CONTROL_ACCESS !!!" );
-                return VLC_EGENERIC;
-            }
-            return access_vaControl( p_access, i_int, args );
-        }
-
         case STREAM_UPDATE_SIZE:
             AStreamControlUpdate( s );
             return VLC_SUCCESS;
diff --git a/src/input/stream_demux.c b/src/input/stream_demux.c
index 01d251c..fbfa2d0 100644
--- a/src/input/stream_demux.c
+++ b/src/input/stream_demux.c
@@ -296,7 +296,6 @@ static int DStreamControl( stream_t *s, int i_query, va_list args )
             return VLC_SUCCESS;
         }
 
-        case STREAM_CONTROL_ACCESS:
         case STREAM_GET_TITLE_INFO:
         case STREAM_GET_META:
         case STREAM_GET_CONTENT_TYPE:
@@ -305,6 +304,9 @@ static int DStreamControl( stream_t *s, int i_query, va_list args )
         case STREAM_SET_TITLE:
         case STREAM_SET_SEEKPOINT:
         case STREAM_SET_RECORD_STATE:
+        case STREAM_SET_PRIVATE_ID_STATE:
+        case STREAM_SET_PRIVATE_ID_CA:
+        case STREAM_GET_PRIVATE_ID_STATE:
             return VLC_EGENERIC;
 
         default:
diff --git a/src/input/stream_memory.c b/src/input/stream_memory.c
index 87b7f1b..daefe30 100644
--- a/src/input/stream_memory.c
+++ b/src/input/stream_memory.c
@@ -133,9 +133,11 @@ static int Control( stream_t *s, int i_query, va_list args )
         case STREAM_SET_PAUSE_STATE:
             break; /* nothing to do */
 
-        case STREAM_CONTROL_ACCESS:
-            msg_Err( s, "Hey, what are you thinking ?"
-                     "DON'T USE STREAM_CONTROL_ACCESS !!!" );
+        case STREAM_SET_PRIVATE_ID_STATE:
+        case STREAM_SET_PRIVATE_ID_CA:
+        case STREAM_GET_PRIVATE_ID_STATE:
+            msg_Err( s, "Hey, what are you thinking? "
+                     "DO NOT USE PRIVATE STREAM CONTROLS!!!" );
             return VLC_EGENERIC;
 
         default:



More information about the vlc-commits mailing list