From 507a419bb152034cf26c5d787bf497cc96e463fc Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Wed, 30 Oct 2019 21:12:54 +0100 Subject: [PATCH] Libavcodec common: return print_decoder_error Needed by audio libavcodec, if linking with the object, there would be needed to link also with VDPAU which doesn't look fortunate. --- src/libavcodec_common.c | 18 ------------------ src/libavcodec_common.h | 20 +++++++++++++++++++- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/libavcodec_common.c b/src/libavcodec_common.c index f0af053ff..0b56dd360 100644 --- a/src/libavcodec_common.c +++ b/src/libavcodec_common.c @@ -158,24 +158,6 @@ const struct uv_to_av_pixfmt *get_av_to_ug_pixfmts() { // // utility functions // -void print_decoder_error(const char *mod_name, int rc) { - char buf[1024]; - switch (rc) { - case 0: - break; - case EAGAIN: - log_msg(LOG_LEVEL_VERBOSE, "%s No frame returned - needs more input data.\n", mod_name); - break; - case EINVAL: - log_msg(LOG_LEVEL_ERROR, "%s Decoder in invalid state!\n", mod_name); - break; - default: - av_strerror(rc, buf, 1024); - log_msg(LOG_LEVEL_WARNING, "%s Error while decoding frame (rc == %d): %s.\n", mod_name, rc, buf); - break; - } -} - void print_libav_error(int verbosity, const char *msg, int rc) { char errbuf[1024]; av_strerror(rc, errbuf, sizeof(errbuf)); diff --git a/src/libavcodec_common.h b/src/libavcodec_common.h index c773c4f67..ba5624165 100644 --- a/src/libavcodec_common.h +++ b/src/libavcodec_common.h @@ -117,7 +117,25 @@ extern "C" { extern "C" { #endif -void print_decoder_error(const char *mod_name, int rc); +static void print_decoder_error(const char *mod_name, int rc) ATTRIBUTE(unused); +static void print_decoder_error(const char *mod_name, int rc) { + char buf[1024]; + switch (rc) { + case 0: + break; + case EAGAIN: + log_msg(LOG_LEVEL_VERBOSE, "%s No frame returned - needs more input data.\n", mod_name); + break; + case EINVAL: + log_msg(LOG_LEVEL_ERROR, "%s Decoder in invalid state!\n", mod_name); + break; + default: + av_strerror(rc, buf, 1024); + log_msg(LOG_LEVEL_WARNING, "%s Error while decoding frame (rc == %d): %s.\n", mod_name, rc, buf); + break; + } +} + void print_libav_error(int verbosity, const char *msg, int rc); bool libav_codec_has_extradata(codec_t codec);