2 #include "adpcm-ffmpeg/adpcm.h"
3 #include "adpcm-ffmpeg/bytestream.h"
8 #define ADAPCM_DEFAULT_BLOCK_SIZE 128
10 #pragma GCC diagnostic ignored "-Wcomment"
11 #pragma GCC diagnostic ignored "-Wsign-compare"
13 namespace adpcm_ffmpeg {
24 memset(&avctx, 0,
sizeof(avctx));
25 memset(&enc_ctx, 0,
sizeof(enc_ctx));
30 void setCodecID(AVCodecID
id) { avctx.codec_id = id; }
32 AVCodecID codecID() {
return avctx.codec_id; }
34 void setFrameSize(
int fs) { avctx.
frame_size = fs; }
36 virtual void setBlockSize(
int size) { enc_ctx.block_size = size; }
38 int blockSize() {
return enc_ctx.block_size; }
42 int channels() {
return avctx.nb_channels; }
45 for (AVSampleFormat fmt: sample_formats){
46 if (fmt == AV_SAMPLE_FMT_S16P)
return true;
54 std::vector<AVSampleFormat> sample_formats;
56 int av_get_bits_per_sample() {
57 switch (avctx.codec_id) {
58 case AV_CODEC_ID_ADPCM_SBPRO_2:
60 case AV_CODEC_ID_ADPCM_SBPRO_3:
62 case AV_CODEC_ID_ADPCM_SBPRO_4:
63 case AV_CODEC_ID_ADPCM_IMA_WAV:
64 case AV_CODEC_ID_ADPCM_IMA_QT:
65 case AV_CODEC_ID_ADPCM_SWF:
66 case AV_CODEC_ID_ADPCM_MS:
67 case AV_CODEC_ID_ADPCM_ARGO:
68 case AV_CODEC_ID_ADPCM_CT:
69 case AV_CODEC_ID_ADPCM_IMA_ALP:
70 case AV_CODEC_ID_ADPCM_IMA_AMV:
71 case AV_CODEC_ID_ADPCM_IMA_APC:
72 case AV_CODEC_ID_ADPCM_IMA_APM:
73 case AV_CODEC_ID_ADPCM_IMA_EA_SEAD:
74 case AV_CODEC_ID_ADPCM_IMA_OKI:
75 case AV_CODEC_ID_ADPCM_IMA_WS:
76 case AV_CODEC_ID_ADPCM_IMA_SSI:
77 case AV_CODEC_ID_ADPCM_G722:
78 case AV_CODEC_ID_ADPCM_YAMAHA:
79 case AV_CODEC_ID_ADPCM_AICA:
97 void avpriv_request_sample(
void *avc,
const char *msg, ...) {
Common ADPCM Functionality.
Definition: ADPCMCodec.h:21
C API context for encoder and decoder.
Definition: adpcm.h:236
int frame_size
Number of samples per channel in an audio frame.
Definition: adpcm.h:239
This structure provides the uncompressed PCM data.
Definition: adpcm.h:151
This structure stores compressed data. It is typically exported by demuxers and then passed as input ...
Definition: adpcm.h:143