diff mbox

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

Message ID 201704031905.47545.cehoyos@ag.or.at
State Superseded
Headers show

Commit Message

Carl Eugen Hoyos April 3, 2017, 5:05 p.m. UTC
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 <cehoyos@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(-)

Comments

Paul B Mahol April 3, 2017, 6:13 p.m. UTC | #1
On 4/3/17, Carl Eugen Hoyos <cehoyos@ag.or.at> wrote:
> 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
>

Breaks indentation, nak.
Carl Eugen Hoyos April 3, 2017, 7:39 p.m. UTC | #2
2017-04-03 20:13 GMT+02:00 Paul B Mahol <onemda@gmail.com>:
> On 4/3/17, Carl Eugen Hoyos <cehoyos@ag.or.at> wrote:
>> 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
>
> Breaks indentation, nak.

I don't understand:
Aren't there more than five lines between the "if" and the "}"?

Carl Eugen
Paul B Mahol April 3, 2017, 7:51 p.m. UTC | #3
On 4/3/17, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
> 2017-04-03 20:13 GMT+02:00 Paul B Mahol <onemda@gmail.com>:
>> On 4/3/17, Carl Eugen Hoyos <cehoyos@ag.or.at> wrote:
>>> 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
>>
>> Breaks indentation, nak.
>
> I don't understand:
> Aren't there more than five lines between the "if" and the "}"?

Irrelevant, you need to fix indentation.
Marton Balint April 3, 2017, 8:39 p.m. UTC | #4
On Mon, 3 Apr 2017, Carl Eugen Hoyos wrote:

> 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 <cehoyos@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) {

I guess you can keep the i += 4 and delete i++ from below.

>              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++;
> +            }

Make this a patch series and send a second patch which fixes the 
indentation.

Thanks,
Marton
diff mbox

Patch

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;