mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-28 12:32:17 +02:00
apedec: output in planar sample format
This commit is contained in:
parent
cf8c93ada4
commit
461ba7e97a
@ -196,13 +196,13 @@ static av_cold int ape_decode_init(AVCodecContext *avctx)
|
|||||||
s->bps = avctx->bits_per_coded_sample;
|
s->bps = avctx->bits_per_coded_sample;
|
||||||
switch (s->bps) {
|
switch (s->bps) {
|
||||||
case 8:
|
case 8:
|
||||||
avctx->sample_fmt = AV_SAMPLE_FMT_U8;
|
avctx->sample_fmt = AV_SAMPLE_FMT_U8P;
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
|
||||||
break;
|
break;
|
||||||
case 24:
|
case 24:
|
||||||
avctx->sample_fmt = AV_SAMPLE_FMT_S32;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S32P;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
av_log_ask_for_sample(avctx, "Unsupported bits per coded sample %d\n",
|
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;
|
uint8_t *sample8;
|
||||||
int16_t *sample16;
|
int16_t *sample16;
|
||||||
int32_t *sample24;
|
int32_t *sample24;
|
||||||
int i, ret;
|
int i, ch, ret;
|
||||||
int blockstodecode;
|
int blockstodecode;
|
||||||
int bytes_used = 0;
|
int bytes_used = 0;
|
||||||
|
|
||||||
@ -930,27 +930,24 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
|
|||||||
|
|
||||||
switch (s->bps) {
|
switch (s->bps) {
|
||||||
case 8:
|
case 8:
|
||||||
sample8 = (uint8_t *)s->frame.data[0];
|
for (ch = 0; ch < s->channels; ch++) {
|
||||||
for (i = 0; i < blockstodecode; i++) {
|
sample8 = (uint8_t *)s->frame.data[ch];
|
||||||
*sample8++ = (s->decoded[0][i] + 0x80) & 0xff;
|
for (i = 0; i < blockstodecode; i++)
|
||||||
if (s->channels == 2)
|
*sample8++ = (s->decoded[ch][i] + 0x80) & 0xff;
|
||||||
*sample8++ = (s->decoded[1][i] + 0x80) & 0xff;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
sample16 = (int16_t *)s->frame.data[0];
|
for (ch = 0; ch < s->channels; ch++) {
|
||||||
for (i = 0; i < blockstodecode; i++) {
|
sample16 = (int16_t *)s->frame.data[ch];
|
||||||
*sample16++ = s->decoded[0][i];
|
for (i = 0; i < blockstodecode; i++)
|
||||||
if (s->channels == 2)
|
*sample16++ = s->decoded[ch][i];
|
||||||
*sample16++ = s->decoded[1][i];
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 24:
|
case 24:
|
||||||
sample24 = (int32_t *)s->frame.data[0];
|
for (ch = 0; ch < s->channels; ch++) {
|
||||||
for (i = 0; i < blockstodecode; i++) {
|
sample24 = (int32_t *)s->frame.data[ch];
|
||||||
*sample24++ = s->decoded[0][i] << 8;
|
for (i = 0; i < blockstodecode; i++)
|
||||||
if (s->channels == 2)
|
*sample24++ = s->decoded[ch][i] << 8;
|
||||||
*sample24++ = s->decoded[1][i] << 8;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -995,5 +992,9 @@ AVCodec ff_ape_decoder = {
|
|||||||
.capabilities = CODEC_CAP_SUBFRAMES | CODEC_CAP_DELAY | CODEC_CAP_DR1,
|
.capabilities = CODEC_CAP_SUBFRAMES | CODEC_CAP_DELAY | CODEC_CAP_DR1,
|
||||||
.flush = ape_flush,
|
.flush = ape_flush,
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("Monkey's Audio"),
|
.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,
|
.priv_class = &ape_decoder_class,
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user