[FFmpeg-devel] [PATCH] non-interleaved AVI read packet fix

Michael Niedermayer michaelni
Thu Sep 3 14:55:56 CEST 2009


On Thu, Sep 03, 2009 at 08:27:07AM +0300, Maksym Veremeyenko wrote:
> Michael Niedermayer ???????(??):
>> On Wed, Sep 02, 2009 at 09:22:42AM +0300, Maksym Veremeyenko wrote:
> [...]
>>> 0d8d919f05a37634591c4b04bf29f0db95fef958  
>>> avidec_non_interleaved_read_packet_fix_v3.patch
>>> Index: libavformat/avidec.c
>>> ===================================================================
>>> --- libavformat/avidec.c	(revision 19698)
>>> +++ libavformat/avidec.c	(working copy)
>>> @@ -682,6 +682,12 @@
>>>               if(ast->sample_size)
>>>                  ts /= ast->sample_size;
>>> +
>>> +            /* skip finished stream */
>>> +            if(!ast->remaining)
>>> +                if(av_index_search_timestamp(st, ts, AVSEEK_FLAG_ANY) < 
>>> 0)
>>> +                    continue;
>>> +
>> you dont need a av_index_search_timestamp() call to test the last index 
>> entry
>
> Another way is to check ast->frame_offset against last index item 
> timestamp.
>
> Newer patch attached.

[...]

> +            /* skip finished stream */
> +            if(!ast->remaining && st->nb_index_entries &&
> +               ts > st->index_entries[st->nb_index_entries - 1].timestamp *
> +                    FFMAX(1, ast->sample_size))
> +                continue;
> +

the st->nb_index_entries check can be factored with the surrounding code,
the whole does nothing if its 0
the * ast->sample_size could possibly be avoided by inserting the if at a
differnt spot

what remains could be written like

last_ts= st->index_entries[st->nb_index_entries - 1].timestamp;
if(!ast->remaining && ts > last_ts)
    continue;


-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090903/9d57696a/attachment.pgp>



More information about the ffmpeg-devel mailing list