mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-04-24 17:12:34 +02:00
mov: Refactor subtitle specific parsing in mov_parse_stsd_subtitle
This commit is contained in:
parent
ef196beeb5
commit
dc518a3ae2
@ -1292,6 +1292,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)
|
int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
|
||||||
{
|
{
|
||||||
AVStream *st;
|
AVStream *st;
|
||||||
@ -1355,14 +1369,9 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
|
|||||||
st->codec->codec_id = id;
|
st->codec->codec_id = id;
|
||||||
mov_parse_stsd_audio(c, pb, st, sc);
|
mov_parse_stsd_audio(c, pb, st, sc);
|
||||||
} else if (st->codec->codec_type==AVMEDIA_TYPE_SUBTITLE){
|
} else if (st->codec->codec_type==AVMEDIA_TYPE_SUBTITLE){
|
||||||
// ttxt stsd contains display flags, justification, background
|
st->codec->codec_id = id;
|
||||||
// color, fonts, and default styles, so fake an atom to read it
|
mov_parse_stsd_subtitle(c, pb, st, sc,
|
||||||
MOVAtom fake_atom = { .size = size - (avio_tell(pb) - start_pos) };
|
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;
|
|
||||||
} else {
|
} else {
|
||||||
/* other codec type, just skip (rtp, mp4s, tmcd ...) */
|
/* other codec type, just skip (rtp, mp4s, tmcd ...) */
|
||||||
avio_skip(pb, size - (avio_tell(pb) - start_pos));
|
avio_skip(pb, size - (avio_tell(pb) - start_pos));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user