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