summaryrefslogtreecommitdiff
path: root/libavcodec/shorten.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-10-15 14:04:35 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-10-15 14:09:35 +0200
commitae237a117acbe958bea798e32249f4c2baeca5f9 (patch)
treec45fc400e59ab03d5346a82580bfc2054b9efe0f /libavcodec/shorten.c
parent4f5e5a05132be4946a655b991850bf81b7497893 (diff)
parent95cd815c3663603871a1f2da95846e8f72d4ea96 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: swscale: try to use mmap only if available configure: check for mprotect wmapro: use planar sample format wmalossless: output in planar sample format wmadec: use float planar sample format output shorten: use planar sample format lavc: update documentation for AVFrame.extended_data Conflicts: libavcodec/shorten.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/shorten.c')
-rw-r--r--libavcodec/shorten.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index d04011e468..c36bb9ee2b 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -195,7 +195,7 @@ static int init_offset(ShortenContext *s)
break;
case TYPE_S16HL:
case TYPE_S16LH:
- s->avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+ s->avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
break;
default:
av_log(s->avctx, AV_LOG_ERROR, "unknown audio type\n");
@@ -587,11 +587,11 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data,
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
- samples_u8 = (uint8_t *)s->frame.data[0];
- samples_s16 = (int16_t *)s->frame.data[0];
- /* interleave output */
- for (i = 0; i < s->blocksize; i++) {
- for (chan = 0; chan < s->channels; chan++) {
+
+ for (chan = 0; chan < s->channels; chan++) {
+ samples_u8 = ((uint8_t **)s->frame.extended_data)[chan];
+ samples_s16 = ((int16_t **)s->frame.extended_data)[chan];
+ for (i = 0; i < s->blocksize; i++) {
switch (s->internal_ftype) {
case TYPE_U8:
*samples_u8++ = av_clip_uint8(s->decoded[chan][i]);
@@ -604,6 +604,7 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data,
}
}
+
*got_frame_ptr = 1;
*(AVFrame *)data = s->frame;
}
@@ -655,4 +656,6 @@ AVCodec ff_shorten_decoder = {
.decode = shorten_decode_frame,
.capabilities = CODEC_CAP_DELAY | CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("Shorten"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P,
+ AV_SAMPLE_FMT_NONE },
};