From 42a792bbc71e1cb4b15765af8acda48a9951a210 Mon Sep 17 00:00:00 2001 From: bircoph Date: Sat, 28 Mar 2009 19:57:56 +0000 Subject: 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 --- libaf/af_ladspa.c | 90 +++++++++++++++++++++++++++---------------------------- 1 file changed, 45 insertions(+), 45 deletions(-) (limited to 'libaf/af_ladspa.c') 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; ininputcontrols; 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; ininputcontrols; 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; ininputcontrols; 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; ininputcontrols; 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