[vlc-commits] stream: add explicit controls for titles and seekpoints

Rémi Denis-Courmont git at videolan.org
Wed Apr 17 21:57:49 CEST 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Apr 17 22:55:29 2013 +0300| [f349eef02937a20803c6b00cdc5d3518272ed754] | committer: Rémi Denis-Courmont

stream: add explicit controls for titles and seekpoints

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

 include/vlc_stream.h      |    5 +++++
 src/input/input.c         |   20 ++++++++------------
 src/input/stream.c        |   28 +++++++++++++++++++---------
 src/input/stream_demux.c  |    3 +++
 src/input/stream_memory.c |    3 +++
 5 files changed, 38 insertions(+), 21 deletions(-)

diff --git a/include/vlc_stream.h b/include/vlc_stream.h
index c85f8e5..0890c54 100644
--- a/include/vlc_stream.h
+++ b/include/vlc_stream.h
@@ -109,8 +109,13 @@ enum stream_query_e
     STREAM_UPDATE_SIZE,
 
     /* */
+    STREAM_GET_TITLE_INFO = 0x102, /**< arg1=input_title_t*** arg2=int* res=can fail */
+    STREAM_RESERVED_FOR_GET_META_DO_NOT_USE,
     STREAM_GET_CONTENT_TYPE,    /**< arg1= char **         res=can fail */
+
     STREAM_SET_PAUSE_STATE = 0x200, /**< arg1= bool        res=can fail */
+    STREAM_SET_TITLE,       /**< arg1= int          res=can fail */
+    STREAM_SET_SEEKPOINT,   /**< arg1= int          res=can fail */
 
     /* 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 */
diff --git a/src/input/input.c b/src/input/input.c
index 0796c58..51de641 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -1920,7 +1920,7 @@ static bool Control( input_thread_t *p_input,
                                DEMUX_SET_TITLE, i_title );
             else
                 stream_Control( p_input->p->input.p_stream,
-                            STREAM_CONTROL_ACCESS, ACCESS_SET_TITLE, i_title );
+                                STREAM_SET_TITLE, i_title );
             input_SendEventTitle( p_input, i_title );
             break;
         }
@@ -1978,8 +1978,7 @@ static bool Control( input_thread_t *p_input,
                                DEMUX_SET_SEEKPOINT, i_seekpoint );
             else
                 stream_Control( p_input->p->input.p_stream,
-                                STREAM_CONTROL_ACCESS,
-                                ACCESS_SET_SEEKPOINT, i_seekpoint );
+                                STREAM_SET_SEEKPOINT, i_seekpoint );
             input_SendEventSeekpoint( p_input, i_title, i_seekpoint );
             break;
         }
@@ -2433,15 +2432,6 @@ static int InputSourceInit( input_thread_t *p_input,
         /* Get infos from access */
         if( !p_input->b_preparsing )
         {
-            in->b_title_demux = false;
-            if( access_Control( p_access, ACCESS_GET_TITLE_INFO,
-                                &in->title, &in->i_title,
-                                &in->i_title_offset, &in->i_seekpoint_offset ) )
-
-            {
-                TAB_INIT( in->i_title, in->title );
-            }
-
             access_Control( p_access, ACCESS_GET_PTS_DELAY, &i_pts_delay );
         }
 
@@ -2532,6 +2522,12 @@ static int InputSourceInit( input_thread_t *p_input,
 
             stream_Control( in->p_stream, STREAM_CAN_SEEK, &b );
             var_SetBool( p_input, "can-seek", b );
+
+            in->b_title_demux = false;
+            if( stream_Control( in->p_stream, STREAM_GET_TITLE_INFO,
+                                &in->title, &in->i_title, &in->i_title_offset,
+                                &in->i_seekpoint_offset ) )
+                TAB_INIT( in->i_title, in->title );
         }
 
         in->p_demux = demux_New( p_input, p_input, psz_access, psz_demux,
diff --git a/src/input/stream.c b/src/input/stream.c
index 76de575..f978fc6 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -549,7 +549,6 @@ static int AStreamControl( stream_t *s, int i_query, va_list args )
     access_t     *p_access = p_sys->p_access;
 
     uint64_t *pi_64, i_64;
-    int      i_int;
 
     switch( i_query )
     {
@@ -595,32 +594,43 @@ static int AStreamControl( stream_t *s, int i_query, va_list args )
 
         case STREAM_CONTROL_ACCESS:
         {
-            i_int = (int) va_arg( args, int );
+            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 &&
-                i_int != ACCESS_SET_TITLE &&
-                i_int != ACCESS_SET_SEEKPOINT )
+                i_int != ACCESS_GET_PRIVATE_ID_STATE )
             {
                 msg_Err( s, "Hey, what are you thinking ?"
                             "DON'T USE STREAM_CONTROL_ACCESS !!!" );
                 return VLC_EGENERIC;
             }
-            int i_ret = access_vaControl( p_access, i_int, args );
-            if( i_int == ACCESS_SET_TITLE || i_int == ACCESS_SET_SEEKPOINT )
-                AStreamControlReset( s );
-            return i_ret;
+            return access_vaControl( p_access, i_int, args );
         }
 
         case STREAM_UPDATE_SIZE:
             AStreamControlUpdate( s );
             return VLC_SUCCESS;
 
+        case STREAM_GET_TITLE_INFO:
+            return access_vaControl( p_access, ACCESS_GET_TITLE_INFO, args );
         case STREAM_GET_CONTENT_TYPE:
             return access_vaControl( p_access, ACCESS_GET_CONTENT_TYPE, args );
 
         case STREAM_SET_PAUSE_STATE:
             return access_vaControl( p_access, ACCESS_SET_PAUSE_STATE, args );
+        case STREAM_SET_TITLE:
+        {
+            int ret = access_vaControl( p_access, ACCESS_SET_TITLE, args );
+            if( ret == VLC_SUCCESS )
+                AStreamControlReset( s );
+            return ret;
+        }
+        case STREAM_SET_SEEKPOINT:
+        {
+            int ret = access_vaControl( p_access, ACCESS_SET_SEEKPOINT, args );
+            if( ret == VLC_SUCCESS )
+                AStreamControlReset( s );
+            return ret;
+        }
 
         case STREAM_SET_RECORD_STATE:
         default:
diff --git a/src/input/stream_demux.c b/src/input/stream_demux.c
index dbd7eec..dfe045b 100644
--- a/src/input/stream_demux.c
+++ b/src/input/stream_demux.c
@@ -297,8 +297,11 @@ static int DStreamControl( stream_t *s, int i_query, va_list args )
         }
 
         case STREAM_CONTROL_ACCESS:
+        case STREAM_GET_TITLE_INFO:
         case STREAM_GET_CONTENT_TYPE:
         case STREAM_SET_PAUSE_STATE:
+        case STREAM_SET_TITLE:
+        case STREAM_SET_SEEKPOINT:
         case STREAM_SET_RECORD_STATE:
             return VLC_EGENERIC;
 
diff --git a/src/input/stream_memory.c b/src/input/stream_memory.c
index 4fce667..85f6e4b 100644
--- a/src/input/stream_memory.c
+++ b/src/input/stream_memory.c
@@ -122,7 +122,10 @@ static int Control( stream_t *s, int i_query, va_list args )
             p_sys->i_pos = i_64;
             break;
 
+        case STREAM_GET_TITLE_INFO:
         case STREAM_GET_CONTENT_TYPE:
+        case STREAM_SET_TITLE:
+        case STREAM_SET_SEEKPOINT:
             return VLC_EGENERIC;
 
         case STREAM_SET_PAUSE_STATE:



More information about the vlc-commits mailing list