summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbircoph <bircoph@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-03-28 19:57:56 +0000
committerbircoph <bircoph@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-03-28 19:57:56 +0000
commit42a792bbc71e1cb4b15765af8acda48a9951a210 (patch)
tree7981ec1d5ac13db260b7bd5d81d1c4848b18a7f1
parent0a1f688c6e837c6807335d8771d785c1c3ff679b (diff)
downloadmpv-42a792bbc71e1cb4b15765af8acda48a9951a210.tar.bz2
mpv-42a792bbc71e1cb4b15765af8acda48a9951a210.tar.xz
Remove af_msg special-casing API in libaf.
Replace it by standard mp_msg message system. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29088 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--libaf/af.c33
-rw-r--r--libaf/af.h31
-rw-r--r--libaf/af_center.c2
-rw-r--r--libaf/af_channels.c14
-rw-r--r--libaf/af_delay.c6
-rw-r--r--libaf/af_dummy.c4
-rw-r--r--libaf/af_equalizer.c2
-rw-r--r--libaf/af_export.c12
-rw-r--r--libaf/af_format.c14
-rw-r--r--libaf/af_hrtf.c20
-rw-r--r--libaf/af_ladspa.c90
-rw-r--r--libaf/af_lavcac3enc.c22
-rw-r--r--libaf/af_mp.h7
-rw-r--r--libaf/af_pan.c4
-rw-r--r--libaf/af_resample.c14
-rw-r--r--libaf/af_scaletempo.c28
-rw-r--r--libaf/af_sinesuppress.c2
-rw-r--r--libaf/af_sub.c4
-rw-r--r--libaf/af_surround.c8
-rw-r--r--libaf/af_volume.c4
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", setup->myname,
MSGTR_AF_LADSPA_ErrNotEnoughControls);
return AF_ERROR;
}
@@ -598,16 +598,16 @@ static int control(struct af_instance_s *af, int cmd, void *arg) {
arg = strchr(arg, ':');
}
- af_msg(AF_MSG_VERBOSE, "%s: input controls: ", setup->myname);
+ mp_msg(MSGT_AFILTER, MSGL_V, "%s: input controls: ", setup->myname);
for(i=0; i<setup->ninputcontrols; i++) {
- af_msg(AF_MSG_VERBOSE, "%0.4f ",
+ mp_msg(MSGT_AFILTER, MSGL_V, "%0.4f ",
setup->inputcontrols[setup->inputcontrolsmap[i]]);
}
- af_msg(AF_MSG_VERBOSE, "\n");
+ mp_msg(MSGT_AFILTER, MSGL_V, "\n");
/* check boundaries of inputcontrols */
- af_msg(AF_MSG_VERBOSE, "%s: checking boundaries of input controls\n",
+ mp_msg(MSGT_AFILTER, MSGL_V, "%s: checking boundaries of input controls\n",
setup->myname);
for(i=0; i<setup->ninputcontrols; i++) {
int p = setup->inputcontrolsmap[i];
@@ -617,18 +617,18 @@ static int control(struct af_instance_s *af, int cmd, void *arg) {
if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor) &&
val < hint.LowerBound) {
- af_msg(AF_MSG_ERROR, MSGTR_AF_LADSPA_ErrControlBelow,
+ mp_msg(MSGT_AFILTER, MSGL_ERR, MSGTR_AF_LADSPA_ErrControlBelow,
setup->myname, i, hint.LowerBound);
return AF_ERROR;
}
if (LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor) &&
val > hint.UpperBound) {
- af_msg(AF_MSG_ERROR, MSGTR_AF_LADSPA_ErrControlAbove,
+ mp_msg(MSGT_AFILTER, MSGL_ERR, MSGTR_AF_LADSPA_ErrControlAbove,
setup->myname, i, hint.UpperBound);
return AF_ERROR;
}
}
- af_msg(AF_MSG_VERBOSE, "%s: all controls have sane values\n",
+ mp_msg(MSGT_AFILTER, MSGL_V, "%s: all controls have sane values\n",
setup->myname);
/* All is well! */
@@ -660,7 +660,7 @@ static void uninit(struct af_instance_s *af) {
const LADSPA_Descriptor *pdes = setup->plugin_descriptor;
if (setup->myname) {
- af_msg(AF_MSG_VERBOSE, "%s: cleaning up\n", setup->myname);
+ mp_msg(MSGT_AFILTER, MSGL_V, "%s: cleaning up\n", setup->myname);
free(setup->myname);
}
@@ -750,7 +750,7 @@ static af_data_t* play(struct af_instance_s *af, af_data_t *data) {
*/
if (setup->nch != 0) {
- af_msg(AF_MSG_DEBUG1, "%s: bufsize change; free old buffer\n",
+ mp_msg(MSGT_AFILTER, MSGL_DBG3, "%s: bufsize change; free old buffer\n",
setup->myname);
if(setup->inbufs) {
@@ -775,7 +775,7 @@ static af_data_t* play(struct af_instance_s *af, af_data_t *data) {
setup->inbufs = calloc(nch, sizeof(float*));
setup->outbufs = calloc(nch, sizeof(float*));
- af_msg(AF_MSG_DEBUG1, "%s: bufsize = %d\n",
+ mp_msg(MSGT_AFILTER, MSGL_DBG3, "%s: bufsize = %d\n",
setup->myname, setup->bufsize);
for(i=0; i<nch; i++) {
diff --git a/libaf/af_lavcac3enc.c b/libaf/af_lavcac3enc.c
index 37a49404e8..36a19dad60 100644
--- a/libaf/af_lavcac3enc.c
+++ b/libaf/af_lavcac3enc.c
@@ -68,7 +68,7 @@ static int control(struct af_instance_s *af, int cmd, void *arg)
else
af->mul = (double)AC3_MAX_CODED_FRAME_SIZE / s->expect_len;
- af_msg(AF_MSG_DEBUG0, "af_lavcac3enc reinit: %d, %d, %f, %d.\n",
+ mp_msg(MSGT_AFILTER, MSGL_DBG2, "af_lavcac3enc reinit: %d, %d, %f, %d.\n",
data->nch, data->rate, af->mul, s->expect_len);
af->data->format = AF_FORMAT_S16_NE;
@@ -98,7 +98,7 @@ static int control(struct af_instance_s *af, int cmd, void *arg)
s->lavc_actx->bit_rate = bit_rate;
if(avcodec_open(s->lavc_actx, s->lavc_acodec) < 0) {
- af_msg(AF_MSG_ERROR, MSGTR_CouldntOpenCodec, "ac3", bit_rate);
+ mp_msg(MSGT_AFILTER, MSGL_ERR, MSGTR_CouldntOpenCodec, "ac3", bit_rate);
return AF_ERROR;
}
}
@@ -106,7 +106,7 @@ static int control(struct af_instance_s *af, int cmd, void *arg)
af->data->nch = 2;
return test_output_res;
case AF_CONTROL_COMMAND_LINE:
- af_msg(AF_MSG_DEBUG0, "af_lavcac3enc cmdline: %s.\n", (char*)arg);
+ mp_msg(MSGT_AFILTER, MSGL_DBG2, "af_lavcac3enc cmdline: %s.\n", (char*)arg);
s->bit_rate = 0;
s->min_channel_num = 0;
s->add_iec61937_header = 0;
@@ -119,7 +119,7 @@ static int control(struct af_instance_s *af, int cmd, void *arg)
if (ff_ac3_bitrate_tab[i] * 1000 == s->bit_rate)
break;
if (i >= 19) {
- af_msg(AF_MSG_WARN, "af_lavcac3enc unable set unsupported "
+ mp_msg(MSGT_AFILTER, MSGL_WARN, "af_lavcac3enc unable set unsupported "
"bitrate %d, use default bitrate (check manpage to see "
"supported bitrates).\n", s->bit_rate);
s->bit_rate = 0;
@@ -127,7 +127,7 @@ static int control(struct af_instance_s *af, int cmd, void *arg)
}
if (s->min_channel_num == 0)
s->min_channel_num = 5;
- af_msg(AF_MSG_VERBOSE, "af_lavcac3enc config spdif:%d, bitrate:%d, "
+ mp_msg(MSGT_AFILTER, MSGL_V, "af_lavcac3enc config spdif:%d, bitrate:%d, "
"minchnum:%d.\n", s->add_iec61937_header, s->bit_rate,
s->min_channel_num);
return AF_OK;
@@ -171,13 +171,13 @@ static af_data_t* play(struct af_instance_s* af, af_data_t* data)
max_output_len = AC3_MAX_CODED_FRAME_SIZE * frame_num;
if (af->data->len < max_output_len) {
- 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,
max_output_len);
free(af->data->audio);
af->data->audio = malloc(max_output_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 NULL;
}
af->data->len = max_output_len;
@@ -231,7 +231,7 @@ static af_data_t* play(struct af_instance_s* af, af_data_t* data)
src += s->expect_len;
left -= s->expect_len;
}
- af_msg(AF_MSG_DEBUG0, "avcodec_encode_audio got %d, pending %d.\n",
+ mp_msg(MSGT_AFILTER, MSGL_DBG2, "avcodec_encode_audio got %d, pending %d.\n",
len, s->pending_len);
if (s->add_iec61937_header) {
@@ -269,7 +269,7 @@ static af_data_t* play(struct af_instance_s* af, af_data_t* data)
c->nch = 2;
c->bps = 2;
c->len = outsize;
- af_msg(AF_MSG_DEBUG0, "play return size %d, pending %d\n",
+ mp_msg(MSGT_AFILTER, MSGL_DBG2, "play return size %d, pending %d\n",
outsize, s->pending_len);
return c;
}
@@ -295,13 +295,13 @@ static int af_open(af_instance_t* af){
s->lavc_acodec = avcodec_find_encoder_by_name("ac3");
if (!s->lavc_acodec) {
- af_msg(AF_MSG_ERROR, MSGTR_LavcAudioCodecNotFound, "ac3");
+ mp_msg(MSGT_AFILTER, MSGL_ERR, MSGTR_LavcAudioCodecNotFound, "ac3");
return AF_ERROR;
}
s->lavc_actx = avcodec_alloc_context();
if (!s->lavc_actx) {
- af_msg(AF_MSG_ERROR, MSGTR_CouldntAllocateLavcContext);
+ mp_msg(MSGT_AFILTER, MSGL_ERR, MSGTR_CouldntAllocateLavcContext);
return AF_ERROR;
}
diff --git a/libaf/af_mp.h b/libaf/af_mp.h
index 29aca538e7..fd4a383720 100644
--- a/libaf/af_mp.h
+++ b/libaf/af_mp.h
@@ -21,7 +21,6 @@
#define MPLAYER_AF_MP_H
#include "config.h"
-#include "mp_msg.h"
#include "cpudetect.h"
/* Set the initialization type from mplayers cpudetect */
@@ -31,10 +30,4 @@
((gCpuCaps.has3DNow || gCpuCaps.hasSSE)?AF_INIT_FAST:AF_INIT_SLOW)
#endif
-#ifdef af_msg
-#undef af_msg
-#endif
-#define af_msg(lev, args... ) \
- mp_msg(MSGT_AFILTER,(((lev)<0)?((lev)+3):(((lev)==0)?MSGL_INFO:((lev)+5))), ##args )
-
#endif /* MPLAYER_AF_MP_H */
diff --git a/libaf/af_pan.c b/libaf/af_pan.c
index ae2f81c50a..2c1a41dd87 100644
--- a/libaf/af_pan.c
+++ b/libaf/af_pan.c
@@ -72,7 +72,7 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
j = 0; k = 0;
while((*cp == ':') && (k < AF_NCH)){
sscanf(cp, ":%f%n" , &s->level[j][k], &n);
- af_msg(AF_MSG_VERBOSE,"[pan] Pan level from channel %i to"
+ mp_msg(MSGT_AFILTER, MSGL_V, "[pan] Pan level from channel %i to"
" channel %i = %f\n",k,j,s->level[j][k]);
cp =&cp[n];
j++;
@@ -108,7 +108,7 @@ 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,"[pan] The number of output channels must be"
+ mp_msg(MSGT_AFILTER, MSGL_ERR, "[pan] The number of output channels must be"
" between 1 and %i. Current value is %i\n",AF_NCH,((int*)arg)[0]);
return AF_ERROR;
}
diff --git a/libaf/af_resample.c b/libaf/af_resample.c
index 2844940000..03ad4e3d42 100644
--- a/libaf/af_resample.c
+++ b/libaf/af_resample.c
@@ -139,7 +139,7 @@ static int set_types(struct af_instance_s* af, af_data_t* data)
s->setup = (s->setup & ~RSMP_MASK) | RSMP_LIN;
af->data->format = AF_FORMAT_S16_NE;
af->data->bps = 2;
- af_msg(AF_MSG_VERBOSE,"[resample] Using linear interpolation. \n");
+ mp_msg(MSGT_AFILTER, MSGL_V, "[resample] Using linear interpolation. \n");
}
else{
/* If the input format is float or if float is explicitly selected
@@ -155,7 +155,7 @@ static int set_types(struct af_instance_s* af, af_data_t* data)
af->data->format = AF_FORMAT_S16_NE;
af->data->bps = 2;
}
- af_msg(AF_MSG_VERBOSE,"[resample] Using %s processing and %s frequecy"
+ mp_msg(MSGT_AFILTER, MSGL_V, "[resample] Using %s processing and %s frequecy"
" conversion.\n",
((s->setup & RSMP_MASK) == RSMP_FLOAT)?"floating point":"integer",
((s->setup & FREQ_MASK) == FREQ_SLOPPY)?"inexact":"exact");
@@ -193,7 +193,7 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
if((s->setup & RSMP_MASK) == RSMP_LIN){
s->pt=0LL;
s->step=((uint64_t)n->rate<<STEPACCURACY)/(uint64_t)af->data->rate+1LL;
- af_msg(AF_MSG_DEBUG0,"[resample] Linear interpolation step: 0x%016"PRIX64".\n",
+ mp_msg(MSGT_AFILTER, MSGL_DBG2, "[resample] Linear interpolation step: 0x%016"PRIX64".\n",
s->step);
af->mul = (double)af->data->rate / n->rate;
return rv;
@@ -243,7 +243,7 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
// Design prototype filter type using Kaiser window with beta = 10
if(NULL == w || NULL == s->w ||
-1 == af_filter_design_fir(s->up*L, w, &fc, LP|KAISER , 10.0)){
- af_msg(AF_MSG_ERROR,"[resample] Unable to design prototype filter.\n");
+ mp_msg(MSGT_AFILTER, MSGL_ERR, "[resample] Unable to design prototype filter.\n");
return AF_ERROR;
}
// Copy data from prototype to polyphase filter
@@ -260,7 +260,7 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
}
}
free(w);
- af_msg(AF_MSG_VERBOSE,"[resample] New filter designed up: %i "
+ mp_msg(MSGT_AFILTER, MSGL_V, "[resample] New filter designed up: %i "
"down: %i\n", s->up, s->dn);
}
@@ -288,14 +288,14 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
// Sanity check
if(((int*)arg)[0] < 8000 || ((int*)arg)[0] > 192000){
- af_msg(AF_MSG_ERROR,"[resample] The output sample frequency "
+ mp_msg(MSGT_AFILTER, MSGL_ERR, "[resample] The output sample frequency "
"must be between 8kHz and 192kHz. Current value is %i \n",
((int*)arg)[0]);
return AF_ERROR;
}
af->data->rate=((int*)arg)[0];
- af_msg(AF_MSG_VERBOSE,"[resample] Changing sample rate "
+ mp_msg(MSGT_AFILTER, MSGL_V, "[resample] Changing sample rate "
"to %iHz\n",af->data->rate);
return AF_OK;
}
diff --git a/libaf/af_scaletempo.c b/libaf/af_scaletempo.c
index d09fe950b5..8b39290efa 100644
--- a/libaf/af_scaletempo.c
+++ b/libaf/af_scaletempo.c
@@ -232,11 +232,11 @@ static af_data_t* play(struct af_instance_s* af, af_data_t* data)
// RESIZE_LOCAL_BUFFER - can't use macro
max_bytes_out = ((int)(data->len / s->bytes_stride_scaled) + 1) * s->bytes_stride;
if (max_bytes_out > af->data->len) {
- 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,max_bytes_out);
af->data->audio = realloc(af->data->audio, max_bytes_out);
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 NULL;
}
af->data->len = max_bytes_out;
@@ -296,7 +296,7 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
int frames_stride, frames_overlap;
int i, j;
- af_msg(AF_MSG_VERBOSE,
+ mp_msg(MSGT_AFILTER, MSGL_V,
"[scaletempo] %.3f speed * %.3f scale_nominal = %.3f\n",
s->speed, s->scale_nominal, s->scale);
@@ -339,7 +339,7 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
s->buf_overlap = realloc(s->buf_overlap, s->bytes_overlap);
s->table_blend = realloc(s->table_blend, s->bytes_overlap * 4);
if(!s->buf_overlap || !s->table_blend) {
- af_msg(AF_MSG_FATAL, "[scaletempo] Out of memory\n");
+ mp_msg(MSGT_AFILTER, MSGL_FATAL, "[scaletempo] Out of memory\n");
return AF_ERROR;
}
memset(s->buf_overlap, 0, s->bytes_overlap);
@@ -377,7 +377,7 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
s->buf_pre_corr = realloc(s->buf_pre_corr, s->bytes_overlap * 2 + UNROLL_PADDING);
s->table_window = realloc(s->table_window, s->bytes_overlap * 2 - nch * bps * 2);
if(!s->buf_pre_corr || !s->table_window) {
- af_msg(AF_MSG_FATAL, "[scaletempo] Out of memory\n");
+ mp_msg(MSGT_AFILTER, MSGL_FATAL, "[scaletempo] Out of memory\n");
return AF_ERROR;
}
memset((char *)s->buf_pre_corr + s->bytes_overlap * 2, 0, UNROLL_PADDING);
@@ -394,7 +394,7 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
s->buf_pre_corr = realloc(s->buf_pre_corr, s->bytes_overlap);
s->table_window = realloc(s->table_window, s->bytes_overlap - nch * bps);
if(!s->buf_pre_corr || !s->table_window) {
- af_msg(AF_MSG_FATAL, "[scaletempo] Out of memory\n");
+ mp_msg(MSGT_AFILTER, MSGL_FATAL, "[scaletempo] Out of memory\n");
return AF_ERROR;
}
pw = s->table_window;
@@ -415,11 +415,11 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
= (s->frames_search + frames_stride + frames_overlap) * bps * nch;
s->buf_queue = realloc(s->buf_queue, s->bytes_queue + UNROLL_PADDING);
if(!s->buf_queue) {
- af_msg(AF_MSG_FATAL, "[scaletempo] Out of memory\n");
+ mp_msg(MSGT_AFILTER, MSGL_FATAL, "[scaletempo] Out of memory\n");
return AF_ERROR;
}
- af_msg (AF_MSG_DEBUG0, "[scaletempo] "
+ mp_msg (MSGT_AFILTER, MSGL_DBG2, "[scaletempo] "
"%.2f stride_in, %i stride_out, %i standing, "
"%i overlap, %i search, %i queue, %s mode\n",
s->frames_stride_scaled,
@@ -470,25 +470,25 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
return AF_ERROR;
}
if (s->scale_nominal <= 0) {
- af_msg(AF_MSG_ERROR, "[scaletempo] "
+ mp_msg(MSGT_AFILTER, MSGL_ERR, "[scaletempo] "
MSGTR_ErrorParsingCommandLine ": " MSGTR_AF_ValueOutOfRange
": scale > 0\n");
return AF_ERROR;
}
if (s->ms_stride <= 0) {
- af_msg(AF_MSG_ERROR, "[scaletempo] "
+ mp_msg(MSGT_AFILTER, MSGL_ERR, "[scaletempo] "
MSGTR_ErrorParsingCommandLine ": " MSGTR_AF_ValueOutOfRange
": stride > 0\n");
return AF_ERROR;
}
if (s->percent_overlap < 0 || s->percent_overlap > 1) {
- af_msg(AF_MSG_ERROR, "[scaletempo] "
+ mp_msg(MSGT_AFILTER, MSGL_ERR, "[scaletempo] "
MSGTR_ErrorParsingCommandLine ": " MSGTR_AF_ValueOutOfRange
": 0 <= overlap <= 1\n");
return AF_ERROR;
}
if (s->ms_search < 0) {
- af_msg(AF_MSG_ERROR, "[scaletempo] "
+ mp_msg(MSGT_AFILTER, MSGL_ERR, "[scaletempo] "
MSGTR_ErrorParsingCommandLine ": " MSGTR_AF_ValueOutOfRange
": search >= 0\n");
return AF_ERROR;
@@ -507,14 +507,14 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
s->speed_tempo = 1;
s->speed_pitch = 1;
} else {
- af_msg(AF_MSG_ERROR, "[scaletempo] "
+ mp_msg(MSGT_AFILTER, MSGL_ERR, "[scaletempo] "
MSGTR_ErrorParsingCommandLine ": " MSGTR_AF_ValueOutOfRange
": speed=[pitch|tempo|none|both]\n");
return AF_ERROR;
}
}
s->scale = s->speed * s->scale_nominal;
- af_msg(AF_MSG_DEBUG0, "[scaletempo] %6.3f scale, %6.2f stride, %6.2f overlap, %6.2f search, speed = %s\n", s->scale_nominal, s->ms_stride, s->percent_overlap, s->ms_search, (s->speed_tempo?(s->speed_pitch?"tempo and speed":"tempo"):(s->speed_pitch?"pitch":"none")));
+ mp_msg(MSGT_AFILTER, MSGL_DBG2, "[scaletempo] %6.3f scale, %6.2f stride, %6.2f overlap, %6.2f search, speed = %s\n", s->scale_nominal, s->ms_stride, s->percent_overlap, s->ms_search, (s->speed_tempo?(s->speed_pitch?"tempo and speed":"tempo"):(s->speed_pitch?"pitch":"none")));
return AF_OK;
}
}
diff --git a/libaf/af_sinesuppress.c b/libaf/af_sinesuppress.c
index e15a740c84..b7ed277d7b 100644
--- a/libaf/af_sinesuppress.c
+++ b/libaf/af_sinesuppress.c
@@ -130,7 +130,7 @@ static af_data_t* play_s16(struct af_instance_s* af, af_data_t* data)
s->pos += 2 * M_PI * s->freq / data->rate;
}
- af_msg(AF_MSG_VERBOSE,"[sinesuppress] f:%8.2f: amp:%8.2f\n", s->freq, sqrt(s->real*s->real + s->imag*s->imag) / s->ref);
+ mp_msg(MSGT_AFILTER, MSGL_V, "[sinesuppress] f:%8.2f: amp:%8.2f\n", s->freq, sqrt(s->real*s->real + s->imag*s->imag) / s->ref);
return data;
}
diff --git a/libaf/af_sub.c b/libaf/af_sub.c
index f7034da61d..294c6f788e 100644
--- a/libaf/af_sub.c
+++ b/libaf/af_sub.c
@@ -94,7 +94,7 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
case AF_CONTROL_SUB_CH | AF_CONTROL_SET: // Requires reinit
// Sanity check
if((*(int*)arg >= AF_NCH) || (*(int*)arg < 0)){
- af_msg(AF_MSG_ERROR,"[sub] Subwoofer channel number must be between "
+ mp_msg(MSGT_AFILTER, MSGL_ERR, "[sub] Subwoofer channel number must be between "
" 0 and %i current value is %i\n", AF_NCH-1, *(int*)arg);
return AF_ERROR;
}
@@ -106,7 +106,7 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
case AF_CONTROL_SUB_FC | AF_CONTROL_SET: // Requires reinit
// Sanity check
if((*(float*)arg > 300) || (*(float*)arg < 20)){
- af_msg(AF_MSG_ERROR,"[sub] Cutoff frequency must be between 20Hz and"
+ mp_msg(MSGT_AFILTER, MSGL_ERR, "[sub] Cutoff frequency must be between 20Hz and"
" 300Hz current value is %0.2f",*(float*)arg);
return AF_ERROR;
}
diff --git a/libaf/af_surround.c b/libaf/af_surround.c
index dad1c5a4b5..a81eb40427 100644
--- a/libaf/af_surround.c
+++ b/libaf/af_surround.c
@@ -98,13 +98,13 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
af->data->bps = 4;
if (af->data->nch != 4){
- af_msg(AF_MSG_ERROR,"[surround] Only stereo input is supported.\n");
+ mp_msg(MSGT_AFILTER, MSGL_ERR, "[surround] Only stereo input is supported.\n");
return AF_DETACH;
}
// Surround filer coefficients
fc = 2.0 * 7000.0/(float)af->data->rate;
if (-1 == af_filter_design_fir(L, s->w, &fc, LP|HAMMING, 0)){
- af_msg(AF_MSG_ERROR,"[surround] Unable to design low-pass filter.\n");
+ mp_msg(MSGT_AFILTER, MSGL_ERR, "[surround] Unable to design low-pass filter.\n");
return AF_ERROR;
}
@@ -117,7 +117,7 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
s->dl = calloc(LD,af->data->bps);
s->dr = calloc(LD,af->data->bps);
if((NULL == s->dl) || (NULL == s->dr))
- af_msg(AF_MSG_FATAL,"[delay] Out of memory\n");
+ mp_msg(MSGT_AFILTER, MSGL_FATAL, "[delay] Out of memory\n");
// Initialize delay queue index
if(AF_OK != af_from_ms(1, &s->d, &s->wi, af->data->rate, 0.0, 1000.0))
@@ -137,7 +137,7 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
float d = 0;
sscanf((char*)arg,"%f",&d);
if ((d < 0) || (d > 1000)){
- af_msg(AF_MSG_ERROR,"[surround] Invalid delay time, valid time values"
+ mp_msg(MSGT_AFILTER, MSGL_ERR, "[surround] Invalid delay time, valid time values"
" are 0ms to 1000ms current value is %0.3f ms\n",d);
return AF_ERROR;
}
diff --git a/libaf/af_volume.c b/libaf/af_volume.c
index 045b4c2618..127db7b37a 100644
--- a/libaf/af_volume.c
+++ b/libaf/af_volume.c
@@ -78,7 +78,7 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
float x = 2.0*M_PI*15.0/(float)af->data->rate;
float t = 2.0-cos(x);
s->time = 1.0 - (t - sqrt(t*t - 1));
- af_msg(AF_MSG_DEBUG0,"[volume] Forgetting factor = %0.5f\n",s->time);
+ mp_msg(MSGT_AFILTER, MSGL_DBG2, "[volume] Forgetting factor = %0.5f\n",s->time);
af->data->format = AF_FORMAT_FLOAT_NE;
af->data->bps = 4;
}
@@ -122,7 +122,7 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
for(i=0;i<AF_NCH;i++)
m=max(m,s->max[i]);
af_to_dB(1, &m, &m, 10.0);
- af_msg(AF_MSG_INFO,"[volume] The maximum volume was %0.2fdB \n", m);
+ mp_msg(MSGT_AFILTER, MSGL_INFO, "[volume] The maximum volume was %0.2fdB \n", m);
}
return AF_OK;
}