[vlc-commits] input: remove bookmark handling

Thomas Guillem git at videolan.org
Thu May 23 10:22:01 CEST 2019


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri May 10 15:20:48 2019 +0200| [737e7db0a04e9d113f88d54f837e2d9c1117fa33] | committer: Thomas Guillem

input: remove bookmark handling

It is unusable now, since there is no player API for it. It need to be handled
by the media library module.

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

 include/vlc_input.h        |   9 ----
 src/input/control.c        | 123 ---------------------------------------------
 src/input/input.c          |  90 +--------------------------------
 src/input/input_internal.h |   5 --
 4 files changed, 1 insertion(+), 226 deletions(-)

diff --git a/include/vlc_input.h b/include/vlc_input.h
index 7d417b5388..4da5d09c6f 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -552,15 +552,6 @@ enum input_query_e
     /** Activate disc Root Menu. res=can fail */
     INPUT_NAV_MENU,
 
-    /* bookmarks */
-    INPUT_GET_BOOKMARK,    /* arg1= seekpoint_t *               res=can fail */
-    INPUT_GET_BOOKMARKS,   /* arg1= seekpoint_t *** arg2= int * res=can fail */
-    INPUT_CLEAR_BOOKMARKS, /* res=can fail */
-    INPUT_ADD_BOOKMARK,    /* arg1= seekpoint_t *  res=can fail   */
-    INPUT_CHANGE_BOOKMARK, /* arg1= seekpoint_t * arg2= int * res=can fail   */
-    INPUT_DEL_BOOKMARK,    /* arg1= seekpoint_t *  res=can fail   */
-    INPUT_SET_BOOKMARK,    /* arg1= int  res=can fail    */
-
     /* On the fly input slave */
     INPUT_ADD_SLAVE,       /* arg1= enum slave_type, arg2= const char *,
                             * arg3= bool forced, arg4= bool notify,
diff --git a/src/input/control.c b/src/input/control.c
index e3401044a9..14d871072d 100644
--- a/src/input/control.c
+++ b/src/input/control.c
@@ -81,129 +81,6 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
                                + INPUT_CONTROL_NAV_ACTIVATE, NULL );
             return VLC_SUCCESS;
 
-        case INPUT_ADD_BOOKMARK:
-            p_bkmk = va_arg( args, seekpoint_t * );
-            p_bkmk = vlc_seekpoint_Duplicate( p_bkmk );
-
-            vlc_mutex_lock( &priv->p_item->lock );
-            if( !p_bkmk->psz_name )
-            {
-                 if( asprintf( &p_bkmk->psz_name, _("Bookmark %i"),
-                               priv->i_bookmark ) == -1 )
-                     p_bkmk->psz_name = NULL;
-            }
-
-            if( p_bkmk->psz_name )
-                TAB_APPEND( priv->i_bookmark, priv->pp_bookmark, p_bkmk );
-            else
-            {
-                vlc_seekpoint_Delete( p_bkmk );
-                p_bkmk = NULL;
-            }
-            vlc_mutex_unlock( &priv->p_item->lock );
-
-            input_SendEventBookmark( p_input );
-
-            return p_bkmk ? VLC_SUCCESS : VLC_EGENERIC;
-
-        case INPUT_CHANGE_BOOKMARK:
-            p_bkmk = va_arg( args, seekpoint_t * );
-            i_bkmk = va_arg( args, int );
-
-            vlc_mutex_lock( &priv->p_item->lock );
-            if( i_bkmk < priv->i_bookmark )
-            {
-                p_bkmk = vlc_seekpoint_Duplicate( p_bkmk );
-                if( p_bkmk )
-                {
-                    vlc_seekpoint_Delete( priv->pp_bookmark[i_bkmk] );
-                    priv->pp_bookmark[i_bkmk] = p_bkmk;
-                }
-            }
-            else p_bkmk = NULL;
-            vlc_mutex_unlock( &priv->p_item->lock );
-
-            input_SendEventBookmark( p_input );
-
-            return p_bkmk ? VLC_SUCCESS : VLC_EGENERIC;
-
-        case INPUT_DEL_BOOKMARK:
-            i_bkmk = va_arg( args, int );
-
-            vlc_mutex_lock( &priv->p_item->lock );
-            if( i_bkmk < priv->i_bookmark )
-            {
-                p_bkmk = priv->pp_bookmark[i_bkmk];
-                TAB_REMOVE( priv->i_bookmark, priv->pp_bookmark, p_bkmk );
-                vlc_seekpoint_Delete( p_bkmk );
-
-                vlc_mutex_unlock( &priv->p_item->lock );
-
-                input_SendEventBookmark( p_input );
-
-                return VLC_SUCCESS;
-            }
-            vlc_mutex_unlock( &priv->p_item->lock );
-
-            return VLC_EGENERIC;
-
-        case INPUT_GET_BOOKMARKS:
-            ppp_bkmk = va_arg( args, seekpoint_t *** );
-            pi_bkmk = va_arg( args, int * );
-
-            vlc_mutex_lock( &priv->p_item->lock );
-            if( priv->i_bookmark )
-            {
-                int i;
-
-                *pi_bkmk = priv->i_bookmark;
-                *ppp_bkmk = vlc_alloc( priv->i_bookmark, sizeof(seekpoint_t *) );
-                for( i = 0; i < priv->i_bookmark; i++ )
-                {
-                    (*ppp_bkmk)[i] =
-                        vlc_seekpoint_Duplicate( input_priv(p_input)->pp_bookmark[i] );
-                }
-
-                vlc_mutex_unlock( &priv->p_item->lock );
-                return VLC_SUCCESS;
-            }
-            else
-            {
-                *ppp_bkmk = NULL;
-                *pi_bkmk = 0;
-
-                vlc_mutex_unlock( &priv->p_item->lock );
-                return VLC_EGENERIC;
-            }
-            break;
-
-        case INPUT_CLEAR_BOOKMARKS:
-            vlc_mutex_lock( &priv->p_item->lock );
-            for( int i = 0; i < priv->i_bookmark; ++i )
-                vlc_seekpoint_Delete( priv->pp_bookmark[i] );
-
-            TAB_CLEAN( priv->i_bookmark, priv->pp_bookmark );
-            vlc_mutex_unlock( &priv->p_item->lock );
-
-            input_SendEventBookmark( p_input );
-            return VLC_SUCCESS;
-
-        case INPUT_SET_BOOKMARK:
-            i_bkmk = va_arg( args, int );
-
-            val.i_int = i_bkmk;
-            input_ControlPushHelper( p_input, INPUT_CONTROL_SET_BOOKMARK, &val );
-
-            return VLC_SUCCESS;
-
-        case INPUT_GET_BOOKMARK:
-            p_bkmk = va_arg( args, seekpoint_t * );
-
-            vlc_mutex_lock( &priv->p_item->lock );
-            *p_bkmk = priv->bookmark;
-            vlc_mutex_unlock( &priv->p_item->lock );
-            return VLC_SUCCESS;
-
         case INPUT_ADD_SLAVE:
         {
             enum slave_type type =  va_arg( args, enum slave_type );
diff --git a/src/input/input.c b/src/input/input.c
index 6759b72f73..4aa89c8091 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -330,8 +330,6 @@ static input_thread_t *Create( vlc_object_t *p_parent,
     priv->is_stopped = false;
     priv->b_recording = false;
     priv->rate = 1.f;
-    memset( &priv->bookmark, 0, sizeof(priv->bookmark) );
-    TAB_INIT( priv->i_bookmark, priv->pp_bookmark );
     TAB_INIT( priv->i_attachment, priv->attachment );
     priv->attachment_demux = NULL;
     priv->p_sout   = NULL;
@@ -426,58 +424,6 @@ static input_thread_t *Create( vlc_object_t *p_parent,
         VLC_TICK_FROM_MS( var_GetInteger( p_input, "audio-desync" ) );
     priv->i_spu_delay = 0;
 
-    /* */
-    if( !priv->b_preparsing )
-    {
-        char *psz_bookmarks = var_GetNonEmptyString( p_input, "bookmarks" );
-        if( psz_bookmarks )
-        {
-            /* FIXME: have a common cfg parsing routine used by sout and others */
-            char *psz_parser, *psz_start, *psz_end;
-            psz_parser = psz_bookmarks;
-            while( (psz_start = strchr( psz_parser, '{' ) ) )
-            {
-                 seekpoint_t *p_seekpoint;
-                 char backup;
-                 psz_start++;
-                 psz_end = strchr( psz_start, '}' );
-                 if( !psz_end ) break;
-                 psz_parser = psz_end + 1;
-                 backup = *psz_parser;
-                 *psz_parser = 0;
-                 *psz_end = ',';
-
-                 p_seekpoint = vlc_seekpoint_New();
-
-                 if( unlikely( p_seekpoint == NULL ) )
-                     break;
-
-                 while( (psz_end = strchr( psz_start, ',' ) ) )
-                 {
-                     *psz_end = 0;
-                     if( !strncmp( psz_start, "name=", 5 ) )
-                     {
-                         free( p_seekpoint->psz_name );
-
-                         p_seekpoint->psz_name = strdup(psz_start + 5);
-                     }
-                     else if( !strncmp( psz_start, "time=", 5 ) )
-                     {
-                         p_seekpoint->i_time_offset = vlc_tick_from_sec(atof(psz_start + 5));
-                     }
-                     psz_start = psz_end + 1;
-                }
-                msg_Dbg( p_input, "adding bookmark: %s, time=%"PRId64,
-                                  p_seekpoint->psz_name,
-                                  p_seekpoint->i_time_offset );
-                input_Control( p_input, INPUT_ADD_BOOKMARK, p_seekpoint );
-                vlc_seekpoint_Delete( p_seekpoint );
-                *psz_parser = backup;
-            }
-            free( psz_bookmarks );
-        }
-    }
-
     /* Remove 'Now playing' info as it is probably outdated */
     input_item_SetNowPlaying( p_item, NULL );
     input_item_SetESNowPlaying( p_item, NULL );
@@ -737,9 +683,7 @@ static void MainLoopStatistics( input_thread_t *p_input )
     if( priv->stats != NULL )
         input_stats_Compute( priv->stats, &new_stats );
 
-    /* update current bookmark */
     vlc_mutex_lock( &priv->p_item->lock );
-    priv->bookmark.i_time_offset = i_time;
     if( priv->stats != NULL )
         *priv->p_item->p_stats = new_stats;
     vlc_mutex_unlock( &priv->p_item->lock );
@@ -1521,11 +1465,6 @@ static void End( input_thread_t * p_input )
         priv->attachment_demux = NULL;
     }
 
-    /* clean bookmarks */
-    for( int i = 0; i < priv->i_bookmark; ++i )
-        vlc_seekpoint_Delete( priv->pp_bookmark[i] );
-    TAB_CLEAN( priv->i_bookmark, priv->pp_bookmark );
-
     vlc_mutex_unlock( &input_priv(p_input)->p_item->lock );
 
     /* */
@@ -1587,8 +1526,7 @@ static size_t ControlGetReducedIndexLocked( input_thread_t *p_input )
               i_ct == INPUT_CONTROL_SET_TIME ||
               i_ct == INPUT_CONTROL_SET_PROGRAM ||
               i_ct == INPUT_CONTROL_SET_TITLE ||
-              i_ct == INPUT_CONTROL_SET_SEEKPOINT ||
-              i_ct == INPUT_CONTROL_SET_BOOKMARK ) )
+              i_ct == INPUT_CONTROL_SET_SEEKPOINT ) )
         {
             continue;
         }
@@ -1671,7 +1609,6 @@ static bool ControlIsSeekRequest( int i_type )
     case INPUT_CONTROL_SET_SEEKPOINT:
     case INPUT_CONTROL_SET_SEEKPOINT_NEXT:
     case INPUT_CONTROL_SET_SEEKPOINT_PREV:
-    case INPUT_CONTROL_SET_BOOKMARK:
     case INPUT_CONTROL_NAV_ACTIVATE:
     case INPUT_CONTROL_NAV_UP:
     case INPUT_CONTROL_NAV_DOWN:
@@ -2317,31 +2254,6 @@ static bool Control( input_thread_t *p_input,
             b_force_update = true;
             break;
 
-        case INPUT_CONTROL_SET_BOOKMARK:
-        {
-            vlc_tick_t time_offset = -1;
-            int bookmark = param.val.i_int;
-
-            vlc_mutex_lock( &priv->p_item->lock );
-            if( bookmark >= 0 && bookmark < priv->i_bookmark )
-            {
-                const seekpoint_t *p_bookmark = priv->pp_bookmark[bookmark];
-                time_offset = p_bookmark->i_time_offset;
-            }
-            vlc_mutex_unlock( &priv->p_item->lock );
-
-            if( time_offset < 0 )
-            {
-                msg_Err( p_input, "invalid bookmark %d", bookmark );
-                break;
-            }
-
-            b_force_update =
-                Control( p_input, INPUT_CONTROL_SET_TIME,
-                         (input_control_param_t) { .time.i_val = time_offset,
-                                                   .time.b_fast_seek = false } );
-            break;
-        }
         case INPUT_CONTROL_SET_RENDERER:
         {
 #ifdef ENABLE_SOUT
diff --git a/src/input/input_internal.h b/src/input/input_internal.h
index cc70b44b6d..cde2f1fa58 100644
--- a/src/input/input_internal.h
+++ b/src/input/input_internal.h
@@ -156,11 +156,6 @@ typedef struct input_thread_private_t
     int i_title_offset;
     int i_seekpoint_offset;
 
-    /* User bookmarks FIXME won't be easy with multiples input */
-    seekpoint_t bookmark;
-    int         i_bookmark;
-    seekpoint_t **pp_bookmark;
-
     /* Input attachment */
     int i_attachment;
     input_attachment_t **attachment;



More information about the vlc-commits mailing list