Go to the documentation of this file.
50 int bufsize,
int *header_size,
int *
coeff)
66 if (buf[4] != 3 || buf[5] != 18 || buf[6] != 4) {
104 int ret, header_size;
114 c->header_parsed = 1;
130 const uint8_t *in,
int ch)
160 int *got_frame_ptr,
AVPacket *avpkt)
162 int buf_size = avpkt->
size;
166 const uint8_t *buf = avpkt->
data;
167 const uint8_t *buf_end = buf + avpkt->
size;
168 int num_blocks, ch,
ret;
169 size_t new_extradata_size;
170 uint8_t *new_extradata;
173 &new_extradata_size);
174 if (new_extradata && new_extradata_size > 0) {
177 new_extradata_size, &header_size,
191 if (!
c->header_parsed && buf_size >= 2 &&
AV_RB16(buf) == 0x8000) {
199 c->header_parsed = 1;
200 if (buf_size < header_size)
203 buf_size -= header_size;
205 if (!
c->header_parsed)
209 num_blocks = buf_size / (
BLOCK_SIZE *
c->channels);
213 if (!num_blocks || buf_size % (
BLOCK_SIZE *
c->channels)) {
214 if (buf_size >= 4 && (
AV_RB16(buf) & 0x8000)) {
229 while (num_blocks--) {
230 for (ch = 0; ch <
c->channels; ch++) {
243 frame->nb_samples = samples_offset;
246 return buf - avpkt->
data;
252 memset(
c->prev, 0,
sizeof(
c->prev));
257 .
p.
name =
"adpcm_adx",
int sample_rate
samples per second
static void adx_decode_flush(AVCodecContext *avctx)
@ AV_PKT_DATA_NEW_EXTRADATA
The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format that the extradata buffer was...
This structure describes decoded (raw) audio or video data.
static int adx_decode(ADXContext *c, int16_t *out, int offset, const uint8_t *in, int ch)
Decode 32 samples from 18 bytes.
enum AVChannelOrder order
Channel order used in this layout.
int nb_channels
Number of channels in this layout.
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
AVCodec p
The public AVCodec.
AVChannelLayout ch_layout
Audio channel layout.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const FFCodec ff_adpcm_adx_decoder
#define FF_CODEC_DECODE_CB(func)
@ AV_CHANNEL_ORDER_UNSPEC
Only the channel count is specified, without any further information about the channel order.
static int get_sbits(GetBitContext *s, int n)
#define CODEC_LONG_NAME(str)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
int64_t bit_rate
the average bitrate
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
static av_cold int adx_decode_init(AVCodecContext *avctx)
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
void ff_adx_calculate_coeffs(int cutoff, int sample_rate, int bits, int *coeff)
Calculate LPC coefficients based on cutoff frequency and sample rate.
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
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
#define i(width, name, range_min, range_max)
static int adx_decode_header(AVCodecContext *avctx, const uint8_t *buf, int bufsize, int *header_size, int *coeff)
Decode ADX stream header.
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
uint8_t * av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, size_t *size)
Get side information from packet.
AVSampleFormat
Audio sample formats.
const char * name
Name of the codec implementation.
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
main external API structure.
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
Filter the word “frame” indicates either a video frame or a group of audio samples
#define avpriv_request_sample(...)
static void scale(int *out, const int *in, const int w, const int h, const int shift)
This structure stores compressed data.
static const double coeff[2][5]
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static int adx_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_RB16