Commit c2abeb12 authored by Gwenole Beauchesne's avatar Gwenole Beauchesne

libs: simplify GstVaapiID definitions.

Make GstVaapiID a gsize instead of guessing an underlying integer large
enough to hold all bits of a pointer. Also drop GST_VAAPI_ID_NONE since
this is plain zero and that it is no longer passed as varargs.
parent 4ffdc98a
......@@ -199,7 +199,7 @@ gst_vaapi_object_unlock_display(GstVaapiObject *object)
GstVaapiID
gst_vaapi_object_get_id(GstVaapiObject *object)
{
g_return_val_if_fail(GST_VAAPI_IS_OBJECT(object), GST_VAAPI_ID_NONE);
g_return_val_if_fail(GST_VAAPI_IS_OBJECT(object), 0);
return GST_VAAPI_OBJECT_ID(object);
}
......@@ -180,8 +180,8 @@ gst_vaapi_surface_proxy_get_flags(GstVaapiSurfaceProxy *proxy)
GstVaapiID
gst_vaapi_surface_proxy_get_surface_id(GstVaapiSurfaceProxy *proxy)
{
g_return_val_if_fail(GST_VAAPI_IS_SURFACE_PROXY(proxy), GST_VAAPI_ID_NONE);
g_return_val_if_fail(proxy->surface != NULL, GST_VAAPI_ID_NONE);
g_return_val_if_fail(GST_VAAPI_IS_SURFACE_PROXY(proxy), 0);
g_return_val_if_fail(proxy->surface != NULL, 0);
return GST_VAAPI_SURFACE_PROXY_SURFACE_ID(proxy);
}
......
......@@ -33,37 +33,7 @@ G_BEGIN_DECLS
* An integer large enough to hold a generic VA id or a pointer
* wherever necessary.
*/
#if defined(GLIB_SIZEOF_VOID_P)
# define GST_VAAPI_TYPE_ID_SIZE GLIB_SIZEOF_VOID_P
#elif G_MAXULONG == 0xffffffff
# define GST_VAAPI_TYPE_ID_SIZE 4
#elif G_MAXULONG == 0xffffffffffffffffull
# define GST_VAAPI_TYPE_ID_SIZE 8
#else
# error "could not determine size of GstVaapiID"
#endif
#if GST_VAAPI_TYPE_ID_SIZE == 4
typedef guint32 GstVaapiID;
#elif GST_VAAPI_TYPE_ID_SIZE == 8
typedef guint64 GstVaapiID;
#else
# 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)
typedef gsize GstVaapiID;
/**
* GST_VAAPI_ID_FORMAT:
......@@ -85,7 +55,7 @@ typedef guint64 GstVaapiID;
* Can be used together with #GST_VAAPI_ID_FORMAT to properly output
* an integer value in a printf()-style text message.
*/
#define GST_VAAPI_ID_ARGS(id) GUINT_TO_POINTER(id)
#define GST_VAAPI_ID_ARGS(id) GSIZE_TO_POINTER(id)
/**
* GstVaapiPoint:
......
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