Opus: opus_multistream.h Source File

Opus audio codec (RFC 6716): API and operations manual
| 1.2

Loading...
Searching...
No Matches
opus_multistream.h
Go to the documentation of this file.
1/* Copyright (c) 2011 Xiph.Org Foundation
2 Written by Jean-Marc Valin */
3/*
4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted provided that the following conditions
6 are met:
7
8 - Redistributions of source code must retain the above copyright
9 notice, this list of conditions and the following disclaimer.
10
11 - Redistributions in binary form must reproduce the above copyright
12 notice, this list of conditions and the following disclaimer in the
13 documentation and/or other materials provided with the distribution.
14
15 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
19 OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*/
27
32
33#ifndef OPUS_MULTISTREAM_H
34#define OPUS_MULTISTREAM_H
35
36#include "opus.h"
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
43
47#define __opus_check_encstate_ptr(ptr) ((ptr) + ((ptr) - (OpusEncoder**)(ptr)))
48#define __opus_check_decstate_ptr(ptr) ((ptr) + ((ptr) - (OpusDecoder**)(ptr)))
50
55#define OPUS_MULTISTREAM_GET_ENCODER_STATE_REQUEST 5120
56#define OPUS_MULTISTREAM_GET_DECODER_STATE_REQUEST 5122
58
60
74
86#define OPUS_MULTISTREAM_GET_ENCODER_STATE(x,y) OPUS_MULTISTREAM_GET_ENCODER_STATE_REQUEST, __opus_check_int(x), __opus_check_encstate_ptr(y)
87
99#define OPUS_MULTISTREAM_GET_DECODER_STATE(x,y) OPUS_MULTISTREAM_GET_DECODER_STATE_REQUEST, __opus_check_int(x), __opus_check_decstate_ptr(y)
100
102
168
175 typedef struct OpusMSEncoder OpusMSEncoder;
176
183 typedef struct OpusMSDecoder OpusMSDecoder;
184
187
203OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_multistream_encoder_get_size(
204 int streams,
205 int coupled_streams
206);
207
208OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_multistream_surround_encoder_get_size(
209 int channels,
210 int mapping_family
211);
212
213
257OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusMSEncoder *opus_multistream_encoder_create(
258 opus_int32 Fs,
259 int channels,
260 int streams,
261 int coupled_streams,
262 const unsigned char *mapping,
263 int application,
264 int *error
265) OPUS_ARG_NONNULL(5);
266
267OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusMSEncoder *opus_multistream_surround_encoder_create(
268 opus_int32 Fs,
269 int channels,
270 int mapping_family,
271 int *streams,
272 int *coupled_streams,
273 unsigned char *mapping,
274 int application,
275 int *error
276) OPUS_ARG_NONNULL(4) OPUS_ARG_NONNULL(5) OPUS_ARG_NONNULL(6);
277
326OPUS_EXPORT int opus_multistream_encoder_init(
327 OpusMSEncoder *st,
328 opus_int32 Fs,
329 int channels,
330 int streams,
331 int coupled_streams,
332 const unsigned char *mapping,
333 int application
334) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(6);
335
336OPUS_EXPORT int opus_multistream_surround_encoder_init(
337 OpusMSEncoder *st,
338 opus_int32 Fs,
339 int channels,
340 int mapping_family,
341 int *streams,
342 int *coupled_streams,
343 unsigned char *mapping,
344 int application
345) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(5) OPUS_ARG_NONNULL(6) OPUS_ARG_NONNULL(7);
346
377OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_encode(
378 OpusMSEncoder *st,
379 const opus_int16 *pcm,
380 int frame_size,
381 unsigned char *data,
382 opus_int32 max_data_bytes
383) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4);
384
422OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_encode_float(
423 OpusMSEncoder *st,
424 const float *pcm,
425 int frame_size,
426 unsigned char *data,
427 opus_int32 max_data_bytes
428) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4);
429
434OPUS_EXPORT void opus_multistream_encoder_destroy(OpusMSEncoder *st);
435
448OPUS_EXPORT int opus_multistream_encoder_ctl(OpusMSEncoder *st, int request, ...) OPUS_ARG_NONNULL(1);
449
451
454
470OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_multistream_decoder_get_size(
471 int streams,
472 int coupled_streams
473);
474
504OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusMSDecoder *opus_multistream_decoder_create(
505 opus_int32 Fs,
506 int channels,
507 int streams,
508 int coupled_streams,
509 const unsigned char *mapping,
510 int *error
511) OPUS_ARG_NONNULL(5);
512
547OPUS_EXPORT int opus_multistream_decoder_init(
548 OpusMSDecoder *st,
549 opus_int32 Fs,
550 int channels,
551 int streams,
552 int coupled_streams,
553 const unsigned char *mapping
554) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(6);
555
585OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_decode(
586 OpusMSDecoder *st,
587 const unsigned char *data,
588 opus_int32 len,
589 opus_int16 *pcm,
590 int frame_size,
591 int decode_fec
592) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
593
623OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_decode_float(
624 OpusMSDecoder *st,
625 const unsigned char *data,
626 opus_int32 len,
627 float *pcm,
628 int frame_size,
629 int decode_fec
630) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
631
644OPUS_EXPORT int opus_multistream_decoder_ctl(OpusMSDecoder *st, int request, ...) OPUS_ARG_NONNULL(1);
645
650OPUS_EXPORT void opus_multistream_decoder_destroy(OpusMSDecoder *st);
651
653
655
656#ifdef __cplusplus
657}
658#endif
659
660#endif /* OPUS_MULTISTREAM_H */
opus_multistream_decoder_init
int opus_multistream_decoder_init(OpusMSDecoder *st, opus_int32 Fs, int channels, int streams, int coupled_streams, const unsigned char *mapping)
Intialize a previously allocated decoder state object.
opus_multistream_decoder_create
OpusMSDecoder * opus_multistream_decoder_create(opus_int32 Fs, int channels, int streams, int coupled_streams, const unsigned char *mapping, int *error)
Allocates and initializes a multistream decoder state.
opus_multistream_decoder_get_size
opus_int32 opus_multistream_decoder_get_size(int streams, int coupled_streams)
Gets the size of an OpusMSDecoder structure.
opus_multistream_decoder_ctl
int opus_multistream_decoder_ctl(OpusMSDecoder *st, int request,...)
Perform a CTL function on a multistream Opus decoder.
opus_multistream_decode_float
int opus_multistream_decode_float(OpusMSDecoder *st, const unsigned char *data, opus_int32 len, float *pcm, int frame_size, int decode_fec)
Decode a multistream Opus packet with floating point output.
opus_multistream_surround_encoder_create
OpusMSEncoder * opus_multistream_surround_encoder_create(opus_int32 Fs, int channels, int mapping_family, int *streams, int *coupled_streams, unsigned char *mapping, int application, int *error)
opus_multistream_encoder_get_size
opus_int32 opus_multistream_encoder_get_size(int streams, int coupled_streams)
Gets the size of an OpusMSEncoder structure.
opus_multistream_surround_encoder_init
int opus_multistream_surround_encoder_init(OpusMSEncoder *st, opus_int32 Fs, int channels, int mapping_family, int *streams, int *coupled_streams, unsigned char *mapping, int application)
opus_multistream_surround_encoder_get_size
opus_int32 opus_multistream_surround_encoder_get_size(int channels, int mapping_family)
opus_multistream_encode
int opus_multistream_encode(OpusMSEncoder *st, const opus_int16 *pcm, int frame_size, unsigned char *data, opus_int32 max_data_bytes)
Encodes a multistream Opus frame.
opus_multistream_decode
int opus_multistream_decode(OpusMSDecoder *st, const unsigned char *data, opus_int32 len, opus_int16 *pcm, int frame_size, int decode_fec)
Decode a multistream Opus packet.
opus_multistream_decoder_destroy
void opus_multistream_decoder_destroy(OpusMSDecoder *st)
Frees an OpusMSDecoder allocated by opus_multistream_decoder_create().
OpusMSDecoder
struct OpusMSDecoder OpusMSDecoder
Opus multistream decoder state.
Definition opus_multistream.h:183
opus_multistream_encoder_ctl
int opus_multistream_encoder_ctl(OpusMSEncoder *st, int request,...)
Perform a CTL function on a multistream Opus encoder.
OpusMSEncoder
struct OpusMSEncoder OpusMSEncoder
Opus multistream encoder state.
Definition opus_multistream.h:175
opus_multistream_encoder_init
int opus_multistream_encoder_init(OpusMSEncoder *st, opus_int32 Fs, int channels, int streams, int coupled_streams, const unsigned char *mapping, int application)
Initialize a previously allocated multistream encoder state.
opus_multistream_encoder_destroy
void opus_multistream_encoder_destroy(OpusMSEncoder *st)
Frees an OpusMSEncoder allocated by opus_multistream_encoder_create().
opus_multistream_encoder_create
OpusMSEncoder * opus_multistream_encoder_create(opus_int32 Fs, int channels, int streams, int coupled_streams, const unsigned char *mapping, int application, int *error)
Allocates and initializes a multistream encoder state.
opus_multistream_encode_float
int opus_multistream_encode_float(OpusMSEncoder *st, const float *pcm, int frame_size, unsigned char *data, opus_int32 max_data_bytes)
Encodes a multistream Opus frame from floating point input.
opus.h
Opus reference implementation API.
opus_int32
int opus_int32
Definition opus_types.h:146
opus_int16
short opus_int16
Definition opus_types.h:144
- Generated by 1.17.0