21 #include <speex/speex.h>
22 #include <speex/speex_header.h>
23 #include <speex/speex_stereo.h>
24 #include <speex/speex_callbacks.h>
41 const SpeexMode *mode;
45 mode = &speex_nb_mode;
47 mode = &speex_wb_mode;
49 mode = &speex_uwb_mode;
59 if (s->
header->frames_per_packet)
62 mode = speex_lib_get_mode(s->
header->mode);
75 speex_bits_init(&s->
bits);
87 SpeexCallback callback;
88 callback.callback_id = SPEEX_INBAND_STEREO;
89 callback.func = speex_std_stereo_request_handler;
90 callback.data = &s->
stereo;
91 s->
stereo = (SpeexStereoState)SPEEX_STEREO_STATE_INIT;
92 speex_decoder_ctl(s->
dec_state, SPEEX_SET_HANDLER, &callback);
102 int *got_frame_ptr,
AVPacket *avpkt)
104 uint8_t *buf = avpkt->
data;
105 int buf_size = avpkt->
size;
108 int ret, consumed = 0;
121 if (speex_bits_remaining(&s->
bits) < 43) {
123 if (!buf || !buf_size) {
128 speex_bits_read_from(&s->
bits, buf, buf_size);
151 speex_header_free(s->
header);
152 speex_bits_destroy(&s->
bits);
161 speex_bits_reset(&s->
bits);
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
AVCodec ff_libspeex_decoder
AVFrame * coded_frame
the picture in the bitstream
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
enum AVSampleFormat sample_fmt
audio sample format
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
static int init(AVCodecParserContext *s)
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
static av_cold void libspeex_decode_flush(AVCodecContext *avctx)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame)
static av_cold int libspeex_decode_init(AVCodecContext *avctx)
int frame_size
Samples per packet, initialized when calling 'init'.
int sample_rate
samples per second
main external API structure.
static void close(AVCodecParserContext *s)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static av_cold int libspeex_decode_close(AVCodecContext *avctx)
static int libspeex_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
common internal api header.
static av_cold void flush(AVCodecContext *avctx)
Flush (reset) the frame ID after seeking.
int channels
number of audio channels
#define CODEC_CAP_SUBFRAMES
Codec can output multiple frames per AVPacket Normally demuxers return one frame at a time...
void avcodec_get_frame_defaults(AVFrame *pic)
Set the fields of the given AVFrame to default values.
#define CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
int nb_samples
number of audio samples (per channel) described by this frame