From: Gwenole Beauchesne Date: Mon, 21 Nov 2011 17:39:49 +0000 (+0100) Subject: decoder: add ref_count to GstVaapiPicture. X-Git-Tag: 0.3.4~24 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=74d36803811dc382d6b11c40222cdf7a98dde27a;p=platform%2Fupstream%2Fgstreamer-vaapi.git decoder: add ref_count to GstVaapiPicture. --- diff --git a/gst-libs/gst/vaapi/gstvaapidecoder.c b/gst-libs/gst/vaapi/gstvaapidecoder.c index 4442f10..da738ef 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder.c @@ -671,6 +671,7 @@ create_picture(GstVaapiDecoder *decoder) picture->type = GST_VAAPI_PICTURE_TYPE_NONE; picture->flags = 0; + picture->ref_count = 1; picture->surface_id = VA_INVALID_ID; picture->surface = NULL; picture->param_id = VA_INVALID_ID; diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_priv.h b/gst-libs/gst/vaapi/gstvaapidecoder_priv.h index 3a6cda1..402348f 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_priv.h +++ b/gst-libs/gst/vaapi/gstvaapidecoder_priv.h @@ -149,6 +149,7 @@ struct _GstVaapiCodecInfo { struct _GstVaapiPicture { GstVaapiPictureType type; guint flags; + guint ref_count; VASurfaceID surface_id; GstVaapiSurface *surface; VABufferID param_id; @@ -254,6 +255,20 @@ void gst_vaapi_decoder_free_picture(GstVaapiDecoder *decoder, GstVaapiPicture *picture) attribute_hidden; +static inline GstVaapiPicture * +gst_vaapi_decoder_ref_picture(GstVaapiDecoder *decoder, GstVaapiPicture *picture) +{ + ++picture->ref_count; + return picture; +} + +static inline void +gst_vaapi_decoder_unref_picture(GstVaapiDecoder *decoder, GstVaapiPicture *picture) +{ + if (--picture->ref_count == 0) + gst_vaapi_decoder_free_picture(decoder, picture); +} + GstVaapiIqMatrix * gst_vaapi_decoder_new_iq_matrix(GstVaapiDecoder *decoder) attribute_hidden;