From 9961c03c6a05fb81c5008c4186dbb05f06946528 Mon Sep 17 00:00:00 2001 From: gb Date: Wed, 24 Mar 2010 17:38:23 +0000 Subject: [PATCH] All GstVaapiID are initialized to GST_VAAPI_ID_NONE by default. Besides, all GstVaapiObject derived class shall initialize "id" to a valid value. --- docs/reference/libs/libs-sections.txt | 2 ++ gst-libs/gst/vaapi/gstvaapiimage.c | 2 ++ gst-libs/gst/vaapi/gstvaapiobject.c | 9 ++++----- gst-libs/gst/vaapi/gstvaapiparamspecs.c | 9 +-------- gst-libs/gst/vaapi/gstvaapisubpicture.c | 1 + gst-libs/gst/vaapi/gstvaapisurface.c | 1 + gst-libs/gst/vaapi/gstvaapitypes.h | 15 +++++++++++++++ gst-libs/gst/vaapi/gstvaapiwindow_x11.c | 4 ++-- 8 files changed, 28 insertions(+), 15 deletions(-) diff --git a/docs/reference/libs/libs-sections.txt b/docs/reference/libs/libs-sections.txt index 3d3ded2782..b5a1ddf61b 100644 --- a/docs/reference/libs/libs-sections.txt +++ b/docs/reference/libs/libs-sections.txt @@ -161,6 +161,8 @@ GST_VAAPI_VIDEO_BUFFER_GET_CLASS GstVaapiID GST_VAAPI_ID_FORMAT GST_VAAPI_ID_ARGS +GST_VAAPI_ID +GST_VAAPI_ID_NONE GstVaapiPoint GstVaapiRectangle diff --git a/gst-libs/gst/vaapi/gstvaapiimage.c b/gst-libs/gst/vaapi/gstvaapiimage.c index 9413f5e070..c4f2b722c9 100644 --- a/gst-libs/gst/vaapi/gstvaapiimage.c +++ b/gst-libs/gst/vaapi/gstvaapiimage.c @@ -444,6 +444,7 @@ gst_vaapi_image_new( image = g_object_new( GST_VAAPI_TYPE_IMAGE, "display", display, + "id", GST_VAAPI_ID(VA_INVALID_ID), "format", format, "width", width, "height", height, @@ -489,6 +490,7 @@ gst_vaapi_image_new_with_image(GstVaapiDisplay *display, VAImage *va_image) image = g_object_new( GST_VAAPI_TYPE_IMAGE, "display", display, + "id", GST_VAAPI_ID(va_image->image_id), "image", va_image, NULL ); diff --git a/gst-libs/gst/vaapi/gstvaapiobject.c b/gst-libs/gst/vaapi/gstvaapiobject.c index 03a9db6606..91bb17bb95 100644 --- a/gst-libs/gst/vaapi/gstvaapiobject.c +++ b/gst-libs/gst/vaapi/gstvaapiobject.c @@ -24,7 +24,6 @@ */ #include "config.h" -#include "gstvaapicompat.h" #include "gstvaapiobject.h" #include "gstvaapiobject_priv.h" #include "gstvaapiparamspecs.h" @@ -70,7 +69,7 @@ gst_vaapi_object_finalize(GObject *object) { GstVaapiObjectPrivate * const priv = GST_VAAPI_OBJECT(object)->priv; - priv->id = VA_INVALID_ID; + priv->id = GST_VAAPI_ID_NONE; if (priv->display) { g_object_unref(priv->display); @@ -163,7 +162,7 @@ gst_vaapi_object_class_init(GstVaapiObjectClass *klass) gst_vaapi_param_spec_id("id", "ID", "The GstVaapiID contained in this object", - VA_INVALID_ID, + GST_VAAPI_ID_NONE, G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY)); /** @@ -191,7 +190,7 @@ gst_vaapi_object_init(GstVaapiObject *object) object->priv = priv; priv->display = NULL; - priv->id = VA_INVALID_ID; + priv->id = GST_VAAPI_ID_NONE; priv->is_destroying = FALSE; } @@ -222,7 +221,7 @@ gst_vaapi_object_get_display(GstVaapiObject *object) GstVaapiID gst_vaapi_object_get_id(GstVaapiObject *object) { - g_return_val_if_fail(GST_VAAPI_IS_OBJECT(object), VA_INVALID_ID); + g_return_val_if_fail(GST_VAAPI_IS_OBJECT(object), GST_VAAPI_ID_NONE); return object->priv->id; } diff --git a/gst-libs/gst/vaapi/gstvaapiparamspecs.c b/gst-libs/gst/vaapi/gstvaapiparamspecs.c index e50fa1e9d2..ef85a57f28 100644 --- a/gst-libs/gst/vaapi/gstvaapiparamspecs.c +++ b/gst-libs/gst/vaapi/gstvaapiparamspecs.c @@ -26,20 +26,13 @@ #include "config.h" #include "gstvaapiparamspecs.h" #include "gstvaapivalue.h" -#include "gstvaapicompat.h" - -#ifdef GST_VAAPI_USE_OLD_VAAPI_0_29 -# include -#else -# include -#endif /* --- GstVaapiParamSpecID --- */ static void gst_vaapi_param_id_init(GParamSpec *pspec) { - GST_VAAPI_PARAM_SPEC_ID(pspec)->default_value = VA_INVALID_ID; + GST_VAAPI_PARAM_SPEC_ID(pspec)->default_value = GST_VAAPI_ID_NONE; } static void diff --git a/gst-libs/gst/vaapi/gstvaapisubpicture.c b/gst-libs/gst/vaapi/gstvaapisubpicture.c index 7c922555a4..eb44ced7f1 100644 --- a/gst-libs/gst/vaapi/gstvaapisubpicture.c +++ b/gst-libs/gst/vaapi/gstvaapisubpicture.c @@ -212,6 +212,7 @@ gst_vaapi_subpicture_new(GstVaapiImage *image) return g_object_new(GST_VAAPI_TYPE_SUBPICTURE, "display", GST_VAAPI_OBJECT_GET_DISPLAY(image), + "id", GST_VAAPI_ID(VA_INVALID_ID), "image", image, NULL); } diff --git a/gst-libs/gst/vaapi/gstvaapisurface.c b/gst-libs/gst/vaapi/gstvaapisurface.c index 80ad4f82dc..03ded417a4 100644 --- a/gst-libs/gst/vaapi/gstvaapisurface.c +++ b/gst-libs/gst/vaapi/gstvaapisurface.c @@ -298,6 +298,7 @@ gst_vaapi_surface_new( return g_object_new(GST_VAAPI_TYPE_SURFACE, "display", display, + "id", GST_VAAPI_ID(VA_INVALID_ID), "width", width, "height", height, "chroma-type", chroma_type, diff --git a/gst-libs/gst/vaapi/gstvaapitypes.h b/gst-libs/gst/vaapi/gstvaapitypes.h index 451486a7aa..d35216e56d 100644 --- a/gst-libs/gst/vaapi/gstvaapitypes.h +++ b/gst-libs/gst/vaapi/gstvaapitypes.h @@ -48,6 +48,21 @@ typedef guint64 GstVaapiID; # error "unsupported value for GST_VAAPI_TYPE_ID_SIZE" #endif +/** + * GST_VAAPI_ID: + * @id: an arbitrary integer value + * + * Macro that creates a #GstVaapiID from @id. + */ +#define GST_VAAPI_ID(id) ((GstVaapiID)(id)) + +/** + * GST_VAAPI_ID_NONE: + * + * Macro that evaluates to the default #GstVaapiID value. + */ +#define GST_VAAPI_ID_NONE GST_VAAPI_ID(0) + /** * GST_VAAPI_ID_FORMAT: * diff --git a/gst-libs/gst/vaapi/gstvaapiwindow_x11.c b/gst-libs/gst/vaapi/gstvaapiwindow_x11.c index b93bd9bc68..2d3ac8a6bf 100644 --- a/gst-libs/gst/vaapi/gstvaapiwindow_x11.c +++ b/gst-libs/gst/vaapi/gstvaapiwindow_x11.c @@ -514,7 +514,7 @@ gst_vaapi_window_x11_new(GstVaapiDisplay *display, guint width, guint height) return g_object_new(GST_VAAPI_TYPE_WINDOW_X11, "display", display, - "id", (GstVaapiID)None, + "id", GST_VAAPI_ID(None), "width", width, "height", height, NULL); @@ -542,7 +542,7 @@ gst_vaapi_window_x11_new_with_xid(GstVaapiDisplay *display, Window xid) return g_object_new(GST_VAAPI_TYPE_WINDOW_X11, "display", display, - "id", (GstVaapiID)xid, + "id", GST_VAAPI_ID(xid), NULL); }