Go to the documentation of this file.
   21 #include <speex/speex.h> 
   22 #include <speex/speex_header.h> 
   23 #include <speex/speex_stereo.h> 
   24 #include <speex/speex_callbacks.h> 
   66         s->pktsize = ((
const int[]){5,10,15,20,20,28,28,38,38,46,62})[
quality];
 
   76         case 8000:  spx_mode = 0; 
break;
 
   77         case 16000: spx_mode = 1; 
break;
 
   78         case 32000: spx_mode = 2; 
break;
 
   82                                           "Decoding as 32kHz ultra-wideband\n",
 
   88     mode = speex_lib_get_mode(spx_mode);
 
   93     s->frame_size      =  160 << spx_mode;
 
  100                                     "Decoding as stereo.\n", avctx->
channels);
 
  106     speex_bits_init(&
s->bits);
 
  107     s->dec_state = speex_decoder_init(
mode);
 
  116         callback.func = speex_std_stereo_request_handler;
 
  118         s->stereo = (SpeexStereoState)SPEEX_STEREO_STATE_INIT;
 
  119         speex_decoder_ctl(
s->dec_state, SPEEX_SET_HANDLER, &
callback);
 
  126                                  int *got_frame_ptr, 
AVPacket *avpkt)
 
  128     uint8_t *buf = avpkt->
data;
 
  129     int buf_size = avpkt->
size;
 
  133     int ret, consumed = 0;
 
  137     frame->nb_samples = 
s->frame_size;
 
  146     if (speex_bits_remaining(&
s->bits) < 5 ||
 
  147         speex_bits_peek_unsigned(&
s->bits, 5) == 0xF) {
 
  149         if (!buf || !buf_size) {
 
  153         if (
s->pktsize && buf_size == 62)
 
  154             buf_size = 
s->pktsize;
 
  156         speex_bits_read_from(&
s->bits, buf, buf_size);
 
  157         consumed = avpkt->
size;
 
  161     ret = speex_decode_int(
s->dec_state, &
s->bits, 
output);
 
  167         speex_decode_stereo_int(
output, 
s->frame_size, &
s->stereo);
 
  172         speex_decoder_ctl(
s->dec_state, SPEEX_GET_BITRATE, &avctx->
bit_rate);
 
  180     speex_bits_destroy(&
s->bits);
 
  181     speex_decoder_destroy(
s->dec_state);
 
  189     speex_bits_reset(&
s->bits);
 
  203     .wrapper_name   = 
"libspeex",
 
  
static av_cold int libspeex_decode_init(AVCodecContext *avctx)
 
#define AV_LOG_WARNING
Something somehow does not look correct.
 
uint64_t channel_layout
Audio channel layout.
 
int sample_rate
samples per second
 
#define AV_CH_LAYOUT_MONO
 
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce output
 
This structure describes decoded (raw) audio or video data.
 
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But a word about quality
 
const AVCodec ff_libspeex_decoder
 
static av_cold void libspeex_decode_flush(AVCodecContext *avctx)
 
#define AV_CH_LAYOUT_STEREO
 
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
 
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
 
static void callback(void *priv_data, int index, uint8_t *buf, int buf_size, int64_t time, enum dshowDeviceType devtype)
 
static void flush(AVCodecContext *avctx)
 
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
 
int64_t bit_rate
the average bitrate
 
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
 
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
 
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
 
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
 
static av_cold int libspeex_decode_close(AVCodecContext *avctx)
 
enum AVSampleFormat sample_fmt
audio sample format
 
static const uint8_t header[24]
 
int channels
number of audio channels
 
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
 
@ AV_SAMPLE_FMT_S16
signed 16 bits
 
const char * name
Name of the codec implementation.
 
#define SPEEX_INBAND_STEREO
 
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.
 
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
 
#define AV_CODEC_CAP_SUBFRAMES
Codec can output multiple frames per AVPacket Normally demuxers return one frame at a time,...
 
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
 
static int libspeex_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
 
This structure stores compressed data.
 
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
 
#define MKTAG(a, b, c, d)