From patchwork Mon Apr 3 17:05:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carl Eugen Hoyos X-Patchwork-Id: 3271 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.44.195 with SMTP id s186csp172809vss; Mon, 3 Apr 2017 10:06:04 -0700 (PDT) X-Received: by 10.223.134.86 with SMTP id 22mr16950208wrw.22.1491239163942; Mon, 03 Apr 2017 10:06:03 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id w197si19901585wmd.1.2017.04.03.10.06.03; Mon, 03 Apr 2017 10:06:03 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6D9B2688396; Mon, 3 Apr 2017 20:05:58 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe03-2.mx.upcmail.net (vie01a-dmta-pe03-2.mx.upcmail.net [62.179.121.161]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0D123688282 for ; Mon, 3 Apr 2017 20:05:52 +0300 (EEST) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe03.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1cv5QO-0007Yp-Uy for ffmpeg-devel@ffmpeg.org; Mon, 03 Apr 2017 19:05:52 +0200 Received: from [192.168.1.3] ([80.110.84.105]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id 3t5n1v01f2GMCV401t5oze; Mon, 03 Apr 2017 19:05:48 +0200 X-SourceIP: 80.110.84.105 From: Carl Eugen Hoyos To: FFmpeg development discussions and patches Date: Mon, 3 Apr 2017 19:05:47 +0200 User-Agent: KMail/1.9.10 MIME-Version: 1.0 Message-Id: <201704031905.47545.cehoyos@ag.or.at> Subject: [FFmpeg-devel] [PATCH]lavf/mpegts: Also read three-character language descriptors X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 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 From d8b30253cc6b1c2156f1e8898e0a0c2ff3c3f900 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos 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;