diff options
author | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2014-12-02 16:51:20 +0100 |
---|---|---|
committer | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2015-01-27 18:11:44 +0100 |
commit | fd775b440098c3e741eece08265baecd1edde098 (patch) | |
tree | 2355c5bd0ddc22350309dcfcab2d1ffacec0c450 /gst-libs/gst/vaapi/gstvaapiminiobject.h | |
parent | c2afdb4650185b0cb337b354ce133cea1fd73309 (diff) | |
download | gst-vaapi-fd775b440098c3e741eece08265baecd1edde098.tar.gz |
libs: expose GstVaapiMiniObject APIs to all backends.
Make it possible to have all libgstvaapi backends (libs) access to a
common GstVaapiMiniObject API and implementation. This is a minor step
towards full exposure when needed, but restrict it to libgstvaapi at
this time.
Diffstat (limited to 'gst-libs/gst/vaapi/gstvaapiminiobject.h')
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapiminiobject.h | 51 |
1 files changed, 46 insertions, 5 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapiminiobject.h b/gst-libs/gst/vaapi/gstvaapiminiobject.h index 7131a9d6..562c5fc4 100644 --- a/gst-libs/gst/vaapi/gstvaapiminiobject.h +++ b/gst-libs/gst/vaapi/gstvaapiminiobject.h @@ -142,27 +142,68 @@ struct _GstVaapiMiniObjectClass GDestroyNotify finalize; }; -G_GNUC_INTERNAL GstVaapiMiniObject * gst_vaapi_mini_object_new (const GstVaapiMiniObjectClass * object_class); -G_GNUC_INTERNAL GstVaapiMiniObject * gst_vaapi_mini_object_new0 (const GstVaapiMiniObjectClass * object_class); -G_GNUC_INTERNAL GstVaapiMiniObject * gst_vaapi_mini_object_ref (GstVaapiMiniObject * object); -G_GNUC_INTERNAL void gst_vaapi_mini_object_unref (GstVaapiMiniObject * object); -G_GNUC_INTERNAL void gst_vaapi_mini_object_replace (GstVaapiMiniObject ** old_object_ptr, GstVaapiMiniObject * new_object); +#ifdef IN_LIBGSTVAAPI_CORE +#undef gst_vaapi_mini_object_ref +#define gst_vaapi_mini_object_ref(object) \ + gst_vaapi_mini_object_ref_internal (object) + +#undef gst_vaapi_mini_object_unref +#define gst_vaapi_mini_object_unref(object) \ + gst_vaapi_mini_object_unref_internal (object) + +G_GNUC_INTERNAL +void +gst_vaapi_mini_object_free (GstVaapiMiniObject * object); + +/** + * gst_vaapi_mini_object_ref_internal: + * @object: a #GstVaapiMiniObject + * + * Atomically increases the reference count of the given @object by one. + * This is an internal function that does not do any run-time type check. + * + * Returns: The same @object argument + */ +static inline GstVaapiMiniObject * +gst_vaapi_mini_object_ref_internal (GstVaapiMiniObject * object) +{ + g_atomic_int_inc (&object->ref_count); + return object; +} + +/** + * gst_vaapi_mini_object_unref_internal: + * @object: a #GstVaapiMiniObject + * + * Atomically decreases the reference count of the @object by one. If + * the reference count reaches zero, the object will be free'd. + * + * This is an internal function that does not do any run-time type check. + */ +static inline void +gst_vaapi_mini_object_unref_internal (GstVaapiMiniObject * object) +{ + if (g_atomic_int_dec_and_test (&object->ref_count)) + gst_vaapi_mini_object_free (object); +} +#endif + G_END_DECLS #endif /* GST_VAAPI_MINI_OBJECT_H */ |