Commit 19f9dc98 authored by Peter Kirk's avatar Peter Kirk Committed by Jean-Marc Valin
Browse files

Use EXPORT macro in a way compatible with win32

parent 96748cf3
......@@ -35,6 +35,7 @@ AC_C_CONST
AC_C_INLINE
AC_C_RESTRICT
AC_DEFINE([CELT_BUILD], [], [This is a build of CELT])
AC_MSG_CHECKING(for C99 variable-size arrays)
AC_TRY_COMPILE( , [
......@@ -63,7 +64,6 @@ has_alloca=no
)
AC_MSG_RESULT($has_alloca)
AC_CHECK_HEADERS(sys/soundcard.h sys/audioio.h)
XIPH_PATH_OGG([tools="tools"], [tools=""])
......
......@@ -79,7 +79,7 @@ struct CELTEncoder {
#endif
};
CELTEncoder EXPORT *celt_encoder_create(const CELTMode *mode)
CELTEncoder *celt_encoder_create(const CELTMode *mode)
{
int N, C;
CELTEncoder *st;
......@@ -115,7 +115,7 @@ CELTEncoder EXPORT *celt_encoder_create(const CELTMode *mode)
return st;
}
void EXPORT celt_encoder_destroy(CELTEncoder *st)
void celt_encoder_destroy(CELTEncoder *st)
{
if (st == NULL)
{
......@@ -225,7 +225,7 @@ static void compute_inv_mdcts(const CELTMode *mode, const celt_word16_t * restri
}
}
int EXPORT celt_encode(CELTEncoder * restrict st, celt_int16_t * restrict pcm, unsigned char *compressed, int nbCompressedBytes)
int celt_encode(CELTEncoder * restrict st, celt_int16_t * restrict pcm, unsigned char *compressed, int nbCompressedBytes)
{
int i, c, N, N4;
int has_pitch;
......@@ -453,7 +453,7 @@ struct CELTDecoder {
int last_pitch_index;
};
CELTDecoder EXPORT *celt_decoder_create(const CELTMode *mode)
CELTDecoder *celt_decoder_create(const CELTMode *mode)
{
int N, C;
CELTDecoder *st;
......@@ -480,7 +480,7 @@ CELTDecoder EXPORT *celt_decoder_create(const CELTMode *mode)
return st;
}
void EXPORT celt_decoder_destroy(CELTDecoder *st)
void celt_decoder_destroy(CELTDecoder *st)
{
if (st == NULL)
{
......@@ -552,7 +552,7 @@ static void celt_decode_lost(CELTDecoder * restrict st, short * restrict pcm)
RESTORE_STACK;
}
int EXPORT celt_decode(CELTDecoder * restrict st, unsigned char *data, int len, celt_int16_t * restrict pcm)
int celt_decode(CELTDecoder * restrict st, unsigned char *data, int len, celt_int16_t * restrict pcm)
{
int c, N, N4;
int has_pitch;
......
......@@ -43,6 +43,14 @@
extern "C" {
#endif
#if defined(__GNUC__) && defined(CELT_BUILD)
#define EXPORT __attribute__ ((visibility ("default")))
#elif defined(WIN32)
#define EXPORT __declspec(dllexport)
#else
#define EXPORT
#endif
/* Error codes */
/** No error */
#define CELT_OK 0
......@@ -100,16 +108,16 @@ typedef struct CELTMode CELTMode;
@param error Returned error code (if NULL, no error will be returned)
@return A newly created mode
*/
CELTMode *celt_mode_create(celt_int32_t Fs, int channels, int frame_size, int lookahead, int *error);
EXPORT CELTMode *celt_mode_create(celt_int32_t Fs, int channels, int frame_size, int lookahead, int *error);
/** Destroys a mode struct. Only call this after all encoders and decoders
using this mode are destroyed as well.
@param mode Mode to be destroyed
*/
void celt_mode_destroy(CELTMode *mode);
EXPORT void celt_mode_destroy(CELTMode *mode);
/** Query information from a mode */
int celt_mode_info(const CELTMode *mode, int request, celt_int32_t *value);
EXPORT int celt_mode_info(const CELTMode *mode, int request, celt_int32_t *value);
/* Encoder stuff */
......@@ -121,12 +129,12 @@ int celt_mode_info(const CELTMode *mode, int request, celt_int32_t *value);
(must be the same characteristics as used for the decoder)
@return Newly created encoder state.
*/
CELTEncoder *celt_encoder_create(const CELTMode *mode);
EXPORT CELTEncoder *celt_encoder_create(const CELTMode *mode);
/** Destroys a an encoder state.
@param st Encoder state to be destroyed
*/
void celt_encoder_destroy(CELTEncoder *st);
EXPORT void celt_encoder_destroy(CELTEncoder *st);
/** Encodes a frame of audio.
@param st Encoder state
......@@ -141,7 +149,7 @@ void celt_encoder_destroy(CELTEncoder *st);
has occured (see error codes). It is IMPORTANT that the length returned
be somehow transmitted to the decoder. Otherwise, no decoding is possible.
*/
int celt_encode(CELTEncoder *st, celt_int16_t *pcm, unsigned char *compressed, int nbCompressedBytes);
EXPORT int celt_encode(CELTEncoder *st, celt_int16_t *pcm, unsigned char *compressed, int nbCompressedBytes);
/* Decoder stuff */
......@@ -152,12 +160,12 @@ int celt_encode(CELTEncoder *st, celt_int16_t *pcm, unsigned char *compressed, i
stream (must be the same characteristics as used for the encoder)
@return Newly created decoder state.
*/
CELTDecoder *celt_decoder_create(const CELTMode *mode);
EXPORT CELTDecoder *celt_decoder_create(const CELTMode *mode);
/** Destroys a a decoder state.
@param st Decoder state to be destroyed
*/
void celt_decoder_destroy(CELTDecoder *st);
EXPORT void celt_decoder_destroy(CELTDecoder *st);
/** Decodes a frame of audio.
@param st Decoder state
......@@ -168,7 +176,7 @@ void celt_decoder_destroy(CELTDecoder *st);
returned here.
@return Error code.
*/
int celt_decode(CELTDecoder *st, unsigned char *data, int len, celt_int16_t *pcm);
EXPORT int celt_decode(CELTDecoder *st, unsigned char *data, int len, celt_int16_t *pcm);
/* @} */
......
......@@ -56,11 +56,11 @@ typedef struct {
} CELTHeader;
/** Creates a basic header struct */
void celt_header_init(CELTHeader *header, const CELTMode *m);
EXPORT void celt_header_init(CELTHeader *header, const CELTMode *m);
int celt_header_to_packet(const CELTHeader *header, unsigned char *packet, celt_uint32_t size);
EXPORT int celt_header_to_packet(const CELTHeader *header, unsigned char *packet, celt_uint32_t size);
int celt_header_from_packet(const unsigned char *packet, celt_uint32_t size, CELTHeader *header);
EXPORT int celt_header_from_packet(const unsigned char *packet, celt_uint32_t size, CELTHeader *header);
#ifdef __cplusplus
}
......
......@@ -62,7 +62,7 @@ _le_32 (celt_uint32_t i)
return ret;
}
void EXPORT celt_header_init(CELTHeader *header, const CELTMode *m)
void celt_header_init(CELTHeader *header, const CELTMode *m)
{
CELT_COPY(header->codec_id, "CELT ", 8);
CELT_COPY(header->codec_version, "experimental ", 20);
......@@ -77,7 +77,7 @@ void EXPORT celt_header_init(CELTHeader *header, const CELTMode *m)
header->extra_headers = 0;
}
int EXPORT celt_header_to_packet(const CELTHeader *header, unsigned char *packet, celt_uint32_t size)
int celt_header_to_packet(const CELTHeader *header, unsigned char *packet, celt_uint32_t size)
{
celt_int32_t * h;
......@@ -103,7 +103,7 @@ int EXPORT celt_header_to_packet(const CELTHeader *header, unsigned char *packet
return sizeof(*header);
}
int EXPORT celt_header_from_packet(const unsigned char *packet, celt_uint32_t size, CELTHeader *header)
int celt_header_from_packet(const unsigned char *packet, celt_uint32_t size, CELTHeader *header)
{
CELT_COPY((unsigned char*)header, packet, sizeof(*header));
return sizeof(*header);
......
......@@ -52,7 +52,7 @@
#endif
int EXPORT celt_mode_info(const CELTMode *mode, int request, celt_int32_t *value)
int celt_mode_info(const CELTMode *mode, int request, celt_int32_t *value)
{
switch (request)
{
......@@ -270,7 +270,7 @@ static void compute_energy_allocation_table(CELTMode *mode)
mode->energy_alloc = alloc;
}
CELTMode EXPORT *celt_mode_create(celt_int32_t Fs, int channels, int frame_size, int lookahead, int *error)
CELTMode *celt_mode_create(celt_int32_t Fs, int channels, int frame_size, int lookahead, int *error)
{
int i;
#ifdef STDIN_TUNING
......@@ -391,7 +391,7 @@ CELTMode EXPORT *celt_mode_create(celt_int32_t Fs, int channels, int frame_size,
return mode;
}
void EXPORT celt_mode_destroy(CELTMode *mode)
void celt_mode_destroy(CELTMode *mode)
{
#ifndef STATIC_MODES
int i;
......
......@@ -42,14 +42,6 @@
#include <stdio.h>
#include <stdlib.h>
#ifdef __GNUC__
#define EXPORT __attribute__ ((visibility ("default")))
#elif defined(WIN32)
#define EXPORT __declspec(dllexport)
#else
#define EXPORT
#endif
/** Speex wrapper for calloc. To do your own dynamic allocation, all you need to do is replace this function, celt_realloc and celt_free
NOTE: celt_alloc needs to CLEAR THE MEMORY */
#ifndef OVERRIDE_CELT_ALLOC
......
Supports Markdown
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