summaryrefslogtreecommitdiff
path: root/libavcodec/flacdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-02-13 11:59:51 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-02-13 11:59:51 +0100
commitd88e674a15dc23ca6bb68173dbb7c12e5d668bb5 (patch)
tree0a7d58e61ea7e3e3e692731f7a4e1e119f197689 /libavcodec/flacdec.c
parent0a5138695aa441ab341b2f00d946c239db69edbf (diff)
parentcb7b47a61dba0b9329ecede5dd3211dc0662dc05 (diff)
downloadffmpeg-d88e674a15dc23ca6bb68173dbb7c12e5d668bb5.tar.gz
Merge commit 'cb7b47a61dba0b9329ecede5dd3211dc0662dc05'
* commit 'cb7b47a61dba0b9329ecede5dd3211dc0662dc05': g726: decode directly to the user-provided AVFrame g723.1: decode directly to the user-provided AVFrame g722: decode directly to the user-provided AVFrame flac: decode directly to the user-provided AVFrame cinaudio: decode directly to the user-provided AVFrame Conflicts: libavcodec/g723_1.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/flacdec.c')
-rw-r--r--libavcodec/flacdec.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c
index 56249729bf..f264d20cb9 100644
--- a/libavcodec/flacdec.c
+++ b/libavcodec/flacdec.c
@@ -49,7 +49,6 @@ typedef struct FLACContext {
FLACSTREAMINFO
AVCodecContext *avctx; ///< parent AVCodecContext
- AVFrame frame;
GetBitContext gb; ///< GetBitContext initialized to start at the current frame
int blocksize; ///< number of samples in the current frame
@@ -113,9 +112,6 @@ static av_cold int flac_decode_init(AVCodecContext *avctx)
ff_flacdsp_init(&s->dsp, avctx->sample_fmt, s->bps);
s->got_streaminfo = 1;
- avcodec_get_frame_defaults(&s->frame);
- avctx->coded_frame = &s->frame;
-
return 0;
}
@@ -491,6 +487,7 @@ static int decode_frame(FLACContext *s)
static int flac_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;
FLACContext *s = avctx->priv_data;
@@ -539,13 +536,13 @@ static int flac_decode_frame(AVCodecContext *avctx, void *data,
bytes_read = (get_bits_count(&s->gb)+7)/8;
/* get output buffer */
- s->frame.nb_samples = s->blocksize;
- if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
+ frame->nb_samples = s->blocksize;
+ if ((ret = ff_get_buffer(avctx, frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
- s->dsp.decorrelate[s->ch_mode](s->frame.data, s->decoded, s->channels,
+ s->dsp.decorrelate[s->ch_mode](frame->data, s->decoded, s->channels,
s->blocksize, s->sample_shift);
if (bytes_read > buf_size) {
@@ -557,8 +554,7 @@ static int flac_decode_frame(AVCodecContext *avctx, void *data,
buf_size - bytes_read, buf_size);
}
- *got_frame_ptr = 1;
- *(AVFrame *)data = s->frame;
+ *got_frame_ptr = 1;
return bytes_read;
}