Opus
IETF low-delay audio codec: API and operations manual
1.0.2
opus_custom.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-2012 Gregory Maxwell
00004    Written by Jean-Marc Valin and Gregory Maxwell */
00005 /*
00006    Redistribution and use in source and binary forms, with or without
00007    modification, are permitted provided that the following conditions
00008    are met:
00009 
00010    - Redistributions of source code must retain the above copyright
00011    notice, this list of conditions and the following disclaimer.
00012 
00013    - Redistributions in binary form must reproduce the above copyright
00014    notice, this list of conditions and the following disclaimer in the
00015    documentation and/or other materials provided with the distribution.
00016 
00017    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00018    ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00019    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00020    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
00021    OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00022    EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00023    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00024    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00025    LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00026    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00027    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00028 */
00029 
00035 #ifndef OPUS_CUSTOM_H
00036 #define OPUS_CUSTOM_H
00037 
00038 #include "opus_defines.h"
00039 
00040 #ifdef __cplusplus
00041 extern "C" {
00042 #endif
00043 
00044 #ifdef CUSTOM_MODES
00045 #define OPUS_CUSTOM_EXPORT OPUS_EXPORT
00046 #define OPUS_CUSTOM_EXPORT_STATIC OPUS_EXPORT
00047 #else
00048 #define OPUS_CUSTOM_EXPORT
00049 #ifdef CELT_C
00050 #define OPUS_CUSTOM_EXPORT_STATIC static inline
00051 #else
00052 #define OPUS_CUSTOM_EXPORT_STATIC
00053 #endif
00054 #endif
00055 
00095 typedef struct OpusCustomEncoder OpusCustomEncoder;
00096 
00102 typedef struct OpusCustomDecoder OpusCustomDecoder;
00103 
00110 typedef struct OpusCustomMode OpusCustomMode;
00111 
00121 OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT OpusCustomMode *opus_custom_mode_create(opus_int32 Fs, int frame_size, int *error);
00122 
00127 OPUS_CUSTOM_EXPORT void opus_custom_mode_destroy(OpusCustomMode *mode);
00128 
00129 /* Encoder */
00135 OPUS_CUSTOM_EXPORT_STATIC OPUS_WARN_UNUSED_RESULT int opus_custom_encoder_get_size(
00136     const OpusCustomMode *mode,
00137     int channels
00138 ) OPUS_ARG_NONNULL(1);
00139 
00149 OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT OpusCustomEncoder *opus_custom_encoder_create(
00150     const OpusCustomMode *mode,
00151     int channels,
00152     int *error
00153 ) OPUS_ARG_NONNULL(1);
00154 
00167 OPUS_CUSTOM_EXPORT_STATIC int opus_custom_encoder_init(
00168     OpusCustomEncoder *st,
00169     const OpusCustomMode *mode,
00170     int channels
00171 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2);
00172 
00176 OPUS_CUSTOM_EXPORT void opus_custom_encoder_destroy(OpusCustomEncoder *st);
00177 
00195 OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT int opus_custom_encode_float(
00196     OpusCustomEncoder *st,
00197     const float *pcm,
00198     int frame_size,
00199     unsigned char *compressed,
00200     int maxCompressedBytes
00201 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4);
00202 
00216 OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT int opus_custom_encode(
00217     OpusCustomEncoder *st,
00218     const opus_int16 *pcm,
00219     int frame_size,
00220     unsigned char *compressed,
00221     int maxCompressedBytes
00222 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4);
00223 
00230 OPUS_CUSTOM_EXPORT int opus_custom_encoder_ctl(OpusCustomEncoder * OPUS_RESTRICT st, int request, ...) OPUS_ARG_NONNULL(1);
00231 
00232 /* Decoder */
00233 
00239 OPUS_CUSTOM_EXPORT_STATIC OPUS_WARN_UNUSED_RESULT int opus_custom_decoder_get_size(
00240     const OpusCustomMode *mode,
00241     int channels
00242 ) OPUS_ARG_NONNULL(1);
00243 
00252 OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT OpusCustomDecoder *opus_custom_decoder_create(
00253     const OpusCustomMode *mode,
00254     int channels,
00255     int *error
00256 ) OPUS_ARG_NONNULL(1);
00257 
00270 OPUS_CUSTOM_EXPORT_STATIC int opus_custom_decoder_init(
00271     OpusCustomDecoder *st,
00272     const OpusCustomMode *mode,
00273     int channels
00274 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2);
00275 
00279 OPUS_CUSTOM_EXPORT void opus_custom_decoder_destroy(OpusCustomDecoder *st);
00280 
00290 OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT int opus_custom_decode_float(
00291     OpusCustomDecoder *st,
00292     const unsigned char *data,
00293     int len,
00294     float *pcm,
00295     int frame_size
00296 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
00297 
00307 OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT int opus_custom_decode(
00308     OpusCustomDecoder *st,
00309     const unsigned char *data,
00310     int len,
00311     opus_int16 *pcm,
00312     int frame_size
00313 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
00314 
00321 OPUS_CUSTOM_EXPORT int opus_custom_decoder_ctl(OpusCustomDecoder * OPUS_RESTRICT st, int request, ...) OPUS_ARG_NONNULL(1);
00322 
00325 #ifdef __cplusplus
00326 }
00327 #endif
00328 
00329 #endif /* OPUS_CUSTOM_H */
 All Files Functions Typedefs Defines
For more information visit the Opus Website.