aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/decoder/plugins')
-rw-r--r--src/decoder/plugins/FfmpegDecoderPlugin.cxx36
1 files changed, 2 insertions, 34 deletions
diff --git a/src/decoder/plugins/FfmpegDecoderPlugin.cxx b/src/decoder/plugins/FfmpegDecoderPlugin.cxx
index 0c11c6349..fcd33a790 100644
--- a/src/decoder/plugins/FfmpegDecoderPlugin.cxx
+++ b/src/decoder/plugins/FfmpegDecoderPlugin.cxx
@@ -26,6 +26,7 @@
#include "lib/ffmpeg/Domain.hxx"
#include "lib/ffmpeg/Error.hxx"
#include "lib/ffmpeg/LogError.hxx"
+#include "lib/ffmpeg/LogCallback.hxx"
#include "lib/ffmpeg/Buffer.hxx"
#include "../DecoderAPI.hxx"
#include "FfmpegMetaData.hxx"
@@ -56,39 +57,6 @@ extern "C" {
#include <assert.h>
#include <string.h>
-static LogLevel
-import_ffmpeg_level(int level)
-{
- if (level <= AV_LOG_FATAL)
- return LogLevel::ERROR;
-
- if (level <= AV_LOG_WARNING)
- return LogLevel::WARNING;
-
- if (level <= AV_LOG_INFO)
- return LogLevel::INFO;
-
- return LogLevel::DEBUG;
-}
-
-static void
-mpd_ffmpeg_log_callback(gcc_unused void *ptr, int level,
- const char *fmt, va_list vl)
-{
- const AVClass * cls = nullptr;
-
- if (ptr != nullptr)
- cls = *(const AVClass *const*)ptr;
-
- if (cls != nullptr) {
- char domain[64];
- snprintf(domain, sizeof(domain), "%s/%s",
- ffmpeg_domain.GetName(), cls->item_name(ptr));
- const Domain d(domain);
- LogFormatV(d, import_ffmpeg_level(level), fmt, vl);
- }
-}
-
/**
* API compatibility wrapper for av_open_input_stream() and
* avformat_open_input().
@@ -111,7 +79,7 @@ mpd_ffmpeg_open_input(AVFormatContext **ic_ptr,
static bool
ffmpeg_init(gcc_unused const config_param &param)
{
- av_log_set_callback(mpd_ffmpeg_log_callback);
+ av_log_set_callback(FfmpegLogCallback);
av_register_all();
return true;