Commit 8952254f authored by James Almer's avatar James Almer

libwebp: simplify AVCodec.close functions

Reviewed-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
Signed-off-by: 's avatarJames Almer <jamrial@gmail.com>
parent 57d9788d
...@@ -80,7 +80,10 @@ end: ...@@ -80,7 +80,10 @@ end:
static int libwebp_encode_close(AVCodecContext *avctx) static int libwebp_encode_close(AVCodecContext *avctx)
{ {
return ff_libwebp_encode_close_common(avctx); LibWebPContextCommon *s = avctx->priv_data;
av_frame_free(&s->ref);
return 0;
} }
static const AVClass class = { static const AVClass class = {
......
...@@ -116,12 +116,11 @@ end: ...@@ -116,12 +116,11 @@ end:
static int libwebp_anim_encode_close(AVCodecContext *avctx) static int libwebp_anim_encode_close(AVCodecContext *avctx)
{ {
int ret = ff_libwebp_encode_close_common(avctx); LibWebPAnimContext *s = avctx->priv_data;
if (!ret) { av_frame_free(&s->cc.ref);
LibWebPAnimContext *s = avctx->priv_data; WebPAnimEncoderDelete(s->enc);
WebPAnimEncoderDelete(s->enc);
} return 0;
return ret;
} }
static const AVClass class = { static const AVClass class = {
......
...@@ -252,10 +252,3 @@ int ff_libwebp_get_frame(AVCodecContext *avctx, LibWebPContextCommon *s, ...@@ -252,10 +252,3 @@ int ff_libwebp_get_frame(AVCodecContext *avctx, LibWebPContextCommon *s,
end: end:
return ret; return ret;
} }
int ff_libwebp_encode_close_common(AVCodecContext *avctx)
{
LibWebPContextCommon *s = avctx->priv_data;
av_frame_free(&s->ref);
return 0;
}
...@@ -57,8 +57,6 @@ int ff_libwebp_get_frame(AVCodecContext *avctx, LibWebPContextCommon *s, ...@@ -57,8 +57,6 @@ int ff_libwebp_get_frame(AVCodecContext *avctx, LibWebPContextCommon *s,
const AVFrame *frame, AVFrame **alt_frame_ptr, const AVFrame *frame, AVFrame **alt_frame_ptr,
WebPPicture **pic_ptr); WebPPicture **pic_ptr);
int ff_libwebp_encode_close_common(AVCodecContext *avctx);
#define OFFSET(x) offsetof(LibWebPContextCommon, x) #define OFFSET(x) offsetof(LibWebPContextCommon, x)
#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
static const AVOption options[] = { static const AVOption options[] = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment