diff mbox series

[FFmpeg-devel,04/19] avformat/matroskaenc: Don't write empty language

Message ID 20210217101356.1723370-4-andreas.rheinhardt@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel,01/19] fate/matroska: Add test for mastering display metadata | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Feb. 17, 2021, 10:13 a.m. UTC
According to the new EBML specifications, a string element of length
zero would be read as the default value by a compliant parser.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavformat/matroskaenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 233c472b8f..786fa41cba 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1147,7 +1147,7 @@  static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
         put_ebml_string(pb, MATROSKA_ID_TRACKNAME, tag->value);
     tag = av_dict_get(st->metadata, "language", NULL, 0);
     put_ebml_string(pb, MATROSKA_ID_TRACKLANGUAGE,
-                    tag && tag->value ? tag->value : "und");
+                    tag && tag->value && tag->value[0] ? tag->value : "und");
 
     // The default value for TRACKFLAGDEFAULT is 1, so add element
     // if we need to clear it.