Go to the documentation of this file.
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(
86 avctx->
delay = lc3_hr_delay_samples(
103 int *got_frame_ptr,
AVPacket *avpkt)
107 uint8_t *in = avpkt->
data;
108 int block_bytes,
ret;
115 block_bytes = avpkt->
size;
116 for (
int ch = 0; ch <
channels; ch++) {
119 ret = lc3_decode(liblc3->
decoder[ch], in, nbytes,
120 LC3_PCM_FORMAT_FLOAT,
frame->data[ch], 1);
140 .p.wrapper_name =
"liblc3",
@ AV_SAMPLE_FMT_FLTP
float, planar
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
int sample_rate
samples per second
int skip_samples
Number of audio samples to skip at the start of the next decoded frame.
This structure describes decoded (raw) audio or video data.
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
int nb_channels
Number of channels in this layout.
AVCodec p
The public AVCodec.
AVChannelLayout ch_layout
Audio channel layout.
static av_cold int liblc3_decode_init(AVCodecContext *avctx)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_CODEC_DECODE_CB(func)
const FFCodec ff_liblc3_decoder
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
#define CODEC_LONG_NAME(str)
struct AVCodecInternal * internal
Private context used for internal data.
#define DECODER_MAX_CHANNELS
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.
enum AVSampleFormat sample_fmt
audio sample format
static int liblc3_decode(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
#define AV_LOG_INFO
Standard information.
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
#define av_malloc_array(a, b)
static av_cold int liblc3_decode_close(AVCodecContext *avctx)
const char * name
Name of the codec implementation.
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
lc3_decoder_t decoder[DECODER_MAX_CHANNELS]
main external API structure.
This structure stores compressed data.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.