[MPlayer-dev-eng] [PATCH 2/2] av_helpers: show libav* version and configuration.
Nicolas George
nicolas.george at normalesup.org
Wed Dec 21 15:59:30 CET 2011
---
With this patch, mplayer will print something like this when opening the
files and codecs:
Playing <censored>
Init libavformat version 53.27.0 (dynamic)
libavformat file format detected.
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Init libavcodec version 53.46.2 (dynamic version 53.46.1)
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
With configure now pulling ffmpeg separately and distributions shipping
dynamically linked binaries, this will help recognize old and/or bogus
versions in bug reports.
Regards,
--
Nicolas George
av_helpers.c | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/av_helpers.c b/av_helpers.c
index 11bed7c..37ec00d 100644
--- a/av_helpers.c
+++ b/av_helpers.c
@@ -76,9 +76,34 @@ static void mp_msp_av_log_callback(void *ptr, int level, const char *fmt,
mp_msg_va(type, mp_level, fmt, vl);
}
+static void show_av_version(int type, const char *name,
+ int st, int dl, const char *conf)
+{
+ char buf[128];
+ int l = 0;
+
+ snprintf(buf + l, sizeof(buf) - l, "Init %s version %d.%d.%d", name,
+ st >> 16, (st >> 8) & 0xFF, st & 0xFF);
+#ifdef CONFIG_FFMPEG_SO
+ l += strlen(buf + l);
+ snprintf(buf + l, sizeof(buf) - l, " (dynamic");
+ if (dl != st) {
+ l += strlen(buf + l);
+ snprintf(buf + l, sizeof(buf) - l, " version %d.%d.%d",
+ dl >> 16, (dl >> 8) & 0xFF, dl & 0xFF);
+ }
+ l += strlen(buf + l);
+ snprintf(buf + l, sizeof(buf) - l, ")");
+#endif
+ mp_msg(type, MSGL_INFO, "%s\n", buf);
+ mp_msg(type, MSGL_V, "Configuration: %s\n", conf);
+}
+
void init_avcodec(void)
{
if (!avcodec_initialized) {
+ show_av_version(MSGT_DECVIDEO, "libavcodec", LIBAVCODEC_VERSION_INT,
+ avcodec_version(), avcodec_configuration());
avcodec_register_all();
avcodec_initialized = 1;
av_log_set_callback(mp_msp_av_log_callback);
@@ -88,6 +113,8 @@ void init_avcodec(void)
void init_avformat(void)
{
if (!avformat_initialized) {
+ show_av_version(MSGT_DEMUX, "libavformat", LIBAVFORMAT_VERSION_INT,
+ avformat_version(), avformat_configuration());
av_register_all();
avformat_initialized = 1;
av_log_set_callback(mp_msp_av_log_callback);
--
1.7.7.3
More information about the MPlayer-dev-eng
mailing list