mpegts: add all stream languages into metadata

This is used at least on some older DVB broadcasts for dual-mono audio
tracks.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit 6a7e074eb9)
oldabi
Anssi Hannula 14 years ago committed by Michael Niedermayer
parent aa612fbb99
commit b543e1dccf
  1. 18
      libavformat/mpegts.c

@ -891,7 +891,8 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
{ {
const uint8_t *desc_end; const uint8_t *desc_end;
int desc_len, desc_tag; int desc_len, desc_tag;
char language[4]; char language[252];
int i;
desc_tag = get8(pp, desc_list_end); desc_tag = get8(pp, desc_list_end);
if (desc_tag < 0) if (desc_tag < 0)
@ -960,16 +961,21 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
av_metadata_set2(&st->metadata, "language", language, 0); av_metadata_set2(&st->metadata, "language", language, 0);
break; break;
case 0x0a: /* ISO 639 language descriptor */ case 0x0a: /* ISO 639 language descriptor */
language[0] = get8(pp, desc_end); for (i = 0; i + 4 <= desc_len; i += 4) {
language[1] = get8(pp, desc_end); language[i + 0] = get8(pp, desc_end);
language[2] = get8(pp, desc_end); language[i + 1] = get8(pp, desc_end);
language[3] = 0; language[i + 2] = get8(pp, desc_end);
av_metadata_set2(&st->metadata, "language", language, 0); language[i + 3] = ',';
switch (get8(pp, desc_end)) { switch (get8(pp, desc_end)) {
case 0x01: st->disposition |= AV_DISPOSITION_CLEAN_EFFECTS; break; case 0x01: st->disposition |= AV_DISPOSITION_CLEAN_EFFECTS; break;
case 0x02: st->disposition |= AV_DISPOSITION_HEARING_IMPAIRED; break; case 0x02: st->disposition |= AV_DISPOSITION_HEARING_IMPAIRED; break;
case 0x03: st->disposition |= AV_DISPOSITION_VISUAL_IMPAIRED; break; case 0x03: st->disposition |= AV_DISPOSITION_VISUAL_IMPAIRED; break;
} }
}
if (i) {
language[i - 1] = 0;
av_metadata_set2(&st->metadata, "language", language, 0);
}
break; break;
case 0x05: /* registration descriptor */ case 0x05: /* registration descriptor */
st->codec->codec_tag = bytestream_get_le32(pp); st->codec->codec_tag = bytestream_get_le32(pp);

Loading…
Cancel
Save