[009/124] avs: convert to refcounted frames.

Message ID 1357655896-21911-10-git-send-email-anton@khirnov.net
State Superseded
Headers show

Commit Message

Anton Khirnov Jan. 8, 2013, 2:36 p.m.
---
 libavcodec/avs.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Luca Barbato Feb. 15, 2013, 1:42 p.m. | #1
On 08/01/13 15:36, Anton Khirnov wrote:
> ---
>  libavcodec/avs.c |   10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/libavcodec/avs.c b/libavcodec/avs.c
> index 71b8b0c..45cb448 100644
> --- a/libavcodec/avs.c
> +++ b/libavcodec/avs.c
> @@ -21,6 +21,7 @@


Ok.

Patch

diff --git a/libavcodec/avs.c b/libavcodec/avs.c
index 71b8b0c..45cb448 100644
--- a/libavcodec/avs.c
+++ b/libavcodec/avs.c
@@ -21,6 +21,7 @@ 
 
 #include "avcodec.h"
 #include "get_bits.h"
+#include "internal.h"
 
 
 typedef struct {
@@ -59,11 +60,10 @@  avs_decode_frame(AVCodecContext * avctx,
     AvsBlockType type;
     GetBitContext change_map;
 
-    if ((ret = avctx->reget_buffer(avctx, p)) < 0) {
+    if ((ret = ff_reget_buffer(avctx, p)) < 0) {
         av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
         return ret;
     }
-    p->reference = 1;
     p->pict_type = AV_PICTURE_TYPE_P;
     p->key_frame = 0;
 
@@ -149,7 +149,8 @@  avs_decode_frame(AVCodecContext * avctx,
             align_get_bits(&change_map);
     }
 
-    *picture   = avs->picture;
+    if ((ret = av_frame_ref(picture, &avs->picture)) < 0)
+        return ret;
     *got_frame = 1;
 
     return buf_size;
@@ -165,8 +166,7 @@  static av_cold int avs_decode_init(AVCodecContext * avctx)
 static av_cold int avs_decode_end(AVCodecContext *avctx)
 {
     AvsContext *s = avctx->priv_data;
-    if (s->picture.data[0])
-        avctx->release_buffer(avctx, &s->picture);
+    av_frame_unref(&s->picture);
     return 0;
 }