[FFmpeg-devel] [PATCH 2/3] Add av_load_index_file and av_save_index_file

Michael Chinen mchinen
Thu Aug 19 11:29:01 CEST 2010


On Tue, Aug 17, 2010 at 2:07 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
[...]
>> +/**
>> + * Save the flags, size, and differences for the index table
>> + */
>> +#define FF_SAVEINDEX_PACKETSIZE 1000
>> +static int av_save_index_stream(ByteIOContext *bc, AVStream *st,
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?AVFormatContext *ic) {
>> + ? ?AVIndexEntry start_ie;
>> + ? ?AVIndexEntry *last_ie, *curr_ie;
>> + ? ?int i;
>> +
>> + ? ?//we may need to save something like codec id to be safe.
>> + ? ?ff_put_v(bc, st->seek_table_flags);
>> + ? ?//we only write the index if we have a finished table.
>> + ? ?if (st->seek_table_flags & AV_SEEKTABLE_FINISHED) {
>> + ? ? ? ?ff_put_v(bc, st->nb_index_entries);
>> +
>> + ? ? ? ?memset(&start_ie, 0, sizeof(AVIndexEntry));
>> + ? ? ? ?last_ie = &start_ie;
>> + ? ? ? ?for (i = 0; i < st->nb_index_entries; i++) {
>> + ? ? ? ? ? ?curr_ie = &st->index_entries[i];
>
>> + ? ? ? ? ? ?ff_put_v(bc, curr_ie->pos - last_ie->pos);
>> + ? ? ? ? ? ?ff_put_v(bc, curr_ie->timestamp - last_ie->timestamp);
>> + ? ? ? ? ? ?ff_put_v(bc, curr_ie->flags - last_ie->flags);
>> + ? ? ? ? ? ?ff_put_v(bc, curr_ie->size - last_ie->size);
>> + ? ? ? ? ? ?ff_put_v(bc, curr_ie->min_distance - last_ie->min_distance);
>
> vertical align please

done.

>
>
>> + ? ? ? ? ? ?last_ie = curr_ie;
>
>> + ? ? ? ? ? ?if (i % FF_SAVEINDEX_PACKETSIZE == 0)
>> + ? ? ? ? ? ? ? ?put_flush_packet(bc);
>
> why?

Unfamiliarity.  Removed.

>
>
> [...]
>
>> +static int av_load_index(ByteIOContext *bc, AVFormatContext *ic) {
>> + ? ?int i, ret;
>> + ? ?uint64_t v;
>> + ? ?char read_str[256];
>> +
>> + ? ?get_strz(bc, read_str, 255);
>
> s/255/sizeof()/

Done.

Michael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Add-av_load_index_file-and-av_save_index_file.patch
Type: application/octet-stream
Size: 7308 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100819/294a6bef/attachment.obj>



More information about the ffmpeg-devel mailing list