avformat/mp3enc: Squeeze our mp3 encoder tag into the 9byte shortname instead of randomly truncating

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-10-24 15:47:33 +02:00
parent e744e9a305
commit 2dbee1a393
1 changed files with 6 additions and 1 deletions

View File

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