31#define DECODER_MAX_CHANNELS 2
44 unsigned decoder_size;
50 "Invalid number of channels %d. Max %d channels are accepted\n",
61 "Error protection mode is not supported.\n");
66 "Decoding %.1f ms frames.\n", liblc3->
frame_us / 1000.f);
70 decoder_size = lc3_hr_decoder_size(
79 for (
int ch = 0; ch <
channels; ch++) {
80 liblc3->
decoder[ch] = lc3_hr_setup_decoder(
88 avctx->
delay = lc3_hr_delay_samples(
104 int *got_frame_ptr,
AVPacket *avpkt)
108 uint8_t *in = avpkt->
data;
109 int block_bytes, ret;
116 block_bytes = avpkt->
size;
119 for (
int ch = 0; ch <
channels; ch++) {
121 float *pcm_data = is_planar ? (
float*)
frame->extended_data[ch] :
122 (
float*)
frame->extended_data[0] + ch;
125 ret = lc3_decode(liblc3->
decoder[ch], in, nbytes,
126 LC3_PCM_FORMAT_FLOAT, pcm_data,
stride);
146 .p.wrapper_name =
"liblc3",
const FFCodec ff_liblc3_decoder
static av_cold void close(AVCodecParserContext *s)
Libavcodec external API header.
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
int(* init)(AVBSFContext *ctx)
#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_INFO
Standard information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
@ AV_SAMPLE_FMT_FLTP
float, planar
common internal api header.
#define DECODER_MAX_CHANNELS
static av_cold int liblc3_decode_init(AVCodecContext *avctx)
static av_cold int liblc3_decode_close(AVCodecContext *avctx)
static int liblc3_decode(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
#define DECODER_MAX_CHANNELS
Memory handling functions.
int nb_channels
Number of channels in this layout.
main external API structure.
AVChannelLayout ch_layout
Audio channel layout.
enum AVSampleFormat sample_fmt
audio sample format
enum AVSampleFormat request_sample_fmt
desired sample format
int sample_rate
samples per second
uint8_t * extradata
Out-of-band global headers that may be used by some codecs.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
lc3_decoder_t decoder[DECODER_MAX_CHANNELS]
#define av_malloc_array(a, b)