summaryrefslogtreecommitdiffstats
path: root/libavcodec/nuv.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-11-17 12:33:27 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-11-17 12:33:27 +0100
commita0c0629dd963b00f989172f0c599353b6b288c37 (patch)
tree9948f38dd870d440db9ac10f98bbf1275282b056 /libavcodec/nuv.c
parent5b0c70c2499e20529d517b712910d6f4f72e9485 (diff)
parent97168b204a0b6b79bb6c5f0d40efdf7fc2262476 (diff)
downloadffmpeg-streaming-a0c0629dd963b00f989172f0c599353b6b288c37.zip
ffmpeg-streaming-a0c0629dd963b00f989172f0c599353b6b288c37.tar.gz
Merge commit '97168b204a0b6b79bb6c5f0d40efdf7fc2262476'
* commit '97168b204a0b6b79bb6c5f0d40efdf7fc2262476': eatgv: use the AVFrame API properly. libxavs: use the AVFrame API properly. nuv: use the AVFrame API properly. flashsvenc: use the AVFrame API properly. Conflicts: libavcodec/eatgv.c libavcodec/nuv.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/nuv.c')
-rw-r--r--libavcodec/nuv.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/libavcodec/nuv.c b/libavcodec/nuv.c
index bfbf802..d4d9318 100644
--- a/libavcodec/nuv.c
+++ b/libavcodec/nuv.c
@@ -32,7 +32,7 @@
#include "rtjpeg.h"
typedef struct {
- AVFrame pic;
+ AVFrame *pic;
int codec_frameheader;
int quality;
int width, height;
@@ -140,7 +140,7 @@ static int codec_reinit(AVCodecContext *avctx, int width, int height,
}
ff_rtjpeg_decode_init(&c->rtj, &c->dsp, c->width, c->height,
c->lq, c->cq);
- av_frame_unref(&c->pic);
+ av_frame_unref(c->pic);
return 1;
} else if (quality != c->quality)
ff_rtjpeg_decode_init(&c->rtj, &c->dsp, c->width, c->height,
@@ -248,20 +248,20 @@ retry:
}
if (size_change || keyframe) {
- av_frame_unref(&c->pic);
+ av_frame_unref(c->pic);
init_frame = 1;
}
- if ((result = ff_reget_buffer(avctx, &c->pic)) < 0)
+ if ((result = ff_reget_buffer(avctx, c->pic)) < 0)
return result;
if (init_frame) {
- memset(c->pic.data[0], 0, avctx->height * c->pic.linesize[0]);
- memset(c->pic.data[1], 0x80, avctx->height * c->pic.linesize[1] / 2);
- memset(c->pic.data[2], 0x80, avctx->height * c->pic.linesize[2] / 2);
+ memset(c->pic->data[0], 0, avctx->height * c->pic->linesize[0]);
+ memset(c->pic->data[1], 0x80, avctx->height * c->pic->linesize[1] / 2);
+ memset(c->pic->data[2], 0x80, avctx->height * c->pic->linesize[2] / 2);
}
- c->pic.pict_type = keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
- c->pic.key_frame = keyframe;
+ c->pic->pict_type = keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
+ c->pic->key_frame = keyframe;
// decompress/copy/whatever data
switch (comptype) {
case NUV_LZO:
@@ -272,19 +272,19 @@ retry:
height = buf_size / c->width / 3 * 2;
}
if(height > 0)
- copy_frame(&c->pic, buf, c->width, height);
+ copy_frame(c->pic, buf, c->width, height);
break;
}
case NUV_RTJPEG_IN_LZO:
case NUV_RTJPEG:
- ret = ff_rtjpeg_decode_frame_yuv420(&c->rtj, &c->pic, buf, buf_size);
+ ret = ff_rtjpeg_decode_frame_yuv420(&c->rtj, c->pic, buf, buf_size);
if (ret < 0)
return ret;
break;
case NUV_BLACK:
- memset(c->pic.data[0], 0, c->width * c->height);
- memset(c->pic.data[1], 128, c->width * c->height / 4);
- memset(c->pic.data[2], 128, c->width * c->height / 4);
+ memset(c->pic->data[0], 0, c->width * c->height);
+ memset(c->pic->data[1], 128, c->width * c->height / 4);
+ memset(c->pic->data[2], 128, c->width * c->height / 4);
break;
case NUV_COPY_LAST:
/* nothing more to do here */
@@ -294,7 +294,7 @@ retry:
return AVERROR_INVALIDDATA;
}
- if ((result = av_frame_ref(picture, &c->pic)) < 0)
+ if ((result = av_frame_ref(picture, c->pic)) < 0)
return result;
*got_frame = 1;
@@ -306,8 +306,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
NuvContext *c = avctx->priv_data;
int ret;
+ c->pic = av_frame_alloc();
+ if (!c->pic)
+ return AVERROR(ENOMEM);
+
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
- c->pic.data[0] = NULL;
c->decomp_buf = NULL;
c->quality = -1;
c->width = 0;
@@ -331,7 +334,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
NuvContext *c = avctx->priv_data;
av_freep(&c->decomp_buf);
- av_frame_unref(&c->pic);
+ av_frame_free(&c->pic);
return 0;
}
OpenPOWER on IntegriCloud