make the previous-chapter "intelligent" seek more general, remove DEMUX_GET_SEEKPOINT...
authorSteve Lhomme <robux@videolan.org>
Mon, 7 Mar 2005 20:16:52 +0000 (20:16 +0000)
committerSteve Lhomme <robux@videolan.org>
Mon, 7 Mar 2005 20:16:52 +0000 (20:16 +0000)
include/vlc_demux.h
include/vlc_input.h
modules/demux/mkv.cpp
src/input/control.c
src/input/input.c

index 2eefcb8..7c4385b 100644 (file)
@@ -82,7 +82,6 @@ enum demux_query_e
     /* TITLE/SEEKPOINT, only when TITLE_INFO succeed */
     DEMUX_SET_TITLE,            /* arg1= int            can fail */
     DEMUX_SET_SEEKPOINT,        /* arg1= int            can fail */
-    DEMUX_GET_SEEKPOINT_TIME,   /* arg1= int arg2 = mtime_t *  res = can fail   */
 
     /* DEMUX_SET_GROUP only a hit for demuxer (mainly DVB) to allow not
      * reading everything (you should not use this to call es_out_Control)
index 29c5287..78e2720 100644 (file)
@@ -176,7 +176,7 @@ static inline seekpoint_t *vlc_seekpoint_New( void )
 {
     seekpoint_t *point = (seekpoint_t*)malloc( sizeof( seekpoint_t ) );
     point->i_byte_offset =
-    point->i_time_offset = 0;
+    point->i_time_offset = -1;
     point->i_level = 0;
     point->psz_name = NULL;
     return point;
index c7225a3..858e5dc 100644 (file)
@@ -1197,16 +1197,6 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             }
             return VLC_EGENERIC;
 
-        case DEMUX_GET_SEEKPOINT_TIME:
-            i_skp = (int)va_arg( args, int );
-            i_sk_time = (mtime_t *)va_arg( args, mtime_t * );
-            if( p_sys->title && i_skp < p_sys->title->i_seekpoint)
-            {
-                *i_sk_time = p_sys->title->seekpoint[i_skp]->i_time_offset;
-                return VLC_SUCCESS;
-            }
-            return VLC_EGENERIC;
-
         case DEMUX_SET_TIME:
         case DEMUX_GET_FPS:
         default:
index 25f5052..9ae0732 100644 (file)
@@ -384,12 +384,12 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
                 vlc_value_t pos;
                 int i_ret;
 
-                if( p_input->bookmark[i_bkmk]->i_time_offset )
+                if( p_input->bookmark[i_bkmk]->i_time_offset != -1 )
                 {
                     pos.i_time = p_input->bookmark[i_bkmk]->i_time_offset;
                     i_ret = var_Set( p_input, "time", pos );
                 }
-                else if( p_input->bookmark[i_bkmk]->i_byte_offset )
+                else if( p_input->bookmark[i_bkmk]->i_byte_offset != -1 )
                 {
                     // don't crash on bookmarks in live streams
                     if( stream_Size( p_input->input.p_stream ) == 0 )
index 6211177..bb0eef4 100644 (file)
@@ -183,7 +183,7 @@ input_thread_t *__input_CreateThread( vlc_object_t *p_parent,
         psz_parser = val.psz_string;
         while( (psz_start = strchr( psz_parser, '{' ) ) )
         {
-            seekpoint_t seekpoint;
+            seekpoint_t *p_seekpoint = vlc_seekpoint_New();
             char backup;
             psz_start++;
             psz_end = strchr( psz_start, '}' );
@@ -193,30 +193,28 @@ input_thread_t *__input_CreateThread( vlc_object_t *p_parent,
             *psz_parser = 0;
             *psz_end = ',';
 
-            seekpoint.psz_name = 0;
-            seekpoint.i_byte_offset = 0;
-            seekpoint.i_time_offset = 0;
             while( (psz_end = strchr( psz_start, ',' ) ) )
             {
                 *psz_end = 0;
                 if( !strncmp( psz_start, "name=", 5 ) )
                 {
-                    seekpoint.psz_name = psz_start + 5;
+                    p_seekpoint->psz_name = psz_start + 5;
                 }
                 else if( !strncmp( psz_start, "bytes=", 6 ) )
                 {
-                    seekpoint.i_byte_offset = atoll(psz_start + 6);
+                    p_seekpoint->i_byte_offset = atoll(psz_start + 6);
                 }
                 else if( !strncmp( psz_start, "time=", 5 ) )
                 {
-                    seekpoint.i_time_offset = atoll(psz_start + 5) * 1000000;
+                    p_seekpoint->i_time_offset = atoll(psz_start + 5) * 1000000;
                 }
                 psz_start = psz_end + 1;
             }
             msg_Dbg( p_input, "adding bookmark: %s, bytes="I64Fd", time="I64Fd,
-                     seekpoint.psz_name, seekpoint.i_byte_offset,
-                     seekpoint.i_time_offset );
-            input_Control( p_input, INPUT_ADD_BOOKMARK, &seekpoint );
+                     p_seekpoint->psz_name, p_seekpoint->i_byte_offset,
+                     p_seekpoint->i_time_offset );
+            input_Control( p_input, INPUT_ADD_BOOKMARK, p_seekpoint );
+            vlc_seekpoint_Delete( p_seekpoint );
             *psz_parser = backup;
         }
         free( val.psz_string );
@@ -1499,7 +1497,8 @@ static vlc_bool_t Control( input_thread_t *p_input, int i_type,
                 if( i_type == INPUT_CONTROL_SET_SEEKPOINT_PREV )
                 {
                     i_seekpoint = p_demux->info.i_seekpoint;
-                    if (demux2_Control( p_demux, DEMUX_GET_SEEKPOINT_TIME, p_demux->info.i_seekpoint, &i_seekpoint_time) == VLC_SUCCESS)
+                    i_seekpoint_time = p_input->input.title[p_demux->info.i_title]->seekpoint[i_seekpoint]->i_time_offset;
+                    if ( i_seekpoint_time != -1 )
                     {
                         demux2_Control( p_demux, INPUT_GET_TIME, &i_input_time );
                         if ( i_input_time < i_seekpoint_time + 3000000 )