mirror of
https://code.videolan.org/videolan/vlc
synced 2024-10-03 01:31:53 +02:00
variables: use char ** for VLC_VAR_GETTEXT
This commit is contained in:
parent
1fd0844ee7
commit
1b380f31b1
@ -1094,7 +1094,7 @@ static int Input( vlc_object_t *p_this, char const *psz_cmd,
|
||||
|| !strcmp( psz_cmd, "strack" ) )
|
||||
{
|
||||
const char *psz_variable;
|
||||
vlc_value_t val_name;
|
||||
char *name;
|
||||
|
||||
if( !strcmp( psz_cmd, "atrack" ) )
|
||||
{
|
||||
@ -1110,8 +1110,8 @@ static int Input( vlc_object_t *p_this, char const *psz_cmd,
|
||||
}
|
||||
|
||||
/* Get the descriptive name of the variable */
|
||||
var_Change( p_input, psz_variable, VLC_VAR_GETTEXT, &val_name );
|
||||
if( !val_name.psz_string ) val_name.psz_string = strdup(psz_variable);
|
||||
var_Change( p_input, psz_variable, VLC_VAR_GETTEXT, &name );
|
||||
if( !name ) name = strdup(psz_variable);
|
||||
|
||||
if( newval.psz_string && *newval.psz_string )
|
||||
{
|
||||
@ -1133,7 +1133,7 @@ static int Input( vlc_object_t *p_this, char const *psz_cmd,
|
||||
goto out;
|
||||
}
|
||||
|
||||
msg_rc( "+----[ %s ]", val_name.psz_string );
|
||||
msg_rc( "+----[ %s ]", name );
|
||||
for ( int i = 0; i < val.i_count; i++ )
|
||||
{
|
||||
if ( i_value == val.p_values[i].i_int )
|
||||
@ -1144,9 +1144,9 @@ static int Input( vlc_object_t *p_this, char const *psz_cmd,
|
||||
text.p_values[i].psz_string );
|
||||
}
|
||||
var_FreeList( &val, &text );
|
||||
msg_rc( "+----[ end of %s ]", val_name.psz_string );
|
||||
msg_rc( "+----[ end of %s ]", name );
|
||||
}
|
||||
free( val_name.psz_string );
|
||||
free( name );
|
||||
}
|
||||
out:
|
||||
vlc_object_release( p_input );
|
||||
@ -1555,7 +1555,7 @@ static int VideoConfig( vlc_object_t *p_this, char const *psz_cmd,
|
||||
else
|
||||
{
|
||||
/* get */
|
||||
vlc_value_t val_name;
|
||||
char *name;
|
||||
vlc_list_t val, text;
|
||||
float f_value = 0.;
|
||||
char *psz_value = NULL;
|
||||
@ -1581,10 +1581,10 @@ static int VideoConfig( vlc_object_t *p_this, char const *psz_cmd,
|
||||
}
|
||||
|
||||
/* Get the descriptive name of the variable */
|
||||
var_Change( p_vout, psz_variable, VLC_VAR_GETTEXT, &val_name );
|
||||
if( !val_name.psz_string ) val_name.psz_string = strdup(psz_variable);
|
||||
var_Change( p_vout, psz_variable, VLC_VAR_GETTEXT, &name );
|
||||
if( !name ) name = strdup(psz_variable);
|
||||
|
||||
msg_rc( "+----[ %s ]", val_name.psz_string );
|
||||
msg_rc( "+----[ %s ]", name );
|
||||
if( !strcmp( psz_variable, "zoom" ) )
|
||||
{
|
||||
for ( int i = 0; i < val.i_count; i++ )
|
||||
@ -1611,9 +1611,9 @@ static int VideoConfig( vlc_object_t *p_this, char const *psz_cmd,
|
||||
free( psz_value );
|
||||
}
|
||||
var_FreeList( &val, &text );
|
||||
msg_rc( "+----[ end of %s ]", val_name.psz_string );
|
||||
msg_rc( "+----[ end of %s ]", name );
|
||||
|
||||
free( val_name.psz_string );
|
||||
free( name );
|
||||
}
|
||||
vlc_object_release( p_vout );
|
||||
return i_error;
|
||||
|
@ -1383,7 +1383,8 @@
|
||||
var:(const char *)psz_variable
|
||||
selector:(SEL)pf_callback
|
||||
{
|
||||
vlc_value_t val, text;
|
||||
vlc_value_t val;
|
||||
char *text;
|
||||
int i_type = var_Type(p_object, psz_variable);
|
||||
|
||||
switch(i_type & VLC_VAR_TYPE) {
|
||||
@ -1400,7 +1401,7 @@
|
||||
|
||||
/* Get the descriptive name of the variable */
|
||||
var_Change(p_object, psz_variable, VLC_VAR_GETTEXT, &text);
|
||||
[mi setTitle: _NS(text.psz_string ? text.psz_string : psz_variable)];
|
||||
[mi setTitle: _NS(text ? text : psz_variable)];
|
||||
|
||||
if (i_type & VLC_VAR_HASCHOICE) {
|
||||
NSMenu *menu = [mi submenu];
|
||||
@ -1408,7 +1409,7 @@
|
||||
[self setupVarMenu:menu forMenuItem:mi target:p_object
|
||||
var:psz_variable selector:pf_callback];
|
||||
|
||||
free(text.psz_string);
|
||||
free(text);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1436,7 +1437,7 @@
|
||||
}
|
||||
|
||||
if ((i_type & VLC_VAR_TYPE) == VLC_VAR_STRING) free(val.psz_string);
|
||||
free(text.psz_string);
|
||||
free(text);
|
||||
}
|
||||
|
||||
|
||||
|
@ -669,14 +669,14 @@ void ExtV4l2::Refresh( void )
|
||||
|
||||
for( int i = 0; i < val.i_count; i++ )
|
||||
{
|
||||
vlc_value_t vartext;
|
||||
char *vartext;
|
||||
const char *psz_var = text.p_values[i].psz_string;
|
||||
|
||||
if( var_Change( p_obj, psz_var, VLC_VAR_GETTEXT, &vartext ) )
|
||||
continue;
|
||||
|
||||
QString name = qtr( vartext.psz_string );
|
||||
free( vartext.psz_string );
|
||||
QString name = qtr( vartext );
|
||||
free( vartext );
|
||||
msg_Dbg( p_intf, "v4l2 control \"%" PRIx64 "\": %s (%s)",
|
||||
val.p_values[i].i_int, psz_var, qtu( name ) );
|
||||
|
||||
|
@ -1244,12 +1244,13 @@ static bool IsMenuEmpty( const char *psz_var, vlc_object_t *p_object )
|
||||
return val <= 1;
|
||||
}
|
||||
|
||||
#define TEXT_OR_VAR qfue ( text.psz_string ? text.psz_string : psz_var )
|
||||
#define TEXT_OR_VAR qfue ( text ? text : psz_var )
|
||||
|
||||
void VLCMenuBar::UpdateItem( QMenu *menu,
|
||||
const char *psz_var, vlc_object_t *p_object, bool b_submenu )
|
||||
{
|
||||
vlc_value_t val, text;
|
||||
vlc_value_t val;
|
||||
char *text;
|
||||
int i_type;
|
||||
|
||||
QAction *action = FindActionWithVar( menu, psz_var );
|
||||
@ -1299,11 +1300,8 @@ void VLCMenuBar::UpdateItem( QMenu *menu,
|
||||
}
|
||||
|
||||
/* Get the descriptive name of the variable */
|
||||
int i_ret = var_Change( p_object, psz_var, VLC_VAR_GETTEXT, &text );
|
||||
if( i_ret != VLC_SUCCESS )
|
||||
{
|
||||
text.psz_string = NULL;
|
||||
}
|
||||
if( var_Change( p_object, psz_var, VLC_VAR_GETTEXT, &text ) )
|
||||
text = NULL;
|
||||
|
||||
if( !action )
|
||||
{
|
||||
@ -1333,7 +1331,7 @@ void VLCMenuBar::UpdateItem( QMenu *menu,
|
||||
action->setEnabled(
|
||||
CreateChoicesMenu( menu, psz_var, p_object ) == 0 );
|
||||
}
|
||||
FREENULL( text.psz_string );
|
||||
free( text );
|
||||
return;
|
||||
}
|
||||
else
|
||||
@ -1354,7 +1352,7 @@ void VLCMenuBar::UpdateItem( QMenu *menu,
|
||||
p_object, val, i_type, !val.b_bool );
|
||||
break;
|
||||
}
|
||||
FREENULL( text.psz_string );
|
||||
free( text );
|
||||
}
|
||||
|
||||
#undef TEXT_OR_VAR
|
||||
|
@ -590,8 +590,8 @@ int (var_Change)(vlc_object_t *p_this, const char *psz_name, int i_action, ...)
|
||||
break;
|
||||
}
|
||||
case VLC_VAR_GETTEXT:
|
||||
va_arg(ap, vlc_value_t *)->psz_string =
|
||||
p_var->psz_text ? strdup( p_var->psz_text ) : NULL;
|
||||
*va_arg(ap, char **) = (p_var->psz_text != NULL)
|
||||
? strdup(p_var->psz_text) : NULL;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user