summaryrefslogtreecommitdiff
path: root/libavcodec/pnmdec.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2012-11-21 21:34:46 +0100
committerAnton Khirnov <anton@khirnov.net>2013-03-08 07:38:30 +0100
commit759001c534287a96dc96d1e274665feb7059145d (patch)
tree6ace9560c20aa30db92067c5b45d7bd86e458d10 /libavcodec/pnmdec.c
parent6e7b50b4270116ded8b874d76cb7c5b1a0341827 (diff)
lavc decoders: work with refcounted frames.
Diffstat (limited to 'libavcodec/pnmdec.c')
-rw-r--r--libavcodec/pnmdec.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/libavcodec/pnmdec.c b/libavcodec/pnmdec.c
index c9b873d468..38056fbbe1 100644
--- a/libavcodec/pnmdec.c
+++ b/libavcodec/pnmdec.c
@@ -32,8 +32,7 @@ static int pnm_decode_frame(AVCodecContext *avctx, void *data,
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
PNMContext * const s = avctx->priv_data;
- AVFrame *picture = data;
- AVFrame * const p = &s->picture;
+ AVFrame * const p = data;
int i, j, n, linesize, h, upgrade = 0;
unsigned char *ptr;
int components, sample_len, ret;
@@ -45,11 +44,7 @@ static int pnm_decode_frame(AVCodecContext *avctx, void *data,
if ((ret = ff_pnm_decode_header(avctx, s)) < 0)
return ret;
- if (p->data[0])
- avctx->release_buffer(avctx, p);
-
- p->reference = 0;
- if ((ret = ff_get_buffer(avctx, p)) < 0) {
+ if ((ret = ff_get_buffer(avctx, p, 0)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -226,7 +221,6 @@ static int pnm_decode_frame(AVCodecContext *avctx, void *data,
}
break;
}
- *picture = s->picture;
*got_frame = 1;
return s->bytestream - s->bytestream_start;
@@ -239,8 +233,6 @@ AVCodec ff_pgm_decoder = {
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_PGM,
.priv_data_size = sizeof(PNMContext),
- .init = ff_pnm_init,
- .close = ff_pnm_end,
.decode = pnm_decode_frame,
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("PGM (Portable GrayMap) image"),
@@ -253,8 +245,6 @@ AVCodec ff_pgmyuv_decoder = {
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_PGMYUV,
.priv_data_size = sizeof(PNMContext),
- .init = ff_pnm_init,
- .close = ff_pnm_end,
.decode = pnm_decode_frame,
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("PGMYUV (Portable GrayMap YUV) image"),
@@ -267,8 +257,6 @@ AVCodec ff_ppm_decoder = {
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_PPM,
.priv_data_size = sizeof(PNMContext),
- .init = ff_pnm_init,
- .close = ff_pnm_end,
.decode = pnm_decode_frame,
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("PPM (Portable PixelMap) image"),
@@ -281,8 +269,6 @@ AVCodec ff_pbm_decoder = {
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_PBM,
.priv_data_size = sizeof(PNMContext),
- .init = ff_pnm_init,
- .close = ff_pnm_end,
.decode = pnm_decode_frame,
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("PBM (Portable BitMap) image"),
@@ -295,8 +281,6 @@ AVCodec ff_pam_decoder = {
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_PAM,
.priv_data_size = sizeof(PNMContext),
- .init = ff_pnm_init,
- .close = ff_pnm_end,
.decode = pnm_decode_frame,
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("PAM (Portable AnyMap) image"),