[Ffmpeg-devel] Re: av_log() bloatedness

Steve Lhomme slhomme
Tue Jul 25 14:43:31 CEST 2006

Michael Niedermayer wrote:
> Hi
> On Sun, Jul 23, 2006 at 02:06:36PM -0400, Rich Felker wrote:
>> On Sun, Jul 23, 2006 at 12:34:24PM +0200, Michael Niedermayer wrote:
>>> Hi
>>> On Sun, Jul 23, 2006 at 09:57:31AM +0100, M?ns Rullg?rd wrote:
>>>> Sigbj?rn Skj?ret said:
>>>>> [..not subscribed to the list, will probably break thread, sorry..]
>>>>>>> supposedly somebody could like to have a custom callback() like a syslog
>>>>>>> one.
>>>>>> then he sets av_log= my_callback;
>>>>> Although I'm aware that lavc isn't recommended as a shared library atm I guess
>>>>> it will some time in the future be allowed?
>>>> Despite what Rich says, shared libs are supported.
>>>>> If so then the above suggestion is not practical for non-dl methods as
>>>>> variables are not exported .. my impression is that this is the reason
>>>>> av_log_set_callback() exists (and it works great as well), it would be a pity
>>>>> if this was removed...
>>>> It would break windows dlls, not proper shared libs.
>>> and as such av_log_set_callback() belongs to the windows dlls but not proper
>>> shared libs
>>> personally i would have no objections to a seperate file which contains
>>> some warpers and which is only compiled on windos, but i do have objections
>>> to spread this mess all over the source
>> Michael, IMO this is much worse. It requires every application that
>> wants to support lavc on both windows and real platforms to have
>> #ifdef WIN32 crap in it, to use the different API on win32. So instead
>> of a few bytes of wrapper 'bloat' in lavc, you have nasty #ifdef bloat
>> in every calling application...
> why does ff_sqrt() in common.h work (on windows) ? or why dont we get
> bugreports about it not working?
> extern FF_IMPORT_ATTR const uint8_t ff_sqrt_tab[128];
> static inline int ff_sqrt(int a)
> {
>     int ret=0;
>     int s;
>     int ret_sq=0;
>     if(a<128) return ff_sqrt_tab[a];
>     for(s=15; s>=0; s--){
>         int b= ret_sq + (1<<(s*2)) + (ret<<s)*2;
>         if(b<=a){
>             ret_sq=b;
>             ret+= 1<<s;
>         }
>     }
>     return ret;
> }
> is FF_IMPORT_ATTR which is __declspec(dllimport) maybe the magic thingy
> which allows non functions to be used from dlls? if so iam very dissapointed
> by thouse wanna be smartass windos kids  claiming otherwise (of course
> without reading the manuals)

I think by default MinGW makes all functions public (the UNIX way). So 
everything that is not static in liabvcodec/libavformat becomes public.

And I think __declspec(dllimport) is MSVC only ? Although I may be wrong 
on that...

For DrFFMPEG we use a .def file that has the advantage to only keep what 
we want to make public and also (optionally) forces the entry point 
location of each functions (so that it remains backward compatible, at 
least to check the version).


More information about the ffmpeg-devel mailing list