53# if defined(__cplusplus)
62# if defined(OPE_BUILD) && defined(DLL_EXPORT)
63# define OPE_EXPORT __declspec(dllexport)
67# elif defined(__GNUC__) && defined(OPE_BUILD)
68# define OPE_EXPORT __attribute__ ((visibility ("default")))
87#define OPE_API_VERSION 0
91#define OPE_BAD_ARG -11
92#define OPE_INTERNAL_ERROR -13
93#define OPE_UNIMPLEMENTED -15
94#define OPE_ALLOC_FAIL -17
97#define OPE_CANNOT_OPEN -30
98#define OPE_TOO_LATE -31
99#define OPE_INVALID_PICTURE -32
100#define OPE_INVALID_ICON -33
101#define OPE_WRITE_FAIL -34
102#define OPE_CLOSE_FAIL -35
108#define OPE_SET_DECISION_DELAY_REQUEST 14000
109#define OPE_GET_DECISION_DELAY_REQUEST 14001
110#define OPE_SET_MUXING_DELAY_REQUEST 14002
111#define OPE_GET_MUXING_DELAY_REQUEST 14003
112#define OPE_SET_COMMENT_PADDING_REQUEST 14004
113#define OPE_GET_COMMENT_PADDING_REQUEST 14005
114#define OPE_SET_SERIALNO_REQUEST 14006
115#define OPE_GET_SERIALNO_REQUEST 14007
116#define OPE_SET_PACKET_CALLBACK_REQUEST 14008
118#define OPE_SET_HEADER_GAIN_REQUEST 14010
119#define OPE_GET_HEADER_GAIN_REQUEST 14011
120#define OPE_GET_NB_STREAMS_REQUEST 14013
121#define OPE_GET_NB_COUPLED_STREAMS_REQUEST 14015
125#define ope_check_int(x) (((void)((x) == (opus_int32)0)), (opus_int32)(x))
126#define ope_check_int_ptr(ptr) ((ptr) + ((ptr) - (opus_int32*)(ptr)))
127#define ope_check_packet_func(x) ((void)((void (*)(void *, const unsigned char *, opus_int32, opus_uint32))0 == (x)), (x))
128#define ope_check_void_ptr(x) ((void)((void *)0 == (x)), (x))
138#define OPE_SET_DECISION_DELAY(x) OPE_SET_DECISION_DELAY_REQUEST, ope_check_int(x)
139#define OPE_GET_DECISION_DELAY(x) OPE_GET_DECISION_DELAY_REQUEST, ope_check_int_ptr(x)
140#define OPE_SET_MUXING_DELAY(x) OPE_SET_MUXING_DELAY_REQUEST, ope_check_int(x)
141#define OPE_GET_MUXING_DELAY(x) OPE_GET_MUXING_DELAY_REQUEST, ope_check_int_ptr(x)
142#define OPE_SET_COMMENT_PADDING(x) OPE_SET_COMMENT_PADDING_REQUEST, ope_check_int(x)
143#define OPE_GET_COMMENT_PADDING(x) OPE_GET_COMMENT_PADDING_REQUEST, ope_check_int_ptr(x)
144#define OPE_SET_SERIALNO(x) OPE_SET_SERIALNO_REQUEST, ope_check_int(x)
145#define OPE_GET_SERIALNO(x) OPE_GET_SERIALNO_REQUEST, ope_check_int_ptr(x)
147#define OPE_SET_PACKET_CALLBACK(x,u) OPE_SET_PACKET_CALLBACK_REQUEST, (x), (u)
149#define OPE_SET_HEADER_GAIN(x) OPE_SET_HEADER_GAIN_REQUEST, ope_check_int(x)
150#define OPE_GET_HEADER_GAIN(x) OPE_GET_HEADER_GAIN_REQUEST, ope_check_int_ptr(x)
151#define OPE_GET_NB_STREAMS(x) OPE_GET_NB_STREAMS_REQUEST, ope_check_int_ptr(x)
152#define OPE_GET_NB_COUPLED_STREAMS(x) OPE_GET_NB_COUPLED_STREAMS_REQUEST, ope_check_int_ptr(x)
172typedef int (*ope_write_func)(
void *user_data,
const unsigned char *ptr, opus_int32 len);
180typedef int (*ope_close_func)(
void *user_data);
188typedef void (*ope_packet_func)(
void *user_data,
const unsigned char *packet_ptr, opus_int32 packet_len, opus_uint32 flags);
201typedef struct OggOpusComments OggOpusComments;
204typedef struct OggOpusEnc OggOpusEnc;
216OPE_EXPORT OggOpusComments *ope_comments_create(
void);
221OPE_EXPORT OggOpusComments *ope_comments_copy(OggOpusComments *comments);
225OPE_EXPORT
void ope_comments_destroy(OggOpusComments *comments);
233OPE_EXPORT
int ope_comments_add(OggOpusComments *comments,
const char *tag,
const char *val);
240OPE_EXPORT
int ope_comments_add_string(OggOpusComments *comments,
const char *tag_and_val);
249OPE_EXPORT
int ope_comments_add_picture(OggOpusComments *comments,
const char *filename,
int picture_type,
const char *description);
259OPE_EXPORT
int ope_comments_add_picture_from_memory(OggOpusComments *comments,
const char *ptr,
size_t size,
int picture_type,
const char *description);
281OPE_EXPORT OggOpusEnc *ope_encoder_create_file(
const char *path, OggOpusComments *comments, opus_int32 rate,
int channels,
int family,
int *error);
293OPE_EXPORT OggOpusEnc *ope_encoder_create_callbacks(
const OpusEncCallbacks *callbacks,
void *user_data,
294 OggOpusComments *comments, opus_int32 rate,
int channels,
int family,
int *error);
305OPE_EXPORT OggOpusEnc *ope_encoder_create_pull(OggOpusComments *comments, opus_int32 rate,
int channels,
int family,
int *error);
316OPE_EXPORT
int ope_encoder_deferred_init_with_mapping(OggOpusEnc *enc,
int family,
int streams,
317 int coupled_streams,
const unsigned char *mapping);
324OPE_EXPORT
int ope_encoder_write_float(OggOpusEnc *enc,
const float *pcm,
int samples_per_channel);
331OPE_EXPORT
int ope_encoder_write(OggOpusEnc *enc,
const opus_int16 *pcm,
int samples_per_channel);
339OPE_EXPORT
int ope_encoder_get_page(OggOpusEnc *enc,
unsigned char **page, opus_int32 *len,
int flush);
345OPE_EXPORT
int ope_encoder_drain(OggOpusEnc *enc);
350OPE_EXPORT
void ope_encoder_destroy(OggOpusEnc *enc);
357OPE_EXPORT
int ope_encoder_chain_current(OggOpusEnc *enc, OggOpusComments *comments);
365OPE_EXPORT
int ope_encoder_continue_new_file(OggOpusEnc *enc,
const char *path, OggOpusComments *comments);
373OPE_EXPORT
int ope_encoder_continue_new_callbacks(OggOpusEnc *enc,
void *user_data, OggOpusComments *comments);
379OPE_EXPORT
int ope_encoder_flush_header(OggOpusEnc *enc);
386OPE_EXPORT
int ope_encoder_ctl(OggOpusEnc *enc,
int request, ...);
393OPE_EXPORT
const char *ope_strerror(
int error);
397OPE_EXPORT
const char *ope_get_version_string(
void);
401OPE_EXPORT
int ope_get_abi_version(
void);
406# if defined(__cplusplus)
Callback functions for accessing the stream.
Definition opusenc.h:191
ope_write_func write
Callback for writing to the stream.
Definition opusenc.h:193
ope_close_func close
Callback for closing the stream.
Definition opusenc.h:195