libwebp: simplify AVCodec.close functions
authorJames Almer <jamrial@gmail.com>
Sat, 23 May 2015 17:24:34 +0000 (14:24 -0300)
committerJames Almer <jamrial@gmail.com>
Sat, 23 May 2015 17:46:46 +0000 (14:46 -0300)
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: James Almer <jamrial@gmail.com>
libavcodec/libwebpenc.c
libavcodec/libwebpenc_animencoder.c
libavcodec/libwebpenc_common.c
libavcodec/libwebpenc_common.h

index 4c22a9b..db96e16 100644 (file)
@@ -80,7 +80,10 @@ end:
 
 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 = {
index c1e2a1c..e958201 100644 (file)
@@ -116,12 +116,11 @@ end:
 
 static int libwebp_anim_encode_close(AVCodecContext *avctx)
 {
-    int ret = ff_libwebp_encode_close_common(avctx);
-    if (!ret) {
-        LibWebPAnimContext *s = avctx->priv_data;
-        WebPAnimEncoderDelete(s->enc);
-    }
-    return ret;
+    LibWebPAnimContext *s = avctx->priv_data;
+    av_frame_free(&s->cc.ref);
+    WebPAnimEncoderDelete(s->enc);
+
+    return 0;
 }
 
 static const AVClass class = {
index 373adca..a76b6da 100644 (file)
@@ -252,10 +252,3 @@ int ff_libwebp_get_frame(AVCodecContext *avctx, LibWebPContextCommon *s,
 end:
     return ret;
 }
-
-int ff_libwebp_encode_close_common(AVCodecContext *avctx)
-{
-    LibWebPContextCommon *s  = avctx->priv_data;
-    av_frame_free(&s->ref);
-    return 0;
-}
index 7e653da..e74e579 100644 (file)
@@ -57,8 +57,6 @@ int ff_libwebp_get_frame(AVCodecContext *avctx, LibWebPContextCommon *s,
                          const AVFrame *frame, AVFrame **alt_frame_ptr,
                          WebPPicture **pic_ptr);
 
-int ff_libwebp_encode_close_common(AVCodecContext *avctx);
-
 #define OFFSET(x) offsetof(LibWebPContextCommon, x)
 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 static const AVOption options[] = {