[FFmpeg-devel] [PATCH] mov.c: Use dimensions from tkhd
David Conrad
lessen42
Mon Jan 12 00:24:38 CET 2009
On Jan 11, 2009, at 7:15 AM, Baptiste Coudurier wrote:
> David Conrad wrote:
>> On Jan 11, 2009, at 2:54 AM, Baptiste Coudurier wrote:
>>
>>> David Conrad wrote:
>>>> Hi,
>>>>
>>>> This sets the codec dimensions to what's set in in the tkhd. This
>>>> is
>>>> useful for timed text because their dimensions are independent of
>>>> video
>>>> tracks and this is the only place they're stored. This shouldn't
>>>> affect
>>>> video since it'll later be overridden when reading the stsd.
>>>>
>>>> --- a/libavformat/mov.c
>>>> +++ b/libavformat/mov.c
>>>> @@ -1510,6 +1510,9 @@ static int mov_read_tkhd(MOVContext *c,
>>>> ByteIOContext *pb, MOVAtom atom)
>>>> width = get_be32(pb); // 16.16 fixed point track width
>>>> height = get_be32(pb); // 16.16 fixed point track height
>>>>
>>>> + st->codec->width = width >> 16;
>>>> + st->codec->height = height >> 16;
>>>> +
>>>> //transform the display width/height according to the matrix
>>>> // skip this if the display matrix is the default identity
>>>> matrix
>>>> // to keep the same scale, use [width height 1<<16]
>>>>
>>>
>>> Humm, code will be lost here IMHO, I'd rather put fields in
>>> MOVStreamContext and set them only for subs in read_stsd to avoid
>>> side
>>> effects, future misbehaviour.
>>
>> How's this?
>>
>>
>> ------------------------------------------------------------------------
>>
>> commit f3770486557a56b39cbabc274e864be8f5e21a72
>> Author: David Conrad <davedc at Kozue.local>
>> Date: Sun Jan 11 01:45:15 2009 -0500
>>
>> Use the dimensions in tkhd for timed text tracks
>>
>> diff --git a/libavformat/mov.c b/libavformat/mov.c
>> index ed027db..c488bf8 100644
>> --- a/libavformat/mov.c
>> +++ b/libavformat/mov.c
>> @@ -134,6 +134,8 @@ typedef struct MOVStreamContext {
>> MOVDref *drefs;
>> int dref_id;
>> int wrong_dts; ///< dts are wrong due to negative ctts
>> + int width;
>> + int height;
>> } MOVStreamContext;
>
> ///< tkhd width/height
>
> Except this I think the patch is ok.
Applied with the comments.
More information about the ffmpeg-devel
mailing list