aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/mov.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-08-26 13:18:34 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-08-26 13:18:43 +0200
commit80e05994025ec40076e40388fcd9361a5f64a519 (patch)
tree12f22522dd31a57d4a24816a83e1061ee7c90631 /libavformat/mov.c
parent9748f1477de2c5e5a892da2b80475ca193bd8d2e (diff)
parentdc518a3ae21e7b6420131b813cfc6bcdcad26b7e (diff)
downloadffmpeg-80e05994025ec40076e40388fcd9361a5f64a519.tar.gz
Merge commit 'dc518a3ae21e7b6420131b813cfc6bcdcad26b7e'
* commit 'dc518a3ae21e7b6420131b813cfc6bcdcad26b7e': mov: Refactor subtitle specific parsing in mov_parse_stsd_subtitle Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r--libavformat/mov.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 966f808d2a..a88f03eaed 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1471,6 +1471,20 @@ static void mov_parse_stsd_audio(MOVContext *c, AVIOContext *pb,
}
}
+static void mov_parse_stsd_subtitle(MOVContext *c, AVIOContext *pb,
+ AVStream *st, MOVStreamContext *sc,
+ int size)
+{
+ // 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->codec->codec_tag != AV_RL32("mp4s"))
+ mov_read_glbl(c, pb, fake_atom);
+ st->codec->width = sc->width;
+ st->codec->height = sc->height;
+}
+
int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
{
AVStream *st;
@@ -1533,14 +1547,9 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
st->codec->codec_id = id;
mov_parse_stsd_audio(c, pb, st, sc);
} else if (st->codec->codec_type==AVMEDIA_TYPE_SUBTITLE){
- // ttxt stsd contains display flags, justification, background
- // color, fonts, and default styles, so fake an atom to read it
- MOVAtom fake_atom = { .size = size - (avio_tell(pb) - start_pos) };
- if (format != AV_RL32("mp4s")) // mp4s contains a regular esds atom
- mov_read_glbl(c, pb, fake_atom);
- st->codec->codec_id= id;
- st->codec->width = sc->width;
- st->codec->height = sc->height;
+ st->codec->codec_id = id;
+ mov_parse_stsd_subtitle(c, pb, st, sc,
+ size - (avio_tell(pb) - start_pos));
} else {
if (st->codec->codec_tag == MKTAG('t','m','c','d')) {
MOVStreamContext *tmcd_ctx = st->priv_data;