[Ffmpeg-devel] swscale patch

Michael Niedermayer michaelni
Tue Jul 4 18:02:45 CEST 2006


Hi

On Tue, Jul 04, 2006 at 04:06:36PM +0200, Luca Abeni wrote:
[...]
> > [...]
> > > Index: mplayer/mplayer.c
> [...]
> > > Index: mplayer/mencoder.c
> [...]
> > that code duplication is unacceptable
> This is the code duplication that I tried to avoid by introducing
> sws_interface.c and sws_init() in my previous patch, but you did not
> like such double level of initialization (if I understand well).
> 
> So, the only remaining solution that I can think about is to introduce a
> sws_interface.c file containing the definitions of my_alloc() and
> my_log(), and to put
> sws_global_init(my_alloc, free, my_log);
> in mplayer.c and mencoder.c. I do not like this solution much (because
> in this way my_alloc() and my_log() cannot be static, and I will have to
> create an additional header with their prototypes - or put the
> prototypes directly in mplayer.c and mencoder.c). But if you think it's
> better, I'll do it. Let me know.

hmm ...
theres another problem ...
if swscale uses some global sws_malloc() sws_free() set by global function
pointers what will happen if 2 libs or a lib like libavcodec and the 
application using that lib like mplayer both use sws?
mplayer -> init(malloc, free, ...)
    starts using a sws
    libavcodec -> init(av_malloc, av_free, ...)
        starts using sws
    tries to free() something (sws_free() points to av_free() while it was
    allocated by malloc())


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is




More information about the ffmpeg-devel mailing list