• Main Page
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

libcelt/celt.h

Go to the documentation of this file.
00001 /* Copyright (c) 2007-2008 CSIRO
00002    Copyright (c) 2007-2009 Xiph.Org Foundation
00003    Copyright (c) 2008 Gregory Maxwell 
00004    Written by Jean-Marc Valin and Gregory Maxwell */
00010 /*
00011    Redistribution and use in source and binary forms, with or without
00012    modification, are permitted provided that the following conditions
00013    are met:
00014    
00015    - Redistributions of source code must retain the above copyright
00016    notice, this list of conditions and the following disclaimer.
00017    
00018    - Redistributions in binary form must reproduce the above copyright
00019    notice, this list of conditions and the following disclaimer in the
00020    documentation and/or other materials provided with the distribution.
00021    
00022    - Neither the name of the Xiph.org Foundation nor the names of its
00023    contributors may be used to endorse or promote products derived from
00024    this software without specific prior written permission.
00025    
00026    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00027    ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00028    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00029    A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
00030    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00031    EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00032    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00033    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00034    LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00035    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00036    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00037 */
00038 
00039 #ifndef CELT_H
00040 #define CELT_H
00041 
00042 #include "celt_types.h"
00043 
00044 #ifdef __cplusplus
00045 extern "C" {
00046 #endif
00047 
00048 #if defined(__GNUC__) && defined(CELT_BUILD)
00049 #define EXPORT __attribute__ ((visibility ("default")))
00050 #elif defined(WIN32)
00051 #define EXPORT __declspec(dllexport)
00052 #else
00053 #define EXPORT
00054 #endif
00055 
00056 #define _celt_check_int(x) (((void)((x) == (celt_int32)0)), (celt_int32)(x))
00057 #define _celt_check_mode_ptr_ptr(ptr) ((ptr) + ((ptr) - (CELTMode**)(ptr)))
00058 
00059 /* Error codes */
00061 #define CELT_OK                0
00062 
00063 #define CELT_BAD_ARG          -1
00064 
00065 #define CELT_INVALID_MODE     -2
00066 
00067 #define CELT_INTERNAL_ERROR   -3
00068 
00069 #define CELT_CORRUPTED_DATA   -4
00070 
00071 #define CELT_UNIMPLEMENTED    -5
00072 
00073 #define CELT_INVALID_STATE    -6
00074 
00075 #define CELT_ALLOC_FAIL       -7
00076 
00077 /* Requests */
00078 #define CELT_GET_MODE_REQUEST    1
00079 
00080 #define CELT_GET_MODE(x) CELT_GET_MODE_REQUEST, _celt_check_mode_ptr_ptr(x)
00081 #define CELT_SET_COMPLEXITY_REQUEST    2
00082 
00083 #define CELT_SET_COMPLEXITY(x) CELT_SET_COMPLEXITY_REQUEST, _celt_check_int(x)
00084 #define CELT_SET_PREDICTION_REQUEST    4
00085 
00090 #define CELT_SET_PREDICTION(x) CELT_SET_PREDICTION_REQUEST, _celt_check_int(x)
00091 #define CELT_SET_VBR_RATE_REQUEST    6
00092 
00093 #define CELT_SET_VBR_RATE(x) CELT_SET_VBR_RATE_REQUEST, _celt_check_int(x)
00094 
00095 #define CELT_RESET_STATE_REQUEST        8
00096 #define CELT_RESET_STATE       CELT_RESET_STATE_REQUEST
00097 
00099 #define CELT_GET_FRAME_SIZE   1000
00100 
00101 #define CELT_GET_LOOKAHEAD    1001
00102 
00103 #define CELT_GET_SAMPLE_RATE  1003
00104 
00106 #define CELT_GET_BITSTREAM_VERSION 2000
00107 
00108 
00114 typedef struct CELTEncoder CELTEncoder;
00115 
00119 typedef struct CELTDecoder CELTDecoder;
00120 
00125 typedef struct CELTMode CELTMode;
00126 
00127 
00129 /*  @{ */
00130 
00131 /* Mode calls */
00132 
00142 EXPORT CELTMode *celt_mode_create(celt_int32 Fs, int frame_size, int *error);
00143 
00148 EXPORT void celt_mode_destroy(CELTMode *mode);
00149 
00151 EXPORT int celt_mode_info(const CELTMode *mode, int request, celt_int32 *value);
00152 
00153 /* Encoder stuff */
00154 
00155 
00165 EXPORT CELTEncoder *celt_encoder_create(const CELTMode *mode, int channels, int *error);
00166 
00170 EXPORT void celt_encoder_destroy(CELTEncoder *st);
00171 
00194 EXPORT int celt_encode_float(CELTEncoder *st, const float *pcm, float *optional_synthesis, unsigned char *compressed, int nbCompressedBytes);
00195 
00214 EXPORT int celt_encode(CELTEncoder *st, const celt_int16 *pcm, celt_int16 *optional_synthesis, unsigned char *compressed, int nbCompressedBytes);
00215 
00222 EXPORT int celt_encoder_ctl(CELTEncoder * st, int request, ...);
00223 
00224 /* Decoder stuff */
00225 
00226 
00235 EXPORT CELTDecoder *celt_decoder_create(const CELTMode *mode, int channels, int *error);
00236 
00240 EXPORT void celt_decoder_destroy(CELTDecoder *st);
00241 
00251 EXPORT int celt_decode_float(CELTDecoder *st, const unsigned char *data, int len, float *pcm);
00252 
00262 EXPORT int celt_decode(CELTDecoder *st, const unsigned char *data, int len, celt_int16 *pcm);
00263 
00270 EXPORT int celt_decoder_ctl(CELTDecoder * st, int request, ...);
00271 
00272 
00277 EXPORT const char *celt_strerror(int error);
00278 
00279 /*  @} */
00280 
00281 
00282 #ifdef __cplusplus
00283 }
00284 #endif
00285 
00286 #endif /*CELT_H */

Generated on Wed Feb 20 2013 18:48:12 for CELT by  doxygen 1.7.1