[FFmpeg-devel] [PATCH] Read mov/mp4 timed text extradata
David Conrad
lessen42
Sun Jan 11 09:25:07 CET 2009
On Jan 11, 2009, at 2:55 AM, Baptiste Coudurier wrote:
> David Conrad wrote:
>> On Jan 11, 2009, at 1:13 AM, Baptiste Coudurier wrote:
>>
>>> Hi,
>>>
>>> David Conrad wrote:
>>>> Hi,
>>>>
>>>> mov/mp4 timed text stores some needed info for rendering
>>>> (specifically
>>>> display flags, justification, background color, fonts, and default
>>>> styles) as a part of the stsd atom. Everything except the font
>>>> table
>>>> (which is a subatom) is an extension of the stsd atom, so
>>>> unfortunately
>>>> I can't simply add an entry in mov_default_parse_table.
>>>>
>>>> [...]
>>>>
>>>> --- a/libavformat/mov.c
>>>> +++ b/libavformat/mov.c
>>>> @@ -978,6 +978,11 @@ static int mov_read_stsd(MOVContext *c,
>>>> ByteIOContext *pb, MOVAtom atom)
>>>> }
>>>> } else if(st->codec->codec_type==CODEC_TYPE_SUBTITLE){
>>>> st->codec->codec_id= id;
>>>> + if (id == CODEC_ID_MOV_TEXT) {
>>>> + st->codec->extradata_size = size -
>>>> (url_ftell(pb) -
>>>> start_pos);
>>>> + st->codec->extradata =
>>>> av_malloc(st->codec->extradata_size +
>>>> FF_INPUT_BUFFER_PADDING_SIZE);
>>>> + get_buffer(pb, st->codec->extradata,
>>>> st->codec->extradata_size);
>>>> + }
>>>> } else {
>>>> /* other codec type, just skip (rtp, mp4s, tmcd ...) */
>>>> url_fskip(pb, size - (url_ftell(pb) - start_pos));
>>>>
>>>
>>> This duplicates mov_read_glbl, IMHO call it with fake atom.
>>> Besides Iam really thinking about exporting whole 'stsd' atom
>>> containing
>>> all extradata, this would avoid exporting on a per case basis, and
>>> would
>>> allow user to retrieve all information he desires. We could provide
>>> helpers to parse atoms also.
>>
>> Like so?
>>
>>
>> ------------------------------------------------------------------------
>>
>> commit 71a905a16dc69a1c1e5d55aa86fdc85629701951
>> Author: David Conrad <davedc at Kozue.local>
>> Date: Sun Jan 11 01:22:56 2009 -0500
>>
>> Read extradata (justification, colors, fonts) for mov/mp4 timed
>> text
>>
>> diff --git a/libavformat/mov.c b/libavformat/mov.c
>> index c0c057a..c34903d 100644
>> --- a/libavformat/mov.c
>> +++ b/libavformat/mov.c
>> @@ -977,7 +977,9 @@ static int mov_read_stsd(MOVContext *c,
>> ByteIOContext *pb, MOVAtom atom)
>> sc->sample_size = (bits_per_sample >> 3) * st-
>> >codec->channels;
>> }
>> } else if(st->codec->codec_type==CODEC_TYPE_SUBTITLE){
>> + MOVAtom fake_atom = { .size = size - (url_ftell(pb) -
>> start_pos) };
>> st->codec->codec_id= id;
>> + mov_read_glbl(c, pb, fake_atom);
>> } else {
>> /* other codec type, just skip (rtp, mp4s, tmcd ...) */
>> url_fskip(pb, size - (url_ftell(pb) - start_pos));
>
> Yes, with a comment explaining what is it good for (rendering infos
> etc..)
Applied with a comment.
More information about the ffmpeg-devel
mailing list