diff options
-rw-r--r-- | libaf/af.c | 33 | ||||
-rw-r--r-- | libaf/af.h | 31 | ||||
-rw-r--r-- | libaf/af_center.c | 2 | ||||
-rw-r--r-- | libaf/af_channels.c | 14 | ||||
-rw-r--r-- | libaf/af_delay.c | 6 | ||||
-rw-r--r-- | libaf/af_dummy.c | 4 | ||||
-rw-r--r-- | libaf/af_equalizer.c | 2 | ||||
-rw-r--r-- | libaf/af_export.c | 12 | ||||
-rw-r--r-- | libaf/af_format.c | 14 | ||||
-rw-r--r-- | libaf/af_hrtf.c | 20 | ||||
-rw-r--r-- | libaf/af_ladspa.c | 90 | ||||
-rw-r--r-- | libaf/af_lavcac3enc.c | 22 | ||||
-rw-r--r-- | libaf/af_mp.h | 7 | ||||
-rw-r--r-- | libaf/af_pan.c | 4 | ||||
-rw-r--r-- | libaf/af_resample.c | 14 | ||||
-rw-r--r-- | libaf/af_scaletempo.c | 28 | ||||
-rw-r--r-- | libaf/af_sinesuppress.c | 2 | ||||
-rw-r--r-- | libaf/af_sub.c | 4 | ||||
-rw-r--r-- | libaf/af_surround.c | 8 | ||||
-rw-r--r-- | libaf/af_volume.c | 4 |
20 files changed, 141 insertions, 180 deletions
diff --git a/libaf/af.c b/libaf/af.c index 1f7a1b0be8..33819c71a5 100644 --- a/libaf/af.c +++ b/libaf/af.c @@ -91,9 +91,6 @@ static af_info_t* filter_list[]={ NULL }; -// Message printing -af_msg_cfg_t af_msg_cfg={0,NULL,NULL}; - // CPU speed int* af_cpu_speed = NULL; @@ -107,7 +104,7 @@ static af_info_t* af_find(char*name) return filter_list[i]; i++; } - af_msg(AF_MSG_ERROR,"Couldn't find audio filter '%s'\n",name); + mp_msg(MSGT_AFILTER, MSGL_ERR, "Couldn't find audio filter '%s'\n",name); return NULL; } @@ -135,7 +132,7 @@ static af_instance_t* af_create(af_stream_t* s, const char* name_with_cmd) // Allocate space for the new filter and reset all pointers af_instance_t* new=malloc(sizeof(af_instance_t)); if (!name || !new) { - af_msg(AF_MSG_ERROR,"[libaf] Could not allocate memory\n"); + mp_msg(MSGT_AFILTER, MSGL_ERR, "[libaf] Could not allocate memory\n"); goto err_out; } memset(new,0,sizeof(af_instance_t)); @@ -151,13 +148,13 @@ static af_instance_t* af_create(af_stream_t* s, const char* name_with_cmd) non-reentrant */ if(new->info->flags & AF_FLAGS_NOT_REENTRANT){ if(af_get(s,name)){ - af_msg(AF_MSG_ERROR,"[libaf] There can only be one instance of" + mp_msg(MSGT_AFILTER, MSGL_ERR, "[libaf] There can only be one instance of" " the filter '%s' in each stream\n",name); goto err_out; } } - af_msg(AF_MSG_VERBOSE,"[libaf] Adding filter %s \n",name); + mp_msg(MSGT_AFILTER, MSGL_V, "[libaf] Adding filter %s \n",name); // Initialize the new filter if(AF_OK == new->info->open(new) && @@ -172,7 +169,7 @@ static af_instance_t* af_create(af_stream_t* s, const char* name_with_cmd) err_out: free(new); - af_msg(AF_MSG_ERROR,"[libaf] Couldn't create or open audio filter '%s'\n", + mp_msg(MSGT_AFILTER, MSGL_ERR, "[libaf] Couldn't create or open audio filter '%s'\n", name); free(name); return NULL; @@ -232,7 +229,7 @@ void af_remove(af_stream_t* s, af_instance_t* af) if(!af) return; // Print friendly message - af_msg(AF_MSG_VERBOSE,"[libaf] Removing filter %s \n",af->info->name); + mp_msg(MSGT_AFILTER, MSGL_V, "[libaf] Removing filter %s \n",af->info->name); // Notify filter before changing anything af->control(af,AF_CONTROL_PRE_DESTROY,0); @@ -321,14 +318,14 @@ static int af_reinit(af_stream_t* s, af_instance_t* af) return rv; } if(!new){ // Should _never_ happen - af_msg(AF_MSG_ERROR,"[libaf] Unable to correct audio format. " + mp_msg(MSGT_AFILTER, MSGL_ERR, "[libaf] Unable to correct audio format. " "This error should never uccur, please send bugreport.\n"); return AF_ERROR; } af=new->next; } else { - af_msg(AF_MSG_ERROR, "[libaf] Automatic filter insertion disabled " + mp_msg(MSGT_AFILTER, MSGL_ERR, "[libaf] Automatic filter insertion disabled " "but formats do not match. Giving up.\n"); return AF_ERROR; } @@ -347,7 +344,7 @@ static int af_reinit(af_stream_t* s, af_instance_t* af) break; } default: - af_msg(AF_MSG_ERROR,"[libaf] Reinitialization did not work, audio" + mp_msg(MSGT_AFILTER, MSGL_ERR, "[libaf] Reinitialization did not work, audio" " filter '%s' returned error code %i\n",af->info->name,rv); return AF_ERROR; } @@ -498,7 +495,7 @@ int af_init(af_stream_t* s) (s->last->data->nch != s->output.nch) || (s->last->data->rate != s->output.rate)) { // Something is stuffed audio out will not work - af_msg(AF_MSG_ERROR,"[libaf] Unable to setup filter system can not" + mp_msg(MSGT_AFILTER, MSGL_ERR, "[libaf] Unable to setup filter system can not" " meet sound-card demands, please send bugreport. \n"); af_uninit(s); return -1; @@ -589,7 +586,7 @@ int af_resize_local_buffer(af_instance_t* af, af_data_t* data) { // Calculate new length register int len = af_lencalc(af->mul,data); - af_msg(AF_MSG_VERBOSE,"[libaf] Reallocating memory in module %s, " + mp_msg(MSGT_AFILTER, MSGL_V, "[libaf] Reallocating memory in module %s, " "old len = %i, new len = %i\n",af->info->name,af->data->len,len); // If there is a buffer free it if(af->data->audio) @@ -597,7 +594,7 @@ int af_resize_local_buffer(af_instance_t* af, af_data_t* data) // Create new buffer and check that it is OK af->data->audio = malloc(len); if(!af->data->audio){ - af_msg(AF_MSG_FATAL,"[libaf] Could not allocate memory \n"); + mp_msg(MSGT_AFILTER, MSGL_FATAL, "[libaf] Could not allocate memory \n"); return AF_ERROR; } af->data->len=len; @@ -619,12 +616,12 @@ af_instance_t *af_control_any_rev (af_stream_t* s, int cmd, void* arg) { void af_help (void) { int i = 0; - af_msg(AF_MSG_INFO, "Available audio filters:\n"); + mp_msg(MSGT_AFILTER, MSGL_INFO, "Available audio filters:\n"); while (filter_list[i]) { if (filter_list[i]->comment && filter_list[i]->comment[0]) - af_msg(AF_MSG_INFO, " %-15s: %s (%s)\n", filter_list[i]->name, filter_list[i]->info, filter_list[i]->comment); + mp_msg(MSGT_AFILTER, MSGL_INFO, " %-15s: %s (%s)\n", filter_list[i]->name, filter_list[i]->info, filter_list[i]->comment); else - af_msg(AF_MSG_INFO, " %-15s: %s\n", filter_list[i]->name, filter_list[i]->info); + mp_msg(MSGT_AFILTER, MSGL_INFO, " %-15s: %s\n", filter_list[i]->name, filter_list[i]->info); i++; } } diff --git a/libaf/af.h b/libaf/af.h index 71dd023fa5..13f3f6cf76 100644 --- a/libaf/af.h +++ b/libaf/af.h @@ -25,6 +25,7 @@ #include "af_mp.h" #include "control.h" #include "af_format.h" +#include "mp_msg.h" struct af_instance_s; @@ -342,34 +343,4 @@ void af_fix_parameters(af_data_t *data); #define lrnd(a,b) ((b)((a)>=0.0?(a)+0.5:(a)-0.5)) #endif -/* Error messages */ - -typedef struct af_msg_cfg_s -{ - int level; /* Message level for debug and error messages max = 2 - min = -2 default = 0 */ - FILE* err; // Stream to print error messages to - FILE* msg; // Stream to print information messages to -}af_msg_cfg_t; - -extern af_msg_cfg_t af_msg_cfg; // Message - -//! \addtogroup af_filter -//! \{ -#define AF_MSG_FATAL -3 ///< Fatal error exit immediately -#define AF_MSG_ERROR -2 ///< Error return gracefully -#define AF_MSG_WARN -1 ///< Print warning but do not exit (can be suppressed) -#define AF_MSG_INFO 0 ///< Important information -#define AF_MSG_VERBOSE 1 ///< Print this if verbose is enabled -#define AF_MSG_DEBUG0 2 ///< Print if very verbose -#define AF_MSG_DEBUG1 3 ///< Print if very very verbose - -//! Macro for printing error messages -#ifndef af_msg -#define af_msg(lev, args... ) \ -(((lev)<AF_MSG_WARN)?(fprintf(af_msg_cfg.err?af_msg_cfg.err:stderr, ## args )): \ -(((lev)<=af_msg_cfg.level)?(fprintf(af_msg_cfg.msg?af_msg_cfg.msg:stdout, ## args )):0)) -#endif -//! \} - #endif /* MPLAYER_AF_H */ diff --git a/libaf/af_center.c b/libaf/af_center.c index c24554436f..5023872447 100644 --- a/libaf/af_center.c +++ b/libaf/af_center.c @@ -62,7 +62,7 @@ static int control(struct af_instance_s* af, int cmd, void* arg) case AF_CONTROL_CENTER_CH | AF_CONTROL_SET: // Requires reinit // Sanity check if((*(int*)arg >= AF_NCH) || (*(int*)arg < 0)){ - af_msg(AF_MSG_ERROR,"[sub] Center channel number must be between " + mp_msg(MSGT_AFILTER, MSGL_ERR, "[sub] Center channel number must be between " " 0 and %i current value is %i\n", AF_NCH-1, *(int*)arg); return AF_ERROR; } diff --git a/libaf/af_channels.c b/libaf/af_channels.c index bc329c9b31..ffed84bfb0 100644 --- a/libaf/af_channels.c +++ b/libaf/af_channels.c @@ -108,7 +108,7 @@ static void copy(void* in, void* out, int ins, int inos,int outs, int outos, int break; } default: - af_msg(AF_MSG_ERROR,"[channels] Unsupported number of bytes/sample: %i" + mp_msg(MSGT_AFILTER, MSGL_ERR, "[channels] Unsupported number of bytes/sample: %i" " please report this error on the MPlayer mailing list. \n",bps); } } @@ -118,14 +118,14 @@ static int check_routes(af_channels_t* s, int nin, int nout) { int i; if((s->nr < 1) || (s->nr > AF_NCH)){ - af_msg(AF_MSG_ERROR,"[channels] The number of routing pairs must be" + mp_msg(MSGT_AFILTER, MSGL_ERR, "[channels] The number of routing pairs must be" " between 1 and %i. Current value is %i\n",AF_NCH,s->nr); return AF_ERROR; } for(i=0;i<s->nr;i++){ if((s->route[i][FR] >= nin) || (s->route[i][TO] >= nout)){ - af_msg(AF_MSG_ERROR,"[channels] Invalid routing in pair nr. %i.\n", i); + mp_msg(MSGT_AFILTER, MSGL_ERR, "[channels] Invalid routing in pair nr. %i.\n", i); return AF_ERROR; } } @@ -180,14 +180,14 @@ static int control(struct af_instance_s* af, int cmd, void* arg) int ch = 0; // Sanity check if((s->nr < 1) || (s->nr > AF_NCH)){ - af_msg(AF_MSG_ERROR,"[channels] The number of routing pairs must be" + mp_msg(MSGT_AFILTER, MSGL_ERR, "[channels] The number of routing pairs must be" " between 1 and %i. Current value is %i\n",AF_NCH,s->nr); } s->router = 1; // Scan for pairs on commandline while((*cp == ':') && (ch < s->nr)){ sscanf(cp, ":%i:%i%n" ,&s->route[ch][FR], &s->route[ch][TO], &n); - af_msg(AF_MSG_VERBOSE,"[channels] Routing from channel %i to" + mp_msg(MSGT_AFILTER, MSGL_V, "[channels] Routing from channel %i to" " channel %i\n",s->route[ch][FR],s->route[ch][TO]); cp = &cp[n]; ch++; @@ -203,14 +203,14 @@ static int control(struct af_instance_s* af, int cmd, void* arg) // Sanity check if(((int*)arg)[0] <= 0 || ((int*)arg)[0] > AF_NCH){ - af_msg(AF_MSG_ERROR,"[channels] The number of output channels must be" + mp_msg(MSGT_AFILTER, MSGL_ERR, "[channels] The number of output channels must be" " between 1 and %i. Current value is %i\n",AF_NCH,((int*)arg)[0]); return AF_ERROR; } af->data->nch=((int*)arg)[0]; if(!s->router) - af_msg(AF_MSG_VERBOSE,"[channels] Changing number of channels" + mp_msg(MSGT_AFILTER, MSGL_V, "[channels] Changing number of channels" " to %i\n",af->data->nch); return AF_OK; case AF_CONTROL_CHANNELS | AF_CONTROL_GET: diff --git a/libaf/af_delay.c b/libaf/af_delay.c index f754e736cd..4b94e00066 100644 --- a/libaf/af_delay.c +++ b/libaf/af_delay.c @@ -63,7 +63,7 @@ static int control(struct af_instance_s* af, int cmd, void* arg) for(i=0;i<af->data->nch;i++){ s->q[i] = calloc(L,af->data->bps); if(NULL == s->q[i]) - af_msg(AF_MSG_FATAL,"[delay] Out of memory\n"); + mp_msg(MSGT_AFILTER, MSGL_FATAL, "[delay] Out of memory\n"); } return control(af,AF_CONTROL_DELAY_LEN | AF_CONTROL_SET,s->d); @@ -87,9 +87,9 @@ static int control(struct af_instance_s* af, int cmd, void* arg) return AF_ERROR; s->ri = 0; for(i=0;i<AF_NCH;i++){ - af_msg(AF_MSG_DEBUG0,"[delay] Channel %i delayed by %0.3fms\n", + mp_msg(MSGT_AFILTER, MSGL_DBG2, "[delay] Channel %i delayed by %0.3fms\n", i,clamp(s->d[i],0.0,1000.0)); - af_msg(AF_MSG_DEBUG1,"[delay] Channel %i delayed by %i samples\n", + mp_msg(MSGT_AFILTER, MSGL_DBG3, "[delay] Channel %i delayed by %i samples\n", i,s->wi[i]); } return AF_OK; diff --git a/libaf/af_dummy.c b/libaf/af_dummy.c index 19a765c66d..6e32116b99 100644 --- a/libaf/af_dummy.c +++ b/libaf/af_dummy.c @@ -31,7 +31,7 @@ static int control(struct af_instance_s* af, int cmd, void* arg) switch(cmd){ case AF_CONTROL_REINIT: memcpy(af->data,(af_data_t*)arg,sizeof(af_data_t)); - af_msg(AF_MSG_VERBOSE,"[dummy] Was reinitialized: %iHz/%ich/%s\n", + mp_msg(MSGT_AFILTER, MSGL_V, "[dummy] Was reinitialized: %iHz/%ich/%s\n", af->data->rate,af->data->nch,af_fmt2str_short(af->data->format)); return AF_OK; } @@ -50,7 +50,7 @@ static af_data_t* play(struct af_instance_s* af, af_data_t* data) { // Do something necessary to get rid of annoying warning during compile if(!af) - af_msg(AF_MSG_ERROR,"EEEK: Argument af == NULL in af_dummy.c play()."); + mp_msg(MSGT_AFILTER, MSGL_ERR, "EEEK: Argument af == NULL in af_dummy.c play()."); return data; } diff --git a/libaf/af_equalizer.c b/libaf/af_equalizer.c index e9c95d98b9..519d9aba4c 100644 --- a/libaf/af_equalizer.c +++ b/libaf/af_equalizer.c @@ -107,7 +107,7 @@ static int control(struct af_instance_s* af, int cmd, void* arg) s->K--; if(s->K != KM) - af_msg(AF_MSG_INFO,"[equalizer] Limiting the number of filters to" + mp_msg(MSGT_AFILTER, MSGL_INFO, "[equalizer] Limiting the number of filters to" " %i due to low sample rate.\n",s->K); // Generate filter taps diff --git a/libaf/af_export.c b/libaf/af_export.c index cc32fac42d..59a6e8ec00 100644 --- a/libaf/af_export.c +++ b/libaf/af_export.c @@ -96,15 +96,15 @@ static int control(struct af_instance_s* af, int cmd, void* arg) // Allocate new buffers (as one continuous block) s->buf[0] = calloc(s->sz*af->data->nch, af->data->bps); if(NULL == s->buf[0]) - af_msg(AF_MSG_FATAL, "[export] Out of memory\n"); + mp_msg(MSGT_AFILTER, MSGL_FATAL, "[export] Out of memory\n"); for(i = 1; i < af->data->nch; i++) s->buf[i] = s->buf[0] + i*s->sz*af->data->bps; // Init memory mapping s->fd = open(s->filename, O_RDWR | O_CREAT | O_TRUNC, 0640); - af_msg(AF_MSG_INFO, "[export] Exporting to file: %s\n", s->filename); + mp_msg(MSGT_AFILTER, MSGL_INFO, "[export] Exporting to file: %s\n", s->filename); if(s->fd < 0) - af_msg(AF_MSG_FATAL, "[export] Could not open/create file: %s\n", + mp_msg(MSGT_AFILTER, MSGL_FATAL, "[export] Could not open/create file: %s\n", s->filename); // header + buffer @@ -119,8 +119,8 @@ static int control(struct af_instance_s* af, int cmd, void* arg) // mmap size s->mmap_area = mmap(0, mapsize, PROT_READ|PROT_WRITE,MAP_SHARED, s->fd, 0); if(s->mmap_area == NULL) - af_msg(AF_MSG_FATAL, "[export] Could not mmap file %s\n", s->filename); - af_msg(AF_MSG_INFO, "[export] Memory mapped to file: %s (%p)\n", + mp_msg(MSGT_AFILTER, MSGL_FATAL, "[export] Could not mmap file %s\n", s->filename); + mp_msg(MSGT_AFILTER, MSGL_INFO, "[export] Memory mapped to file: %s (%p)\n", s->filename, s->mmap_area); // Initialize header @@ -160,7 +160,7 @@ static int control(struct af_instance_s* af, int cmd, void* arg) case AF_CONTROL_EXPORT_SZ | AF_CONTROL_SET: s->sz = * (int *) arg; if((s->sz <= 0) || (s->sz > 2048)) - af_msg( AF_MSG_ERROR, "[export] Buffer size must be between" + mp_msg(MSGT_AFILTER, MSGL_ERR, "[export] Buffer size must be between" " 1 and 2048\n" ); return AF_OK; diff --git a/libaf/af_format.c b/libaf/af_format.c index df4dac2841..8917a870a6 100644 --- a/libaf/af_format.c +++ b/libaf/af_format.c @@ -62,7 +62,7 @@ static af_data_t* play_s16_float(struct af_instance_s* af, af_data_t* data); static int check_bps(int bps) { if(bps != 4 && bps != 3 && bps != 2 && bps != 1){ - af_msg(AF_MSG_ERROR,"[format] The number of bytes per sample" + mp_msg(MSGT_AFILTER, MSGL_ERR, "[format] The number of bytes per sample" " must be 1, 2, 3 or 4. Current value is %i \n",bps); return AF_ERROR; } @@ -77,7 +77,7 @@ static int check_format(int format) case(AF_FORMAT_IMA_ADPCM): case(AF_FORMAT_MPEG2): case(AF_FORMAT_AC3): - af_msg(AF_MSG_ERROR,"[format] Sample format %s not yet supported \n", + mp_msg(MSGT_AFILTER, MSGL_ERR, "[format] Sample format %s not yet supported \n", af_fmt2str(format,buf,256)); return AF_ERROR; } @@ -105,7 +105,7 @@ static int control(struct af_instance_s* af, int cmd, void* arg) (AF_OK != check_format(af->data->format))) return AF_ERROR; - af_msg(AF_MSG_VERBOSE,"[format] Changing sample format from %s to %s\n", + mp_msg(MSGT_AFILTER, MSGL_V, "[format] Changing sample format from %s to %s\n", af_fmt2str(data->format,buf1,256), af_fmt2str(af->data->format,buf2,256)); @@ -119,13 +119,13 @@ static int control(struct af_instance_s* af, int cmd, void* arg) if ((af->data->format & ~AF_FORMAT_END_MASK) == (data->format & ~AF_FORMAT_END_MASK)) { - af_msg(AF_MSG_VERBOSE,"[format] Accelerated endianness conversion only\n"); + mp_msg(MSGT_AFILTER, MSGL_V, "[format] Accelerated endianness conversion only\n"); af->play = play_swapendian; } if ((data->format == AF_FORMAT_FLOAT_NE) && (af->data->format == AF_FORMAT_S16_NE)) { - af_msg(AF_MSG_VERBOSE,"[format] Accelerated %s to %s conversion\n", + mp_msg(MSGT_AFILTER, MSGL_V, "[format] Accelerated %s to %s conversion\n", af_fmt2str(data->format,buf1,256), af_fmt2str(af->data->format,buf2,256)); af->play = play_float_s16; @@ -133,7 +133,7 @@ static int control(struct af_instance_s* af, int cmd, void* arg) if ((data->format == AF_FORMAT_S16_NE) && (af->data->format == AF_FORMAT_FLOAT_NE)) { - af_msg(AF_MSG_VERBOSE,"[format] Accelerated %s to %s conversion\n", + mp_msg(MSGT_AFILTER, MSGL_V, "[format] Accelerated %s to %s conversion\n", af_fmt2str(data->format,buf1,256), af_fmt2str(af->data->format,buf2,256)); af->play = play_s16_float; @@ -143,7 +143,7 @@ static int control(struct af_instance_s* af, int cmd, void* arg) case AF_CONTROL_COMMAND_LINE:{ int format = af_str2fmt_short(arg); if (format == -1) { - af_msg(AF_MSG_ERROR, "[format] %s is not a valid format\n", (char *)arg); + mp_msg(MSGT_AFILTER, MSGL_ERR, "[format] %s is not a valid format\n", (char *)arg); return AF_ERROR; } if(AF_OK != af->control(af,AF_CONTROL_FORMAT_FMT | AF_CONTROL_SET,&format)) diff --git a/libaf/af_hrtf.c b/libaf/af_hrtf.c index 6fc6035c08..8f86f5d854 100644 --- a/libaf/af_hrtf.c +++ b/libaf/af_hrtf.c @@ -293,7 +293,7 @@ static int control(struct af_instance_s *af, int cmd, void* arg) if(af->data->rate != 48000) { // automatic samplerate adjustment in the filter chain // is not yet supported. - af_msg(AF_MSG_ERROR, + mp_msg(MSGT_AFILTER, MSGL_ERR, "[hrtf] ERROR: Sampling rate is not 48000 Hz (%d)!\n", af->data->rate); return AF_ERROR; @@ -331,7 +331,7 @@ static int control(struct af_instance_s *af, int cmd, void* arg) s->matrix_mode = 0; break; default: - af_msg(AF_MSG_ERROR, + mp_msg(MSGT_AFILTER, MSGL_ERR, "[hrtf] Mode is neither 'm', 's', nor '0' (%c).\n", mode); return AF_ERROR; @@ -409,29 +409,29 @@ static af_data_t* play(struct af_instance_s *af, af_data_t *data) s->print_flag = 0; switch (s->decode_mode) { case HRTF_MIX_51: - af_msg(AF_MSG_INFO, + mp_msg(MSGT_AFILTER, MSGL_INFO, "[hrtf] Using HRTF to mix %s discrete surround into " "L, R channels\n", s->matrix_mode ? "5+1" : "5"); break; case HRTF_MIX_STEREO: - af_msg(AF_MSG_INFO, + mp_msg(MSGT_AFILTER, MSGL_INFO, "[hrtf] Using HRTF to mix stereo into " "L, R channels\n"); break; case HRTF_MIX_MATRIX2CH: - af_msg(AF_MSG_INFO, + mp_msg(MSGT_AFILTER, MSGL_INFO, "[hrtf] Using active matrix to decode 2 channel " "input, HRTF to mix %s matrix surround into " "L, R channels\n", "3/2"); break; default: - af_msg(AF_MSG_WARN, + mp_msg(MSGT_AFILTER, MSGL_WARN, "[hrtf] bogus decode_mode: %d\n", s->decode_mode); break; } if(s->matrix_mode) - af_msg(AF_MSG_INFO, + mp_msg(MSGT_AFILTER, MSGL_INFO, "[hrtf] Using active matrix to decode rear center " "channel\n"); } @@ -636,7 +636,7 @@ static int af_open(af_instance_t* af) s->print_flag = 1; if (allocate(s) != 0) { - af_msg(AF_MSG_ERROR, "[hrtf] Memory allocation error.\n"); + mp_msg(MSGT_AFILTER, MSGL_ERR, "[hrtf] Memory allocation error.\n"); return AF_ERROR; } @@ -655,13 +655,13 @@ static int af_open(af_instance_t* af) s->cr_ir = cr_filt + (s->cr_o = pulse_detect(cr_filt)); if((s->ba_ir = malloc(s->basslen * sizeof(float))) == NULL) { - af_msg(AF_MSG_ERROR, "[hrtf] Memory allocation error.\n"); + mp_msg(MSGT_AFILTER, MSGL_ERR, "[hrtf] Memory allocation error.\n"); return AF_ERROR; } fc = 2.0 * BASSFILTFREQ / (float)af->data->rate; if(af_filter_design_fir(s->basslen, s->ba_ir, &fc, LP | KAISER, 4 * M_PI) == -1) { - af_msg(AF_MSG_ERROR, "[hrtf] Unable to design low-pass " + mp_msg(MSGT_AFILTER, MSGL_ERR, "[hrtf] Unable to design low-pass " "filter.\n"); return AF_ERROR; } diff --git a/libaf/af_ladspa.c b/libaf/af_ladspa.c index 414cd34ff1..34cf0a6d19 100644 --- a/libaf/af_ladspa.c +++ b/libaf/af_ladspa.c @@ -212,30 +212,30 @@ static int af_ladspa_parse_plugin(af_ladspa_t *setup) { } if (setup->ninputs == 0) { - af_msg(AF_MSG_WARN, "%s: %s\n", setup->myname, + mp_msg(MSGT_AFILTER, MSGL_WARN, "%s: %s\n", setup->myname, MSGTR_AF_LADSPA_WarnNoInputs); } else if (setup->ninputs == 1) { - af_msg(AF_MSG_VERBOSE, "%s: this is a mono effect\n", setup->myname); + mp_msg(MSGT_AFILTER, MSGL_V, "%s: this is a mono effect\n", setup->myname); } else if (setup->ninputs == 2) { - af_msg(AF_MSG_VERBOSE, "%s: this is a stereo effect\n", setup->myname); + mp_msg(MSGT_AFILTER, MSGL_V, "%s: this is a stereo effect\n", setup->myname); } else { - af_msg(AF_MSG_VERBOSE, "%s: this is a %i-channel effect, " + mp_msg(MSGT_AFILTER, MSGL_V, "%s: this is a %i-channel effect, " "support is experimental\n", setup->myname, setup->ninputs); } if (setup->noutputs == 0) { - af_msg(AF_MSG_ERROR, "%s: %s\n", setup->myname, + mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname, MSGTR_AF_LADSPA_ErrNoOutputs); return AF_ERROR; } if (setup->noutputs != setup->ninputs ) { - af_msg(AF_MSG_ERROR, "%s: %s\n", setup->myname, + mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname, MSGTR_AF_LADSPA_ErrInOutDiff); return AF_ERROR; } - af_msg(AF_MSG_VERBOSE, "%s: this plugin has %d input control(s)\n", + mp_msg(MSGT_AFILTER, MSGL_V, "%s: this plugin has %d input control(s)\n", setup->myname, setup->ninputcontrols); /* Print list of controls and its range of values it accepts */ @@ -243,18 +243,18 @@ static int af_ladspa_parse_plugin(af_ladspa_t *setup) { for (i=0; i<setup->ninputcontrols; i++) { p = setup->inputcontrolsmap[i]; hint = pdes->PortRangeHints[p]; - af_msg(AF_MSG_VERBOSE, " --- %d %s [", i, pdes->PortNames[p]); + mp_msg(MSGT_AFILTER, MSGL_V, " --- %d %s [", i, pdes->PortNames[p]); if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor)) { - af_msg(AF_MSG_VERBOSE, "%0.2f , ", hint.LowerBound); + mp_msg(MSGT_AFILTER, MSGL_V, "%0.2f , ", hint.LowerBound); } else { - af_msg(AF_MSG_VERBOSE, "... , "); + mp_msg(MSGT_AFILTER, MSGL_V, "... , "); } if (LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor)) { - af_msg(AF_MSG_VERBOSE, "%0.2f]\n", hint.UpperBound); + mp_msg(MSGT_AFILTER, MSGL_V, "%0.2f]\n", hint.UpperBound); } else { - af_msg(AF_MSG_VERBOSE, "...]\n"); + mp_msg(MSGT_AFILTER, MSGL_V, "...]\n"); } } @@ -300,9 +300,9 @@ static void* mydlopen(const char *filename, int flag) { /* For Windows there's only absolute path support. * If you have a Windows machine, feel free to fix this. * (path separator, shared objects extension, et cetera). */ - af_msg(AF_MSG_VERBOSE, "\ton windows, only absolute pathnames " + mp_msg(MSGT_AFILTER, MSGL_V, "\ton windows, only absolute pathnames " "are supported\n"); - af_msg(AF_MSG_VERBOSE, "\ttrying %s\n", filename); + mp_msg(MSGT_AFILTER, MSGL_V, "\ttrying %s\n", filename); return dlopen(filename, flag); #endif @@ -343,7 +343,7 @@ static void* mydlopen(const char *filename, int flag) { } strcpy(buf+needslash+(end-start), filename); - af_msg(AF_MSG_VERBOSE, "\ttrying %s\n", buf); + mp_msg(MSGT_AFILTER, MSGL_V, "\ttrying %s\n", buf); result=dlopen(buf, flag); free(buf); @@ -357,7 +357,7 @@ static void* mydlopen(const char *filename, int flag) { } /* end if there's a ladspapath */ /* last resort, just open it again, so the dlerror() message is correct */ - af_msg(AF_MSG_VERBOSE, "\ttrying %s\n", filename); + mp_msg(MSGT_AFILTER, MSGL_V, "\ttrying %s\n", filename); return dlopen(filename,flag); } @@ -384,18 +384,18 @@ static int af_ladspa_load_plugin(af_ladspa_t *setup) { int i; /* load library */ - af_msg(AF_MSG_VERBOSE, "%s: loading ladspa plugin library %s\n", + mp_msg(MSGT_AFILTER, MSGL_V, "%s: loading ladspa plugin library %s\n", setup->myname, setup->file); setup->libhandle = mydlopen(setup->file, RTLD_NOW); if (!setup->libhandle) { - af_msg(AF_MSG_ERROR, "%s: %s %s\n\t%s\n", setup->myname, + mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s %s\n\t%s\n", setup->myname, MSGTR_AF_LADSPA_ErrFailedToLoad, setup->file, dlerror() ); return AF_ERROR; } - af_msg(AF_MSG_VERBOSE, "%s: library found.\n", setup->myname); + mp_msg(MSGT_AFILTER, MSGL_V, "%s: library found.\n", setup->myname); /* find descriptor function */ dlerror(); @@ -403,7 +403,7 @@ static int af_ladspa_load_plugin(af_ladspa_t *setup) { "ladspa_descriptor"); if (!descriptor_function) { - af_msg(AF_MSG_ERROR, "%s: %s\n\t%s\n", setup->myname, + mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n\t%s\n", setup->myname, MSGTR_AF_LADSPA_ErrNoDescriptor, dlerror()); return AF_ERROR; } @@ -411,33 +411,33 @@ static int af_ladspa_load_plugin(af_ladspa_t *setup) { /* if label == help, list all labels in library and exit */ if (strcmp(setup->label, "help") == 0) { - af_msg(AF_MSG_INFO, "%s: %s %s:\n", setup->myname, + mp_msg(MSGT_AFILTER, MSGL_INFO, "%s: %s %s:\n", setup->myname, MSGTR_AF_LADSPA_AvailableLabels, setup->file); for (i=0; ; i++) { ladspa_descriptor = descriptor_function(i); if (ladspa_descriptor == NULL) { return AF_ERROR; } - af_msg(AF_MSG_INFO, " %-16s - %s (%lu)\n", + mp_msg(MSGT_AFILTER, MSGL_INFO, " %-16s - %s (%lu)\n", ladspa_descriptor->Label, ladspa_descriptor->Name, ladspa_descriptor->UniqueID); } } - af_msg(AF_MSG_VERBOSE, "%s: looking for label\n", setup->myname); + mp_msg(MSGT_AFILTER, MSGL_V, "%s: looking for label\n", setup->myname); /* find label in library */ for (i=0; ; i++) { ladspa_descriptor = descriptor_function(i); if (ladspa_descriptor == NULL) { - af_msg(AF_MSG_ERROR, "%s: %s\n", setup->myname, + mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname, MSGTR_AF_LADSPA_ErrLabelNotFound); return AF_ERROR; } if (strcmp(ladspa_descriptor->Label, setup->label) == 0) { setup->plugin_descriptor = ladspa_descriptor; - af_msg(AF_MSG_VERBOSE, "%s: %s found\n", setup->myname, + mp_msg(MSGT_AFILTER, MSGL_V, "%s: %s found\n", setup->myname, setup->label); return AF_OK; } @@ -458,7 +458,7 @@ static int af_ladspa_load_plugin(af_ladspa_t *setup) { */ static int af_ladspa_malloc_failed(char *myname) { - af_msg(AF_MSG_ERROR, "%s: %s", myname, MSGTR_MemAllocFailed); + mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s", myname, MSGTR_MemAllocFailed); return AF_ERROR; } @@ -493,7 +493,7 @@ static int control(struct af_instance_s *af, int cmd, void *arg) { switch(cmd) { case AF_CONTROL_REINIT: - af_msg(AF_MSG_VERBOSE, "%s: (re)init\n", setup->myname); + mp_msg(MSGT_AFILTER, MSGL_V, "%s: (re)init\n", setup->myname); if (!arg) return AF_ERROR; @@ -512,14 +512,14 @@ static int control(struct af_instance_s *af, int cmd, void *arg) { case AF_CONTROL_COMMAND_LINE: { char *buf; - af_msg(AF_MSG_VERBOSE, "%s: parse suboptions\n", setup->myname); + mp_msg(MSGT_AFILTER, MSGL_V, "%s: parse suboptions\n", setup->myname); /* suboption parser here! * format is (ladspa=)file:label:controls.... */ if (!arg) { - af_msg(AF_MSG_ERROR, "%s: %s\n", setup->myname, + mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname, MSGTR_AF_LADSPA_ErrNoSuboptions); return AF_ERROR; } @@ -531,7 +531,7 @@ static int control(struct af_instance_s *af, int cmd, void *arg) { buf[0] = '\0'; sscanf(arg, "%[^:]", buf); if (buf[0] == '\0') { - af_msg(AF_MSG_ERROR, "%s: %s\n", setup->myname, + mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname, MSGTR_AF_LADSPA_ErrNoLibFile); free(buf); return AF_ERROR; @@ -539,7 +539,7 @@ static int control(struct af_instance_s *af, int cmd, void *arg) { arg += strlen(buf); setup->file = strdup(buf); if (!setup->file) return af_ladspa_malloc_failed(setup->myname); - af_msg(AF_MSG_VERBOSE, "%s: file --> %s\n", setup->myname, + mp_msg(MSGT_AFILTER, MSGL_V, "%s: file --> %s\n", setup->myname, setup->file); if (*(char*)arg != '\0') arg++; /* read ':' */ @@ -547,7 +547,7 @@ static int control(struct af_instance_s *af, int cmd, void *arg) { buf[0] = '\0'; sscanf(arg, "%[^:]", buf); if (buf[0] == '\0') { - af_msg(AF_MSG_ERROR, "%s: %s\n", setup->myname, + mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname, MSGTR_AF_LADSPA_ErrNoLabel); free(buf); return AF_ERROR; @@ -555,7 +555,7 @@ static int control(struct af_instance_s *af, int cmd, void *arg) { arg += strlen(buf); setup->label = strdup(buf); if (!setup->label) return af_ladspa_malloc_failed(setup->myname); - af_msg(AF_MSG_VERBOSE, "%s: label --> %s\n", setup->myname, + mp_msg(MSGT_AFILTER, MSGL_V, "%s: label --> %s\n", setup->myname, setup->label); /* if (*(char*)arg != '0') arg++; */ /* read ':' */ @@ -583,14 +583,14 @@ static int control(struct af_instance_s *af, int cmd, void *arg) { for(i=0; i<setup->ninputcontrols; i++) { if (!arg || (*(char*)arg != ':') ) { - af_msg(AF_MSG_ERROR, "%s: %s\n", setup->myname, + mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname, MSGTR_AF_LADSPA_ErrNotEnoughControls); return AF_ERROR; } arg++; r = sscanf(arg, "%f", &val); if (r!=1) { - af_msg(AF_MSG_ERROR, "%s: %s\n", setup->myname, + mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n" |