[FFmpeg-devel] [PATCH] Split huge transcode() function into transcode_init(), transcode(), and transcode_deinit().

Stefano Sabatini stefano.sabatini-lala
Sat Oct 16 22:59:47 CEST 2010


On date Saturday 2010-10-16 22:04:15 +0200, Michael Niedermayer encoded:
> On Sat, Oct 16, 2010 at 01:22:09PM +0200, Stefano Sabatini wrote:
> > ---
> >  ffmpeg.c |  104 ++++++++++++++++++++++++++++++++++++++++---------------------
> >  1 files changed, 68 insertions(+), 36 deletions(-)
> > 
> > diff --git a/ffmpeg.c b/ffmpeg.c
> > index 9513c7f..fbc8415 100644
> > --- a/ffmpeg.c
> > +++ b/ffmpeg.c
> > @@ -1935,30 +1935,31 @@ static int copy_chapters(int infile, int outfile)
> >      return 0;
> >  }
> >  
> > +static int nb_istreams = 0, nb_ostreams = 0;
> > +static AVInputStream **ist_table = NULL;
> > +static AVOutputStream **ost_table = NULL;
> > +static AVInputFile *file_table;
> > +
> >  /*
> >   * The following code is the main loop of the file converter
> >   */
> 
> iam against moving local variables to global ones
> also i dont see the sense in spliting this function given that it seems to
> require a new struct holding its local variables. thats not simplification like
> that thats messification. If there is self contained code that can be split out
> into seperate functions thats a good idea to do but simply spliting a function
> like func_init() func_loop1() func_loop2() func_deinit() and move all locals
> to globals is no improvment

The objective is to get simpler/shorter functions. For example seeing
in the patch the name of the function (transcode_init() rather than
transcode()) may help to understand the patch itself.

Would the use of a TranscodeContext help? Also note that ffmpeg.c is
already making an extensive use of globals.

Regards.
-- 
FFmpeg = Fundamental and Fundamental Mastodontic Purposeless Elegant God



More information about the ffmpeg-devel mailing list