[FFmpeg-cvslog] r25380 - trunk/libavformat/utils.c

Michael Niedermayer michaelni
Thu Oct 7 21:50:36 CEST 2010


On Thu, Oct 07, 2010 at 09:14:24PM +0200, Aurelien Jacobs wrote:
> 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
>  avformat.h |   12 ++++++++
>  utils.c    |   87 +++++++++++++++++++++++--------------------------------------
>  2 files changed, 45 insertions(+), 54 deletions(-)
> 198eee1dfcebb6dfee7b584f2447133b2b66974d  find_stream_info.diff

i think this is missing some freeing at closing time in case streams where
added after find_stream_info()

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

There will always be a question for which you do not know the correct awnser.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-cvslog/attachments/20101007/065c40b2/attachment.pgp>



More information about the ffmpeg-cvslog mailing list