[FFmpeg-devel] [PATCH] MOV: support stz2 "Compact Sample Size Box"

Alex Converse alex.converse
Tue Mar 3 08:45:15 CET 2009


On Tue, Mar 3, 2009 at 2:40 AM, Baptiste Coudurier
<baptiste.coudurier at gmail.com> wrote:
> On 3/2/2009 11:09 PM, Alex Converse wrote:
>> On Tue, Mar 3, 2009 at 2:05 AM, Alex Converse <alex.converse at gmail.com> wrote:
>>> Hi,
>>>
>>> $subj.
>>>
>>> Ref: ISO/IEC 14496-12:2008 ? 8.7.3
>>> Sample ISO/IEC 14496-4:2004/Amd.24:2008 a7-tone-oddities.mp4
>>>
>>> Regards,
>>> Alex Converse
>>>
>>
>> Please ignore the previous attachment and use this one instead.
>>
>> [...]
>>
>> @@ -1143,8 +1150,30 @@ static int mov_read_stsz(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
>> ? ? ?if (!sc->sample_sizes)
>> ? ? ? ? ?return AVERROR(ENOMEM);
>>
>> + ? ?switch(field_size) {
>> + ? ?case 4:
>> + ? ? ? ?for(i=0; i<entries; i++) {
>> + ? ? ? ? ? ?int field = get_byte(pb);
>> + ? ? ? ? ? ?sc->sample_sizes[i] = field >> 4;
>> + ? ? ? ? ? ?sc->sample_sizes[i] = field & 0xF;
>
> This is incorrect I think.
>
>> + ? ? ? ?}
>> + ? ? ? ?break;
>> + ? ?case 8:
>> + ? ? ? ?for(i=0; i<entries; i++)
>> + ? ? ? ? ? ?sc->sample_sizes[i] = get_byte(pb);
>> + ? ? ? ?break;
>> + ? ?case 16:
>> + ? ? ? ?for(i=0; i<entries; i++)
>> + ? ? ? ? ? ?sc->sample_sizes[i] = get_be16(pb);
>> + ? ? ? ?break;
>> + ? ?case 32:
>> ? ? ?for(i=0; i<entries; i++)
>> ? ? ? ? ?sc->sample_sizes[i] = get_be32(pb);
>
> I believe an "if" should be cleaner, inside the loop, what do you think
> ? You can check for wrong value before.
>

Case 4 is nastier than I had originally written. See Vladimir's post.
If you still think it should be inside the loop I'll move it.

--Alex
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mov-stz2.diff
Type: text/x-diff
Size: 2425 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090303/b58a610d/attachment.diff>



More information about the ffmpeg-devel mailing list