/*****************************************************************************
* audiobargraph_v.c : audiobargraph video plugin for vlc
*****************************************************************************
- * Copyright (C) 2003-2006 the VideoLAN team
+ * Copyright (C) 2003-2006 VLC authors and VideoLAN
*
* Authors: Clement CHESNIN <clement.chesnin@gmail.com>
* Philippe COENT <philippe.coent@tdf.fr>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
*****************************************************************************/
#define I_VALUES_TEXT N_("Value of the audio channels levels")
-#define I_VALUES_LONGTEXT N_("Value of the audio level of each channels between 0 and 1" \
+#define I_VALUES_LONGTEXT N_("Value of the audio level of each channels between 0 and 1. " \
"Each level should be separated with ':'.")
#define POSX_TEXT N_("X coordinate")
#define POSX_LONGTEXT N_("X coordinate of the bargraph." )
p_sys->i_pos_y = var_CreateGetIntegerCommand( p_filter, "audiobargraph_v-y" );
p_BarGraph->i_alpha = var_CreateGetIntegerCommand( p_filter,
"audiobargraph_v-transparency" );
- p_BarGraph->i_alpha = __MAX( __MIN( p_BarGraph->i_alpha, 255 ), 0 );
+ p_BarGraph->i_alpha = VLC_CLIP( p_BarGraph->i_alpha, 0, 255 );
i_values = var_CreateGetStringCommand( p_filter, "audiobargraph_v-i_values" );
//p_BarGraph->nbChannels = 0;
//p_BarGraph->i_values = NULL;
VLC_UNUSED(oldval);
filter_sys_t *p_sys = (filter_sys_t *)p_data;
BarGraph_t *p_BarGraph = &(p_sys->p_BarGraph);
- char* i_values;
char* res = NULL;
vlc_mutex_lock( &p_sys->lock );
}
else if ( !strcmp( psz_var, "audiobargraph_v-transparency" ) )
{
- p_BarGraph->i_alpha = __MAX( __MIN( newval.i_int, 255 ), 0 );
+ p_BarGraph->i_alpha = VLC_CLIP( newval.i_int, 0, 255 );
}
else if ( !strcmp( psz_var, "audiobargraph_v-i_values" ) )
{
picture_Release( p_BarGraph->p_pic );
p_BarGraph->p_pic = NULL;
}
- i_values = strdup( newval.psz_string );
+ char *psz_i_values = strdup( newval.psz_string );
free(p_BarGraph->i_values);
//p_BarGraph->i_values = NULL;
//p_BarGraph->nbChannels = 0;
// in case many answer are received at the same time, only keep one
- res = strchr(i_values, '@');
+ res = strchr(psz_i_values, '@');
if (res)
*res = 0;
- parse_i_values( p_BarGraph, i_values);
+ parse_i_values( p_BarGraph, psz_i_values);
+ free( psz_i_values );
LoadBarGraph(p_this,p_BarGraph);
}
else if ( !strcmp( psz_var, "audiobargraph_v-alarm" ) )
p_BarGraph->nbChannels++;
p_BarGraph->i_values = xrealloc(p_BarGraph->i_values,
p_BarGraph->nbChannels*sizeof(int));
- p_BarGraph->i_values[p_BarGraph->nbChannels-1] = __MAX( __MIN( atof(res)*p_BarGraph->scale, p_BarGraph->scale ), 0 );
+ p_BarGraph->i_values[p_BarGraph->nbChannels-1] = VLC_CLIP( atof(res)*p_BarGraph->scale, 0, p_BarGraph->scale );
res = strtok_r(NULL, delim, &tok);
}