Mercurial > libavcodec.hg
changeset 6177:5195f1ffba43 libavcodec
clean up dynamic loading of libfaad
author | mru |
---|---|
date | Fri, 25 Jan 2008 21:14:17 +0000 |
parents | 1d735690e172 |
children | de96bd7409ad |
files | libfaad.c |
diffstat | 1 files changed, 20 insertions(+), 35 deletions(-) [+] |
line wrap: on
line diff
--- a/libfaad.c Fri Jan 25 07:37:46 2008 +0000 +++ b/libfaad.c Fri Jan 25 21:14:17 2008 +0000 @@ -234,47 +234,32 @@ libfaadname, dlerror()); return -1; } -#define dfaac(a, b) \ - do { static const char* n = AV_STRINGIFY(faacDec ## a); \ - if ((s->faacDec ## a = b dlsym( s->handle, n )) == NULL) { err = n; break; } } while(0) - for(;;) { + +#define dfaac(a) do { \ + const char* n = AV_STRINGIFY(faacDec ## a); \ + if (!err && !(s->faacDec ## a = dlsym(s->handle, n))) { \ + err = n; \ + } \ + } while(0) #else /* !CONFIG_LIBFAADBIN */ -#define dfaac(a, b) s->faacDec ## a = faacDec ## a +#define dfaac(a) s->faacDec ## a = faacDec ## a #endif /* CONFIG_LIBFAADBIN */ - // resolve all needed function calls - dfaac(Open, (faacDecHandle FAADAPI (*)(void))); - dfaac(Close, (void FAADAPI (*)(faacDecHandle hDecoder))); - dfaac(GetCurrentConfiguration, (faacDecConfigurationPtr - FAADAPI (*)(faacDecHandle))); -#ifndef FAAD2_VERSION - dfaac(SetConfiguration, (int FAADAPI (*)(faacDecHandle, - faacDecConfigurationPtr))); + // resolve all needed function calls + dfaac(Open); + dfaac(Close); + dfaac(GetCurrentConfiguration); + dfaac(SetConfiguration); + dfaac(Init); + dfaac(Init2); + dfaac(Decode); +#ifdef FAAD2_VERSION + dfaac(GetErrorMessage); +#endif - dfaac(Init, (int FAADAPI (*)(faacDecHandle, unsigned char*, - unsigned long*, unsigned long*))); - dfaac(Init2, (int FAADAPI (*)(faacDecHandle, unsigned char*, - unsigned long, unsigned long*, - unsigned long*))); - dfaac(Decode, (int FAADAPI (*)(faacDecHandle, unsigned char*, - unsigned long*, short*, unsigned long*))); -#else - dfaac(SetConfiguration, (unsigned char FAADAPI (*)(faacDecHandle, - faacDecConfigurationPtr))); - dfaac(Init, (long FAADAPI (*)(faacDecHandle, unsigned char*, - unsigned long, unsigned long*, unsigned char*))); - dfaac(Init2, (char FAADAPI (*)(faacDecHandle, unsigned char*, - unsigned long, unsigned long*, - unsigned char*))); - dfaac(Decode, (void *FAADAPI (*)(faacDecHandle, faacDecFrameInfo*, - unsigned char*, unsigned long))); - dfaac(GetErrorMessage, (char* FAADAPI (*)(unsigned char))); -#endif -#undef dfacc +#undef dfaac #ifdef CONFIG_LIBFAADBIN - break; - } if (err) { dlclose(s->handle); av_log(avctx, AV_LOG_ERROR, "FAAD library: cannot resolve %s in %s!\n",