summaryrefslogtreecommitdiff
path: root/libavcodec/ra144enc.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2012-02-22 13:29:09 -0500
committerJustin Ruggles <justin.ruggles@gmail.com>2012-02-25 11:49:43 -0500
commit03359ebcf99d2949f44069836224273d383b1638 (patch)
tree620ac65b483c2e4a397f41a989ac93dffa2bc650 /libavcodec/ra144enc.c
parenta65f7c96fce257966ca7e224cbc1ff91af81e91c (diff)
ra144enc: set AVCodecContext.coded_frame
Diffstat (limited to 'libavcodec/ra144enc.c')
-rw-r--r--libavcodec/ra144enc.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/libavcodec/ra144enc.c b/libavcodec/ra144enc.c
index 302f66b410..5977928362 100644
--- a/libavcodec/ra144enc.c
+++ b/libavcodec/ra144enc.c
@@ -33,6 +33,15 @@
#include "ra144.h"
+static av_cold int ra144_encode_close(AVCodecContext *avctx)
+{
+ RA144Context *ractx = avctx->priv_data;
+ ff_lpc_end(&ractx->lpc_ctx);
+ av_freep(&avctx->coded_frame);
+ return 0;
+}
+
+
static av_cold int ra144_encode_init(AVCodecContext * avctx)
{
RA144Context *ractx;
@@ -51,15 +60,19 @@ static av_cold int ra144_encode_init(AVCodecContext * avctx)
ractx->avctx = avctx;
ret = ff_lpc_init(&ractx->lpc_ctx, avctx->frame_size, LPC_ORDER,
FF_LPC_TYPE_LEVINSON);
- return ret;
-}
+ if (ret < 0)
+ goto error;
+ avctx->coded_frame = avcodec_alloc_frame();
+ if (!avctx->coded_frame) {
+ ret = AVERROR(ENOMEM);
+ goto error;
+ }
-static av_cold int ra144_encode_close(AVCodecContext *avctx)
-{
- RA144Context *ractx = avctx->priv_data;
- ff_lpc_end(&ractx->lpc_ctx);
return 0;
+error:
+ ra144_encode_close(avctx);
+ return ret;
}