summaryrefslogtreecommitdiff
path: root/libavcodec/apedec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-10-02 16:25:58 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-10-02 17:27:52 +0200
commite88ca80dc325a0291c64e1dd3245c4943397cfa3 (patch)
treedf8abbc8d6defc5bf10932ed096ec18cd979d0eb /libavcodec/apedec.c
parent82db8ee3211014a38db6b8cae03f1c3246938eee (diff)
parentbfcd4b6a1691d20aebc6d2308424c2a88334a9f0 (diff)
Merge commit 'bfcd4b6a1691d20aebc6d2308424c2a88334a9f0'
* commit 'bfcd4b6a1691d20aebc6d2308424c2a88334a9f0': adpcmdec: set AVCodec.sample_fmts twinvq: use planar sample format ralf: use planar sample format mpc7/8: use planar sample format iac/imc: use planar sample format dcadec: use float planar sample format cook: use planar sample format atrac3: use float planar sample format apedec: output in planar sample format 8svx: use planar sample format Conflicts: libavcodec/8svx.c libavcodec/dcadec.c libavcodec/mpc7.c libavcodec/mpc8.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/apedec.c')
-rw-r--r--libavcodec/apedec.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index 21080902ee..cba3dc0354 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -196,13 +196,13 @@ static av_cold int ape_decode_init(AVCodecContext *avctx)
s->bps = avctx->bits_per_coded_sample;
switch (s->bps) {
case 8:
- avctx->sample_fmt = AV_SAMPLE_FMT_U8;
+ avctx->sample_fmt = AV_SAMPLE_FMT_U8P;
break;
case 16:
- avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+ avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
break;
case 24:
- avctx->sample_fmt = AV_SAMPLE_FMT_S32;
+ avctx->sample_fmt = AV_SAMPLE_FMT_S32P;
break;
default:
av_log_ask_for_sample(avctx, "Unsupported bits per coded sample %d\n",
@@ -830,7 +830,7 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
uint8_t *sample8;
int16_t *sample16;
int32_t *sample24;
- int i, ret;
+ int i, ch, ret;
int blockstodecode;
int bytes_used = 0;
@@ -930,27 +930,24 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
switch (s->bps) {
case 8:
- sample8 = (uint8_t *)s->frame.data[0];
- for (i = 0; i < blockstodecode; i++) {
- *sample8++ = (s->decoded[0][i] + 0x80) & 0xff;
- if (s->channels == 2)
- *sample8++ = (s->decoded[1][i] + 0x80) & 0xff;
+ for (ch = 0; ch < s->channels; ch++) {
+ sample8 = (uint8_t *)s->frame.data[ch];
+ for (i = 0; i < blockstodecode; i++)
+ *sample8++ = (s->decoded[ch][i] + 0x80) & 0xff;
}
break;
case 16:
- sample16 = (int16_t *)s->frame.data[0];
- for (i = 0; i < blockstodecode; i++) {
- *sample16++ = s->decoded[0][i];
- if (s->channels == 2)
- *sample16++ = s->decoded[1][i];
+ for (ch = 0; ch < s->channels; ch++) {
+ sample16 = (int16_t *)s->frame.data[ch];
+ for (i = 0; i < blockstodecode; i++)
+ *sample16++ = s->decoded[ch][i];
}
break;
case 24:
- sample24 = (int32_t *)s->frame.data[0];
- for (i = 0; i < blockstodecode; i++) {
- *sample24++ = s->decoded[0][i] << 8;
- if (s->channels == 2)
- *sample24++ = s->decoded[1][i] << 8;
+ for (ch = 0; ch < s->channels; ch++) {
+ sample24 = (int32_t *)s->frame.data[ch];
+ for (i = 0; i < blockstodecode; i++)
+ *sample24++ = s->decoded[ch][i] << 8;
}
break;
}
@@ -995,5 +992,9 @@ AVCodec ff_ape_decoder = {
.capabilities = CODEC_CAP_SUBFRAMES | CODEC_CAP_DELAY | CODEC_CAP_DR1,
.flush = ape_flush,
.long_name = NULL_IF_CONFIG_SMALL("Monkey's Audio"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_U8P,
+ AV_SAMPLE_FMT_S16P,
+ AV_SAMPLE_FMT_S32P,
+ AV_SAMPLE_FMT_NONE },
.priv_class = &ape_decoder_class,
};