]> git.sesse.net Git - vlc/commitdiff
stream: add explicit controls for titles and seekpoints
authorRémi Denis-Courmont <remi@remlab.net>
Wed, 17 Apr 2013 19:55:29 +0000 (22:55 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Wed, 17 Apr 2013 19:57:45 +0000 (22:57 +0300)
include/vlc_stream.h
src/input/input.c
src/input/stream.c
src/input/stream_demux.c
src/input/stream_memory.c

index c85f8e5eba42ca8531d1f28b3618a94aebd1657f..0890c5464c9efc04782198295d711ccdc88321be 100644 (file)
@@ -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 */
index 0796c587b23320f45c1ad549ce6aca5fee99dcac..51de64133f6944433d191e4b1b71349d3c521435 100644 (file)
@@ -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,
index 76de575ae93941925ff9c727420db6ace8d4e182..f978fc697ad4ad71e6d1147da8ae122be9447de3 100644 (file)
@@ -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:
index dbd7eec846b46bf81a33fabed0519e67fe5bf4f5..dfe045bdaa19f819bc6248c253ad7cfe5fe04847 100644 (file)
@@ -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;
 
index 4fce667441b3283a095eb5340e73fe87fd20534a..85f6e4b92fc743c69bf49a8ae8694788755074a0 100644 (file)
@@ -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: