From f7813a5324be39d13ab536c245d15dfc602a7849 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Sun, 29 Dec 2013 12:19:38 +0000 Subject: basic type mechanism working --- ffmpeg/libavcodec/sunrastenc.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'ffmpeg/libavcodec/sunrastenc.c') diff --git a/ffmpeg/libavcodec/sunrastenc.c b/ffmpeg/libavcodec/sunrastenc.c index 2c7e72f..a55e3d4 100644 --- a/ffmpeg/libavcodec/sunrastenc.c +++ b/ffmpeg/libavcodec/sunrastenc.c @@ -2,20 +2,20 @@ * Sun Rasterfile (.sun/.ras/im{1,8,24}/.sunras) image encoder * Copyright (c) 2012 Aneesh Dogra (lionaneesh) * - * This file is part of Libav. + * This file is part of FFmpeg. * - * Libav is free software; you can redistribute it and/or + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * Libav is distributed in the hope that it will be useful, + * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -25,7 +25,6 @@ #include "sunrast.h" typedef struct SUNRASTContext { - AVFrame picture; PutByteContext p; int depth; ///< depth of pixel int length; ///< length (bytes) of image @@ -149,9 +148,6 @@ static av_cold int sunrast_encode_init(AVCodecContext *avctx) return AVERROR(EINVAL); } - avctx->coded_frame = &s->picture; - avctx->coded_frame->key_frame = 1; - avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; s->maptype = RMT_NONE; s->maplength = 0; @@ -202,6 +198,12 @@ static int sunrast_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, return 0; } +static av_cold int sunrast_encode_close(AVCodecContext *avctx) +{ + av_frame_free(&avctx->coded_frame); + return 0; +} + static const AVCodecDefault sunrast_defaults[] = { { "coder", "rle" }, { NULL }, @@ -209,10 +211,12 @@ static const AVCodecDefault sunrast_defaults[] = { AVCodec ff_sunrast_encoder = { .name = "sunrast", + .long_name = NULL_IF_CONFIG_SMALL("Sun Rasterfile image"), .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_SUNRAST, .priv_data_size = sizeof(SUNRASTContext), .init = sunrast_encode_init, + .close = sunrast_encode_close, .encode2 = sunrast_encode_frame, .defaults = sunrast_defaults, .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_BGR24, @@ -220,5 +224,4 @@ AVCodec ff_sunrast_encoder = { AV_PIX_FMT_GRAY8, AV_PIX_FMT_MONOWHITE, AV_PIX_FMT_NONE }, - .long_name = NULL_IF_CONFIG_SMALL("Sun Rasterfile image"), }; -- cgit v1.2.3