[FFmpeg-cvslog] r25303 - trunk/ffmpeg.c

Aurelien Jacobs aurel
Sat Oct 2 00:05:11 CEST 2010


On Fri, Oct 01, 2010 at 11:59:14PM +0200, Stefano Sabatini wrote:
> On date Friday 2010-10-01 23:54:20 +0200, aurel wrote:
> > Author: aurel
> > Date: Fri Oct  1 23:54:20 2010
> > New Revision: 25303
> > 
> > Log:
> > ffmpeg: dynamically allocate bitstream_filters
> > 
> > Modified:
> >    trunk/ffmpeg.c
> > 
> > Modified: trunk/ffmpeg.c
> > ==============================================================================
> > --- trunk/ffmpeg.c	Fri Oct  1 23:52:09 2010	(r25302)
> > +++ trunk/ffmpeg.c	Fri Oct  1 23:54:20 2010	(r25303)
> [...]
> > @@ -606,6 +607,7 @@ static int ffmpeg_exit(int ret)
> >          }
> >          av_metadata_free(&s->metadata);
> >          av_free(s);
> > +        av_free(bitstream_filters[i]);
> >      }
> >      for(i=0;i<nb_input_files;i++) {
> >          av_close_input_file(input_files[i]);
> > @@ -3413,6 +3415,7 @@ static void new_video_stream(AVFormatCon
> >      }
> 
> >  
> >      avcodec_get_context_defaults3(st->codec, codec);
> > +    bitstream_filters[nb_output_files] = grow_array(bitstream_filters[nb_output_files], sizeof(*bitstream_filters[nb_output_files]), &nb_bitstream_filters[nb_output_files], oc->nb_streams);
> >      bitstream_filters[nb_output_files][oc->nb_streams - 1]= video_bitstream_filters;
> >      video_bitstream_filters= NULL;
> >  
> > @@ -3554,6 +3557,7 @@ static void new_audio_stream(AVFormatCon
> >  
> >      avcodec_get_context_defaults3(st->codec, codec);
> >  
> > +    bitstream_filters[nb_output_files] = grow_array(bitstream_filters[nb_output_files], sizeof(*bitstream_filters[nb_output_files]), &nb_bitstream_filters[nb_output_files], oc->nb_streams);
> >      bitstream_filters[nb_output_files][oc->nb_streams - 1]= audio_bitstream_filters;
> >      audio_bitstream_filters= NULL;
> >  
> > @@ -3622,6 +3626,7 @@ static void new_subtitle_stream(AVFormat
> >      }
> >      avcodec_get_context_defaults3(st->codec, codec);
> >  
> > +    bitstream_filters[nb_output_files] = grow_array(bitstream_filters[nb_output_files], sizeof(*bitstream_filters[nb_output_files]), &nb_bitstream_filters[nb_output_files], oc->nb_streams);
> 
> Uhm, superlong lines...

That's exactly why I originally had a wrapping macro which made this
line looks like this:

    GROW_ARRAY(bitstream_filters[nb_output_files], oc->nb_streams);

But wrapping macros are not really appreciated...
I could break up the line but it wouldn't be much nicer IMO:

    bitstream_filters[nb_output_files]
        = grow_array(bitstream_filters[nb_output_files],
                     sizeof(*bitstream_filters[nb_output_files]),
                     &nb_bitstream_filters[nb_output_files], oc->nb_streams);

If you want me to commit this version, say so.

Aurel



More information about the ffmpeg-cvslog mailing list