...
|
...
|
@@ -44,7 +44,6 @@
|
44
|
44
|
|
45
|
45
|
typedef struct DPCMContext {
|
46
|
46
|
AVFrame frame;
|
47
|
|
- int channels;
|
48
|
47
|
int16_t roq_square_array[256];
|
49
|
48
|
int sample[2]; ///< previous sample (for SOL_DPCM)
|
50
|
49
|
const int8_t *sol_table; ///< delta table for SOL_DPCM
|
...
|
...
|
@@ -123,7 +122,6 @@ static av_cold int dpcm_decode_init(AVCodecContext *avctx)
|
123
|
123
|
return AVERROR(EINVAL);
|
124
|
124
|
}
|
125
|
125
|
|
126
|
|
- s->channels = avctx->channels;
|
127
|
126
|
s->sample[0] = s->sample[1] = 0;
|
128
|
127
|
|
129
|
128
|
switch(avctx->codec->id) {
|
...
|
...
|
@@ -179,7 +177,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data,
|
179
|
179
|
int out = 0, ret;
|
180
|
180
|
int predictor[2];
|
181
|
181
|
int ch = 0;
|
182
|
|
- int stereo = s->channels - 1;
|
|
182
|
+ int stereo = avctx->channels - 1;
|
183
|
183
|
int16_t *output_samples, *samples_end;
|
184
|
184
|
GetByteContext gb;
|
185
|
185
|
|
...
|
...
|
@@ -193,10 +191,10 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data,
|
193
|
193
|
out = buf_size - 8;
|
194
|
194
|
break;
|
195
|
195
|
case AV_CODEC_ID_INTERPLAY_DPCM:
|
196
|
|
- out = buf_size - 6 - s->channels;
|
|
196
|
+ out = buf_size - 6 - avctx->channels;
|
197
|
197
|
break;
|
198
|
198
|
case AV_CODEC_ID_XAN_DPCM:
|
199
|
|
- out = buf_size - 2 * s->channels;
|
|
199
|
+ out = buf_size - 2 * avctx->channels;
|
200
|
200
|
break;
|
201
|
201
|
case AV_CODEC_ID_SOL_DPCM:
|
202
|
202
|
if (avctx->codec_tag != 3)
|
...
|
...
|
@@ -211,7 +209,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data,
|
211
|
211
|
}
|
212
|
212
|
|
213
|
213
|
/* get output buffer */
|
214
|
|
- s->frame.nb_samples = out / s->channels;
|
|
214
|
+ s->frame.nb_samples = out / avctx->channels;
|
215
|
215
|
if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
|
216
|
216
|
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
|
217
|
217
|
return ret;
|
...
|
...
|
@@ -245,7 +243,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data,
|
245
|
245
|
case AV_CODEC_ID_INTERPLAY_DPCM:
|
246
|
246
|
bytestream2_skipu(&gb, 6); /* skip over the stream mask and stream length */
|
247
|
247
|
|
248
|
|
- for (ch = 0; ch < s->channels; ch++) {
|
|
248
|
+ for (ch = 0; ch < avctx->channels; ch++) {
|
249
|
249
|
predictor[ch] = sign_extend(bytestream2_get_le16u(&gb), 16);
|
250
|
250
|
*output_samples++ = predictor[ch];
|
251
|
251
|
}
|
...
|
...
|
@@ -265,7 +263,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data,
|
265
|
265
|
{
|
266
|
266
|
int shift[2] = { 4, 4 };
|
267
|
267
|
|
268
|
|
- for (ch = 0; ch < s->channels; ch++)
|
|
268
|
+ for (ch = 0; ch < avctx->channels; ch++)
|
269
|
269
|
predictor[ch] = sign_extend(bytestream2_get_le16u(&gb), 16);
|
270
|
270
|
|
271
|
271
|
ch = 0;
|