[vlc-commits] variables: pass vlc_list_t directly with VLC_VAR_GETCHOICES
Rémi Denis-Courmont
git at videolan.org
Sun Jun 10 12:11:16 CEST 2018
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jun 9 16:08:47 2018 +0300| [63ce43622549be7e1ea58b9d98eaa856343fbac5] | committer: Rémi Denis-Courmont
variables: pass vlc_list_t directly with VLC_VAR_GETCHOICES
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=63ce43622549be7e1ea58b9d98eaa856343fbac5
---
include/vlc_variables.h | 2 +-
lib/audio.c | 8 +-
lib/media_player.c | 10 +-
lib/video.c | 24 ++--
modules/control/gestures.c | 28 ++--
modules/control/hotkeys.c | 177 +++++++++++++-----------
modules/control/oldrc.c | 56 ++++----
modules/gui/macosx/VLCMainMenu.m | 21 +--
modules/gui/ncurses.c | 15 +-
modules/gui/qt/components/controller_widget.cpp | 8 +-
modules/gui/qt/components/extended_panels.cpp | 18 +--
modules/gui/qt/input_manager.cpp | 14 +-
modules/gui/qt/menus.cpp | 9 +-
modules/lua/libs/variables.c | 7 +-
src/audio_output/output.c | 8 +-
src/input/input.c | 8 +-
src/misc/variables.c | 62 ++++-----
test/src/misc/variables.c | 14 +-
18 files changed, 249 insertions(+), 240 deletions(-)
diff --git a/include/vlc_variables.h b/include/vlc_variables.h
index 5442782be3..4cf328822a 100644
--- a/include/vlc_variables.h
+++ b/include/vlc_variables.h
@@ -212,7 +212,7 @@ VLC_API int var_Inherit( vlc_object_t *, const char *, int, vlc_value_t * );
* @param p_val: the list variable
* @param p_val2: the variable associated or NULL
*/
-VLC_API void var_FreeList( vlc_value_t *, vlc_value_t * );
+VLC_API void var_FreeList( vlc_list_t *, vlc_list_t * );
/*****************************************************************************
diff --git a/lib/audio.c b/lib/audio.c
index 0ea1cd4023..23280ff60a 100644
--- a/lib/audio.c
+++ b/lib/audio.c
@@ -381,17 +381,17 @@ int libvlc_audio_get_track( libvlc_media_player_t *p_mi )
int libvlc_audio_set_track( libvlc_media_player_t *p_mi, int i_track )
{
input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi );
- vlc_value_t val_list;
+ vlc_list_t val_list;
int i_ret = -1;
if( !p_input_thread )
return -1;
var_Change( p_input_thread, "audio-es", VLC_VAR_GETCHOICES, &val_list,
- (vlc_value_t *)NULL );
- for( int i = 0; i < val_list.p_list->i_count; i++ )
+ (vlc_list_t *)NULL );
+ for( int i = 0; i < val_list.i_count; i++ )
{
- if( i_track == val_list.p_list->p_values[i].i_int )
+ if( i_track == val_list.p_values[i].i_int )
{
if( var_SetInteger( p_input_thread, "audio-es", i_track ) < 0 )
break;
diff --git a/lib/media_player.c b/lib/media_player.c
index a4ea86b300..dc5813227a 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -1788,13 +1788,13 @@ libvlc_track_description_t *
if( !p_input )
return NULL;
- vlc_value_t val_list, text_list;
+ vlc_list_t val_list, text_list;
int i_ret = var_Change( p_input, psz_variable, VLC_VAR_GETCHOICES, &val_list, &text_list );
if( i_ret != VLC_SUCCESS )
return NULL;
/* no tracks */
- if( val_list.p_list->i_count <= 0 )
+ if( val_list.i_count <= 0 )
goto end;
p_track_description = malloc( sizeof *p_track_description );
@@ -1805,7 +1805,7 @@ libvlc_track_description_t *
}
p_actual = p_track_description;
p_previous = NULL;
- for( int i = 0; i < val_list.p_list->i_count; i++ )
+ for( int i = 0; i < val_list.i_count; i++ )
{
if( !p_actual )
{
@@ -1819,8 +1819,8 @@ libvlc_track_description_t *
goto end;
}
}
- p_actual->i_id = val_list.p_list->p_values[i].i_int;
- p_actual->psz_name = strdup( text_list.p_list->p_values[i].psz_string );
+ p_actual->i_id = val_list.p_values[i].i_int;
+ p_actual->psz_name = strdup( text_list.p_values[i].psz_string );
p_actual->p_next = NULL;
if( p_previous )
p_previous->p_next = p_actual;
diff --git a/lib/video.c b/lib/video.c
index e9f95fc2c7..d34862e8b0 100644
--- a/lib/video.c
+++ b/lib/video.c
@@ -353,17 +353,17 @@ libvlc_track_description_t *
int libvlc_video_set_spu( libvlc_media_player_t *p_mi, int i_spu )
{
input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi );
- vlc_value_t list;
+ vlc_list_t list;
int i_ret = -1;
if( !p_input_thread )
return -1;
var_Change(p_input_thread, "spu-es", VLC_VAR_GETCHOICES, &list,
- (vlc_value_t *)NULL);
- for (int i = 0; i < list.p_list->i_count; i++)
+ (vlc_list_t *)NULL);
+ for (int i = 0; i < list.i_count; i++)
{
- if( i_spu == list.p_list->p_values[i].i_int )
+ if( i_spu == list.p_values[i].i_int )
{
if( var_SetInteger( p_input_thread, "spu-es", i_spu ) < 0 )
break;
@@ -451,13 +451,13 @@ static void teletext_enable( input_thread_t *p_input_thread, bool b_enable )
{
if( b_enable )
{
- vlc_value_t list;
+ vlc_list_t list;
if( !var_Change( p_input_thread, "teletext-es", VLC_VAR_GETCHOICES,
- &list, (vlc_value_t *)NULL ) )
+ &list, (vlc_list_t *)NULL ) )
{
- if( list.p_list->i_count > 0 )
+ if( list.i_count > 0 )
var_SetInteger( p_input_thread, "spu-es",
- list.p_list->p_values[0].i_int );
+ list.p_values[0].i_int );
var_FreeList( &list, NULL );
}
@@ -568,17 +568,17 @@ int libvlc_video_get_track( libvlc_media_player_t *p_mi )
int libvlc_video_set_track( libvlc_media_player_t *p_mi, int i_track )
{
input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi );
- vlc_value_t val_list;
+ vlc_list_t val_list;
int i_ret = -1;
if( !p_input_thread )
return -1;
var_Change( p_input_thread, "video-es", VLC_VAR_GETCHOICES, &val_list,
- (vlc_value_t *)NULL );
- for( int i = 0; i < val_list.p_list->i_count; i++ )
+ (vlc_list_t *)NULL );
+ for( int i = 0; i < val_list.i_count; i++ )
{
- if( i_track == val_list.p_list->p_values[i].i_int )
+ if( i_track == val_list.p_values[i].i_int )
{
if( var_SetInteger( p_input_thread, "video-es", i_track ) < 0 )
break;
diff --git a/modules/control/gestures.c b/modules/control/gestures.c
index 4fc28910bb..15ef58e81c 100644
--- a/modules/control/gestures.c
+++ b/modules/control/gestures.c
@@ -277,31 +277,31 @@ static void ProcessGesture( intf_thread_t *p_intf )
if( p_input == NULL )
break;
- vlc_value_t list, list2;
+ vlc_list_t list, list2;
var_Change( p_input, "audio-es", VLC_VAR_GETCHOICES,
&list, &list2 );
- if( list.p_list->i_count > 1 )
+ if( list.i_count > 1 )
{
int i_audio_es = var_GetInteger( p_input, "audio-es" );
int i;
- for( i = 0; i < list.p_list->i_count; i++ )
- if( i_audio_es == list.p_list->p_values[i].i_int )
+ for( i = 0; i < list.i_count; i++ )
+ if( i_audio_es == list.p_values[i].i_int )
break;
/* value of audio-es was not in choices list */
- if( i == list.p_list->i_count )
+ if( i == list.i_count )
{
msg_Warn( p_input,
"invalid current audio track, selecting 0" );
i = 0;
}
- else if( i == list.p_list->i_count - 1 )
+ else if( i == list.i_count - 1 )
i = 1;
else
i++;
var_SetInteger( p_input, "audio-es",
- list.p_list->p_values[i].i_int );
+ list.p_values[i].i_int );
}
var_FreeList( &list, &list2 );
vlc_object_release( p_input );
@@ -314,31 +314,31 @@ static void ProcessGesture( intf_thread_t *p_intf )
if( p_input == NULL )
break;
- vlc_value_t list, list2;
+ vlc_list_t list, list2;
var_Change( p_input, "spu-es", VLC_VAR_GETCHOICES,
&list, &list2 );
- if( list.p_list->i_count > 1 )
+ if( list.i_count > 1 )
{
int i_audio_es = var_GetInteger( p_input, "spu-es" );
int i;
- for( i = 0; i < list.p_list->i_count; i++ )
- if( i_audio_es == list.p_list->p_values[i].i_int )
+ for( i = 0; i < list.i_count; i++ )
+ if( i_audio_es == list.p_values[i].i_int )
break;
/* value of audio-es was not in choices list */
- if( i == list.p_list->i_count )
+ if( i == list.i_count )
{
msg_Warn( p_input,
"invalid current subtitle track, selecting 0" );
i = 0;
}
- else if( i == list.p_list->i_count - 1 )
+ else if( i == list.i_count - 1 )
i = 1;
else
i++;
var_SetInteger( p_input, "audio-es",
- list.p_list->p_values[i].i_int );
+ list.p_values[i].i_int );
}
var_FreeList( &list, &list2 );
vlc_object_release( p_input );
diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
index 40ed470f7e..220245a55c 100644
--- a/modules/control/hotkeys.c
+++ b/modules/control/hotkeys.c
@@ -627,14 +627,14 @@ static int PutAction( intf_thread_t *p_intf, input_thread_t *p_input,
case ACTIONID_SUBSYNC_MARKSUB:
if( p_input )
{
- vlc_value_t val, list, list2;
- int i_count;
- var_Get( p_input, "spu-es", &val );
+ vlc_value_t val;
+ vlc_list_t list, list2;
+ var_Get( p_input, "spu-es", &val );
var_Change( p_input, "spu-es", VLC_VAR_GETCHOICES,
&list, &list2 );
- i_count = list.p_list->i_count;
- if( i_count < 1 || val.i_int < 0 )
+
+ if( list.i_count < 1 || val.i_int < 0 )
{
DisplayMessage( p_vout, _("No active subtitle") );
var_FreeList( &list, &list2 );
@@ -696,14 +696,14 @@ static int PutAction( intf_thread_t *p_intf, input_thread_t *p_input,
int diff = (i_action == ACTIONID_SUBDELAY_UP) ? 50000 : -50000;
if( p_input )
{
- vlc_value_t val, list, list2;
- int i_count;
- var_Get( p_input, "spu-es", &val );
+ vlc_value_t val;
+ vlc_list_t list, list2;
+ var_Get( p_input, "spu-es", &val );
var_Change( p_input, "spu-es", VLC_VAR_GETCHOICES,
&list, &list2 );
- i_count = list.p_list->i_count;
- if( i_count < 1 || val.i_int < 0 )
+
+ if( list.i_count < 1 || val.i_int < 0 )
{
DisplayMessage( p_vout, _("No active subtitle") );
var_FreeList( &list, &list2 );
@@ -739,35 +739,38 @@ static int PutAction( intf_thread_t *p_intf, input_thread_t *p_input,
case ACTIONID_AUDIO_TRACK:
if( p_input )
{
- vlc_value_t val, list, list2;
- int i_count, i;
+ vlc_value_t val;
+ vlc_list_t list, list2;
+
var_Get( p_input, "audio-es", &val );
var_Change( p_input, "audio-es", VLC_VAR_GETCHOICES,
&list, &list2 );
- i_count = list.p_list->i_count;
- if( i_count > 1 )
+
+ if( list.i_count > 1 )
{
- for( i = 0; i < i_count; i++ )
+ int i;
+
+ for( i = 0; i < list.i_count; i++ )
{
- if( val.i_int == list.p_list->p_values[i].i_int )
+ if( val.i_int == list.p_values[i].i_int )
{
break;
}
}
/* value of audio-es was not in choices list */
- if( i == i_count )
+ if( i == list.i_count )
{
msg_Warn( p_input,
"invalid current audio track, selecting 0" );
i = 0;
}
- else if( i == i_count - 1 )
+ else if( i == list.i_count - 1 )
i = 1;
else
i++;
- var_Set( p_input, "audio-es", list.p_list->p_values[i] );
+ var_Set( p_input, "audio-es", list.p_values[i] );
DisplayMessage( p_vout, _("Audio track: %s"),
- list2.p_list->p_values[i].psz_string );
+ list2.p_values[i].psz_string );
}
var_FreeList( &list, &list2 );
}
@@ -777,54 +780,56 @@ static int PutAction( intf_thread_t *p_intf, input_thread_t *p_input,
case ACTIONID_SUBTITLE_REVERSE_TRACK:
if( p_input )
{
- vlc_value_t val, list, list2;
- int i_count, i;
+ vlc_value_t val;
+ vlc_list_t list, list2;
+ int i;
var_Get( p_input, "spu-es", &val );
var_Change( p_input, "spu-es", VLC_VAR_GETCHOICES,
&list, &list2 );
- i_count = list.p_list->i_count;
- if( i_count <= 1 )
+
+ if( list.i_count <= 1 )
{
DisplayMessage( p_vout, _("Subtitle track: %s"),
_("N/A") );
var_FreeList( &list, &list2 );
break;
}
- for( i = 0; i < i_count; i++ )
+ for( i = 0; i < list.i_count; i++ )
{
- if( val.i_int == list.p_list->p_values[i].i_int )
+ if( val.i_int == list.p_values[i].i_int )
{
break;
}
}
/* value of spu-es was not in choices list */
- if( i == i_count )
+ if( i == list.i_count )
{
msg_Warn( p_input,
"invalid current subtitle track, selecting 0" );
i = 0;
}
- else if ((i == i_count - 1) && (i_action == ACTIONID_SUBTITLE_TRACK))
+ else if ((i == list.i_count - 1) && (i_action == ACTIONID_SUBTITLE_TRACK))
i = 0;
else if ((i == 0) && (i_action == ACTIONID_SUBTITLE_REVERSE_TRACK))
- i = i_count - 1;
+ i = list.i_count - 1;
else
i = (i_action == ACTIONID_SUBTITLE_TRACK) ? i+1 : i-1;
- var_SetInteger( p_input, "spu-es", list.p_list->p_values[i].i_int );
+ var_SetInteger( p_input, "spu-es", list.p_values[i].i_int );
DisplayMessage( p_vout, _("Subtitle track: %s"),
- list2.p_list->p_values[i].psz_string );
+ list2.p_values[i].psz_string );
var_FreeList( &list, &list2 );
}
break;
case ACTIONID_SUBTITLE_TOGGLE:
if( p_input )
{
- vlc_value_t list, list2;
+ vlc_list_t list, list2;
+
var_Change( p_input, "spu-es", VLC_VAR_GETCHOICES,
&list, &list2 );
- int i_count = list.p_list->i_count;
- if( i_count <= 1 )
+
+ if( list.i_count <= 1 )
{
DisplayMessage( p_vout, _("Subtitle track: %s"),
_("N/A") );
@@ -852,18 +857,18 @@ static int PutAction( intf_thread_t *p_intf, input_thread_t *p_input,
/* if subtitles were disabled with no saved id, use the first track */
if( i_cur_id != -1 || i_new_id != -1 )
{
- for( int i = 0; i < i_count; ++i )
+ for( int i = 0; i < list.i_count; ++i )
{
- if( i_new_id == list.p_list->p_values[i].i_int )
+ if( i_new_id == list.p_values[i].i_int )
{
i_new_index = i;
break;
}
}
}
- var_SetInteger( p_input, "spu-es", list.p_list->p_values[i_new_index].i_int );
+ var_SetInteger( p_input, "spu-es", list.p_values[i_new_index].i_int );
DisplayMessage( p_vout, _("Subtitle track: %s"),
- list2.p_list->p_values[i_new_index].psz_string );
+ list2.p_values[i_new_index].psz_string );
var_FreeList( &list, &list2 );
}
break;
@@ -871,49 +876,50 @@ static int PutAction( intf_thread_t *p_intf, input_thread_t *p_input,
case ACTIONID_PROGRAM_SID_PREV:
if( p_input )
{
- vlc_value_t val, list, list2;
- int i_count, i;
+ vlc_value_t val;
+ vlc_list_t list, list2;
+ int i;
var_Get( p_input, "program", &val );
var_Change( p_input, "program", VLC_VAR_GETCHOICES,
&list, &list2 );
- i_count = list.p_list->i_count;
- if( i_count <= 1 )
+
+ if( list.i_count <= 1 )
{
DisplayMessage( p_vout, _("Program Service ID: %s"),
_("N/A") );
var_FreeList( &list, &list2 );
break;
}
- for( i = 0; i < i_count; i++ )
+ for( i = 0; i < list.i_count; i++ )
{
- if( val.i_int == list.p_list->p_values[i].i_int )
+ if( val.i_int == list.p_values[i].i_int )
{
break;
}
}
/* value of program sid was not in choices list */
- if( i == i_count )
+ if( i == list.i_count )
{
msg_Warn( p_input,
"invalid current program SID, selecting 0" );
i = 0;
}
else if( i_action == ACTIONID_PROGRAM_SID_NEXT ) {
- if( i == i_count - 1 )
+ if( i == list.i_count - 1 )
i = 0;
else
i++;
}
else { /* ACTIONID_PROGRAM_SID_PREV */
if( i == 0 )
- i = i_count - 1;
+ i = list.i_count - 1;
else
i--;
}
- var_Set( p_input, "program", list.p_list->p_values[i] );
+ var_Set( p_input, "program", list.p_values[i] );
DisplayMessage( p_vout, _("Program Service ID: %s"),
- list2.p_list->p_values[i].psz_string );
+ list2.p_values[i].psz_string );
var_FreeList( &list, &list2 );
}
break;
@@ -1037,26 +1043,28 @@ static int PutAction( intf_thread_t *p_intf, input_thread_t *p_input,
case ACTIONID_ASPECT_RATIO:
if( p_vout )
{
- vlc_value_t val={0}, val_list, text_list;
+ vlc_value_t val;
+ vlc_list_t val_list, text_list;
+
var_Get( p_vout, "aspect-ratio", &val );
if( var_Change( p_vout, "aspect-ratio", VLC_VAR_GETCHOICES,
&val_list, &text_list ) >= 0 )
{
int i;
- for( i = 0; i < val_list.p_list->i_count; i++ )
+ for( i = 0; i < val_list.i_count; i++ )
{
- if( !strcmp( val_list.p_list->p_values[i].psz_string,
+ if( !strcmp( val_list.p_values[i].psz_string,
val.psz_string ) )
{
i++;
break;
}
}
- if( i == val_list.p_list->i_count ) i = 0;
+ if( i == val_list.i_count ) i = 0;
var_SetString( p_vout, "aspect-ratio",
- val_list.p_list->p_values[i].psz_string );
+ val_list.p_values[i].psz_string );
DisplayMessage( p_vout, _("Aspect ratio: %s"),
- text_list.p_list->p_values[i].psz_string );
+ text_list.p_values[i].psz_string );
var_FreeList( &val_list, &text_list );
}
@@ -1067,26 +1075,28 @@ static int PutAction( intf_thread_t *p_intf, input_thread_t *p_input,
case ACTIONID_CROP:
if( p_vout )
{
- vlc_value_t val={0}, val_list, text_list;
+ vlc_value_t val;
+ vlc_list_t val_list, text_list;
+
var_Get( p_vout, "crop", &val );
if( var_Change( p_vout, "crop", VLC_VAR_GETCHOICES,
&val_list, &text_list ) >= 0 )
{
int i;
- for( i = 0; i < val_list.p_list->i_count; i++ )
+ for( i = 0; i < val_list.i_count; i++ )
{
- if( !strcmp( val_list.p_list->p_values[i].psz_string,
+ if( !strcmp( val_list.p_values[i].psz_string,
val.psz_string ) )
{
i++;
break;
}
}
- if( i == val_list.p_list->i_count ) i = 0;
+ if( i == val_list.i_count ) i = 0;
var_SetString( p_vout, "crop",
- val_list.p_list->p_values[i].psz_string );
+ val_list.p_values[i].psz_string );
DisplayMessage( p_vout, _("Crop: %s"),
- text_list.p_list->p_values[i].psz_string );
+ text_list.p_values[i].psz_string );
var_FreeList( &val_list, &text_list );
}
@@ -1215,16 +1225,17 @@ static int PutAction( intf_thread_t *p_intf, input_thread_t *p_input,
case ACTIONID_UNZOOM:
if( p_vout )
{
- vlc_value_t val={0}, val_list, text_list;
+ vlc_value_t val;
+ vlc_list_t val_list, text_list;
+
var_Get( p_vout, "zoom", &val );
if( var_Change( p_vout, "zoom", VLC_VAR_GETCHOICES,
&val_list, &text_list ) >= 0 )
{
int i;
- for( i = 0; i < val_list.p_list->i_count; i++ )
+ for( i = 0; i < val_list.i_count; i++ )
{
- if( val_list.p_list->p_values[i].f_float
- == val.f_float )
+ if( val_list.p_values[i].f_float == val.f_float )
{
if( i_action == ACTIONID_ZOOM )
i++;
@@ -1233,12 +1244,12 @@ static int PutAction( intf_thread_t *p_intf, input_thread_t *p_input,
break;
}
}
- if( i == val_list.p_list->i_count ) i = 0;
- if( i == -1 ) i = val_list.p_list->i_count-1;
+ if( i == val_list.i_count ) i = 0;
+ if( i == -1 ) i = val_list.i_count-1;
var_SetFloat( p_vout, "zoom",
- val_list.p_list->p_values[i].f_float );
+ val_list.p_values[i].f_float );
DisplayMessage( p_vout, _("Zoom mode: %s"),
- text_list.p_list->p_values[i].psz_string );
+ text_list.p_values[i].psz_string );
var_FreeList( &val_list, &text_list );
}
@@ -1259,15 +1270,15 @@ static int PutAction( intf_thread_t *p_intf, input_thread_t *p_input,
var_SetInteger( p_vout, "deinterlace", 1 );
char *psz_mode = var_GetString( p_vout, "deinterlace-mode" );
- vlc_value_t vlist, tlist;
+ vlc_list_t vlist, tlist;
if( psz_mode && !var_Change( p_vout, "deinterlace-mode", VLC_VAR_GETCHOICES, &vlist, &tlist ) )
{
const char *psz_text = NULL;
- for( int i = 0; i < vlist.p_list->i_count; i++ )
+ for( int i = 0; i < vlist.i_count; i++ )
{
- if( !strcmp( vlist.p_list->p_values[i].psz_string, psz_mode ) )
+ if( !strcmp( vlist.p_values[i].psz_string, psz_mode ) )
{
- psz_text = tlist.p_list->p_values[i].psz_string;
+ psz_text = tlist.p_values[i].psz_string;
break;
}
}
@@ -1284,22 +1295,23 @@ static int PutAction( intf_thread_t *p_intf, input_thread_t *p_input,
if( p_vout )
{
char *psz_mode = var_GetString( p_vout, "deinterlace-mode" );
- vlc_value_t vlist, tlist;
+ vlc_list_t vlist, tlist;
+
if( psz_mode && !var_Change( p_vout, "deinterlace-mode", VLC_VAR_GETCHOICES, &vlist, &tlist ))
{
const char *psz_text = NULL;
int i;
- for( i = 0; i < vlist.p_list->i_count; i++ )
+ for( i = 0; i < vlist.i_count; i++ )
{
- if( !strcmp( vlist.p_list->p_values[i].psz_string, psz_mode ) )
+ if( !strcmp( vlist.p_values[i].psz_string, psz_mode ) )
{
i++;
break;
}
}
- if( i == vlist.p_list->i_count ) i = 0;
- psz_text = tlist.p_list->p_values[i].psz_string;
- var_SetString( p_vout, "deinterlace-mode", vlist.p_list->p_values[i].psz_string );
+ if( i == vlist.i_count ) i = 0;
+ psz_text = tlist.p_values[i].psz_string;
+ var_SetString( p_vout, "deinterlace-mode", vlist.p_values[i].psz_string );
int i_deinterlace = var_GetInteger( p_vout, "deinterlace" );
if( i_deinterlace != 0 )
@@ -1324,14 +1336,13 @@ static int PutAction( intf_thread_t *p_intf, input_thread_t *p_input,
{
if( p_input )
{
- vlc_value_t val, list, list2;
- int i_count;
+ vlc_value_t val;
+ vlc_list_t list, list2;
var_Get( p_input, "spu-es", &val );
var_Change( p_input, "spu-es", VLC_VAR_GETCHOICES,
&list, &list2 );
- i_count = list.p_list->i_count;
- if( i_count < 1 || val.i_int < 0 )
+ if( list.i_count < 1 || val.i_int < 0 )
{
DisplayMessage( p_vout,
_("Subtitle position: no active subtitle") );
diff --git a/modules/control/oldrc.c b/modules/control/oldrc.c
index 489261acb4..c2d85f9bfa 100644
--- a/modules/control/oldrc.c
+++ b/modules/control/oldrc.c
@@ -1122,7 +1122,7 @@ static int Input( vlc_object_t *p_this, char const *psz_cmd,
else
{
/* get */
- vlc_value_t val, text;
+ vlc_list_t val, text;
int i_value = var_GetInteger( p_input, psz_variable );
@@ -1131,16 +1131,14 @@ static int Input( vlc_object_t *p_this, char const *psz_cmd,
goto out;
msg_rc( "+----[ %s ]", val_name.psz_string );
- for ( int i = 0; i < val.p_list->i_count; i++ )
+ for ( int i = 0; i < val.i_count; i++ )
{
- if ( i_value == val.p_list->p_values[i].i_int )
- msg_rc( "| %"PRId64" - %s *",
- val.p_list->p_values[i].i_int,
- text.p_list->p_values[i].psz_string );
+ if ( i_value == val.p_values[i].i_int )
+ msg_rc( "| %"PRId64" - %s *", val.p_values[i].i_int,
+ text.p_values[i].psz_string );
else
- msg_rc( "| %"PRId64" - %s",
- val.p_list->p_values[i].i_int,
- text.p_list->p_values[i].psz_string );
+ msg_rc( "| %"PRId64" - %s", val.p_values[i].i_int,
+ text.p_values[i].psz_string );
}
var_FreeList( &val, &text );
msg_rc( "+----[ end of %s ]", val_name.psz_string );
@@ -1555,7 +1553,7 @@ static int VideoConfig( vlc_object_t *p_this, char const *psz_cmd,
{
/* get */
vlc_value_t val_name;
- vlc_value_t val, text;
+ vlc_list_t val, text;
float f_value = 0.;
char *psz_value = NULL;
@@ -1586,26 +1584,26 @@ static int VideoConfig( vlc_object_t *p_this, char const *psz_cmd,
msg_rc( "+----[ %s ]", val_name.psz_string );
if( !strcmp( psz_variable, "zoom" ) )
{
- for ( int i = 0; i < val.p_list->i_count; i++ )
+ for ( int i = 0; i < val.i_count; i++ )
{
- if ( f_value == val.p_list->p_values[i].f_float )
- msg_rc( "| %f - %s *", val.p_list->p_values[i].f_float,
- text.p_list->p_values[i].psz_string );
+ if ( f_value == val.p_values[i].f_float )
+ msg_rc( "| %f - %s *", val.p_values[i].f_float,
+ text.p_values[i].psz_string );
else
- msg_rc( "| %f - %s", val.p_list->p_values[i].f_float,
- text.p_list->p_values[i].psz_string );
+ msg_rc( "| %f - %s", val.p_values[i].f_float,
+ text.p_values[i].psz_string );
}
}
else
{
- for ( int i = 0; i < val.p_list->i_count; i++ )
+ for ( int i = 0; i < val.i_count; i++ )
{
- if ( !strcmp( psz_value, val.p_list->p_values[i].psz_string ) )
- msg_rc( "| %s - %s *", val.p_list->p_values[i].psz_string,
- text.p_list->p_values[i].psz_string );
+ if ( !strcmp( psz_value, val.p_values[i].psz_string ) )
+ msg_rc( "| %s - %s *", val.p_values[i].psz_string,
+ text.p_values[i].psz_string );
else
- msg_rc( "| %s - %s", val.p_list->p_values[i].psz_string,
- text.p_list->p_values[i].psz_string );
+ msg_rc( "| %s - %s", val.p_values[i].psz_string,
+ text.p_values[i].psz_string );
}
free( psz_value );
}
@@ -1674,7 +1672,7 @@ static int AudioChannel( vlc_object_t *obj, char const *cmd,
if ( !*cur.psz_string )
{
/* Retrieve all registered ***. */
- vlc_value_t val, text;
+ vlc_list_t val, text;
if ( var_Change( p_aout, "stereo-mode",
VLC_VAR_GETCHOICES, &val, &text ) < 0 )
{
@@ -1685,14 +1683,14 @@ static int AudioChannel( vlc_object_t *obj, char const *cmd,
int i_value = var_GetInteger( p_aout, "stereo-mode" );
msg_rc( "+----[ %s ]", cmd );
- for ( int i = 0; i < val.p_list->i_count; i++ )
+ for ( int i = 0; i < val.i_count; i++ )
{
- if ( i_value == val.p_list->p_values[i].i_int )
- msg_rc( "| %"PRId64" - %s *", val.p_list->p_values[i].i_int,
- text.p_list->p_values[i].psz_string );
+ if ( i_value == val.p_values[i].i_int )
+ msg_rc( "| %"PRId64" - %s *", val.p_values[i].i_int,
+ text.p_values[i].psz_string );
else
- msg_rc( "| %"PRId64" - %s", val.p_list->p_values[i].i_int,
- text.p_list->p_values[i].psz_string );
+ msg_rc( "| %"PRId64" - %s", val.p_values[i].i_int,
+ text.p_values[i].psz_string );
}
var_FreeList( &val, &text );
msg_rc( "+----[ end of %s ]", cmd );
diff --git a/modules/gui/macosx/VLCMainMenu.m b/modules/gui/macosx/VLCMainMenu.m
index e5f003efe6..8449dec701 100644
--- a/modules/gui/macosx/VLCMainMenu.m
+++ b/modules/gui/macosx/VLCMainMenu.m
@@ -1446,7 +1446,8 @@
var:(const char *)psz_variable
selector:(SEL)pf_callback
{
- vlc_value_t val, val_list, text_list;
+ vlc_value_t val;
+ vlc_list_t val_list, text_list;
int i_type, i;
/* remove previous items */
@@ -1502,9 +1503,9 @@
}
/* make (un)sensitive */
- [parent setEnabled: (val_list.p_list->i_count > 1)];
+ [parent setEnabled: (val_list.i_count > 1)];
- for (i = 0; i < val_list.p_list->i_count; i++) {
+ for (i = 0; i < val_list.i_count; i++) {
NSMenuItem *lmi;
NSString *title = @"";
VLCAutoGeneratedMenuContent *data;
@@ -1512,31 +1513,31 @@
switch(i_type & VLC_VAR_TYPE) {
case VLC_VAR_STRING:
- title = _NS(text_list.p_list->p_values[i].psz_string ? text_list.p_list->p_values[i].psz_string : val_list.p_list->p_values[i].psz_string);
+ title = _NS(text_list.p_values[i].psz_string ? text_list.p_values[i].psz_string : val_list.p_values[i].psz_string);
lmi = [menu addItemWithTitle: title action: pf_callback keyEquivalent: @""];
data = [[VLCAutoGeneratedMenuContent alloc] initWithVariableName: psz_variable ofObject: p_object
- andValue: val_list.p_list->p_values[i] ofType: i_type];
+ andValue: val_list.p_values[i] ofType: i_type];
[lmi setRepresentedObject:data];
[lmi setTarget: self];
- if (!strcmp(val.psz_string, val_list.p_list->p_values[i].psz_string) && !(i_type & VLC_VAR_ISCOMMAND))
+ if (!strcmp(val.psz_string, val_list.p_values[i].psz_string) && !(i_type & VLC_VAR_ISCOMMAND))
[lmi setState: TRUE ];
break;
case VLC_VAR_INTEGER:
- title = text_list.p_list->p_values[i].psz_string ?
- _NS(text_list.p_list->p_values[i].psz_string) : [NSString stringWithFormat: @"%"PRId64, val_list.p_list->p_values[i].i_int];
+ title = text_list.p_values[i].psz_string ?
+ _NS(text_list.p_values[i].psz_string) : [NSString stringWithFormat: @"%"PRId64, val_list.p_values[i].i_int];
lmi = [menu addItemWithTitle: title action: pf_callback keyEquivalent: @""];
data = [[VLCAutoGeneratedMenuContent alloc] initWithVariableName: psz_variable ofObject: p_object
- andValue: val_list.p_list->p_values[i] ofType: i_type];
+ andValue: val_list.p_values[i] ofType: i_type];
[lmi setRepresentedObject:data];
[lmi setTarget: self];
- if (val_list.p_list->p_values[i].i_int == val.i_int && !(i_type & VLC_VAR_ISCOMMAND))
+ if (val_list.p_values[i].i_int == val.i_int && !(i_type & VLC_VAR_ISCOMMAND))
[lmi setState: TRUE ];
break;
diff --git a/modules/gui/ncurses.c b/modules/gui/ncurses.c
index 6f965dcfe7..4b0e0c4d6c 100644
--- a/modules/gui/ncurses.c
+++ b/modules/gui/ncurses.c
@@ -1529,22 +1529,21 @@ static void CycleESTrack(input_thread_t *input, const char *var)
if (!input)
return;
- vlc_value_t val;
- if (var_Change(input, var, VLC_VAR_GETCHOICES, &val,
- (vlc_value_t *)NULL) < 0)
+ vlc_list_t list;
+ if (var_Change(input, var, VLC_VAR_GETCHOICES, &list,
+ (vlc_list_t *)NULL) < 0)
return;
- vlc_list_t *list = val.p_list;
int64_t current = var_GetInteger(input, var);
int i;
- for (i = 0; i < list->i_count; i++)
- if (list->p_values[i].i_int == current)
+ for (i = 0; i < list.i_count; i++)
+ if (list.p_values[i].i_int == current)
break;
- if (++i >= list->i_count)
+ if (++i >= list.i_count)
i = 0;
- var_SetInteger(input, var, list->p_values[i].i_int);
+ var_SetInteger(input, var, list.p_values[i].i_int);
}
static void HandleCommonKey(intf_thread_t *intf, input_thread_t *input,
diff --git a/modules/gui/qt/components/controller_widget.cpp b/modules/gui/qt/components/controller_widget.cpp
index 392d806c83..24e5372846 100644
--- a/modules/gui/qt/components/controller_widget.cpp
+++ b/modules/gui/qt/components/controller_widget.cpp
@@ -268,7 +268,7 @@ void AspectRatioComboBox::updateRatios()
{
/* Clear the list before updating */
clear();
- vlc_value_t val_list, text_list;
+ vlc_list_t val_list, text_list;
vout_thread_t* p_vout = THEMIM->getVout();
/* Disable if there is no vout */
@@ -280,9 +280,9 @@ void AspectRatioComboBox::updateRatios()
}
var_Change( p_vout, "aspect-ratio", VLC_VAR_GETCHOICES, &val_list, &text_list );
- for( int i = 0; i < val_list.p_list->i_count; i++ )
- addItem( qfu( text_list.p_list->p_values[i].psz_string ),
- QString( val_list.p_list->p_values[i].psz_string ) );
+ for( int i = 0; i < val_list.i_count; i++ )
+ addItem( qfu( text_list.p_values[i].psz_string ),
+ QString( val_list.p_values[i].psz_string ) );
setEnabled( true );
var_FreeList( &val_list, &text_list );
vlc_object_release( p_vout );
diff --git a/modules/gui/qt/components/extended_panels.cpp b/modules/gui/qt/components/extended_panels.cpp
index c66100e0ea..c429bee753 100644
--- a/modules/gui/qt/components/extended_panels.cpp
+++ b/modules/gui/qt/components/extended_panels.cpp
@@ -651,7 +651,7 @@ void ExtV4l2::Refresh( void )
}
if( p_obj )
{
- vlc_value_t val, text;
+ vlc_list_t val, text;
int i_ret = var_Change( p_obj, "controls", VLC_VAR_GETCHOICES,
&val, &text );
if( i_ret < 0 )
@@ -667,10 +667,10 @@ void ExtV4l2::Refresh( void )
QVBoxLayout *layout = new QVBoxLayout( box );
box->setLayout( layout );
- for( int i = 0; i < val.p_list->i_count; i++ )
+ for( int i = 0; i < val.i_count; i++ )
{
vlc_value_t vartext;
- const char *psz_var = text.p_list->p_values[i].psz_string;
+ const char *psz_var = text.p_values[i].psz_string;
if( var_Change( p_obj, psz_var, VLC_VAR_GETTEXT, &vartext ) )
continue;
@@ -678,7 +678,7 @@ void ExtV4l2::Refresh( void )
QString name = qtr( vartext.psz_string );
free( vartext.psz_string );
msg_Dbg( p_intf, "v4l2 control \"%" PRIx64 "\": %s (%s)",
- val.p_list->p_values[i].i_int, psz_var, qtu( name ) );
+ val.p_values[i].i_int, psz_var, qtu( name ) );
int i_type = var_Type( p_obj, psz_var );
switch( i_type & VLC_VAR_TYPE )
@@ -694,15 +694,15 @@ void ExtV4l2::Refresh( void )
QComboBox *combobox = new QComboBox( box );
combobox->setObjectName( qfu( psz_var ) );
- vlc_value_t val2, text2;
+ vlc_list_t val2, text2;
var_Change( p_obj, psz_var, VLC_VAR_GETCHOICES,
&val2, &text2 );
- for( int j = 0; j < val2.p_list->i_count; j++ )
+ for( int j = 0; j < val2.i_count; j++ )
{
combobox->addItem(
- text2.p_list->p_values[j].psz_string,
- qlonglong( val2.p_list->p_values[j].i_int) );
- if( i_val == val2.p_list->p_values[j].i_int )
+ text2.p_values[j].psz_string,
+ qlonglong( val2.p_values[j].i_int) );
+ if( i_val == val2.p_values[j].i_int )
combobox->setCurrentIndex( j );
}
var_FreeList( &val2, &text2 );
diff --git a/modules/gui/qt/input_manager.cpp b/modules/gui/qt/input_manager.cpp
index c0c3020bc9..8a3fc596ae 100644
--- a/modules/gui/qt/input_manager.cpp
+++ b/modules/gui/qt/input_manager.cpp
@@ -859,24 +859,24 @@ void InputManager::telexSetTransparency( bool b_transparentTelextext )
void InputManager::activateTeletext( bool b_enable )
{
- vlc_value_t list;
- vlc_value_t text;
+ vlc_list_t list, text;
+
if( hasInput() && !var_Change( p_input, "teletext-es", VLC_VAR_GETCHOICES, &list, &text ) )
{
- if( list.p_list->i_count > 0 )
+ if( list.i_count > 0 )
{
/* Prefer the page 100 if it is present */
int i;
- for( i = 0; i < text.p_list->i_count; i++ )
+ for( i = 0; i < text.i_count; i++ )
{
/* The description is the page number as a string */
- const char *psz_page = text.p_list->p_values[i].psz_string;
+ const char *psz_page = text.p_values[i].psz_string;
if( psz_page && !strcmp( psz_page, "100" ) )
break;
}
- if( i >= list.p_list->i_count )
+ if( i >= list.i_count )
i = 0;
- var_SetInteger( p_input, "spu-es", b_enable ? list.p_list->p_values[i].i_int : -1 );
+ var_SetInteger( p_input, "spu-es", b_enable ? list.p_values[i].i_int : -1 );
}
var_FreeList( &list, &text );
}
diff --git a/modules/gui/qt/menus.cpp b/modules/gui/qt/menus.cpp
index 5f8929fe0f..99958ab62e 100644
--- a/modules/gui/qt/menus.cpp
+++ b/modules/gui/qt/menus.cpp
@@ -1376,7 +1376,8 @@ static bool CheckTitle( vlc_object_t *p_object, const char *psz_var )
int VLCMenuBar::CreateChoicesMenu( QMenu *submenu, const char *psz_var,
vlc_object_t *p_object )
{
- vlc_value_t val, val_list, text_list;
+ vlc_value_t val;
+ vlc_list_t val_list, text_list;
int i_type, i;
/* Check the type of the object variable */
@@ -1405,11 +1406,11 @@ int VLCMenuBar::CreateChoicesMenu( QMenu *submenu, const char *psz_var,
return VLC_EGENERIC;
}
-#define CURVAL val_list.p_list->p_values[i]
-#define CURTEXT text_list.p_list->p_values[i].psz_string
+#define CURVAL val_list.p_values[i]
+#define CURTEXT text_list.p_values[i].psz_string
#define RADIO_OR_COMMAND ( i_type & ( VLC_VAR_ISCOMMAND | VLC_VAR_HASCHOICE ) ) ? ITEM_RADIO : ITEM_NORMAL
- for( i = 0; i < val_list.p_list->i_count; i++ )
+ for( i = 0; i < val_list.i_count; i++ )
{
vlc_value_t another_val;
QString menutext;
diff --git a/modules/lua/libs/variables.c b/modules/lua/libs/variables.c
index 76e4290f13..bd34eedbaa 100644
--- a/modules/lua/libs/variables.c
+++ b/modules/lua/libs/variables.c
@@ -235,8 +235,7 @@ static int vlclua_var_create( lua_State *L )
static int vlclua_var_get_list( lua_State *L )
{
- vlc_value_t val;
- vlc_value_t text;
+ vlc_list_t val, text;
vlc_object_t **pp_obj = luaL_checkudata( L, 1, "vlc_object" );
const char *psz_var = luaL_checkstring( L, 2 );
@@ -244,8 +243,8 @@ static int vlclua_var_get_list( lua_State *L )
if( i_ret < 0 )
return vlclua_push_ret( L, i_ret );
- vlclua_pushlist( L, val.p_list );
- vlclua_pushlist( L, text.p_list );
+ vlclua_pushlist( L, &val );
+ vlclua_pushlist( L, &text );
var_FreeList( &val, &text );
return 2;
diff --git a/src/audio_output/output.c b/src/audio_output/output.c
index 9be72836f2..724ac44cf6 100644
--- a/src/audio_output/output.c
+++ b/src/audio_output/output.c
@@ -475,13 +475,13 @@ static void aout_PrepareStereoMode (audio_output_t *aout,
}
bool mode_available = false;
- vlc_value_t vals;
+ vlc_list_t vals;
if (!var_Change(aout, "stereo-mode", VLC_VAR_GETCHOICES, &vals,
- (vlc_value_t *)NULL))
+ (vlc_list_t *)NULL))
{
- for (int i = 0; !mode_available && i < vals.p_list->i_count; ++i)
+ for (int i = 0; !mode_available && i < vals.i_count; ++i)
{
- if (vals.p_list->p_values[i].i_int == i_output_mode)
+ if (vals.p_values[i].i_int == i_output_mode)
mode_available = true;
}
var_FreeList(&vals, NULL);
diff --git a/src/input/input.c b/src/input/input.c
index 85b8cd9ff5..b3d69f08b5 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -3277,19 +3277,19 @@ static int input_SlaveSourceAdd( input_thread_t *p_input,
return VLC_SUCCESS;
/* Select the ES */
- vlc_value_t list;
+ vlc_list_t list;
if( var_Change( p_input, psz_es, VLC_VAR_GETCHOICES, &list,
- (vlc_value_t *)NULL ) )
+ (vlc_list_t *)NULL ) )
return VLC_SUCCESS;
if( count == 0 )
count++;
/* if it was first one, there is disable too */
- if( count < (size_t)list.p_list->i_count )
+ if( count < (size_t)list.i_count )
{
- const int i_id = list.p_list->p_values[count].i_int;
+ const int i_id = list.p_values[count].i_int;
es_out_Control( input_priv(p_input)->p_es_out_display, ES_OUT_SET_ES_DEFAULT_BY_ID, i_id );
es_out_Control( input_priv(p_input)->p_es_out_display, ES_OUT_SET_ES_BY_ID, i_id );
diff --git a/src/misc/variables.c b/src/misc/variables.c
index 41f1787cca..5a07cbc926 100644
--- a/src/misc/variables.c
+++ b/src/misc/variables.c
@@ -551,31 +551,32 @@ int (var_Change)(vlc_object_t *p_this, const char *psz_name, int i_action, ...)
break;
case VLC_VAR_GETCHOICES:
{
- vlc_value_t *p_val = va_arg(ap, vlc_value_t *);
- vlc_value_t *p_val2 = va_arg(ap, vlc_value_t *);
+ vlc_list_t *values = va_arg(ap, vlc_list_t *);
+ vlc_list_t *texts = va_arg(ap, vlc_list_t *);
- p_val->p_list = xmalloc( sizeof(vlc_list_t) );
- p_val->p_list->p_values =
+ values->p_values =
xmalloc( p_var->choices.i_count * sizeof(vlc_value_t) );
- p_val->p_list->i_type = p_var->i_type;
- p_val->p_list->i_count = p_var->choices.i_count;
- if( p_val2 )
+ values->i_type = p_var->i_type;
+ values->i_count = p_var->choices.i_count;
+
+ for( int i = 0 ; i < p_var->choices.i_count ; i++ )
{
- p_val2->p_list = xmalloc( sizeof(vlc_list_t) );
- p_val2->p_list->p_values =
- xmalloc( p_var->choices.i_count * sizeof(vlc_value_t) );
- p_val2->p_list->i_type = VLC_VAR_STRING;
- p_val2->p_list->i_count = p_var->choices.i_count;
+ values->p_values[i] = p_var->choices.p_values[i];
+ p_var->ops->pf_dup( &values->p_values[i] );
}
- for( int i = 0 ; i < p_var->choices.i_count ; i++ )
+
+ if( texts != NULL )
{
- p_val->p_list->p_values[i] = p_var->choices.p_values[i];
- p_var->ops->pf_dup( &p_val->p_list->p_values[i] );
- if( p_val2 )
+ texts->p_values =
+ xmalloc( p_var->choices.i_count * sizeof(vlc_value_t) );
+ texts->i_type = VLC_VAR_STRING;
+ texts->i_count = p_var->choices.i_count;
+
+ for( int i = 0 ; i < p_var->choices.i_count ; i++ )
{
- p_val2->p_list->p_values[i].psz_string =
- p_var->choices_text.p_values[i].psz_string ?
- strdup(p_var->choices_text.p_values[i].psz_string) : NULL;
+ texts->p_values[i].psz_string =
+ p_var->choices_text.p_values[i].psz_string
+ ? strdup(p_var->choices_text.p_values[i].psz_string) : NULL;
}
}
break;
@@ -1137,28 +1138,25 @@ error:
return VLC_EGENERIC;
}
-void var_FreeList( vlc_value_t *p_val, vlc_value_t *p_val2 )
+void var_FreeList( vlc_list_t *values, vlc_list_t *texts )
{
- switch( p_val->p_list->i_type & VLC_VAR_CLASS )
+ switch( values->i_type & VLC_VAR_CLASS )
{
case VLC_VAR_STRING:
- for( int i = 0; i < p_val->p_list->i_count; i++ )
- free( p_val->p_list->p_values[i].psz_string );
+ for( int i = 0; i < values->i_count; i++ )
+ free( values->p_values[i].psz_string );
break;
}
- free( p_val->p_list->p_values );
- free( p_val->p_list );
+ free( values->p_values );
- if( p_val2 != NULL )
+ if( texts != NULL )
{
- assert( p_val2->p_list != NULL );
- assert( p_val2->p_list->i_type == VLC_VAR_STRING );
+ assert( texts->i_type == VLC_VAR_STRING );
- for( int i = 0; i < p_val2->p_list->i_count; i++ )
- free( p_val2->p_list->p_values[i].psz_string );
- free( p_val2->p_list->p_values );
- free( p_val2->p_list );
+ for( int i = 0; i < texts->i_count; i++ )
+ free( texts->p_values[i].psz_string );
+ free( texts->p_values );
}
}
diff --git a/test/src/misc/variables.c b/test/src/misc/variables.c
index 83e246dcbf..877ea22d47 100644
--- a/test/src/misc/variables.c
+++ b/test/src/misc/variables.c
@@ -323,7 +323,9 @@ static void test_limits( libvlc_int_t *p_libvlc )
static void test_choices( libvlc_int_t *p_libvlc )
{
- vlc_value_t val, val2;
+ vlc_value_t val;
+ vlc_list_t vals, texts;
+
var_Create( p_libvlc, "bla", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
val.i_int = 1;
var_Change( p_libvlc, "bla", VLC_VAR_ADDCHOICE, val, "one" );
@@ -336,11 +338,11 @@ static void test_choices( libvlc_int_t *p_libvlc )
var_Change( p_libvlc, "bla", VLC_VAR_DELCHOICE, val );
assert( var_CountChoices( p_libvlc, "bla" ) == 1 );
- var_Change( p_libvlc, "bla", VLC_VAR_GETCHOICES, &val, &val2 );
- assert( val.p_list->i_count == 1 && val.p_list->p_values[0].i_int == 1 &&
- val2.p_list->i_count == 1 &&
- !strcmp( val2.p_list->p_values[0].psz_string, "one" ) );
- var_FreeList( &val, &val2 );
+ var_Change( p_libvlc, "bla", VLC_VAR_GETCHOICES, &vals, &texts );
+ assert( vals.i_count == 1 && vals.p_values[0].i_int == 1 &&
+ texts.i_count == 1 &&
+ !strcmp( texts.p_values[0].psz_string, "one" ) );
+ var_FreeList( &vals, &texts );
var_Change( p_libvlc, "bla", VLC_VAR_CLEARCHOICES );
assert( var_CountChoices( p_libvlc, "bla" ) == 0 );
More information about the vlc-commits
mailing list