ADPCM Codecs
All Classes Files Functions Variables Macros Pages
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
adpcm_ffmpeg::ADPCMDecoder Class Referenceabstract

ADPCM Decoder. More...

#include <ADPCMDecoder.h>

Inheritance diagram for adpcm_ffmpeg::ADPCMDecoder:
Inheritance graph
[legend]
Collaboration diagram for adpcm_ffmpeg::ADPCMDecoder:
Collaboration graph
[legend]

Public Member Functions

bool begin (int sampleRate, int channels)
 
void end ()
 
AVFramedecode (uint8_t *data, size_t size)
 
AVFramedecode (AVPacket &packet)
 
virtual std::vector< AVSampleFormat > get_sample_format ()
 
void flush ()
 
AVCodecContextctx ()
 
void setCodecID (AVCodecID id)
 
AVCodecID codecID ()
 
void setFrameSize (int fs)
 
virtual void setBlockSize (int size)
 
int blockSize ()
 
int frameSize ()
 
int channels ()
 
bool isPlanar ()
 

Protected Types

enum  DataSource { Undefined , FromFrame , FromExtended }
 

Protected Member Functions

DataSource getDataSource (int16_t *frame_data, int16_t *ext_data, int len)
 
virtual int adpcm_decode_init ()
 Init decoder.
 
int16_t adpcm_ima_expand_nibble (ADPCMChannelStatus *c, int8_t nibble, int shift)
 
int16_t adpcm_ima_mtf_expand_nibble (ADPCMChannelStatus *c, int nibble)
 
int16_t adpcm_ima_cunning_expand_nibble (ADPCMChannelStatus *c, int8_t nibble)
 
int adpcm_ima_qt_expand_nibble (ADPCMChannelStatus *c, int nibble)
 
int16_t adpcm_yamaha_expand_nibble (ADPCMChannelStatus *c, uint8_t nibble)
 
int get_nb_samples (GetByteContext *gb, int buf_size, int *coded_samples, int *approx_nb_samples)
 
virtual void adpcm_flush ()
 Flush decoder.
 
virtual int decode_frame_impl (AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)=0
 
virtual int adpcm_decode_frame (AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
 Decode a pcm frame.
 
int decode_frame_init (AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
 
int av_get_bits_per_sample ()
 
int ff_get_encode_buffer (AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int flags)
 
int ff_get_buffer (AVCodecContext *avctx, AVFrame *frame, int flags)
 
void avpriv_request_sample (void *avc, const char *msg,...)
 

Protected Attributes

AVPacket packet
 
AVFrame frame
 
DataSource data_source = Undefined
 
bool is_frame_data = true
 
std::vector< int16_t > frame_data_vector
 
std::vector< std::vector< int16_t > > frame_extended_data_vectors
 
int16_t * extended_data [2] = {NULL}
 
uint8_t * data [AV_NUM_DATA_POINTERS] = {NULL}
 
const uint8_t * buf
 
int buf_size
 
ADPCMDecodeContextc
 
int16_t * samples
 
int16_t ** samples_p
 
int st
 
int nb_samples
 
int coded_samples
 
int approx_nb_samples
 
int ret
 
GetByteContext gb
 
AVCodecContext avctx
 
ADPCMEncodeContext enc_ctx
 
std::vector< AVSampleFormat > sample_formats
 

Detailed Description

ADPCM Decoder.

Author
Phil Schatzmann

Member Function Documentation

◆ decode()

AVFrame& adpcm_ffmpeg::ADPCMDecoder::decode ( AVPacket packet)
inline

determine data source: only once

◆ get_nb_samples()

int adpcm_ffmpeg::ADPCMDecoder::get_nb_samples ( GetByteContext gb,
int  buf_size,
int *  coded_samples,
int *  approx_nb_samples 
)
inlineprotected

Get the number of samples (per channel) that will be decoded from the packet. In one case, this is actually the maximum number of samples possible to decode with the given buf_size.

Parameters
[out]coded_samplesset to the number of samples as coded in the packet, or 0 if the codec does not encode the number of samples in each frame.
[out]approx_nb_samplesset to non-zero if the number of samples returned is an approximation.

◆ getDataSource()

DataSource adpcm_ffmpeg::ADPCMDecoder::getDataSource ( int16_t *  frame_data,
int16_t *  ext_data,
int  len 
)
inlineprotected

The result is not returned consistently: sometimes it is in the frame data, sometimes it is in the extra data. Here we check where it actually is!


The documentation for this class was generated from the following file: