All GstVaapiID are initialized to GST_VAAPI_ID_NONE by default.
authorgb <gb@5584edef-b1fe-4b99-b61b-dd2bab72e969>
Wed, 24 Mar 2010 17:38:23 +0000 (17:38 +0000)
committergb <gb@5584edef-b1fe-4b99-b61b-dd2bab72e969>
Wed, 24 Mar 2010 17:38:23 +0000 (17:38 +0000)
Besides, all GstVaapiObject derived class shall initialize "id" to a valid value.

docs/reference/libs/libs-sections.txt
gst-libs/gst/vaapi/gstvaapiimage.c
gst-libs/gst/vaapi/gstvaapiobject.c
gst-libs/gst/vaapi/gstvaapiparamspecs.c
gst-libs/gst/vaapi/gstvaapisubpicture.c
gst-libs/gst/vaapi/gstvaapisurface.c
gst-libs/gst/vaapi/gstvaapitypes.h
gst-libs/gst/vaapi/gstvaapiwindow_x11.c

index 3d3ded2..b5a1ddf 100644 (file)
@@ -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
 </SECTION>
index 9413f5e..c4f2b72 100644 (file)
@@ -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
     );
index 03a9db6..91bb17b 100644 (file)
@@ -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;
 }
index e50fa1e..ef85a57 100644 (file)
 #include "config.h"
 #include "gstvaapiparamspecs.h"
 #include "gstvaapivalue.h"
-#include "gstvaapicompat.h"
-
-#ifdef GST_VAAPI_USE_OLD_VAAPI_0_29
-# include <va.h>
-#else
-# include <va/va.h>
-#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
index 7c92255..eb44ced 100644 (file)
@@ -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);
 }
index 80ad4f8..03ded41 100644 (file)
@@ -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,
index 451486a..d35216e 100644 (file)
@@ -49,6 +49,21 @@ typedef guint64 GstVaapiID;
 #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:
  *
  * Can be used together with #GST_VAAPI_ID_ARGS to properly output an
index b93bd9b..2d3ac8a 100644 (file)
@@ -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);
 }