]> git.alsa-project.org Git - alsa-utils.git/commitdiff
aconnect: add support for new log handler (alsa-lib 1.2.15)
authorJaroslav Kysela <perex@perex.cz>
Fri, 7 Nov 2025 16:11:16 +0000 (17:11 +0100)
committerJaroslav Kysela <perex@perex.cz>
Fri, 7 Nov 2025 16:11:16 +0000 (17:11 +0100)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
seq/aconnect/aconnect.c

index edd028f0391dfe1982dca13495b26e8a23440744..d782ef073c155438107dbabcdb27e6a0cf0d7261 100644 (file)
 
 static int show_all;
 
-static void error_handler(const char *file, int line, const char *function, int err, const char *fmt, ...)
+
+#if SND_LIB_VER(1, 2, 15) < SND_LIB_VERSION
+static void error_handler(const char *file, int line, const char *function, int errcode, const char *fmt, ...)
 {
        va_list arg;
 
-       if (err == ENOENT)      /* Ignore those misleading "warnings" */
+       if (errcode == ENOENT)  /* Ignore those misleading "warnings" */
                return;
        va_start(arg, fmt);
        fprintf(stderr, "ALSA lib %s:%i:(%s) ", file, line, function);
@@ -45,6 +47,16 @@ static void error_handler(const char *file, int line, const char *function, int
        putc('\n', stderr);
        va_end(arg);
 }
+#else
+static snd_lib_log_handler_t original_log_handler;
+static void log_handler(int prio, int interface, const char *file, int line, const char *function, int errcode, const char *fmt, va_list arg)
+{
+       if (prio == SND_LOG_ERROR && errcode == ENOENT) /* Ignore those misleading "warnings" */
+               return;
+       if (original_log_handler)
+               original_log_handler(prio, interface, file, line, function, errcode, fmt, arg);
+}
+#endif
 
 static void usage(void)
 {
@@ -356,7 +368,11 @@ int main(int argc, char **argv)
                return 1;
        }
        
+#if SND_LIB_VER(1, 2, 15) < SND_LIB_VERSION
        snd_lib_error_set_handler(error_handler);
+#else
+       original_log_handler = snd_lib_log_set_handler(log_handler);
+#endif
 
        switch (command) {
        case LIST: