aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2012-12-23 19:58:35 -0500
committerJustin Ruggles <justin.ruggles@gmail.com>2013-02-12 12:22:39 -0500
commit09d6831f490179a3d87f680955f29b9d7cdda4d4 (patch)
tree33b5a2be443c3dc0527f13ad54b78f128fb0f2dd
parentfed74c0ae497723f4756fab5cfe3ac9b04176edf (diff)
downloadffmpeg-09d6831f490179a3d87f680955f29b9d7cdda4d4.tar.gz
sipr: decode directly to the user-provided AVFrame
-rw-r--r--libavcodec/sipr.c15
-rw-r--r--libavcodec/sipr.h1
2 files changed, 6 insertions, 10 deletions
diff --git a/libavcodec/sipr.c b/libavcodec/sipr.c
index 3f3c13c6e1..a36cdeff95 100644
--- a/libavcodec/sipr.c
+++ b/libavcodec/sipr.c
@@ -516,9 +516,6 @@ static av_cold int sipr_decoder_init(AVCodecContext * avctx)
avctx->channel_layout = AV_CH_LAYOUT_MONO;
avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
- avcodec_get_frame_defaults(&ctx->frame);
- avctx->coded_frame = &ctx->frame;
-
return 0;
}
@@ -526,6 +523,7 @@ static int sipr_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame_ptr, AVPacket *avpkt)
{
SiprContext *ctx = avctx->priv_data;
+ AVFrame *frame = data;
const uint8_t *buf=avpkt->data;
SiprParameters parm;
const SiprModeParam *mode_par = &modes[ctx->mode];
@@ -543,13 +541,13 @@ static int sipr_decode_frame(AVCodecContext *avctx, void *data,
}
/* get output buffer */
- ctx->frame.nb_samples = mode_par->frames_per_packet * subframe_size *
- mode_par->subframe_count;
- if ((ret = ff_get_buffer(avctx, &ctx->frame)) < 0) {
+ frame->nb_samples = mode_par->frames_per_packet * subframe_size *
+ mode_par->subframe_count;
+ if ((ret = ff_get_buffer(avctx, frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
- samples = (float *)ctx->frame.data[0];
+ samples = (float *)frame->data[0];
init_get_bits(&gb, buf, mode_par->bits_per_frame);
@@ -561,8 +559,7 @@ static int sipr_decode_frame(AVCodecContext *avctx, void *data,
samples += subframe_size * mode_par->subframe_count;
}
- *got_frame_ptr = 1;
- *(AVFrame *)data = ctx->frame;
+ *got_frame_ptr = 1;
return mode_par->bits_per_frame >> 3;
}
diff --git a/libavcodec/sipr.h b/libavcodec/sipr.h
index 5007c75c8a..1a35cdbfc1 100644
--- a/libavcodec/sipr.h
+++ b/libavcodec/sipr.h
@@ -65,7 +65,6 @@ typedef struct SiprParameters {
typedef struct SiprContext {
AVCodecContext *avctx;
- AVFrame frame;
SiprMode mode;