mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-27 09:38:17 +00:00
Move "id" down to the GstVaapiObject base.
This commit is contained in:
parent
1a90e11ae5
commit
a91206bbc1
12 changed files with 143 additions and 175 deletions
|
@ -200,6 +200,7 @@ GST_VAAPI_WINDOW_GET_CLASS
|
||||||
GstVaapiObject
|
GstVaapiObject
|
||||||
GstVaapiObjectClass
|
GstVaapiObjectClass
|
||||||
gst_vaapi_object_get_display
|
gst_vaapi_object_get_display
|
||||||
|
gst_vaapi_object_get_id
|
||||||
<SUBSECTION Standard>
|
<SUBSECTION Standard>
|
||||||
GST_VAAPI_OBJECT
|
GST_VAAPI_OBJECT
|
||||||
GST_VAAPI_IS_OBJECT
|
GST_VAAPI_IS_OBJECT
|
||||||
|
@ -220,7 +221,6 @@ GstVaapiImage
|
||||||
GstVaapiImageClass
|
GstVaapiImageClass
|
||||||
gst_vaapi_image_new
|
gst_vaapi_image_new
|
||||||
gst_vaapi_image_new_with_image
|
gst_vaapi_image_new_with_image
|
||||||
gst_vaapi_image_get_id
|
|
||||||
gst_vaapi_image_get_image
|
gst_vaapi_image_get_image
|
||||||
gst_vaapi_image_get_format
|
gst_vaapi_image_get_format
|
||||||
gst_vaapi_image_get_width
|
gst_vaapi_image_get_width
|
||||||
|
@ -253,7 +253,6 @@ GstVaapiSurfaceRenderFlags
|
||||||
GstVaapiSurface
|
GstVaapiSurface
|
||||||
GstVaapiSurfaceClass
|
GstVaapiSurfaceClass
|
||||||
gst_vaapi_surface_new
|
gst_vaapi_surface_new
|
||||||
gst_vaapi_surface_get_id
|
|
||||||
gst_vaapi_surface_get_chroma_type
|
gst_vaapi_surface_get_chroma_type
|
||||||
gst_vaapi_surface_get_width
|
gst_vaapi_surface_get_width
|
||||||
gst_vaapi_surface_get_height
|
gst_vaapi_surface_get_height
|
||||||
|
@ -280,7 +279,6 @@ GST_VAAPI_SURFACE_GET_CLASS
|
||||||
GstVaapiSubpicture
|
GstVaapiSubpicture
|
||||||
GstVaapiSubpictureClass
|
GstVaapiSubpictureClass
|
||||||
gst_vaapi_subpicture_new
|
gst_vaapi_subpicture_new
|
||||||
gst_vaapi_subpicture_get_id
|
|
||||||
gst_vaapi_subpicture_get_image
|
gst_vaapi_subpicture_get_image
|
||||||
gst_vaapi_subpicture_set_image
|
gst_vaapi_subpicture_set_image
|
||||||
<SUBSECTION Standard>
|
<SUBSECTION Standard>
|
||||||
|
|
|
@ -56,7 +56,6 @@ enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
|
|
||||||
PROP_IMAGE,
|
PROP_IMAGE,
|
||||||
PROP_IMAGE_ID,
|
|
||||||
PROP_FORMAT,
|
PROP_FORMAT,
|
||||||
PROP_WIDTH,
|
PROP_WIDTH,
|
||||||
PROP_HEIGHT
|
PROP_HEIGHT
|
||||||
|
@ -147,24 +146,22 @@ static void
|
||||||
gst_vaapi_image_destroy(GstVaapiImage *image)
|
gst_vaapi_image_destroy(GstVaapiImage *image)
|
||||||
{
|
{
|
||||||
GstVaapiDisplay * const display = GST_VAAPI_OBJECT_GET_DISPLAY(image);
|
GstVaapiDisplay * const display = GST_VAAPI_OBJECT_GET_DISPLAY(image);
|
||||||
GstVaapiImagePrivate * const priv = image->priv;
|
VAImageID image_id;
|
||||||
VAStatus status;
|
VAStatus status;
|
||||||
|
|
||||||
_gst_vaapi_image_unmap(image);
|
_gst_vaapi_image_unmap(image);
|
||||||
|
|
||||||
GST_DEBUG("image 0x%08x", priv->internal_image.image_id);
|
image_id = GST_VAAPI_OBJECT_ID(image);
|
||||||
|
GST_DEBUG("image %" GST_VAAPI_ID_FORMAT, GST_VAAPI_ID_ARGS(image_id));
|
||||||
|
|
||||||
if (priv->internal_image.image_id != VA_INVALID_ID) {
|
if (image_id != VA_INVALID_ID) {
|
||||||
GST_VAAPI_DISPLAY_LOCK(display);
|
GST_VAAPI_DISPLAY_LOCK(display);
|
||||||
status = vaDestroyImage(
|
status = vaDestroyImage(GST_VAAPI_DISPLAY_VADISPLAY(display), image_id);
|
||||||
GST_VAAPI_DISPLAY_VADISPLAY(display),
|
|
||||||
priv->internal_image.image_id
|
|
||||||
);
|
|
||||||
GST_VAAPI_DISPLAY_UNLOCK(display);
|
GST_VAAPI_DISPLAY_UNLOCK(display);
|
||||||
if (!vaapi_check_status(status, "vaDestroyImage()"))
|
if (!vaapi_check_status(status, "vaDestroyImage()"))
|
||||||
g_warning("failed to destroy image 0x%08x\n",
|
g_warning("failed to destroy image %" GST_VAAPI_ID_FORMAT "\n",
|
||||||
priv->internal_image.image_id);
|
GST_VAAPI_ID_ARGS(image_id));
|
||||||
priv->internal_image.image_id = VA_INVALID_ID;
|
GST_VAAPI_OBJECT_ID(image) = VA_INVALID_ID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,6 +203,7 @@ gst_vaapi_image_create(GstVaapiImage *image)
|
||||||
GstVaapiImagePrivate * const priv = image->priv;
|
GstVaapiImagePrivate * const priv = image->priv;
|
||||||
GstVaapiImageFormat format = priv->format;
|
GstVaapiImageFormat format = priv->format;
|
||||||
const VAImageFormat *va_format;
|
const VAImageFormat *va_format;
|
||||||
|
VAImageID image_id;
|
||||||
|
|
||||||
if (!priv->create_image)
|
if (!priv->create_image)
|
||||||
return (priv->image.image_id != VA_INVALID_ID &&
|
return (priv->image.image_id != VA_INVALID_ID &&
|
||||||
|
@ -227,6 +225,7 @@ gst_vaapi_image_create(GstVaapiImage *image)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
priv->image = priv->internal_image;
|
priv->image = priv->internal_image;
|
||||||
|
image_id = priv->image.image_id;
|
||||||
|
|
||||||
if (priv->format != priv->internal_format) {
|
if (priv->format != priv->internal_format) {
|
||||||
switch (priv->format) {
|
switch (priv->format) {
|
||||||
|
@ -243,9 +242,10 @@ gst_vaapi_image_create(GstVaapiImage *image)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_DEBUG("image 0x%08x", priv->image.image_id);
|
|
||||||
priv->is_linear = vaapi_image_is_linear(&priv->image);
|
priv->is_linear = vaapi_image_is_linear(&priv->image);
|
||||||
|
|
||||||
|
GST_DEBUG("image %" GST_VAAPI_ID_FORMAT, GST_VAAPI_ID_ARGS(image_id));
|
||||||
|
GST_VAAPI_OBJECT_ID(image) = image_id;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,9 +304,6 @@ gst_vaapi_image_get_property(
|
||||||
case PROP_IMAGE:
|
case PROP_IMAGE:
|
||||||
g_value_set_boxed(value, &image->priv->image);
|
g_value_set_boxed(value, &image->priv->image);
|
||||||
break;
|
break;
|
||||||
case PROP_IMAGE_ID:
|
|
||||||
g_value_set_uint(value, gst_vaapi_image_get_id(image));
|
|
||||||
break;
|
|
||||||
case PROP_FORMAT:
|
case PROP_FORMAT:
|
||||||
g_value_set_uint(value, gst_vaapi_image_get_format(image));
|
g_value_set_uint(value, gst_vaapi_image_get_format(image));
|
||||||
break;
|
break;
|
||||||
|
@ -356,20 +353,6 @@ gst_vaapi_image_class_init(GstVaapiImageClass *klass)
|
||||||
VAAPI_TYPE_IMAGE,
|
VAAPI_TYPE_IMAGE,
|
||||||
G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY));
|
G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY));
|
||||||
|
|
||||||
/**
|
|
||||||
* GstVaapiImage:id:
|
|
||||||
*
|
|
||||||
* The underlying #VAImageID of the image.
|
|
||||||
*/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class,
|
|
||||||
PROP_IMAGE_ID,
|
|
||||||
g_param_spec_uint("id",
|
|
||||||
"VA image id",
|
|
||||||
"The underlying VA image id",
|
|
||||||
0, G_MAXUINT32, VA_INVALID_ID,
|
|
||||||
G_PARAM_READABLE));
|
|
||||||
|
|
||||||
g_object_class_install_property
|
g_object_class_install_property
|
||||||
(object_class,
|
(object_class,
|
||||||
PROP_WIDTH,
|
PROP_WIDTH,
|
||||||
|
@ -517,23 +500,6 @@ gst_vaapi_image_new_with_image(GstVaapiDisplay *display, VAImage *va_image)
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_vaapi_image_get_id:
|
|
||||||
* @image: a #GstVaapiImage
|
|
||||||
*
|
|
||||||
* Returns the underlying VAImageID of the @image.
|
|
||||||
*
|
|
||||||
* Return value: the underlying VA image id
|
|
||||||
*/
|
|
||||||
VAImageID
|
|
||||||
gst_vaapi_image_get_id(GstVaapiImage *image)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail(GST_VAAPI_IS_IMAGE(image), VA_INVALID_ID);
|
|
||||||
g_return_val_if_fail(image->priv->is_constructed, VA_INVALID_ID);
|
|
||||||
|
|
||||||
return image->priv->image.image_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_vaapi_image_get_image:
|
* gst_vaapi_image_get_image:
|
||||||
* @image: a #GstVaapiImage
|
* @image: a #GstVaapiImage
|
||||||
|
|
|
@ -116,9 +116,6 @@ gst_vaapi_image_new(
|
||||||
GstVaapiImage *
|
GstVaapiImage *
|
||||||
gst_vaapi_image_new_with_image(GstVaapiDisplay *display, VAImage *va_image);
|
gst_vaapi_image_new_with_image(GstVaapiDisplay *display, VAImage *va_image);
|
||||||
|
|
||||||
VAImageID
|
|
||||||
gst_vaapi_image_get_id(GstVaapiImage *image);
|
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_image_get_image(GstVaapiImage *image, VAImage *va_image);
|
gst_vaapi_image_get_image(GstVaapiImage *image, VAImage *va_image);
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "gstvaapiobject.h"
|
#include "gstvaapiobject.h"
|
||||||
#include "gstvaapiobject_priv.h"
|
#include "gstvaapiobject_priv.h"
|
||||||
|
#include "gstvaapiparamspecs.h"
|
||||||
#include "gstvaapimarshal.h"
|
#include "gstvaapimarshal.h"
|
||||||
|
|
||||||
#define DEBUG 1
|
#define DEBUG 1
|
||||||
|
@ -37,6 +38,7 @@ enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
|
|
||||||
PROP_DISPLAY,
|
PROP_DISPLAY,
|
||||||
|
PROP_ID
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
@ -66,6 +68,8 @@ gst_vaapi_object_finalize(GObject *object)
|
||||||
{
|
{
|
||||||
GstVaapiObjectPrivate * const priv = GST_VAAPI_OBJECT(object)->priv;
|
GstVaapiObjectPrivate * const priv = GST_VAAPI_OBJECT(object)->priv;
|
||||||
|
|
||||||
|
priv->id = VA_INVALID_ID;
|
||||||
|
|
||||||
if (priv->display) {
|
if (priv->display) {
|
||||||
g_object_unref(priv->display);
|
g_object_unref(priv->display);
|
||||||
priv->display = NULL;
|
priv->display = NULL;
|
||||||
|
@ -88,6 +92,9 @@ gst_vaapi_object_set_property(
|
||||||
case PROP_DISPLAY:
|
case PROP_DISPLAY:
|
||||||
object->priv->display = g_object_ref(g_value_get_object(value));
|
object->priv->display = g_object_ref(g_value_get_object(value));
|
||||||
break;
|
break;
|
||||||
|
case PROP_ID:
|
||||||
|
object->priv->id = gst_vaapi_value_get_id(value);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
@ -108,6 +115,9 @@ gst_vaapi_object_get_property(
|
||||||
case PROP_DISPLAY:
|
case PROP_DISPLAY:
|
||||||
g_value_set_object(value, gst_vaapi_object_get_display(object));
|
g_value_set_object(value, gst_vaapi_object_get_display(object));
|
||||||
break;
|
break;
|
||||||
|
case PROP_ID:
|
||||||
|
gst_vaapi_value_set_id(value, gst_vaapi_object_get_id(object));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
@ -140,6 +150,20 @@ gst_vaapi_object_class_init(GstVaapiObjectClass *klass)
|
||||||
GST_VAAPI_TYPE_DISPLAY,
|
GST_VAAPI_TYPE_DISPLAY,
|
||||||
G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY));
|
G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GstVaapiObject:id:
|
||||||
|
*
|
||||||
|
* The #GstVaapiID contained in this object.
|
||||||
|
*/
|
||||||
|
g_object_class_install_property
|
||||||
|
(object_class,
|
||||||
|
PROP_ID,
|
||||||
|
gst_vaapi_param_spec_id("id",
|
||||||
|
"ID",
|
||||||
|
"The GstVaapiID contained in this object",
|
||||||
|
VA_INVALID_ID,
|
||||||
|
G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GstVaapiObject::destroy:
|
* GstVaapiObject::destroy:
|
||||||
* @object: the object which received the signal
|
* @object: the object which received the signal
|
||||||
|
@ -165,6 +189,7 @@ gst_vaapi_object_init(GstVaapiObject *object)
|
||||||
|
|
||||||
object->priv = priv;
|
object->priv = priv;
|
||||||
priv->display = NULL;
|
priv->display = NULL;
|
||||||
|
priv->id = VA_INVALID_ID;
|
||||||
priv->is_destroying = FALSE;
|
priv->is_destroying = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,3 +208,19 @@ gst_vaapi_object_get_display(GstVaapiObject *object)
|
||||||
|
|
||||||
return object->priv->display;
|
return object->priv->display;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_vaapi_object_get_id:
|
||||||
|
* @object: a #GstVaapiObject
|
||||||
|
*
|
||||||
|
* Returns the #GstVaapiID contained in the @object.
|
||||||
|
*
|
||||||
|
* Return value: the #GstVaapiID of the @object
|
||||||
|
*/
|
||||||
|
GstVaapiID
|
||||||
|
gst_vaapi_object_get_id(GstVaapiObject *object)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail(GST_VAAPI_IS_OBJECT(object), NULL);
|
||||||
|
|
||||||
|
return object->priv->id;
|
||||||
|
}
|
||||||
|
|
|
@ -86,6 +86,9 @@ gst_vaapi_object_get_type(void);
|
||||||
GstVaapiDisplay *
|
GstVaapiDisplay *
|
||||||
gst_vaapi_object_get_display(GstVaapiObject *object);
|
gst_vaapi_object_get_display(GstVaapiObject *object);
|
||||||
|
|
||||||
|
GstVaapiID
|
||||||
|
gst_vaapi_object_get_id(GstVaapiObject *object);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* GST_VAAPI_OBJECT_H */
|
#endif /* GST_VAAPI_OBJECT_H */
|
||||||
|
|
|
@ -30,15 +30,27 @@ G_BEGIN_DECLS
|
||||||
GST_VAAPI_TYPE_OBJECT, \
|
GST_VAAPI_TYPE_OBJECT, \
|
||||||
GstVaapiObjectPrivate))
|
GstVaapiObjectPrivate))
|
||||||
|
|
||||||
|
#define GST_VAAPI_OBJECT_CAST(object) ((GstVaapiObject *)(object))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GST_VAAPI_OBJECT_GET_DISPLAY:
|
* GST_VAAPI_OBJECT_GET_DISPLAY:
|
||||||
* @object: a #GstVaapiObject
|
* @object: a #GstVaapiObject
|
||||||
*
|
*
|
||||||
* Macro that evaluates to the #GstVaapiDisplay @object is bound to.
|
* Macro that evaluates to the #GstVaapiDisplay the @object is bound to.
|
||||||
* This is an internal macro that does not do any run-time type checks.
|
* This is an internal macro that does not do any run-time type check.
|
||||||
*/
|
*/
|
||||||
#define GST_VAAPI_OBJECT_GET_DISPLAY(object) \
|
#define GST_VAAPI_OBJECT_GET_DISPLAY(object) \
|
||||||
(((GstVaapiObject *)(object))->priv->display)
|
GST_VAAPI_OBJECT_CAST(object)->priv->display
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GST_VAAPI_OBJECT_ID:
|
||||||
|
* @object: a #GstVaapiObject
|
||||||
|
*
|
||||||
|
* Macro that evaluates to the #GstVaapiID contained in @object.
|
||||||
|
* This is an internal macro that does not do any run-time type checks.
|
||||||
|
*/
|
||||||
|
#define GST_VAAPI_OBJECT_ID(object) \
|
||||||
|
GST_VAAPI_OBJECT_CAST(object)->priv->id
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GstVaapiObjectPrivate:
|
* GstVaapiObjectPrivate:
|
||||||
|
@ -47,6 +59,7 @@ G_BEGIN_DECLS
|
||||||
*/
|
*/
|
||||||
struct _GstVaapiObjectPrivate {
|
struct _GstVaapiObjectPrivate {
|
||||||
GstVaapiDisplay *display;
|
GstVaapiDisplay *display;
|
||||||
|
GstVaapiID id;
|
||||||
guint is_destroying : 1;
|
guint is_destroying : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -40,14 +40,12 @@ G_DEFINE_TYPE(GstVaapiSubpicture, gst_vaapi_subpicture, GST_VAAPI_TYPE_OBJECT);
|
||||||
GstVaapiSubpicturePrivate))
|
GstVaapiSubpicturePrivate))
|
||||||
|
|
||||||
struct _GstVaapiSubpicturePrivate {
|
struct _GstVaapiSubpicturePrivate {
|
||||||
VASubpictureID subpicture_id;
|
|
||||||
GstVaapiImage *image;
|
GstVaapiImage *image;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
|
|
||||||
PROP_SUBPICTURE_ID,
|
|
||||||
PROP_IMAGE
|
PROP_IMAGE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -56,23 +54,26 @@ gst_vaapi_subpicture_destroy(GstVaapiSubpicture *subpicture)
|
||||||
{
|
{
|
||||||
GstVaapiDisplay * const display = GST_VAAPI_OBJECT_GET_DISPLAY(subpicture);
|
GstVaapiDisplay * const display = GST_VAAPI_OBJECT_GET_DISPLAY(subpicture);
|
||||||
GstVaapiSubpicturePrivate * const priv = subpicture->priv;
|
GstVaapiSubpicturePrivate * const priv = subpicture->priv;
|
||||||
|
VASubpictureID subpicture_id;
|
||||||
VAStatus status;
|
VAStatus status;
|
||||||
|
|
||||||
GST_DEBUG("subpicture 0x%08x", priv->subpicture_id);
|
subpicture_id = GST_VAAPI_OBJECT_ID(subpicture);
|
||||||
|
GST_DEBUG("subpicture %" GST_VAAPI_ID_FORMAT,
|
||||||
|
GST_VAAPI_ID_ARGS(subpicture_id));
|
||||||
|
|
||||||
if (priv->subpicture_id != VA_INVALID_ID) {
|
if (subpicture_id != VA_INVALID_ID) {
|
||||||
if (display) {
|
if (display) {
|
||||||
GST_VAAPI_DISPLAY_LOCK(display);
|
GST_VAAPI_DISPLAY_LOCK(display);
|
||||||
status = vaDestroySubpicture(
|
status = vaDestroySubpicture(
|
||||||
GST_VAAPI_DISPLAY_VADISPLAY(display),
|
GST_VAAPI_DISPLAY_VADISPLAY(display),
|
||||||
priv->subpicture_id
|
subpicture_id
|
||||||
);
|
);
|
||||||
GST_VAAPI_DISPLAY_UNLOCK(display);
|
GST_VAAPI_DISPLAY_UNLOCK(display);
|
||||||
if (!vaapi_check_status(status, "vaDestroySubpicture()"))
|
if (!vaapi_check_status(status, "vaDestroySubpicture()"))
|
||||||
g_warning("failed to destroy subpicture 0x%08x\n",
|
g_warning("failed to destroy subpicture %" GST_VAAPI_ID_FORMAT "\n",
|
||||||
priv->subpicture_id);
|
GST_VAAPI_ID_ARGS(subpicture_id));
|
||||||
}
|
}
|
||||||
priv->subpicture_id = VA_INVALID_ID;
|
GST_VAAPI_OBJECT_ID(subpicture) = VA_INVALID_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->image) {
|
if (priv->image) {
|
||||||
|
@ -95,15 +96,16 @@ gst_vaapi_subpicture_create(GstVaapiSubpicture *subpicture)
|
||||||
GST_VAAPI_DISPLAY_LOCK(display);
|
GST_VAAPI_DISPLAY_LOCK(display);
|
||||||
status = vaCreateSubpicture(
|
status = vaCreateSubpicture(
|
||||||
GST_VAAPI_DISPLAY_VADISPLAY(display),
|
GST_VAAPI_DISPLAY_VADISPLAY(display),
|
||||||
gst_vaapi_image_get_id(priv->image),
|
GST_VAAPI_OBJECT_ID(priv->image),
|
||||||
&subpicture_id
|
&subpicture_id
|
||||||
);
|
);
|
||||||
GST_VAAPI_DISPLAY_UNLOCK(display);
|
GST_VAAPI_DISPLAY_UNLOCK(display);
|
||||||
if (!vaapi_check_status(status, "vaCreateSubpicture()"))
|
if (!vaapi_check_status(status, "vaCreateSubpicture()"))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
GST_DEBUG("subpicture 0x%08x", subpicture_id);
|
GST_DEBUG("subpicture %" GST_VAAPI_ID_FORMAT,
|
||||||
priv->subpicture_id = subpicture_id;
|
GST_VAAPI_ID_ARGS(subpicture_id));
|
||||||
|
GST_VAAPI_OBJECT_ID(subpicture) = subpicture_id;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,9 +148,6 @@ gst_vaapi_subpicture_get_property(
|
||||||
GstVaapiSubpicture * const subpicture = GST_VAAPI_SUBPICTURE(object);
|
GstVaapiSubpicture * const subpicture = GST_VAAPI_SUBPICTURE(object);
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_SUBPICTURE_ID:
|
|
||||||
g_value_set_uint(value, gst_vaapi_subpicture_get_id(subpicture));
|
|
||||||
break;
|
|
||||||
case PROP_IMAGE:
|
case PROP_IMAGE:
|
||||||
g_value_set_object(value, gst_vaapi_subpicture_get_image(subpicture));
|
g_value_set_object(value, gst_vaapi_subpicture_get_image(subpicture));
|
||||||
break;
|
break;
|
||||||
|
@ -169,20 +168,6 @@ gst_vaapi_subpicture_class_init(GstVaapiSubpictureClass *klass)
|
||||||
object_class->set_property = gst_vaapi_subpicture_set_property;
|
object_class->set_property = gst_vaapi_subpicture_set_property;
|
||||||
object_class->get_property = gst_vaapi_subpicture_get_property;
|
object_class->get_property = gst_vaapi_subpicture_get_property;
|
||||||
|
|
||||||
/**
|
|
||||||
* GstVaapiSubpicture:id:
|
|
||||||
*
|
|
||||||
* The underlying #VASubpictureID of the subpicture.
|
|
||||||
*/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class,
|
|
||||||
PROP_SUBPICTURE_ID,
|
|
||||||
g_param_spec_uint("id",
|
|
||||||
"VA subpicture id",
|
|
||||||
"The underlying VA subpicture id",
|
|
||||||
0, G_MAXUINT32, VA_INVALID_ID,
|
|
||||||
G_PARAM_READABLE));
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GstVaapiSubpicture:image:
|
* GstVaapiSubpicture:image:
|
||||||
*
|
*
|
||||||
|
@ -204,7 +189,6 @@ gst_vaapi_subpicture_init(GstVaapiSubpicture *subpicture)
|
||||||
GstVaapiSubpicturePrivate *priv = GST_VAAPI_SUBPICTURE_GET_PRIVATE(subpicture);
|
GstVaapiSubpicturePrivate *priv = GST_VAAPI_SUBPICTURE_GET_PRIVATE(subpicture);
|
||||||
|
|
||||||
subpicture->priv = priv;
|
subpicture->priv = priv;
|
||||||
priv->subpicture_id = VA_INVALID_ID;
|
|
||||||
priv->image = NULL;
|
priv->image = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,7 +206,8 @@ gst_vaapi_subpicture_new(GstVaapiImage *image)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail(GST_VAAPI_IS_IMAGE(image), NULL);
|
g_return_val_if_fail(GST_VAAPI_IS_IMAGE(image), NULL);
|
||||||
|
|
||||||
GST_DEBUG("create from image 0x%08x", gst_vaapi_image_get_id(image));
|
GST_DEBUG("create from image %" GST_VAAPI_ID_FORMAT,
|
||||||
|
GST_VAAPI_ID_ARGS(GST_VAAPI_OBJECT_ID(image)));
|
||||||
|
|
||||||
return g_object_new(GST_VAAPI_TYPE_SUBPICTURE,
|
return g_object_new(GST_VAAPI_TYPE_SUBPICTURE,
|
||||||
"display", GST_VAAPI_OBJECT_GET_DISPLAY(image),
|
"display", GST_VAAPI_OBJECT_GET_DISPLAY(image),
|
||||||
|
@ -230,22 +215,6 @@ gst_vaapi_subpicture_new(GstVaapiImage *image)
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_vaapi_subpicture_get_id:
|
|
||||||
* @subpicture: a #GstVaapiSubpicture
|
|
||||||
*
|
|
||||||
* Returns the underlying VASubpictureID of the @subpicture.
|
|
||||||
*
|
|
||||||
* Return value: the underlying VA subpicture id
|
|
||||||
*/
|
|
||||||
VASubpictureID
|
|
||||||
gst_vaapi_subpicture_get_id(GstVaapiSubpicture *subpicture)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail(GST_VAAPI_IS_SUBPICTURE(subpicture), VA_INVALID_ID);
|
|
||||||
|
|
||||||
return subpicture->priv->subpicture_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_vaapi_subpicture_get_image:
|
* gst_vaapi_subpicture_get_image:
|
||||||
* @subpicture: a #GstVaapiSubpicture
|
* @subpicture: a #GstVaapiSubpicture
|
||||||
|
|
|
@ -83,9 +83,6 @@ gst_vaapi_subpicture_get_type(void);
|
||||||
GstVaapiSubpicture *
|
GstVaapiSubpicture *
|
||||||
gst_vaapi_subpicture_new(GstVaapiImage *image);
|
gst_vaapi_subpicture_new(GstVaapiImage *image);
|
||||||
|
|
||||||
VASubpictureID
|
|
||||||
gst_vaapi_subpicture_get_id(GstVaapiSubpicture *subpicture);
|
|
||||||
|
|
||||||
GstVaapiImage *
|
GstVaapiImage *
|
||||||
gst_vaapi_subpicture_get_image(GstVaapiSubpicture *subpicture);
|
gst_vaapi_subpicture_get_image(GstVaapiSubpicture *subpicture);
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,6 @@ G_DEFINE_TYPE(GstVaapiSurface, gst_vaapi_surface, GST_VAAPI_TYPE_OBJECT);
|
||||||
GstVaapiSurfacePrivate))
|
GstVaapiSurfacePrivate))
|
||||||
|
|
||||||
struct _GstVaapiSurfacePrivate {
|
struct _GstVaapiSurfacePrivate {
|
||||||
VASurfaceID surface_id;
|
|
||||||
guint width;
|
guint width;
|
||||||
guint height;
|
guint height;
|
||||||
GstVaapiChromaType chroma_type;
|
GstVaapiChromaType chroma_type;
|
||||||
|
@ -50,7 +49,6 @@ struct _GstVaapiSurfacePrivate {
|
||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
|
|
||||||
PROP_SURFACE_ID,
|
|
||||||
PROP_WIDTH,
|
PROP_WIDTH,
|
||||||
PROP_HEIGHT,
|
PROP_HEIGHT,
|
||||||
PROP_CHROMA_TYPE
|
PROP_CHROMA_TYPE
|
||||||
|
@ -67,20 +65,23 @@ gst_vaapi_surface_destroy(GstVaapiSurface *surface)
|
||||||
{
|
{
|
||||||
GstVaapiDisplay * const display = GST_VAAPI_OBJECT_GET_DISPLAY(surface);
|
GstVaapiDisplay * const display = GST_VAAPI_OBJECT_GET_DISPLAY(surface);
|
||||||
GstVaapiSurfacePrivate * const priv = surface->priv;
|
GstVaapiSurfacePrivate * const priv = surface->priv;
|
||||||
|
VASurfaceID surface_id;
|
||||||
VAStatus status;
|
VAStatus status;
|
||||||
|
|
||||||
GST_DEBUG("surface 0x%08x", priv->surface_id);
|
surface_id = GST_VAAPI_OBJECT_ID(surface);
|
||||||
|
GST_DEBUG("surface %" GST_VAAPI_ID_FORMAT, GST_VAAPI_ID_ARGS(surface_id));
|
||||||
|
|
||||||
if (priv->surface_id != VA_INVALID_SURFACE) {
|
if (surface_id != VA_INVALID_SURFACE) {
|
||||||
GST_VAAPI_DISPLAY_LOCK(display);
|
GST_VAAPI_DISPLAY_LOCK(display);
|
||||||
status = vaDestroySurfaces(
|
status = vaDestroySurfaces(
|
||||||
GST_VAAPI_DISPLAY_VADISPLAY(display),
|
GST_VAAPI_DISPLAY_VADISPLAY(display),
|
||||||
&priv->surface_id, 1
|
&surface_id, 1
|
||||||
);
|
);
|
||||||
GST_VAAPI_DISPLAY_UNLOCK(display);
|
GST_VAAPI_DISPLAY_UNLOCK(display);
|
||||||
if (!vaapi_check_status(status, "vaDestroySurfaces()"))
|
if (!vaapi_check_status(status, "vaDestroySurfaces()"))
|
||||||
g_warning("failed to destroy surface 0x%08x\n", priv->surface_id);
|
g_warning("failed to destroy surface %" GST_VAAPI_ID_FORMAT "\n",
|
||||||
priv->surface_id = VA_INVALID_SURFACE;
|
GST_VAAPI_ID_ARGS(surface_id));
|
||||||
|
GST_VAAPI_OBJECT_ID(surface) = VA_INVALID_SURFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->subpictures) {
|
if (priv->subpictures) {
|
||||||
|
@ -126,8 +127,8 @@ gst_vaapi_surface_create(GstVaapiSurface *surface)
|
||||||
if (!vaapi_check_status(status, "vaCreateSurfaces()"))
|
if (!vaapi_check_status(status, "vaCreateSurfaces()"))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
GST_DEBUG("surface 0x%08x", surface_id);
|
GST_DEBUG("surface %" GST_VAAPI_ID_FORMAT, GST_VAAPI_ID_ARGS(surface_id));
|
||||||
priv->surface_id = surface_id;
|
GST_VAAPI_OBJECT_ID(surface) = surface_id;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,9 +178,6 @@ gst_vaapi_surface_get_property(
|
||||||
GstVaapiSurface * const surface = GST_VAAPI_SURFACE(object);
|
GstVaapiSurface * const surface = GST_VAAPI_SURFACE(object);
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_SURFACE_ID:
|
|
||||||
g_value_set_uint(value, gst_vaapi_surface_get_id(surface));
|
|
||||||
break;
|
|
||||||
case PROP_WIDTH:
|
case PROP_WIDTH:
|
||||||
g_value_set_uint(value, gst_vaapi_surface_get_width(surface));
|
g_value_set_uint(value, gst_vaapi_surface_get_width(surface));
|
||||||
break;
|
break;
|
||||||
|
@ -220,20 +218,6 @@ gst_vaapi_surface_class_init(GstVaapiSurfaceClass *klass)
|
||||||
object_class->get_property = gst_vaapi_surface_get_property;
|
object_class->get_property = gst_vaapi_surface_get_property;
|
||||||
object_class->constructed = gst_vaapi_surface_constructed;
|
object_class->constructed = gst_vaapi_surface_constructed;
|
||||||
|
|
||||||
/**
|
|
||||||
* GstVaapiSurface:id:
|
|
||||||
*
|
|
||||||
* The underlying #VASurfaceID of the surface.
|
|
||||||
*/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class,
|
|
||||||
PROP_SURFACE_ID,
|
|
||||||
g_param_spec_uint("id",
|
|
||||||
"VA surface id",
|
|
||||||
"The underlying VA surface id",
|
|
||||||
0, G_MAXUINT32, VA_INVALID_SURFACE,
|
|
||||||
G_PARAM_READABLE));
|
|
||||||
|
|
||||||
g_object_class_install_property
|
g_object_class_install_property
|
||||||
(object_class,
|
(object_class,
|
||||||
PROP_WIDTH,
|
PROP_WIDTH,
|
||||||
|
@ -268,7 +252,6 @@ gst_vaapi_surface_init(GstVaapiSurface *surface)
|
||||||
GstVaapiSurfacePrivate *priv = GST_VAAPI_SURFACE_GET_PRIVATE(surface);
|
GstVaapiSurfacePrivate *priv = GST_VAAPI_SURFACE_GET_PRIVATE(surface);
|
||||||
|
|
||||||
surface->priv = priv;
|
surface->priv = priv;
|
||||||
priv->surface_id = VA_INVALID_SURFACE;
|
|
||||||
priv->width = 0;
|
priv->width = 0;
|
||||||
priv->height = 0;
|
priv->height = 0;
|
||||||
priv->chroma_type = 0;
|
priv->chroma_type = 0;
|
||||||
|
@ -305,22 +288,6 @@ gst_vaapi_surface_new(
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_vaapi_surface_get_id:
|
|
||||||
* @surface: a #GstVaapiSurface
|
|
||||||
*
|
|
||||||
* Returns the underlying VASurfaceID of the @surface.
|
|
||||||
*
|
|
||||||
* Return value: the underlying VA surface id
|
|
||||||
*/
|
|
||||||
VASurfaceID
|
|
||||||
gst_vaapi_surface_get_id(GstVaapiSurface *surface)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail(GST_VAAPI_IS_SURFACE(surface), VA_INVALID_SURFACE);
|
|
||||||
|
|
||||||
return surface->priv->surface_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_vaapi_surface_get_chroma_type:
|
* gst_vaapi_surface_get_chroma_type:
|
||||||
* @surface: a #GstVaapiSurface
|
* @surface: a #GstVaapiSurface
|
||||||
|
@ -433,7 +400,7 @@ gst_vaapi_surface_derive_image(GstVaapiSurface *surface)
|
||||||
GST_VAAPI_DISPLAY_LOCK(display);
|
GST_VAAPI_DISPLAY_LOCK(display);
|
||||||
status = vaDeriveImage(
|
status = vaDeriveImage(
|
||||||
GST_VAAPI_DISPLAY_VADISPLAY(display),
|
GST_VAAPI_DISPLAY_VADISPLAY(display),
|
||||||
surface->priv->surface_id,
|
GST_VAAPI_OBJECT_ID(surface),
|
||||||
&va_image
|
&va_image
|
||||||
);
|
);
|
||||||
GST_VAAPI_DISPLAY_UNLOCK(display);
|
GST_VAAPI_DISPLAY_UNLOCK(display);
|
||||||
|
@ -474,14 +441,14 @@ gst_vaapi_surface_get_image(GstVaapiSurface *surface, GstVaapiImage *image)
|
||||||
if (width != surface->priv->width || height != surface->priv->height)
|
if (width != surface->priv->width || height != surface->priv->height)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
image_id = gst_vaapi_image_get_id(image);
|
image_id = GST_VAAPI_OBJECT_ID(image);
|
||||||
if (image_id == VA_INVALID_ID)
|
if (image_id == VA_INVALID_ID)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
GST_VAAPI_DISPLAY_LOCK(display);
|
GST_VAAPI_DISPLAY_LOCK(display);
|
||||||
status = vaGetImage(
|
status = vaGetImage(
|
||||||
GST_VAAPI_DISPLAY_VADISPLAY(display),
|
GST_VAAPI_DISPLAY_VADISPLAY(display),
|
||||||
surface->priv->surface_id,
|
GST_VAAPI_OBJECT_ID(surface),
|
||||||
0, 0, width, height,
|
0, 0, width, height,
|
||||||
image_id
|
image_id
|
||||||
);
|
);
|
||||||
|
@ -521,14 +488,14 @@ gst_vaapi_surface_put_image(GstVaapiSurface *surface, GstVaapiImage *image)
|
||||||
if (width != surface->priv->width || height != surface->priv->height)
|
if (width != surface->priv->width || height != surface->priv->height)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
image_id = gst_vaapi_image_get_id(image);
|
image_id = GST_VAAPI_OBJECT_ID(image);
|
||||||
if (image_id == VA_INVALID_ID)
|
if (image_id == VA_INVALID_ID)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
GST_VAAPI_DISPLAY_LOCK(display);
|
GST_VAAPI_DISPLAY_LOCK(display);
|
||||||
status = vaPutImage(
|
status = vaPutImage(
|
||||||
GST_VAAPI_DISPLAY_VADISPLAY(display),
|
GST_VAAPI_DISPLAY_VADISPLAY(display),
|
||||||
surface->priv->surface_id,
|
GST_VAAPI_OBJECT_ID(surface),
|
||||||
image_id,
|
image_id,
|
||||||
0, 0, width, height,
|
0, 0, width, height,
|
||||||
0, 0, width, height
|
0, 0, width, height
|
||||||
|
@ -569,6 +536,7 @@ gst_vaapi_surface_associate_subpicture(
|
||||||
GstVaapiDisplay *display;
|
GstVaapiDisplay *display;
|
||||||
GstVaapiRectangle src_rect_default, dst_rect_default;
|
GstVaapiRectangle src_rect_default, dst_rect_default;
|
||||||
GstVaapiImage *image;
|
GstVaapiImage *image;
|
||||||
|
VASurfaceID surface_id;
|
||||||
VAStatus status;
|
VAStatus status;
|
||||||
|
|
||||||
g_return_val_if_fail(GST_VAAPI_IS_SURFACE(surface), FALSE);
|
g_return_val_if_fail(GST_VAAPI_IS_SURFACE(surface), FALSE);
|
||||||
|
@ -587,6 +555,10 @@ gst_vaapi_surface_associate_subpicture(
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
surface_id = GST_VAAPI_OBJECT_ID(surface);
|
||||||
|
if (surface_id == VA_INVALID_SURFACE)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (!src_rect) {
|
if (!src_rect) {
|
||||||
image = gst_vaapi_subpicture_get_image(subpicture);
|
image = gst_vaapi_subpicture_get_image(subpicture);
|
||||||
if (!image)
|
if (!image)
|
||||||
|
@ -612,8 +584,8 @@ gst_vaapi_surface_associate_subpicture(
|
||||||
GST_VAAPI_DISPLAY_LOCK(display);
|
GST_VAAPI_DISPLAY_LOCK(display);
|
||||||
status = vaAssociateSubpicture(
|
status = vaAssociateSubpicture(
|
||||||
GST_VAAPI_DISPLAY_VADISPLAY(display),
|
GST_VAAPI_DISPLAY_VADISPLAY(display),
|
||||||
gst_vaapi_subpicture_get_id(subpicture),
|
GST_VAAPI_OBJECT_ID(subpicture),
|
||||||
&surface->priv->surface_id, 1,
|
&surface_id, 1,
|
||||||
src_rect->x, src_rect->y, src_rect->width, src_rect->height,
|
src_rect->x, src_rect->y, src_rect->width, src_rect->height,
|
||||||
dst_rect->x, dst_rect->y, dst_rect->width, dst_rect->height,
|
dst_rect->x, dst_rect->y, dst_rect->width, dst_rect->height,
|
||||||
0
|
0
|
||||||
|
@ -642,6 +614,7 @@ gst_vaapi_surface_deassociate_subpicture(
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
GstVaapiDisplay *display;
|
GstVaapiDisplay *display;
|
||||||
|
VASurfaceID surface_id;
|
||||||
VAStatus status;
|
VAStatus status;
|
||||||
|
|
||||||
g_return_val_if_fail(GST_VAAPI_IS_SURFACE(surface), FALSE);
|
g_return_val_if_fail(GST_VAAPI_IS_SURFACE(surface), FALSE);
|
||||||
|
@ -656,17 +629,22 @@ gst_vaapi_surface_deassociate_subpicture(
|
||||||
|
|
||||||
/* First, check subpicture was really associated with this surface */
|
/* First, check subpicture was really associated with this surface */
|
||||||
if (!g_ptr_array_remove_fast(surface->priv->subpictures, subpicture)) {
|
if (!g_ptr_array_remove_fast(surface->priv->subpictures, subpicture)) {
|
||||||
GST_DEBUG("subpicture 0x%08x was not bound to surface 0x%08x",
|
GST_DEBUG("subpicture %" GST_VAAPI_ID_FORMAT "was not bound to "
|
||||||
gst_vaapi_subpicture_get_id(subpicture),
|
"surface %" GST_VAAPI_ID_FORMAT,
|
||||||
surface->priv->surface_id);
|
GST_VAAPI_ID_ARGS(GST_VAAPI_OBJECT_ID(subpicture)),
|
||||||
|
GST_VAAPI_ID_ARGS(GST_VAAPI_OBJECT_ID(surface)));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
surface_id = GST_VAAPI_OBJECT_ID(surface);
|
||||||
|
if (surface_id == VA_INVALID_SURFACE)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
GST_VAAPI_DISPLAY_LOCK(display);
|
GST_VAAPI_DISPLAY_LOCK(display);
|
||||||
status = vaDeassociateSubpicture(
|
status = vaDeassociateSubpicture(
|
||||||
GST_VAAPI_DISPLAY_VADISPLAY(display),
|
GST_VAAPI_DISPLAY_VADISPLAY(display),
|
||||||
gst_vaapi_subpicture_get_id(subpicture),
|
GST_VAAPI_OBJECT_ID(subpicture),
|
||||||
&surface->priv->surface_id, 1
|
&surface_id, 1
|
||||||
);
|
);
|
||||||
GST_VAAPI_DISPLAY_UNLOCK(display);
|
GST_VAAPI_DISPLAY_UNLOCK(display);
|
||||||
g_object_unref(subpicture);
|
g_object_unref(subpicture);
|
||||||
|
@ -699,7 +677,7 @@ gst_vaapi_surface_sync(GstVaapiSurface *surface)
|
||||||
GST_VAAPI_DISPLAY_LOCK(display);
|
GST_VAAPI_DISPLAY_LOCK(display);
|
||||||
status = vaSyncSurface(
|
status = vaSyncSurface(
|
||||||
GST_VAAPI_DISPLAY_VADISPLAY(display),
|
GST_VAAPI_DISPLAY_VADISPLAY(display),
|
||||||
surface->priv->surface_id
|
GST_VAAPI_OBJECT_ID(surface)
|
||||||
);
|
);
|
||||||
GST_VAAPI_DISPLAY_UNLOCK(display);
|
GST_VAAPI_DISPLAY_UNLOCK(display);
|
||||||
if (!vaapi_check_status(status, "vaSyncSurface()"))
|
if (!vaapi_check_status(status, "vaSyncSurface()"))
|
||||||
|
|
|
@ -133,9 +133,6 @@ gst_vaapi_surface_new(
|
||||||
guint height
|
guint height
|
||||||
);
|
);
|
||||||
|
|
||||||
VASurfaceID
|
|
||||||
gst_vaapi_surface_get_id(GstVaapiSurface *surface);
|
|
||||||
|
|
||||||
GstVaapiChromaType
|
GstVaapiChromaType
|
||||||
gst_vaapi_surface_get_chroma_type(GstVaapiSurface *surface);
|
gst_vaapi_surface_get_chroma_type(GstVaapiSurface *surface);
|
||||||
|
|
||||||
|
|
|
@ -404,7 +404,7 @@ gst_vaapi_window_x11_render(
|
||||||
if (!display)
|
if (!display)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
surface_id = gst_vaapi_surface_get_id(surface);
|
surface_id = GST_VAAPI_OBJECT_ID(surface);
|
||||||
if (surface_id == VA_INVALID_ID)
|
if (surface_id == VA_INVALID_ID)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
|
|
@ -33,12 +33,13 @@ gst_vaapi_object_destroy_cb(gpointer object, gpointer user_data)
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
GstVaapiDisplay *display;
|
GstVaapiDisplay *display;
|
||||||
GstVaapiSurface *surface;
|
GstVaapiSurface *surface;
|
||||||
GstVaapiSurface *surfaces[MAX_SURFACES];
|
GstVaapiID surface_id;
|
||||||
GstVaapiVideoPool *pool;
|
GstVaapiSurface *surfaces[MAX_SURFACES];
|
||||||
GstCaps *caps;
|
GstVaapiVideoPool *pool;
|
||||||
gint i;
|
GstCaps *caps;
|
||||||
|
gint i;
|
||||||
|
|
||||||
static const GstVaapiChromaType chroma_type = GST_VAAPI_CHROMA_TYPE_YUV420;
|
static const GstVaapiChromaType chroma_type = GST_VAAPI_CHROMA_TYPE_YUV420;
|
||||||
static const guint width = 320;
|
static const guint width = 320;
|
||||||
|
@ -53,6 +54,14 @@ main(int argc, char *argv[])
|
||||||
surface = gst_vaapi_surface_new(display, chroma_type, width, height);
|
surface = gst_vaapi_surface_new(display, chroma_type, width, height);
|
||||||
if (!surface)
|
if (!surface)
|
||||||
g_error("could not create Gst/VA surface");
|
g_error("could not create Gst/VA surface");
|
||||||
|
|
||||||
|
/* This also tests for the GstVaapiParamSpecID */
|
||||||
|
g_object_get(G_OBJECT(surface), "id", &surface_id, NULL);
|
||||||
|
if (surface_id != gst_vaapi_object_get_id(GST_VAAPI_OBJECT(surface)))
|
||||||
|
g_error("could not retrieve the native surface ID");
|
||||||
|
g_print("created surface %" GST_VAAPI_ID_FORMAT "\n",
|
||||||
|
GST_VAAPI_ID_ARGS(surface_id));
|
||||||
|
|
||||||
g_object_unref(surface);
|
g_object_unref(surface);
|
||||||
|
|
||||||
caps = gst_caps_new_simple(
|
caps = gst_caps_new_simple(
|
||||||
|
@ -72,8 +81,8 @@ main(int argc, char *argv[])
|
||||||
surface = gst_vaapi_video_pool_get_object(pool);
|
surface = gst_vaapi_video_pool_get_object(pool);
|
||||||
if (!surface)
|
if (!surface)
|
||||||
g_error("could not allocate Gst/VA surface from pool");
|
g_error("could not allocate Gst/VA surface from pool");
|
||||||
g_print("created surface 0x%08x from pool\n",
|
g_print("created surface %" GST_VAAPI_ID_FORMAT " from pool\n",
|
||||||
gst_vaapi_surface_get_id(surface));
|
GST_VAAPI_ID_ARGS(gst_vaapi_object_get_id(GST_VAAPI_OBJECT(surface))));
|
||||||
surfaces[i] = surface;
|
surfaces[i] = surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,8 +96,8 @@ main(int argc, char *argv[])
|
||||||
surfaces[i] = gst_vaapi_video_pool_get_object(pool);
|
surfaces[i] = gst_vaapi_video_pool_get_object(pool);
|
||||||
if (!surfaces[i])
|
if (!surfaces[i])
|
||||||
g_error("could not re-allocate Gst/VA surface%d from pool", i);
|
g_error("could not re-allocate Gst/VA surface%d from pool", i);
|
||||||
g_print("created surface 0x%08x from pool (realloc)\n",
|
g_print("created surface %" GST_VAAPI_ID_FORMAT " from pool (realloc)\n",
|
||||||
gst_vaapi_surface_get_id(surfaces[i]));
|
GST_VAAPI_ID_ARGS(gst_vaapi_object_get_id(GST_VAAPI_OBJECT(surfaces[i]))));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (surface == surfaces[0])
|
if (surface == surfaces[0])
|
||||||
|
|
Loading…
Reference in a new issue