diff options
author | Jan Ekström <jan.ekstrom@24i.com> | 2023-04-21 16:07:08 +0300 |
---|---|---|
committer | Jan Ekström <jeebjp@gmail.com> | 2023-07-28 15:31:56 +0300 |
commit | b300552dfb525990e28eeef14edb67ef5ceacb65 (patch) | |
tree | 3590a605306fa49607b0efd171361b527209831d /libavformat/mov.c | |
parent | 7de3fcb059376f50268aa1d0e7b9f98a440c1529 (diff) | |
download | ffmpeg-b300552dfb525990e28eeef14edb67ef5ceacb65.tar.gz |
avformat/mov: enable identifying TTML subtitle streams as such
The contents are full TTML XML documents. TTML writing tests'
results are updated as the streams are now properly identified
as TTML ones.
Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r-- | libavformat/mov.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index ac19b3157a..be9975f297 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2263,6 +2263,11 @@ static int mov_codec_id(AVStream *st, uint32_t format) (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE && st->codecpar->codec_id == AV_CODEC_ID_NONE)) { id = ff_codec_get_id(ff_codec_movsubtitle_tags, format); + if (id <= 0) { + id = (format == MOV_MP4_TTML_TAG || format == MOV_ISMV_TTML_TAG) ? + AV_CODEC_ID_TTML : id; + } + if (id > 0) st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE; else @@ -2457,8 +2462,10 @@ static void mov_parse_stsd_subtitle(MOVContext *c, AVIOContext *pb, // ttxt stsd contains display flags, justification, background // color, fonts, and default styles, so fake an atom to read it MOVAtom fake_atom = { .size = size }; - // mp4s contains a regular esds atom - if (st->codecpar->codec_tag != AV_RL32("mp4s")) + // mp4s contains a regular esds atom, dfxp ISMV TTML has no content + // in extradata unlike stpp MP4 TTML. + if (st->codecpar->codec_tag != AV_RL32("mp4s") && + st->codecpar->codec_tag != MOV_ISMV_TTML_TAG) mov_read_glbl(c, pb, fake_atom); st->codecpar->width = sc->width; st->codecpar->height = sc->height; |