mirror of
https://github.com/videolan/vlc.git
synced 2025-01-27 01:56:19 +08:00
* src/playlist/*: when deleting the currently playing item, skip it instead of stopping the playlist.
* include/modules_inner.h, include/configuration.h: don't use a static array anymore during the initialization of the plugins, malloc it instead. This fixes regular overflow problems we have when we increase the number of options in the main module.
This commit is contained in:
parent
d0104ec8c8
commit
d3de64660f
@ -4,7 +4,7 @@
|
||||
* It includes functions allowing to declare, get or set configuration options.
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1999, 2000 VideoLAN
|
||||
* $Id: configuration.h,v 1.32 2003/11/05 00:39:16 gbazin Exp $
|
||||
* $Id: configuration.h,v 1.33 2003/12/13 17:16:11 gbazin Exp $
|
||||
*
|
||||
* Authors: Gildas Bazin <gbazin@netcourrier.com>
|
||||
*
|
||||
@ -139,46 +139,74 @@ VLC_EXPORT( void, config_UnsetCallbacks, ( module_config_t * ) );
|
||||
|
||||
#define add_category_hint( text, longtext, advc ) \
|
||||
i_config++; \
|
||||
if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
|
||||
(i_config+11) * sizeof(module_config_t)); \
|
||||
{ static module_config_t tmp = { CONFIG_HINT_CATEGORY, NULL, NULL, '\0', text, longtext }; p_config[ i_config ] = tmp; p_config[i_config].b_advanced = advc; }
|
||||
#define add_subcategory_hint( text, longtext ) \
|
||||
i_config++; \
|
||||
if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
|
||||
(i_config+11) * sizeof(module_config_t)); \
|
||||
{ static module_config_t tmp = { CONFIG_HINT_SUBCATEGORY, NULL, NULL, '\0', text, longtext }; p_config[ i_config ] = tmp; }
|
||||
#define end_subcategory_hint \
|
||||
i_config++; \
|
||||
if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
|
||||
(i_config+11) * sizeof(module_config_t)); \
|
||||
{ static module_config_t tmp = { CONFIG_HINT_SUBCATEGORY_END, NULL, NULL, '\0' }; p_config[ i_config ] = tmp; }
|
||||
#define add_usage_hint( text ) \
|
||||
i_config++; \
|
||||
if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
|
||||
(i_config+11) * sizeof(module_config_t)); \
|
||||
{ static module_config_t tmp = { CONFIG_HINT_USAGE, NULL, NULL, '\0', text }; p_config[ i_config ] = tmp; }
|
||||
|
||||
#define add_string( name, psz_value, p_callback, text, longtext, advc ) \
|
||||
i_config++; \
|
||||
if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
|
||||
(i_config+11) * sizeof(module_config_t)); \
|
||||
{ static module_config_t tmp = { CONFIG_ITEM_STRING, NULL, name, '\0', text, longtext, psz_value }; tmp.b_advanced = advc; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; }
|
||||
#define add_file( name, psz_value, p_callback, text, longtext, advc ) \
|
||||
i_config++; \
|
||||
if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
|
||||
(i_config+11) * sizeof(module_config_t)); \
|
||||
{ static module_config_t tmp = { CONFIG_ITEM_FILE, NULL, name, '\0', text, longtext, psz_value, 0, 0 }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; }
|
||||
#define add_directory( name, psz_value, p_callback, text, longtext, advc ) \
|
||||
i_config++; \
|
||||
if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
|
||||
(i_config+11) * sizeof(module_config_t)); \
|
||||
{ static module_config_t tmp = { CONFIG_ITEM_DIRECTORY, NULL, name, '\0', text, longtext, psz_value, 0, 0 }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; }
|
||||
#define add_module( name, psz_caps, psz_value, p_callback, text, longtext, advc ) \
|
||||
i_config++; \
|
||||
if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
|
||||
(i_config+11) * sizeof(module_config_t)); \
|
||||
{ static module_config_t tmp = { CONFIG_ITEM_MODULE, psz_caps, name, '\0', text, longtext, psz_value }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; }
|
||||
#define add_integer( name, i_value, p_callback, text, longtext, advc ) \
|
||||
i_config++; \
|
||||
if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
|
||||
(i_config+11) * sizeof(module_config_t)); \
|
||||
{ static module_config_t tmp = { CONFIG_ITEM_INTEGER, NULL, name, '\0', text, longtext, NULL, i_value }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; }
|
||||
#define add_key( name, i_value, p_callback, text, longtext, advc ) \
|
||||
i_config++; \
|
||||
if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
|
||||
(i_config+11) * sizeof(module_config_t)); \
|
||||
{ static module_config_t tmp = { CONFIG_ITEM_KEY, NULL, name, '\0', text, longtext, NULL, i_value }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; }
|
||||
#define add_integer_with_range( name, i_value, i_min, i_max, p_callback, text, longtext, advc ) \
|
||||
i_config++; \
|
||||
if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
|
||||
(i_config+11) * sizeof(module_config_t)); \
|
||||
{ static module_config_t tmp = { CONFIG_ITEM_INTEGER, NULL, name, '\0', text, longtext, NULL, i_value, 0, i_min, i_max }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; }
|
||||
#define add_float( name, f_value, p_callback, text, longtext, advc ) \
|
||||
i_config++; \
|
||||
if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
|
||||
(i_config+11) * sizeof(module_config_t)); \
|
||||
{ static module_config_t tmp = { CONFIG_ITEM_FLOAT, NULL, name, '\0', text, longtext, NULL, 0, f_value }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; }
|
||||
#define add_float_with_range( name, f_value, f_min, f_max, p_callback, text, longtext, advc ) \
|
||||
i_config++; \
|
||||
if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
|
||||
(i_config+11) * sizeof(module_config_t)); \
|
||||
{ static module_config_t tmp = { CONFIG_ITEM_FLOAT, NULL, name, '\0', text, longtext, NULL, 0, f_value, 0, 0, f_min, f_max }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; }
|
||||
#define add_bool( name, b_value, p_callback, text, longtext, advc ) \
|
||||
i_config++; \
|
||||
if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
|
||||
(i_config+11) * sizeof(module_config_t)); \
|
||||
{ static module_config_t tmp = { CONFIG_ITEM_BOOL, NULL, name, '\0', text, longtext, NULL, b_value }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; }
|
||||
|
||||
/* Modifier macros for the config options (used for fine tuning) */
|
||||
|
@ -2,7 +2,7 @@
|
||||
* modules_inner.h : Macros used from within a module.
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2001 VideoLAN
|
||||
* $Id: modules_inner.h,v 1.40 2003/11/05 00:39:16 gbazin Exp $
|
||||
* $Id: modules_inner.h,v 1.41 2003/12/13 17:16:11 gbazin Exp $
|
||||
*
|
||||
* Authors: Samuel Hocevar <sam@zoy.org>
|
||||
*
|
||||
@ -92,7 +92,7 @@
|
||||
__VLC_SYMBOL(vlc_entry) ( module_t *p_module ) \
|
||||
{ \
|
||||
int i_shortcut = 1, i_config = -1; \
|
||||
module_config_t p_config[ 130 ]; \
|
||||
module_config_t *p_config = NULL; \
|
||||
STORE_SYMBOLS; \
|
||||
p_module->b_submodule = VLC_FALSE; \
|
||||
p_module->b_unloadable = VLC_TRUE; \
|
||||
@ -112,11 +112,13 @@
|
||||
#define vlc_module_end( ) \
|
||||
p_submodule->pp_shortcuts[ i_shortcut ] = NULL; \
|
||||
} \
|
||||
if( p_config ) \
|
||||
{ \
|
||||
static module_config_t tmp = { CONFIG_HINT_END }; \
|
||||
p_config[ ++i_config ] = tmp; \
|
||||
p_config[ ++i_config ] = (module_config_t){ CONFIG_HINT_END }; \
|
||||
config_Duplicate( p_module, p_config ); \
|
||||
free( p_config ); \
|
||||
} \
|
||||
config_Duplicate( p_module, p_config ); \
|
||||
else config_Duplicate(p_module, &(module_config_t){CONFIG_HINT_END}); \
|
||||
if( p_module->p_config == NULL ) \
|
||||
{ \
|
||||
return VLC_EGENERIC; \
|
||||
|
@ -2,7 +2,7 @@
|
||||
* item.c : Playlist item functions
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1999-2001 VideoLAN
|
||||
* $Id: item.c,v 1.8 2003/12/05 02:12:53 rocky Exp $
|
||||
* $Id: item.c,v 1.9 2003/12/13 17:16:11 gbazin Exp $
|
||||
*
|
||||
* Authors: Samuel Hocevar <sam@zoy.org>
|
||||
*
|
||||
@ -262,9 +262,10 @@ int playlist_Delete( playlist_t * p_playlist, int i_pos )
|
||||
vlc_value_t val;
|
||||
|
||||
/* if i_pos is the current played item, playlist should stop playing it */
|
||||
if( ( p_playlist->i_status == PLAYLIST_RUNNING) && (p_playlist->i_index == i_pos) )
|
||||
if( p_playlist->i_status == PLAYLIST_RUNNING &&
|
||||
p_playlist->i_index == i_pos )
|
||||
{
|
||||
playlist_Command( p_playlist, PLAYLIST_STOP, 0 );
|
||||
playlist_Command( p_playlist, PLAYLIST_SKIP, 1 );
|
||||
}
|
||||
|
||||
vlc_mutex_lock( &p_playlist->object_lock );
|
||||
|
@ -2,7 +2,7 @@
|
||||
* playlist.c : Playlist management functions
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1999-2001 VideoLAN
|
||||
* $Id: playlist.c,v 1.69 2003/12/07 19:06:21 jpsaman Exp $
|
||||
* $Id: playlist.c,v 1.70 2003/12/13 17:16:11 gbazin Exp $
|
||||
*
|
||||
* Authors: Samuel Hocevar <sam@zoy.org>
|
||||
*
|
||||
@ -344,14 +344,14 @@ static void RunThread ( playlist_t *p_playlist )
|
||||
{
|
||||
vlc_mutex_unlock( &p_playlist->object_lock );
|
||||
playlist_Delete( p_playlist, p_playlist->i_index );
|
||||
vlc_mutex_lock( &p_playlist->object_lock );
|
||||
}
|
||||
|
||||
/* Select the next playlist item */
|
||||
SkipItem( p_playlist, 1 );
|
||||
|
||||
input_StopThread( p_playlist->p_input );
|
||||
vlc_mutex_unlock( &p_playlist->object_lock );
|
||||
else
|
||||
{
|
||||
/* Select the next playlist item */
|
||||
SkipItem( p_playlist, 1 );
|
||||
input_StopThread( p_playlist->p_input );
|
||||
vlc_mutex_unlock( &p_playlist->object_lock );
|
||||
}
|
||||
|
||||
val.b_bool = VLC_TRUE;
|
||||
var_Set( p_playlist, "intf-change", val );
|
||||
|
Loading…
Reference in New Issue
Block a user