22 #include <celt/celt.h>
23 #include <celt/celt_header.h>
37 case CELT_BAD_ARG:
return AVERROR(EINVAL);
38 #ifdef CELT_BUFFER_TOO_SMALL
39 case CELT_BUFFER_TOO_SMALL:
return AVERROR(ENOBUFS);
41 case CELT_INTERNAL_ERROR:
return AVERROR(EFAULT);
43 case CELT_UNIMPLEMENTED:
return AVERROR(ENOSYS);
44 #ifdef ENOTRECOVERABLE
45 case CELT_INVALID_STATE:
return AVERROR(ENOTRECOVERABLE);
47 case CELT_ALLOC_FAIL:
return AVERROR(ENOMEM);
48 default:
return AVERROR(EINVAL);
54 CELTHeader
header = { .version_id = 0 };
64 if (!
c->channels || !
c->frame_size ||
65 c->frame_size > INT_MAX /
sizeof(int16_t) /
c->channels)
67 celt->
mode = celt_mode_create(
c->sample_rate,
c->frame_size, &err);
70 celt->
dec = celt_decoder_create_custom(celt->
mode,
c->channels, &err);
72 celt_mode_destroy(celt->
mode);
75 if (
c->extradata_size >= 4) {
79 "Invalid overlap (%d), ignored.\n", celt->
discard);
83 if (
c->extradata_size >= 8) {
88 "CELT bitstream version 0x%x may be "
89 "improperly decoded by libcelt for version 0x%x.\n",
100 celt_decoder_destroy(celt->
dec);
101 celt_mode_destroy(celt->
mode);
122 memmove(pcm, pcm + celt->
discard *
c->channels,
140 .wrapper_name =
"libcelt",
Libavcodec external API header.
static av_cold int init(AVCodecContext *avctx)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
mode
Use these values in ebur128_init (or'ed).
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_WARNING
Something somehow does not look correct.
@ AV_SAMPLE_FMT_S16
signed 16 bits
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static int ff_celt_bitstream_version_hack(CELTMode *mode)
AVCodec ff_libcelt_decoder
static int ff_celt_error_to_averror(int err)
static av_cold int libcelt_dec_init(AVCodecContext *c)
static av_cold int libcelt_dec_close(AVCodecContext *c)
static int libcelt_dec_decode(AVCodecContext *c, void *data, int *got_frame_ptr, AVPacket *pkt)
static const uint8_t header[24]
main external API structure.
const char * name
Name of the codec implementation.
This structure describes decoded (raw) audio or video data.
int nb_samples
number of audio samples (per channel) described by this frame
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
This structure stores compressed data.