Commit 702a58c4 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Audiobar: remove trailing whitespace

parent 03c245ca
......@@ -86,7 +86,7 @@ vlc_module_begin ()
set_capability( "audio filter", 0 )
set_category( CAT_AUDIO )
set_subcategory( SUBCAT_AUDIO_AFILTER )
add_string( CFG_PREFIX "address", "localhost", ADDRESS_TEXT, ADDRESS_LONGTEXT, false )
add_integer( CFG_PREFIX "port", 12345, PORT_TEXT, PORT_LONGTEXT, false )
add_integer( CFG_PREFIX "bargraph", 1, BARGRAPH_TEXT, BARGRAPH_LONGTEXT, false )
......@@ -96,7 +96,7 @@ vlc_module_begin ()
add_float( CFG_PREFIX "alarm_threshold", 0.1, ALARM_THRESHOLD_TEXT, ALARM_THRESHOLD_LONGTEXT, false )
add_integer( CFG_PREFIX "repetition_time", 2000, REPETITION_TIME_TEXT, REPETITION_TIME_LONGTEXT, false )
add_integer( CFG_PREFIX "connection_reset", 1, CONNECTION_RESET_TEXT, CONNECTION_RESET_LONGTEXT, false )
set_callbacks( Open, Close )
vlc_module_end ()
......@@ -153,7 +153,7 @@ static int Open( vlc_object_t *p_this )
p_sys = p_filter->p_sys = malloc( sizeof( *p_sys ) );
if( !p_sys )
return VLC_ENOMEM;
p_sys->bargraph = var_CreateGetIntegerCommand( p_filter, "audiobargraph_a-bargraph" );
p_sys->bargraph_repetition = var_CreateGetIntegerCommand( p_filter, "audiobargraph_a-bargraph_repetition" );
p_sys->silence = var_CreateGetIntegerCommand( p_filter, "audiobargraph_a-silence" );
......@@ -196,16 +196,16 @@ static block_t *DoWork( filter_t *p_filter, block_t *p_in_buf )
float sum;
int count = 0;
int i_ret;
nbChannels = aout_FormatNbChannels( &p_filter->fmt_in.audio );
p_sys->nbChannels = nbChannels;
i_value = (float*)malloc(nbChannels * sizeof(float));
for (i=0; i<nbChannels; i++) {
i_value[i] = 0;
}
/* 1 - Compute the peack values */
for ( i = 0 ; i < (int)(p_in_buf->i_nb_samples); i++ )
{
......@@ -218,7 +218,7 @@ static block_t *DoWork( filter_t *p_filter, block_t *p_in_buf )
}
}
max = pow( max, 2 );
if (p_sys->silence) {
/* 2 - store the new value */
new = (ValueDate_t*)malloc(sizeof(ValueDate_t));
......@@ -232,7 +232,7 @@ static block_t *DoWork( filter_t *p_filter, block_t *p_in_buf )
if (p_sys->first == NULL) {
p_sys->first = new;
}
/* 3 - delete too old values */
while (p_sys->first->date < (new->date - (p_sys->time_window*1000))) {
p_sys->started = 1; // we have enough values to compute a valid total
......@@ -240,10 +240,10 @@ static block_t *DoWork( filter_t *p_filter, block_t *p_in_buf )
p_sys->first = p_sys->first->next;
free(current);
}
/* If last message was sent enough time ago */
if ((p_sys->started) && (p_in_buf->i_pts > p_sys->lastAlarm + (p_sys->repetition_time*1000))) {
/* 4 - compute the RMS */
current = p_sys->first;
sum = 0.0;
......@@ -254,7 +254,7 @@ static block_t *DoWork( filter_t *p_filter, block_t *p_in_buf )
}
sum = sum / count;
sum = sqrt(sum);
/* 5 - compare it to the threshold */
if (sum < p_sys->alarm_threshold) {
i=1;
......@@ -262,12 +262,12 @@ static block_t *DoWork( filter_t *p_filter, block_t *p_in_buf )
i=0;
}
snprintf(message,255,"@audiobargraph_v audiobargraph_v-alarm %d\n",i);
msg_Dbg( p_filter, "message alarm : %s", message );
//TCPconnection = net_ConnectTCP(p_filter,p_sys->address,p_sys->port);
net_Write(p_filter, p_sys->TCPconnection, NULL, message, strlen(message));
//net_Close(TCPconnection);
p_sys->lastAlarm = p_in_buf->i_pts;
}
}
......@@ -279,7 +279,7 @@ static block_t *DoWork( filter_t *p_filter, block_t *p_in_buf )
else
p_sys->value[i] = p_sys->value[i] - 6;
}*/
if (p_sys->bargraph) {
/* 6 - sent the message with the values for the BarGraph */
if ((nbChannels > 0) && (p_sys->counter%(p_sys->bargraph_repetition) == 0)) {
......@@ -297,9 +297,9 @@ static block_t *DoWork( filter_t *p_filter, block_t *p_in_buf )
}
}
free(i_value);
if (p_sys->counter > p_sys->bargraph_repetition*100) {
if (p_sys->connection_reset) {
net_Close(p_sys->TCPconnection);
......@@ -307,10 +307,10 @@ static block_t *DoWork( filter_t *p_filter, block_t *p_in_buf )
}
p_sys->counter = 0;
}
//free(message);
p_sys->counter++;
return p_in_buf;
}
......@@ -322,7 +322,7 @@ static void Close( vlc_object_t *p_this )
filter_t * p_filter = (filter_t *)p_this;
filter_sys_t *p_sys = p_filter->p_sys;
ValueDate_t* current;
p_sys->last = NULL;
while (p_sys->first != NULL) {
current = p_sys->first;
......
......@@ -43,7 +43,7 @@
/*****************************************************************************
* Module descriptor
*****************************************************************************/
#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" \
"Each level should be separated with ':'.")
......@@ -135,7 +135,7 @@ struct filter_sys_t
filter_t *p_blend;
vlc_mutex_t lock;
BarGraph_t p_BarGraph;
int i_pos;
......@@ -290,14 +290,14 @@ static void Close( vlc_object_t *p_this )
filter_DeleteBlend( p_sys->p_blend );
vlc_mutex_destroy( &p_sys->lock );
if( p_BarGraph->p_pic )
{
picture_Release( p_BarGraph->p_pic );
p_BarGraph->p_pic = NULL;
}
free( p_BarGraph->i_values );
free( p_sys );
}
......@@ -536,31 +536,31 @@ static picture_t *LoadImage( vlc_object_t *p_this, int nbChannels, int* i_values
int i_width = 0;
int i_line;
int moinsTrois, moinsCinq, moinsSept, moinsDix, moinsVingt;
if (nbChannels == 0) {
i_width = 20;
} else {
i_width = 2 * nbChannels * barWidth + 10;
}
moinsTrois = 0.71*scale + 20;
moinsCinq = 0.56*scale + 20;
moinsSept = 0.45*scale + 20;
moinsDix = 0.32*scale + 20;
moinsVingt = 0.1*scale + 20;
p_pic = picture_New(VLC_FOURCC('Y','U','V','A'), i_width+20, scale+30, 1, 1);
// blacken the whole picture
for( i = 0 ; i < p_pic->i_planes ; i++ )
{
memset( p_pic->p[i].p_pixels, 0x00,
p_pic->p[i].i_visible_lines * p_pic->p[i].i_pitch );
}
// side bar
for ( i_line = 20; i_line < scale+20; i_line++ ) {
#define DrawPointsBlack(a,b) {\
for (i=a; i<b; i++) {\
*(p_pic->p[0].p_pixels + (scale + 30 - i_line - 1) * p_pic->p[0].i_pitch + i ) = 0x00; \
......@@ -576,12 +576,12 @@ static picture_t *LoadImage( vlc_object_t *p_this, int nbChannels, int* i_values
*(p_pic->p[2].p_pixels + (scale + 30 - i_line - 1) * p_pic->p[2].i_pitch + i ) = 128;\
*(p_pic->p[3].p_pixels + (scale + 30 - i_line - 1) * p_pic->p[3].i_pitch + i ) = 0xFF; \
}\
}
}
// vertical line
DrawPointsBlack(20,22);
DrawPointsWhite(22,24);
// -3dB
if (i_line == moinsTrois - 2) {
// 3
......@@ -609,7 +609,7 @@ static picture_t *LoadImage( vlc_object_t *p_this, int nbChannels, int* i_values
// 3
DrawPointsBlack(16,19);
}
// -5dB
if (i_line == moinsCinq - 2) {
// 5
......@@ -637,7 +637,7 @@ static picture_t *LoadImage( vlc_object_t *p_this, int nbChannels, int* i_values
// 5
DrawPointsBlack(16,19);
}
// -7dB
if (i_line == moinsSept - 2) {
// 7
......@@ -665,8 +665,8 @@ static picture_t *LoadImage( vlc_object_t *p_this, int nbChannels, int* i_values
// 7
DrawPointsBlack(16,19);
}
// -10dB
if (i_line == moinsDix - 2) {
// 1
......@@ -707,7 +707,7 @@ static picture_t *LoadImage( vlc_object_t *p_this, int nbChannels, int* i_values
// 0
DrawPointsBlack(16,19);
}
// -20dB
if (i_line == moinsVingt - 2) {
// 2
......@@ -748,10 +748,10 @@ static picture_t *LoadImage( vlc_object_t *p_this, int nbChannels, int* i_values
// 0
DrawPointsBlack(16,19);
}
}
// draw the bars and channel indicators
for (i=0; i<nbChannels; i++) {
for( j = barWidth+20 ; j < 2*barWidth+20; j++)
......@@ -834,9 +834,9 @@ static picture_t *LoadImage( vlc_object_t *p_this, int nbChannels, int* i_values
}
}
}
if (alarm) {// draw the alarm square
// bottom
for ( i_line = 0; i_line < 10; i_line++ ) {
......@@ -904,7 +904,7 @@ static picture_t *LoadImage( vlc_object_t *p_this, int nbChannels, int* i_values
}
}
}
return p_pic;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment