Opus
Opus audio codec (RFC 6716): API and operations manual
1.3
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 OPUS_BUILD
00050 #  define OPUS_CUSTOM_EXPORT_STATIC static OPUS_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 
00130 #if !defined(OPUS_BUILD) || defined(CELT_ENCODER_C)
00131 
00132 /* Encoder */
00138 OPUS_CUSTOM_EXPORT_STATIC OPUS_WARN_UNUSED_RESULT int opus_custom_encoder_get_size(
00139     const OpusCustomMode *mode,
00140     int channels
00141 ) OPUS_ARG_NONNULL(1);
00142 
00143 # ifdef CUSTOM_MODES
00144 
00156 OPUS_CUSTOM_EXPORT int opus_custom_encoder_init(
00157     OpusCustomEncoder *st,
00158     const OpusCustomMode *mode,
00159     int channels
00160 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2);
00161 # endif
00162 #endif
00163 
00164 
00174 OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT OpusCustomEncoder *opus_custom_encoder_create(
00175     const OpusCustomMode *mode,
00176     int channels,
00177     int *error
00178 ) OPUS_ARG_NONNULL(1);
00179 
00180 
00184 OPUS_CUSTOM_EXPORT void opus_custom_encoder_destroy(OpusCustomEncoder *st);
00185 
00203 OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT int opus_custom_encode_float(
00204     OpusCustomEncoder *st,
00205     const float *pcm,
00206     int frame_size,
00207     unsigned char *compressed,
00208     int maxCompressedBytes
00209 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4);
00210 
00224 OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT int opus_custom_encode(
00225     OpusCustomEncoder *st,
00226     const opus_int16 *pcm,
00227     int frame_size,
00228     unsigned char *compressed,
00229     int maxCompressedBytes
00230 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4);
00231 
00238 OPUS_CUSTOM_EXPORT int opus_custom_encoder_ctl(OpusCustomEncoder * OPUS_RESTRICT st, int request, ...) OPUS_ARG_NONNULL(1);
00239 
00240 
00241 #if !defined(OPUS_BUILD) || defined(CELT_DECODER_C)
00242 /* Decoder */
00243 
00249 OPUS_CUSTOM_EXPORT_STATIC OPUS_WARN_UNUSED_RESULT int opus_custom_decoder_get_size(
00250     const OpusCustomMode *mode,
00251     int channels
00252 ) OPUS_ARG_NONNULL(1);
00253 
00266 OPUS_CUSTOM_EXPORT_STATIC int opus_custom_decoder_init(
00267     OpusCustomDecoder *st,
00268     const OpusCustomMode *mode,
00269     int channels
00270 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2);
00271 
00272 #endif
00273 
00274 
00283 OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT OpusCustomDecoder *opus_custom_decoder_create(
00284     const OpusCustomMode *mode,
00285     int channels,
00286     int *error
00287 ) OPUS_ARG_NONNULL(1);
00288 
00292 OPUS_CUSTOM_EXPORT void opus_custom_decoder_destroy(OpusCustomDecoder *st);
00293 
00303 OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT int opus_custom_decode_float(
00304     OpusCustomDecoder *st,
00305     const unsigned char *data,
00306     int len,
00307     float *pcm,
00308     int frame_size
00309 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
00310 
00320 OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT int opus_custom_decode(
00321     OpusCustomDecoder *st,
00322     const unsigned char *data,
00323     int len,
00324     opus_int16 *pcm,
00325     int frame_size
00326 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
00327 
00334 OPUS_CUSTOM_EXPORT int opus_custom_decoder_ctl(OpusCustomDecoder * OPUS_RESTRICT st, int request, ...) OPUS_ARG_NONNULL(1);
00335 
00338 #ifdef __cplusplus
00339 }
00340 #endif
00341 
00342 #endif /* OPUS_CUSTOM_H */
 All Files Functions Typedefs Defines
For more information visit the Opus Website.