mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-31 03:29:50 +00:00
display: add utility function to query VA driver name.
Add gst_vaapi_display_get_vendor_string() helper function to query the underlying VA driver name. The display object owns the resulting string, so it shall not be deallocated. That function is thread-safe. It could be used for debugging purposes, for instance.
This commit is contained in:
parent
71053228b3
commit
c0993182bd
3 changed files with 45 additions and 0 deletions
|
@ -854,6 +854,9 @@ gst_vaapi_display_destroy (GstVaapiDisplay * display)
|
|||
klass->close_display (display);
|
||||
}
|
||||
|
||||
g_free (priv->vendor_string);
|
||||
priv->vendor_string = NULL;
|
||||
|
||||
gst_vaapi_display_replace_internal (&priv->parent, NULL);
|
||||
|
||||
g_mutex_lock (&g_display_cache_lock);
|
||||
|
@ -2031,3 +2034,41 @@ set_color_balance (GstVaapiDisplay * display, guint prop_id, gfloat v)
|
|||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Ensures the VA driver vendor string was copied */
|
||||
static gboolean
|
||||
ensure_vendor_string (GstVaapiDisplay * display)
|
||||
{
|
||||
GstVaapiDisplayPrivate *const priv = GST_VAAPI_DISPLAY_GET_PRIVATE (display);
|
||||
const gchar *vendor_string;
|
||||
|
||||
GST_VAAPI_DISPLAY_LOCK (display);
|
||||
if (!priv->vendor_string) {
|
||||
vendor_string = vaQueryVendorString (priv->display);
|
||||
if (vendor_string)
|
||||
priv->vendor_string = g_strdup (vendor_string);
|
||||
}
|
||||
GST_VAAPI_DISPLAY_UNLOCK (display);
|
||||
return priv->vendor_string != NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_vaapi_display_get_vendor_string:
|
||||
* @display: a #GstVaapiDisplay
|
||||
*
|
||||
* Returns the VA driver vendor string attached to the supplied VA @display.
|
||||
* The @display owns the vendor string, do *not* de-allocate it.
|
||||
*
|
||||
* This function is thread safe.
|
||||
*
|
||||
* Return value: the current #GstVaapiRotation value
|
||||
*/
|
||||
const gchar *
|
||||
gst_vaapi_display_get_vendor_string (GstVaapiDisplay * display)
|
||||
{
|
||||
g_return_val_if_fail (display != NULL, NULL);
|
||||
|
||||
if (!ensure_vendor_string (display))
|
||||
return NULL;
|
||||
return display->priv.vendor_string;
|
||||
}
|
||||
|
|
|
@ -198,6 +198,9 @@ gboolean
|
|||
gst_vaapi_display_set_rotation (GstVaapiDisplay * display,
|
||||
GstVaapiRotation rotation);
|
||||
|
||||
const gchar *
|
||||
gst_vaapi_display_get_vendor_string (GstVaapiDisplay * display);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* GST_VAAPI_DISPLAY_H */
|
||||
|
|
|
@ -156,6 +156,7 @@ struct _GstVaapiDisplayPrivate
|
|||
GArray *image_formats;
|
||||
GArray *subpicture_formats;
|
||||
GArray *properties;
|
||||
gchar *vendor_string;
|
||||
guint use_foreign_display:1;
|
||||
guint has_vpp:1;
|
||||
guint has_profiles:1;
|
||||
|
|
Loading…
Reference in a new issue