[FFmpeg-devel] MPEG-PS demuxer index memory usage

Paul Kelly paul
Sun Jan 6 20:05:40 CET 2008


On Sat, 5 Jan 2008, Michael Niedermayer wrote:

> On Sat, Jan 05, 2008 at 05:14:21PM +0000, Paul Kelly wrote:
>> On Sat, 5 Jan 2008, Michael Niedermayer wrote:
>>
>>> also iam slightly thinking that this would belong more to AVFormatContext
>>> or what is the use case of having max_index_size differ between streams
>>> and the user should be able to set it from the command line
>>> if it were in AVFormatContext you only would have to add a single line to
>>> the AVOption array in libavformat/utils.c
>>
>> Ok I understand now about the AVOption array - it's a very neat idea and I
>> agree adding it there and putting max_index_size in AVFormatContext is a
>> more logical and elegant solution than putting it in AVStream.
[...]
>> If that's the case then the only way I can see that having it in
>> AVFormatContext would work would be to rewrite av_add_index_entry() to take
>> a pointer to an AVFormatContext, and change everywhere it is called in all
>> the demuxers -
>
> yes, if its in AVFormatContext av_add_index_entry() and all calls to it
> need a tiny change.

OK, the attached patch changes av_add_index_stream() to take a pointer to 
an AVFormatContext and a stream index instead of a pointer to an AVStream 
(in a similar manner to av_seek_frame_binary()), and changes all calls to 
av_add_index_entry() accordingly.

The new struct member max_index_size is added to the end of 
AVFormatContext, and the AVOption array has a new entry to allow it to be 
set from the command line.

Things I'm still not sure about:
* Should there be also an FF_OPT_TYPE_UINT, or is setting max_index_size 
to INT_MAX as the default (as I have done) OK?
* Should the option be marked as relevant to encoding as well as decoding 
(not sure how to do that) - while changing all the calls to 
av_add_index_entry() some of the calls to it appeared to be in muxers as 
well as demuxers (example: nutenc.c)

Paul
-------------- next part --------------
A non-text attachment was scrubbed...
Name: max_index.diff
Type: text/x-diff
Size: 15064 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080106/66ff352c/attachment.diff>



More information about the ffmpeg-devel mailing list