mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 10:41:04 +00:00
libs: display: redirect logging at initialize
Redirect libva's logs to GStreamer logging mechanism. This is particularly useful when VA is initialized, because it always logs out the drivers details. In order to achieve this a new helper function was added as a wrapper for the vaInitialize() function. https://bugzilla.gnome.org/show_bug.cgi?id=777115
This commit is contained in:
parent
bca2b1680b
commit
1e0b3c2f74
4 changed files with 40 additions and 7 deletions
|
@ -900,8 +900,6 @@ gst_vaapi_display_create_unlocked (GstVaapiDisplay * display,
|
|||
GstVaapiDisplayPrivate *const priv = GST_VAAPI_DISPLAY_GET_PRIVATE (display);
|
||||
const GstVaapiDisplayClass *const klass =
|
||||
GST_VAAPI_DISPLAY_GET_CLASS (display);
|
||||
gint major_version, minor_version;
|
||||
VAStatus status;
|
||||
GstVaapiDisplayInfo info;
|
||||
const GstVaapiDisplayInfo *cached_info = NULL;
|
||||
|
||||
|
@ -947,10 +945,8 @@ gst_vaapi_display_create_unlocked (GstVaapiDisplay * display,
|
|||
}
|
||||
|
||||
if (!priv->parent) {
|
||||
status = vaInitialize (priv->display, &major_version, &minor_version);
|
||||
if (!vaapi_check_status (status, "vaInitialize()"))
|
||||
if (!vaapi_initialize (priv->display))
|
||||
return FALSE;
|
||||
GST_DEBUG ("VA-API version %d.%d", major_version, minor_version);
|
||||
}
|
||||
|
||||
if (!cached_info) {
|
||||
|
|
|
@ -63,13 +63,12 @@ supports_vaapi (int fd)
|
|||
{
|
||||
gboolean ret;
|
||||
VADisplay va_dpy;
|
||||
int major, minor;
|
||||
|
||||
va_dpy = vaGetDisplayDRM (fd);
|
||||
if (!va_dpy)
|
||||
return FALSE;
|
||||
|
||||
ret = (vaInitialize (va_dpy, &major, &minor) == VA_STATUS_SUCCESS);
|
||||
ret = vaapi_initialize (va_dpy);
|
||||
vaTerminate (va_dpy);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -45,6 +45,39 @@
|
|||
#define STRCASEP(p, x) STRCASE(CONCAT(p, x))
|
||||
#define STRCASE(x) case x: return STRINGIFY(x)
|
||||
|
||||
#if VA_CHECK_VERSION (0,39,4)
|
||||
static void
|
||||
gst_vaapi_log (const char *message)
|
||||
{
|
||||
gchar *msg;
|
||||
|
||||
msg = g_strdup (message);
|
||||
if (!msg)
|
||||
return;
|
||||
g_strchomp (msg);
|
||||
GST_INFO ("%s", msg);
|
||||
g_free (msg);
|
||||
}
|
||||
#endif
|
||||
|
||||
gboolean
|
||||
vaapi_initialize (VADisplay dpy)
|
||||
{
|
||||
gint major_version, minor_version;
|
||||
VAStatus status;
|
||||
|
||||
#if VA_CHECK_VERSION (0,39,4)
|
||||
vaSetInfoCallback (gst_vaapi_log);
|
||||
#endif
|
||||
|
||||
status = vaInitialize (dpy, &major_version, &minor_version);
|
||||
if (!vaapi_check_status (status, "vaInitialize()"))
|
||||
return FALSE;
|
||||
|
||||
GST_INFO ("VA-API version %d.%d", major_version, minor_version);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Check VA status for success or print out an error */
|
||||
gboolean
|
||||
vaapi_check_status (VAStatus status, const gchar * msg)
|
||||
|
|
|
@ -30,6 +30,11 @@
|
|||
#include <glib.h>
|
||||
#include <va/va.h>
|
||||
|
||||
/** calls vaInitialize() redirecting the logging mechanism */
|
||||
G_GNUC_INTERNAL
|
||||
gboolean
|
||||
vaapi_initialize (VADisplay dpy);
|
||||
|
||||
/** Check VA status for success or print out an error */
|
||||
G_GNUC_INTERNAL
|
||||
gboolean
|
||||
|
|
Loading…
Reference in a new issue