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.
This commit is contained in:
Martin Pulec
2019-10-30 21:12:54 +01:00
parent 75fb7fb8c2
commit 507a419bb1
2 changed files with 19 additions and 19 deletions

View File

@@ -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));

View File

@@ -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);