[FFmpeg-devel] MPEG-PS demuxer index memory usage
Paul Kelly
paul
Mon Jan 7 09:10:17 CET 2008
On Mon, 7 Jan 2008, Michael Niedermayer wrote:
> On Mon, Jan 07, 2008 at 01:36:39AM +0100, Baptiste Coudurier wrote:
>> Paul Kelly wrote:
>>> [...]
>>>
>>> + max_entries= s->max_index_size / sizeof(AVIndexEntry);
>>> + if(max_entries == 0)
>>> + return -1;
>>> + if((unsigned)st->nb_index_entries >= max_entries){
>>> + int in, out= 0;
>>> + /* Halve the size of the index by removing every second entry */
>>> + for(in=0; in<st->nb_index_entries; in+= 2)
>>> + st->index_entries[out++]= st->index_entries[in];
>>> + st->nb_index_entries= out;
>>> + }
>>> +
>>> entries = av_fast_realloc(st->index_entries,
>>
>> Just a note to remember that mov demuxer is building index containing
>> all samples, and absolutely need all index entries to seek and demux, so
>> you cannot remove any index entry with the current implementation.
>
> yes, right, i should have realized that earlier ...
> so i guess the best would be an explicitly called ff_reduce_index() which
> does the above. This also safes us from changing all av_add_index_entry()
Do you mean to call ff_reduce_index() before av_add_index_entry() in
individual demuxers, if it's appropriate to how they use the index? The
attached patch does that, but only for AVFMT_GENERIC_INDEX and the mpegps
demuxer (to solve my specific problem). If it's the right approach I could
try adding it to the other demuxers too, but it might be better if someone
more familiar with how they work did that.
Paul
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ff_reduce_index.patch
Type: text/x-diff
Size: 4231 bytes
Desc:
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080107/0e3bed4e/attachment.patch>
More information about the ffmpeg-devel
mailing list