shithub: opus

Download patch

ref: 3870ddb665f987c139c8ca6477a152868c1c6f6e
parent: 6cd4e2cd010b50cdba9991252ed1ff83ff9a8392
author: Jean-Marc Valin <[email protected]>
date: Thu Sep 1 11:22:37 EDT 2011

Only export the CELT calls when CUSTOM_MODES is defined

--- a/libcelt/opus_custom.h
+++ b/libcelt/opus_custom.h
@@ -42,6 +42,12 @@
 extern "C" {
 #endif
 
+#ifdef CUSTOM_MODES
+#define OPUS_CUSTOM_EXPORT OPUS_EXPORT
+#else
+#define OPUS_CUSTOM_EXPORT
+#endif
+
 /** Contains the state of an encoder. One encoder state is needed
     for each stream. It is initialised once at the beginning of the
     stream. Do *not* re-initialise the state for every frame.
@@ -73,19 +79,19 @@
  @param error Returned error code (if NULL, no error will be returned)
  @return A newly created mode
 */
-OPUS_EXPORT CELTMode *opus_custom_mode_create(opus_int32 Fs, int frame_size, int *error);
+OPUS_CUSTOM_EXPORT CELTMode *opus_custom_mode_create(opus_int32 Fs, int frame_size, 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
 */
-OPUS_EXPORT void opus_custom_mode_destroy(CELTMode *mode);
+OPUS_CUSTOM_EXPORT void opus_custom_mode_destroy(CELTMode *mode);
 
 
 
 /* Encoder */
 
-OPUS_EXPORT int opus_custom_encoder_get_size(const CELTMode *mode, int channels);
+OPUS_CUSTOM_EXPORT int opus_custom_encoder_get_size(const CELTMode *mode, int channels);
 
 /** Creates a new encoder state. Each stream needs its own encoder
     state (can't be shared across simultaneous streams).
@@ -96,14 +102,14 @@
  @param error Returns an error code
  @return Newly created encoder state.
 */
-OPUS_EXPORT CELTEncoder *opus_custom_encoder_create(const CELTMode *mode, int channels, int *error);
+OPUS_CUSTOM_EXPORT CELTEncoder *opus_custom_encoder_create(const CELTMode *mode, int channels, int *error);
 
-OPUS_EXPORT int opus_custom_encoder_init(CELTEncoder *st, const CELTMode *mode, int channels);
+OPUS_CUSTOM_EXPORT int opus_custom_encoder_init(CELTEncoder *st, const CELTMode *mode, int channels);
 
 /** Destroys a an encoder state.
  @param st Encoder state to be destroyed
  */
-OPUS_EXPORT void opus_custom_encoder_destroy(CELTEncoder *st);
+OPUS_CUSTOM_EXPORT void opus_custom_encoder_destroy(CELTEncoder *st);
 
 /** Encodes a frame of audio.
  @param st Encoder state
@@ -123,7 +129,7 @@
  *       the length returned be somehow transmitted to the decoder. Otherwise, no
  *       decoding is possible.
 */
-OPUS_EXPORT int opus_custom_encode_float(CELTEncoder *st, const float *pcm, int frame_size, unsigned char *compressed, int maxCompressedBytes);
+OPUS_CUSTOM_EXPORT int opus_custom_encode_float(CELTEncoder *st, const float *pcm, int frame_size, unsigned char *compressed, int maxCompressedBytes);
 
 /** Encodes a frame of audio.
  @param st Encoder state
@@ -139,7 +145,7 @@
  *       the length returned be somehow transmitted to the decoder. Otherwise, no
  *       decoding is possible.
  */
-OPUS_EXPORT int opus_custom_encode(CELTEncoder *st, const opus_int16 *pcm, int frame_size, unsigned char *compressed, int maxCompressedBytes);
+OPUS_CUSTOM_EXPORT int opus_custom_encode(CELTEncoder *st, const opus_int16 *pcm, int frame_size, unsigned char *compressed, int maxCompressedBytes);
 
 /** Query and set encoder parameters
  @param st Encoder state
@@ -147,13 +153,13 @@
  @param value Pointer to a 32-bit int value
  @return Error code
 */
-OPUS_EXPORT int opus_custom_encoder_ctl(CELTEncoder * restrict st, int request, ...);
+OPUS_CUSTOM_EXPORT int opus_custom_encoder_ctl(CELTEncoder * restrict st, int request, ...);
 
 
 
 /* Decoder */
 
-OPUS_EXPORT int opus_custom_decoder_get_size(const CELTMode *mode, int channels);
+OPUS_CUSTOM_EXPORT int opus_custom_decoder_get_size(const CELTMode *mode, int channels);
 
 /** Creates a new decoder state. Each stream needs its own decoder state (can't
     be shared across simultaneous streams).
@@ -163,14 +169,14 @@
  @param error Returns an error code
  @return Newly created decoder state.
  */
-OPUS_EXPORT CELTDecoder *opus_custom_decoder_create(const CELTMode *mode, int channels, int *error);
+OPUS_CUSTOM_EXPORT CELTDecoder *opus_custom_decoder_create(const CELTMode *mode, int channels, int *error);
 
-OPUS_EXPORT int opus_custom_decoder_init(CELTDecoder *st, const CELTMode *mode, int channels);
+OPUS_CUSTOM_EXPORT int opus_custom_decoder_init(CELTDecoder *st, const CELTMode *mode, int channels);
 
 /** Destroys a a decoder state.
  @param st Decoder state to be destroyed
  */
-OPUS_EXPORT void opus_custom_decoder_destroy(CELTDecoder *st);
+OPUS_CUSTOM_EXPORT void opus_custom_decoder_destroy(CELTDecoder *st);
 
 /** Decodes a frame of audio.
  @param st Decoder state
@@ -181,7 +187,7 @@
             returned here in float format.
  @return Error code.
    */
-OPUS_EXPORT int opus_custom_decode_float(CELTDecoder *st, const unsigned char *data, int len, float *pcm, int frame_size);
+OPUS_CUSTOM_EXPORT int opus_custom_decode_float(CELTDecoder *st, const unsigned char *data, int len, float *pcm, int frame_size);
 
 /** Decodes a frame of audio.
  @param st Decoder state
@@ -192,7 +198,7 @@
             returned here in 16-bit PCM format (native endian).
  @return Error code.
  */
-OPUS_EXPORT int opus_custom_decode(CELTDecoder *st, const unsigned char *data, int len, opus_int16 *pcm, int frame_size);
+OPUS_CUSTOM_EXPORT int opus_custom_decode(CELTDecoder *st, const unsigned char *data, int len, opus_int16 *pcm, int frame_size);
 
 /** Query and set decoder parameters
    @param st Decoder state
@@ -200,7 +206,7 @@
    @param value Pointer to a 32-bit int value
    @return Error code
  */
-OPUS_EXPORT int opus_custom_decoder_ctl(CELTDecoder * restrict st, int request, ...);
+OPUS_CUSTOM_EXPORT int opus_custom_decoder_ctl(CELTDecoder * restrict st, int request, ...);
 
 
 #ifdef __cplusplus