[FFmpeg-devel] [PATCH] rmdec.c: merge old/new packet reading code

Ronald S. Bultje rsbultje
Wed Mar 11 13:27:10 CET 2009


Hi,

On Wed, Mar 11, 2009 at 1:46 AM, Kostya <kostya.shishkov at gmail.com> wrote:
> Somehow this becomes more and more complicated.
>
> Can we use some simpler solution - like when packet flags & 2 and there was
> no remaining_len before it (i.e. we are not inside partial packet)
> nor after it (i.e. we were not reading start of partial packet, but maybe
> this condition can be omitted) then add this packet to index.
>
> Passing two additional arguments for getting data to index does not seem right.

I don't like it either, but the old condition was clearly wrong,
particularly for audio, since seq&0x7F==1 was true by default (seq
starts at 1 and only involved video, so was never changed for audio)
an flags&2 is true for the _last_ audio packet, not the first.
Therefore, it added index entries for last audio packets. At the very
least, that needs changing, and then I figured it was easier to just
separate video and audio altogether, since they are really handled
completely differently. Anyway, that was not your question. :-).

Yes, I'd like it easier also, but don't know how yet. We could add
1argument to ff_rm_parse_packet() like int *please_write_index_entry
or *is_first_slice, since the know exactly when we are at the first
packet of a packet and whether that is a keyframe (flags&2). Then the
condition would just be 1-2 pieces, if (is_first_slice && old_flags &
2) or if (please_write_index_entry).

Ronald




More information about the ffmpeg-devel mailing list