40 -9, -8, -6, -5, -4, -3, -2, -1,
41 0, 1, 2, 3, 4, 5, 6, 8
58 int buf_size = avpkt->
size;
60 int in_size, out_size,
ret;
77 if (in_size > buf_size) {
86 samples = frame->
data[0];
87 samples_end = samples + out_size;
89 if (in_size == out_size) {
90 memcpy(samples, buf, out_size);
95 while (samples < samples_end && buf - avpkt->data < buf_size) {
104 case 0: smp = 4 * (count + 1);
break;
105 case 1: smp = 2 * (count + 1);
break;
106 case 2: smp = (count & 0x20) ? 1 : count + 1;
break;
107 default: smp = count + 1;
break;
109 if (samples_end - samples < smp)
113 size = ((code == 2 && (count & 0x20)) || code == 3) ? 0 : count + 1;
114 if ((buf - avpkt->
data) + size > buf_size)
119 for (count++; count > 0; count--) {
121 sample += ( code & 0x3) - 2;
122 sample = av_clip_uint8(sample);
124 sample += ((code >> 2) & 0x3) - 2;
125 sample = av_clip_uint8(sample);
127 sample += ((code >> 4) & 0x3) - 2;
128 sample = av_clip_uint8(sample);
130 sample += (code >> 6) - 2;
131 sample = av_clip_uint8(sample);
136 for (count++; count > 0; count--) {
139 sample = av_clip_uint8(sample);
142 sample = av_clip_uint8(sample);
152 sample = av_clip_uint8(sample);
155 memcpy(samples, buf, smp);
162 memset(samples, sample, smp);
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
static av_cold int ws_snd_decode_init(AVCodecContext *avctx)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
AVCodec ff_ws_snd1_decoder
enum AVSampleFormat sample_fmt
audio sample format
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
const char * name
Name of the codec implementation.
Libavcodec external API header.
uint64_t channel_layout
Audio channel layout.
audio channel layout utility functions
main external API structure.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
static const int8_t ws_adpcm_4bit[]
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
common internal api header.
common internal and external API header
int channels
number of audio channels
#define AV_CH_LAYOUT_MONO
static int ws_snd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
This structure stores compressed data.
int nb_samples
number of audio samples (per channel) described by this frame