Commit 9961c03c authored by gb's avatar gb

All GstVaapiID are initialized to GST_VAAPI_ID_NONE by default.

Besides, all GstVaapiObject derived class shall initialize "id" to a valid value.
parent 08815079
......@@ -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>
......
......@@ -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
);
......
......@@ -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;
}
......@@ -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 <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
......
......@@ -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);
}
......
......@@ -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,
......
......@@ -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:
*
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment