summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorŁukasz Krzciuk <lkrzciuk@vewd.com>2018-04-13 14:57:57 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2018-04-27 01:14:45 +0200
commit48330500efd636b1540002b600257d8802badc69 (patch)
treef35d85fc26decb62699882c3ae2fbe56bb8ab9a4 /libavformat
parent05c0f620bf1431f3959399234a543838050941f2 (diff)
avformat/mpegts: set AV_DISPOSITION_DESCRIPTIONS for OIPF cases
1. an audio component with an ISO_639_language_descriptor in the PMT with the audio_type field set to 0x03 2. a supplementary_audio_descriptor with the editorial_classification field set to 0x01 3. an ac-3_descriptor or an enhanced_ac-3_descriptor with a component_type field with the service_type flags set to Visually Impaired Tested-by: Łukasz Krzciuk <lkrzciuk@vewd.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/mpegts.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 37a6aa8bff..629631f60a 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1835,6 +1835,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
break;
case 0x03:
st->disposition |= AV_DISPOSITION_VISUAL_IMPAIRED;
+ st->disposition |= AV_DISPOSITION_DESCRIPTIONS;
break;
}
}
@@ -1910,6 +1911,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
switch ((flags >> 2) & 0x1F) { /* editorial_classification */
case 0x01:
st->disposition |= AV_DISPOSITION_VISUAL_IMPAIRED;
+ st->disposition |= AV_DISPOSITION_DESCRIPTIONS;
break;
case 0x02:
st->disposition |= AV_DISPOSITION_HEARING_IMPAIRED;
@@ -1934,6 +1936,34 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
}
}
break;
+ case 0x6a: /* ac-3_descriptor */
+ {
+ int component_type_flag = get8(pp, desc_end) & (1 << 7);
+ if (component_type_flag) {
+ int component_type = get8(pp, desc_end);
+ int service_type_mask = 0x38; // 0b00111000
+ int service_type = ((component_type & service_type_mask) >> 3);
+ if (service_type == 0x02 /* 0b010 */) {
+ st->disposition |= AV_DISPOSITION_DESCRIPTIONS;
+ av_log(ts->stream, AV_LOG_DEBUG, "New track disposition for id %u: %u\n", st->id, st->disposition);
+ }
+ }
+ }
+ break;
+ case 0x7a: /* enhanced_ac-3_descriptor */
+ {
+ int component_type_flag = get8(pp, desc_end) & (1 << 7);
+ if (component_type_flag) {
+ int component_type = get8(pp, desc_end);
+ int service_type_mask = 0x38; // 0b00111000
+ int service_type = ((component_type & service_type_mask) >> 3);
+ if (service_type == 0x02 /* 0b010 */) {
+ st->disposition |= AV_DISPOSITION_DESCRIPTIONS;
+ av_log(ts->stream, AV_LOG_DEBUG, "New track disposition for id %u: %u\n", st->id, st->disposition);
+ }
+ }
+ }
+ break;
default:
break;
}