summaryrefslogtreecommitdiff
path: root/libavcodec/dcadec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-02-13 11:53:23 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-02-13 11:53:23 +0100
commit0a5138695aa441ab341b2f00d946c239db69edbf (patch)
tree900049ab4690d9511ae2ccad787e0000694529cb /libavcodec/dcadec.c
parentf03cdbd0454fbdba53a123a8f95186a519fade8d (diff)
parent182821cff43f5f977004d105b86c47ceb20d00d6 (diff)
Merge commit '182821cff43f5f977004d105b86c47ceb20d00d6'
* commit '182821cff43f5f977004d105b86c47ceb20d00d6': dca: decode directly to the user-provided AVFrame cook: decode directly to the user-provided AVFrame comfortnoise: decode directly to the user-provided AVFrame bmvaudio: decode directly to the user-provided AVFrame pcm: decode directly to the user-provided AVFrame Conflicts: libavcodec/pcm.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/dcadec.c')
-rw-r--r--libavcodec/dcadec.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c
index ff6375dd79..e2f37328aa 100644
--- a/libavcodec/dcadec.c
+++ b/libavcodec/dcadec.c
@@ -349,7 +349,6 @@ static av_always_inline int get_bitalloc(GetBitContext *gb, BitAlloc *ba,
typedef struct {
AVCodecContext *avctx;
- AVFrame frame;
/* Frame header */
int frame_type; ///< type of the current frame
int samples_deficit; ///< deficit sample count
@@ -2067,6 +2066,7 @@ static void dca_exss_parse_header(DCAContext *s)
static int dca_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame_ptr, AVPacket *avpkt)
{
+ AVFrame *frame = data;
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
int channel_mask;
@@ -2354,17 +2354,17 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data,
}
/* get output buffer */
- s->frame.nb_samples = 256 * (s->sample_blocks / 8);
- if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
+ frame->nb_samples = 256 * (s->sample_blocks / 8);
+ if ((ret = ff_get_buffer(avctx, frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
- samples_flt = (float **) s->frame.extended_data;
+ samples_flt = (float **)frame->extended_data;
/* allocate buffer for extra channels if downmixing */
if (avctx->channels < full_channels) {
ret = av_samples_get_buffer_size(NULL, full_channels - channels,
- s->frame.nb_samples,
+ frame->nb_samples,
avctx->sample_fmt, 0);
if (ret < 0)
return ret;
@@ -2377,7 +2377,7 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data,
ret = av_samples_fill_arrays((uint8_t **)s->extra_channels, NULL,
s->extra_channels_buffer,
full_channels - channels,
- s->frame.nb_samples, avctx->sample_fmt, 0);
+ frame->nb_samples, avctx->sample_fmt, 0);
if (ret < 0)
return ret;
}
@@ -2456,8 +2456,7 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data,
for (i = 0; i < 2 * s->lfe * 4; i++)
s->lfe_data[i] = s->lfe_data[i + lfe_samples];
- *got_frame_ptr = 1;
- *(AVFrame *) data = s->frame;
+ *got_frame_ptr = 1;
return buf_size;
}
@@ -2491,9 +2490,6 @@ static av_cold int dca_decode_init(AVCodecContext *avctx)
avctx->channels = avctx->request_channels;
}
- avcodec_get_frame_defaults(&s->frame);
- avctx->coded_frame = &s->frame;
-
return 0;
}