Commit a49df44d authored by mru's avatar mru

clean up dynamic loading of libfaad


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@11609 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent d13fd84f
...@@ -234,47 +234,32 @@ static int faac_decode_init(AVCodecContext *avctx) ...@@ -234,47 +234,32 @@ static int faac_decode_init(AVCodecContext *avctx)
libfaadname, dlerror()); libfaadname, dlerror());
return -1; return -1;
} }
#define dfaac(a, b) \
do { static const char* n = AV_STRINGIFY(faacDec ## a); \ #define dfaac(a) do { \
if ((s->faacDec ## a = b dlsym( s->handle, n )) == NULL) { err = n; break; } } while(0) const char* n = AV_STRINGIFY(faacDec ## a); \
for(;;) { if (!err && !(s->faacDec ## a = dlsym(s->handle, n))) { \
err = n; \
} \
} while(0)
#else /* !CONFIG_LIBFAADBIN */ #else /* !CONFIG_LIBFAADBIN */
#define dfaac(a, b) s->faacDec ## a = faacDec ## a #define dfaac(a) s->faacDec ## a = faacDec ## a
#endif /* CONFIG_LIBFAADBIN */ #endif /* CONFIG_LIBFAADBIN */
// resolve all needed function calls // resolve all needed function calls
dfaac(Open, (faacDecHandle FAADAPI (*)(void))); dfaac(Open);
dfaac(Close, (void FAADAPI (*)(faacDecHandle hDecoder))); dfaac(Close);
dfaac(GetCurrentConfiguration, (faacDecConfigurationPtr dfaac(GetCurrentConfiguration);
FAADAPI (*)(faacDecHandle))); dfaac(SetConfiguration);
#ifndef FAAD2_VERSION dfaac(Init);
dfaac(SetConfiguration, (int FAADAPI (*)(faacDecHandle, dfaac(Init2);
faacDecConfigurationPtr))); dfaac(Decode);
#ifdef FAAD2_VERSION
dfaac(Init, (int FAADAPI (*)(faacDecHandle, unsigned char*, dfaac(GetErrorMessage);
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 #endif
#undef dfacc
#undef dfaac
#ifdef CONFIG_LIBFAADBIN #ifdef CONFIG_LIBFAADBIN
break;
}
if (err) { if (err) {
dlclose(s->handle); dlclose(s->handle);
av_log(avctx, AV_LOG_ERROR, "FAAD library: cannot resolve %s in %s!\n", av_log(avctx, AV_LOG_ERROR, "FAAD library: cannot resolve %s in %s!\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment