[FFmpeg-cvslog] r25380 - trunk/libavformat/utils.c
Aurelien Jacobs
aurel
Thu Oct 7 21:14:24 CEST 2010
On Thu, Oct 07, 2010 at 12:02:12AM +0200, Michael Niedermayer wrote:
> On Wed, Oct 06, 2010 at 10:52:26PM +0200, aurel wrote:
> > Author: aurel
> > Date: Wed Oct 6 22:52:26 2010
> > New Revision: 25380
> >
> > Log:
> > dynamically use nb_streams instead of static use of MAX_STREAMS
> >
> > Modified:
> > trunk/libavformat/utils.c
> >
> > Modified: trunk/libavformat/utils.c
> > ==============================================================================
> > --- trunk/libavformat/utils.c Wed Oct 6 22:49:25 2010 (r25379)
> > +++ trunk/libavformat/utils.c Wed Oct 6 22:52:26 2010 (r25380)
> > @@ -1879,19 +1879,24 @@ static void av_estimate_timings_from_bit
> > /* only usable for MPEG-PS streams */
> > static void av_estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset)
> > {
> > + unsigned int nb_streams = ic->nb_streams;
> > AVPacket pkt1, *pkt = &pkt1;
>
> useless
OK
> [..]
> > @@ -2172,13 +2178,18 @@ int av_find_stream_info(AVFormatContext
> > AVStream *st;
> > AVPacket pkt1, *pkt;
> > int64_t old_offset = url_ftell(ic->pb);
> > + unsigned int nb_streams = ic->nb_streams;
> > struct {
> > int64_t last_dts;
>
> same
OK
> > int64_t duration_gcd;
> > int duration_count;
> > double duration_error[MAX_STD_TIMEBASES];
> > int64_t codec_info_duration;
> > - } info[MAX_STREAMS] = {{0}};
> > + } *info, *tmp_info;
>
>
> this struct too belongs in AVStream, allocated in av_new_stream()
> freed at the end of find_stream_info()
OK. Attached patch does this.
It looks a little bit ugly to me to have this struct in AVStream, but
overall, this is indeed much better than the current situation.
> peppering teh code with checks if a stream was
> added after every call to lavf and then reallocating arrays is very hackish
> and fragile
Indeed, I have to agree.
Aurel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: find_stream_info.diff
Type: text/x-diff
Size: 10062 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-cvslog/attachments/20101007/8f442bd7/attachment-0001.diff>
More information about the ffmpeg-cvslog
mailing list