[FFmpeg-devel] [RFC] Global or local variables in ffmpeg.c

Michael Niedermayer michaelni
Sat Sep 15 23:26:22 CEST 2007


Hi

On Sat, Sep 15, 2007 at 04:14:52PM -0300, Ramiro Polla wrote:
> Hello,
> 
> In [1], it was discussed whether variables passed to av_encode would be 
> passed as arguments or used as globals.
> 
> Since the beginning of ffmpeg, they have been defined globals, are 
> passed as arguments to av_encode, and av_encode uses the same local name 
> as the global variables for them.
> 
> The arguments to av_encode are useless. Regression tests still pass for 
> av_encode(void).
> 
> I'm trying to finish Limin Wang's work to split av_encode, but don't 
> know which way to go.
> Which way is preferable: making everything global variables and have 
> parameter-less functions in ffmpeg.c, or passing something like 
> AVTranscodeContext to av_encode and other functions?

both are silly

a function should take sensible arguments

str= "%d %d\n"
var1= a;
var2= b;
printf();

is as idiotic as

s.str= "%d %d\n"
s.var1= a;
s.var2= b;
printf();

both are a huge step backward from the current

static int av_encode(AVFormatContext **output_files,
                     int nb_output_files,
                     AVFormatContext **input_files,
                     int nb_input_files,
                     AVStreamMap *stream_maps, int nb_stream_maps)

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070915/4d0c194c/attachment.pgp>



More information about the ffmpeg-devel mailing list