[FFmpeg-devel] [PATCH] Add av_file_get_size() and av_file_read(), replace cmdutils.h:read_file().

Nicolas George nicolas.george
Tue Dec 28 12:43:30 CET 2010


Le septidi 7 niv?se, an CCXIX, Michael Niedermayer a ?crit?:
> I dont see what is inconventient to write a 10 line av_log_callcack() that
> passes its strings to thread local storage (if the GUI has a log window
> per thread) or global storeage through a mutex if theres one window

Relying on global variables to carry information between parts of the
program is usually considered very bad design, since it usually leads to
ugly constructs and lots of bugs, for example maintaining a stack of values
and forgetting to unstack.

> open_log_buffer(log_ctx);
> ret = av_foo(..., log_offset, log_ctx);
> if (ret < 0){
>     show_lasterror_in_window_to_user( get_log_buffer(log_ctx) );
>     return ret;
> }

I find this kind of API reasonable.

> and if errbuf_size is too small ...

It could be mallocated.

Regards,

-- 
  Nicolas George
-------------- 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-devel/attachments/20101228/ccfe1e86/attachment.pgp>



More information about the ffmpeg-devel mailing list