From 2dbee1a3935a91842c22eb65fd13f77e8d590e07 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 24 Oct 2014 15:47:33 +0200 Subject: [PATCH] avformat/mp3enc: Squeeze our mp3 encoder tag into the 9byte shortname instead of randomly truncating Signed-off-by: Michael Niedermayer --- libavformat/mp3enc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c index 713dcd143c..a691f75f99 100644 --- a/libavformat/mp3enc.c +++ b/libavformat/mp3enc.c @@ -231,7 +231,12 @@ static int mp3_write_xing(AVFormatContext *s) // encoder short version string if (enc) { uint8_t encoder_str[9] = { 0 }; - memcpy(encoder_str, enc->value, FFMIN(strlen(enc->value), sizeof(encoder_str))); + if ( strlen(enc->value) > sizeof(encoder_str) + && !strcmp("Lavc libmp3lame", enc->value)) { + memcpy(encoder_str, "Lavf lame", 9); + } else + memcpy(encoder_str, enc->value, FFMIN(strlen(enc->value), sizeof(encoder_str))); + avio_write(dyn_ctx, encoder_str, sizeof(encoder_str)); } else avio_write(dyn_ctx, "Lavf\0\0\0\0\0", 9);