[FFmpeg-devel] [PATCH] rmdec.c: parse INDX chunk

Ronald S. Bultje rsbultje
Wed Mar 11 16:17:50 CET 2009


Hi Kostya,

so now on to the patch:

On Wed, Mar 11, 2009 at 1:40 AM, Kostya <kostya.shishkov at gmail.com> wrote:
> On Wed, Mar 11, 2009 at 01:00:45AM -0400, Ronald S. Bultje wrote:
>> + ? ? ? ?if (size > 20)
>> + ? ? ? ? ? ?url_fskip(pb, size - 20);
>
> err, what happens when somebody decides to follow spec and include size of index
> entries into header size?

Oops, old code. I removed these two lines, they're useless.

>> +skip:
>> + ? ? ? ?if (url_ftell(pb) != next_off &&
>> + ? ? ? ? ? ?url_fseek(pb, next_off, SEEK_SET) < 0)
>> + ? ? ? ? ? ?return -1;
>
> this condition should be changed since it does not take into account streamed
> data, for which we should read or skip only this index chunk

I've honestly never seen files with an index at the beginning, so I'm
assuming this code wouldn't ever be reached for non-seekable sources,
unless someone implements massive data-read-skips in place of
url_fseek() (please god no). See also this chunk:

>> @@ -400,6 +446,14 @@
>> ? ? ?if (!rm->nb_packets && (flags & 4))
>> ? ? ? ? ?rm->nb_packets = 3600 * 25;
>> ? ? ?get_be32(pb); /* next data header */
>> +
>> + ? ?if (!data_off)
>> + ? ? ? ?data_off = url_ftell(pb) - 14;
>> + ? ?if (indx_off && url_fseek(pb, indx_off, SEEK_SET) >= 0) {
>> + ? ? ? ?rm_read_index(s);
>> + ? ? ? ?url_fseek(pb, data_off + 14, SEEK_SET);
>> + ? ?}
>> +
>> ? ? ?return 0;
>> ?}

I don't think (hope) that rm_read_index() would be called for
non-seekable sources, am I wrong?

Also, note that a rm_read_seek() isn't strictly necessary, with this
code, seeking already works for most files, just not for old_format
files or multirate files, and if there's cached data that is returned
first before we continue with the after-seek, see my other patch later
on in this thread.




More information about the ffmpeg-devel mailing list