ref: 2e9e68b17558372963789ec8fbc9ea81c18683e9
parent: 022b3e5c4ef3f7a557bf262d2ca4eff276a1a96c
author: Krzysztof Nikiel <knik@users.sourceforge.net>
date: Fri Oct 6 07:26:54 EDT 2017
split NEAACDECAPI into ATTR/CDECL for GCC/VC compatibility
--- a/include/neaacdec.h
+++ b/include/neaacdec.h
@@ -60,17 +60,14 @@
#ifdef _WIN32
#pragma pack(push, 8)
- #ifndef NEAACDECAPI
- #define NEAACDECAPI __cdecl
- #endif
+ #define CDECL __cdecl
+ #define ATTR
#elif defined(__GNUC__) && __GNUC__ >= 4
- #ifndef NEAACDECAPI
- #define NEAACDECAPI __attribute__((visibility("default")))
- #endif
+ #define CDECL
+ #define ATTR __attribute__((visibility("default")))
#else
- #ifndef NEAACDECAPI
- #define NEAACDECAPI
- #endif
+ #define CDECL
+ #define ATTR
#endif
#define FAAD2_VERSION "unknown"
@@ -202,19 +199,19 @@
unsigned char ps;
} NeAACDecFrameInfo;
-char* NEAACDECAPI NeAACDecGetErrorMessage(unsigned char errcode);
+ATTR char* CDECL NeAACDecGetErrorMessage(unsigned char errcode);
-unsigned long NEAACDECAPI NeAACDecGetCapabilities(void);
+ATTR unsigned long CDECL NeAACDecGetCapabilities(void);
-NeAACDecHandle NEAACDECAPI NeAACDecOpen(void);
+ATTR NeAACDecHandle CDECL NeAACDecOpen(void);
-NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder);
+ATTR NeAACDecConfigurationPtr CDECL NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder);
-unsigned char NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hDecoder,
+ATTR unsigned char CDECL NeAACDecSetConfiguration(NeAACDecHandle hDecoder,
NeAACDecConfigurationPtr config);
/* Init the library based on info from the AAC file (ADTS/ADIF) */
-long NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder,
+ATTR long CDECL NeAACDecInit(NeAACDecHandle hDecoder,
unsigned char *buffer,
unsigned long buffer_size,
unsigned long *samplerate,
@@ -221,7 +218,7 @@
unsigned char *channels);
/* Init the library using a DecoderSpecificInfo */
-char NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder,
+ATTR char CDECL NeAACDecInit2(NeAACDecHandle hDecoder,
unsigned char *pBuffer,
unsigned long SizeOfDecoderSpecificInfo,
unsigned long *samplerate,
@@ -228,19 +225,19 @@
unsigned char *channels);
/* Init the library for DRM */
-char NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder, unsigned long samplerate,
+ATTR char CDECL NeAACDecInitDRM(NeAACDecHandle *hDecoder, unsigned long samplerate,
unsigned char channels);
-void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, long frame);
+ATTR void CDECL NeAACDecPostSeekReset(NeAACDecHandle hDecoder, long frame);
-void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder);
+ATTR void CDECL NeAACDecClose(NeAACDecHandle hDecoder);
-void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder,
+ATTR void* CDECL NeAACDecDecode(NeAACDecHandle hDecoder,
NeAACDecFrameInfo *hInfo,
unsigned char *buffer,
unsigned long buffer_size);
-void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder,
+ATTR void* CDECL NeAACDecDecode2(NeAACDecHandle hDecoder,
NeAACDecFrameInfo *hInfo,
unsigned char *buffer,
unsigned long buffer_size,
@@ -247,12 +244,12 @@
void **sample_buffer,
unsigned long sample_buffer_size);
-char NEAACDECAPI NeAACDecAudioSpecificConfig(unsigned char *pBuffer,
+ATTR char CDECL NeAACDecAudioSpecificConfig(unsigned char *pBuffer,
unsigned long buffer_size,
mp4AudioSpecificConfig *mp4ASC);
/* Get version and copyright strings */
-int NEAACDECAPI NeAACDecGetVersion(char **faad_id_string,
+ATTR int CDECL NeAACDecGetVersion(char **faad_id_string,
char **faad_copyright_string);
#ifdef _WIN32
--- a/libfaad/decoder.c
+++ b/libfaad/decoder.c
@@ -64,7 +64,7 @@
NeAACDecFrameInfo *hInfo);
-int NEAACDECAPI NeAACDecGetVersion(char **faad_id_string,
+ATTR int CDECL NeAACDecGetVersion(char **faad_id_string,
char **faad_copyright_string)
{
static char *libfaadName = PACKAGE_VERSION;
@@ -81,7 +81,7 @@
return 0;
}
-char* NEAACDECAPI NeAACDecGetErrorMessage(unsigned char errcode)
+ATTR char* CDECL NeAACDecGetErrorMessage(unsigned char errcode)
{
if (errcode >= NUM_ERROR_MESSAGES)
return NULL;
@@ -88,7 +88,7 @@
return err_msg[errcode];
}
-unsigned long NEAACDECAPI NeAACDecGetCapabilities(void)
+ATTR unsigned long CDECL NeAACDecGetCapabilities(void)
{
uint32_t cap = 0;
@@ -115,7 +115,7 @@
}
const unsigned char mes[] = { 0x67,0x20,0x61,0x20,0x20,0x20,0x6f,0x20,0x72,0x20,0x65,0x20,0x6e,0x20,0x20,0x20,0x74,0x20,0x68,0x20,0x67,0x20,0x69,0x20,0x72,0x20,0x79,0x20,0x70,0x20,0x6f,0x20,0x63 };
-NeAACDecHandle NEAACDECAPI NeAACDecOpen(void)
+ATTR NeAACDecHandle CDECL NeAACDecOpen(void)
{
uint8_t i;
NeAACDecStruct *hDecoder = NULL;
@@ -176,7 +176,7 @@
return hDecoder;
}
-NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hpDecoder)
+ATTR NeAACDecConfigurationPtr CDECL NeAACDecGetCurrentConfiguration(NeAACDecHandle hpDecoder)
{
NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder;
if (hDecoder)
@@ -189,7 +189,7 @@
return NULL;
}
-unsigned char NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hpDecoder,
+ATTR unsigned char CDECL NeAACDecSetConfiguration(NeAACDecHandle hpDecoder,
NeAACDecConfigurationPtr config)
{
NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder;
@@ -252,7 +252,7 @@
}
-long NEAACDECAPI NeAACDecInit(NeAACDecHandle hpDecoder,
+ATTR long CDECL NeAACDecInit(NeAACDecHandle hpDecoder,
unsigned char *buffer,
unsigned long buffer_size,
unsigned long *samplerate,
@@ -386,7 +386,7 @@
}
/* Init the library using a DecoderSpecificInfo */
-char NEAACDECAPI NeAACDecInit2(NeAACDecHandle hpDecoder,
+ATTR char CDECL NeAACDecInit2(NeAACDecHandle hpDecoder,
unsigned char *pBuffer,
unsigned long SizeOfDecoderSpecificInfo,
unsigned long *samplerate,
@@ -480,7 +480,7 @@
}
#ifdef DRM
-char NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hpDecoder,
+ATTR char CDECL NeAACDecInitDRM(NeAACDecHandle *hpDecoder,
unsigned long samplerate,
unsigned char channels)
{
@@ -523,7 +523,7 @@
}
#endif
-void NEAACDECAPI NeAACDecClose(NeAACDecHandle hpDecoder)
+ATTR void CDECL NeAACDecClose(NeAACDecHandle hpDecoder)
{
uint8_t i;
NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder;
@@ -577,7 +577,7 @@
if (hDecoder) faad_free(hDecoder);
}
-void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hpDecoder, long frame)
+ATTR void CDECL NeAACDecPostSeekReset(NeAACDecHandle hpDecoder, long frame)
{
NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder;
if (hDecoder)
@@ -807,7 +807,7 @@
}
}
-void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hpDecoder,
+ATTR void* CDECL NeAACDecDecode(NeAACDecHandle hpDecoder,
NeAACDecFrameInfo *hInfo,
unsigned char *buffer,
unsigned long buffer_size)
@@ -816,7 +816,7 @@
return aac_frame_decode(hDecoder, hInfo, buffer, buffer_size, NULL, 0);
}
-void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hpDecoder,
+ATTR void* CDECL NeAACDecDecode2(NeAACDecHandle hpDecoder,
NeAACDecFrameInfo *hInfo,
unsigned char *buffer,
unsigned long buffer_size,
--- a/libfaad/mp4.c
+++ b/libfaad/mp4.c
@@ -114,7 +114,7 @@
};
/* Table 1.6.1 */
-char NEAACDECAPI NeAACDecAudioSpecificConfig(unsigned char *pBuffer,
+ATTR char CDECL NeAACDecAudioSpecificConfig(unsigned char *pBuffer,
unsigned long buffer_size,
mp4AudioSpecificConfig *mp4ASC)
{