[Ffmpeg-devel] swscale patch

Michael Niedermayer michaelni
Wed Jul 5 12:26:39 CEST 2006


On Wed, Jul 05, 2006 at 10:14:07AM +0200, Luca Abeni wrote:
> Hi Michael,
> On Tue, 2006-07-04 at 18:02 +0200, Michael Niedermayer wrote:
> [...]
> > 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?
> Ok, I see the problem...
> Would it be ok to put something like
>   static int inited;
>   if (inited == 0) {
>     return;

no, its if(inited) { ...

>   }
>   inited = 1;
> in sws_global_init()?
> (of course, sws_global_init() should not be called in a multithreaded
> environment without protecting the call with a mutex)
> Or do you prefer some other kind of solution?

hmm, somehow iam not completely happy with the whole malloc/free handling ...

what about the sws_log() function? same situation, 2 libs or app+lib using
sws with the log messages from one lib will end up being output over the
functions of the other lib now lets think about 2 threads where one libs
sws_log implementation isnt thread safe ...
-> this one is easy, we have no choice sws_log must be put into the sws
context, iam not sure why i didnt realize that earlier ...

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