[FFmpeg-devel] [PATCH]lavf/mpegts: Also read three-character language descriptors

Carl Eugen Hoyos cehoyos at ag.or.at
Mon Apr 3 20:05:47 EEST 2017


Hi!

Attached patch fixes setting the language for the sample from vlc ticket 
#10830: http://streams.videolan.org/issues/10830/vlc-audio-lang.ts

Please comment, Carl Eugen
-------------- next part --------------
From d8b30253cc6b1c2156f1e8898e0a0c2ff3c3f900 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <cehoyos at ag.or.at>
Date: Mon, 3 Apr 2017 19:03:29 +0200
Subject: [PATCH] lavf/mpegts: Also read three-character langauge descriptors.

Sets the language for the sample from vlc ticket #10830
---
 libavformat/mpegts.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 3eff152..eff129d 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1821,11 +1821,12 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
         }
         break;
     case 0x0a: /* ISO 639 language descriptor */
-        for (i = 0; i + 4 <= desc_len; i += 4) {
+        for (i = 0; i + 3 <= desc_len; i += 3) {
             language[i + 0] = get8(pp, desc_end);
             language[i + 1] = get8(pp, desc_end);
             language[i + 2] = get8(pp, desc_end);
             language[i + 3] = ',';
+            if (i + 4 <= desc_len) {
             switch (get8(pp, desc_end)) {
             case 0x01:
                 st->disposition |= AV_DISPOSITION_CLEAN_EFFECTS;
@@ -1837,6 +1838,8 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
                 st->disposition |= AV_DISPOSITION_VISUAL_IMPAIRED;
                 break;
             }
+            i++;
+            }
         }
         if (i && language[0]) {
             language[i - 1] = 0;
-- 
1.7.10.4



More information about the ffmpeg-devel mailing list