aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-11-09 10:14:46 +0100
committerAnton Khirnov <anton@khirnov.net>2013-11-16 12:45:05 +0100
commit13e9cc9ce0646ba8e31d837b5e6372ec80fa7a73 (patch)
tree771753cee4f0a517e945876b7c00e8e3101626b4
parentb9fb59d2ab05fdfe89d3fb0d7ecbbd91e560f57d (diff)
downloadffmpeg-13e9cc9ce0646ba8e31d837b5e6372ec80fa7a73.tar.gz
a64multienc: use the AVFrame API properly.
-rw-r--r--libavcodec/a64enc.h3
-rw-r--r--libavcodec/a64multienc.c11
2 files changed, 8 insertions, 6 deletions
diff --git a/libavcodec/a64enc.h b/libavcodec/a64enc.h
index d5f8e9ac99..65c1d30951 100644
--- a/libavcodec/a64enc.h
+++ b/libavcodec/a64enc.h
@@ -34,9 +34,6 @@
#define C64YRES 200
typedef struct A64Context {
- /* general variables */
- AVFrame picture;
-
/* variables for multicolor modes */
AVLFG randctx;
int mc_lifetime;
diff --git a/libavcodec/a64multienc.c b/libavcodec/a64multienc.c
index f2c6c4a357..11d6e2c300 100644
--- a/libavcodec/a64multienc.c
+++ b/libavcodec/a64multienc.c
@@ -165,6 +165,7 @@ static void render_charset(AVCodecContext *avctx, uint8_t *charset,
static av_cold int a64multi_close_encoder(AVCodecContext *avctx)
{
A64Context *c = avctx->priv_data;
+ av_frame_free(&avctx->coded_frame);
av_free(c->mc_meta_charset);
av_free(c->mc_best_cb);
av_free(c->mc_charset);
@@ -216,8 +217,12 @@ static av_cold int a64multi_init_encoder(AVCodecContext *avctx)
AV_WB32(avctx->extradata, c->mc_lifetime);
AV_WB32(avctx->extradata + 16, INTERLACED);
- avcodec_get_frame_defaults(&c->picture);
- avctx->coded_frame = &c->picture;
+ avctx->coded_frame = av_frame_alloc();
+ if (!avctx->coded_frame) {
+ a64multi_close_encoder(avctx);
+ return AVERROR(ENOMEM);
+ }
+
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
avctx->coded_frame->key_frame = 1;
if (!avctx->codec_tag)
@@ -247,7 +252,7 @@ static int a64multi_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
const AVFrame *pict, int *got_packet)
{
A64Context *c = avctx->priv_data;
- AVFrame *const p = &c->picture;
+ AVFrame *const p = avctx->coded_frame;
int frame;
int x, y;