mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 11:55:39 +00:00
libs: display: replace gst_vaapi_display_new() with gst_vaapi_display_config()
Gobjectification for GstVaapiDisplay was almost done by the commit 185da3d1
.
But still something breaking GObject code convention remains, which is
calling gst_vaapi_display_new() in each decendants.
This patch replaces it with gst_vaapi_display_config(), defined in private
header.
https://bugzilla.gnome.org/show_bug.cgi?id=796470
This commit is contained in:
parent
8de7dcfe3c
commit
a6881b9b5e
7 changed files with 68 additions and 22 deletions
|
@ -1143,11 +1143,24 @@ gst_vaapi_display_class_init (GstVaapiDisplayClass * klass)
|
|||
g_object_class_install_properties (object_class, N_PROPERTIES, g_properties);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_vaapi_display_config:
|
||||
* @display: instance of #GstVaapiDisplay
|
||||
* @init_type: type of initialization #GstVaapiDisplayInitType
|
||||
* @init_value: a pointer to the structure with the initialization
|
||||
* parameters
|
||||
*
|
||||
* Binds @display to the VA layer; otherwise it is just an empty
|
||||
* structure.
|
||||
*
|
||||
* Returns: the configured @display if it was configured correctly;
|
||||
* otherwise unrefs @display and returns %NULL.
|
||||
**/
|
||||
GstVaapiDisplay *
|
||||
gst_vaapi_display_new (GstVaapiDisplay * display,
|
||||
gst_vaapi_display_config (GstVaapiDisplay * display,
|
||||
GstVaapiDisplayInitType init_type, gpointer init_value)
|
||||
{
|
||||
g_return_val_if_fail (display != NULL, NULL);
|
||||
g_return_val_if_fail (display && GST_VAAPI_IS_DISPLAY (display), NULL);
|
||||
|
||||
if (!gst_vaapi_display_create (display, init_type, init_value))
|
||||
goto error;
|
||||
|
@ -1156,7 +1169,7 @@ gst_vaapi_display_new (GstVaapiDisplay * display,
|
|||
/* ERRORS */
|
||||
error:
|
||||
{
|
||||
gst_vaapi_display_unref (display);
|
||||
gst_object_unref (display);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -1177,7 +1190,7 @@ gst_vaapi_display_new_with_display (VADisplay va_display)
|
|||
.va_display = va_display,
|
||||
};
|
||||
|
||||
return gst_vaapi_display_new (g_object_new (GST_TYPE_VAAPI_DISPLAY, NULL),
|
||||
return gst_vaapi_display_config (g_object_new (GST_TYPE_VAAPI_DISPLAY, NULL),
|
||||
GST_VAAPI_DISPLAY_INIT_FROM_VA_DISPLAY, &info);
|
||||
}
|
||||
|
||||
|
|
|
@ -395,8 +395,8 @@ gst_vaapi_display_drm_new (const gchar * device_path)
|
|||
|
||||
for (i = 0; i < num_types; i++) {
|
||||
g_drm_device_type = types[i];
|
||||
display =
|
||||
gst_vaapi_display_new (g_object_new (GST_TYPE_VAAPI_DISPLAY_DRM, NULL),
|
||||
display = g_object_new (GST_TYPE_VAAPI_DISPLAY_DRM, NULL);
|
||||
display = gst_vaapi_display_config (display,
|
||||
GST_VAAPI_DISPLAY_INIT_FROM_DISPLAY_NAME, (gpointer) device_path);
|
||||
if (display || device_path)
|
||||
break;
|
||||
|
@ -419,9 +419,12 @@ gst_vaapi_display_drm_new (const gchar * device_path)
|
|||
GstVaapiDisplay *
|
||||
gst_vaapi_display_drm_new_with_device (gint device)
|
||||
{
|
||||
GstVaapiDisplay *display;
|
||||
|
||||
g_return_val_if_fail (device >= 0, NULL);
|
||||
|
||||
return gst_vaapi_display_new (g_object_new (GST_TYPE_VAAPI_DISPLAY_DRM, NULL),
|
||||
display = g_object_new (GST_TYPE_VAAPI_DISPLAY_DRM, NULL);
|
||||
return gst_vaapi_display_config (display,
|
||||
GST_VAAPI_DISPLAY_INIT_FROM_NATIVE_DISPLAY, GINT_TO_POINTER (device));
|
||||
}
|
||||
|
||||
|
|
|
@ -366,6 +366,7 @@ gst_vaapi_display_egl_class_init (GstVaapiDisplayEGLClass * klass)
|
|||
GstVaapiDisplay *
|
||||
gst_vaapi_display_egl_new (GstVaapiDisplay * display, guint gles_version)
|
||||
{
|
||||
GstVaapiDisplay *wrapper_display;
|
||||
InitParams params = {
|
||||
.gles_version = gles_version,
|
||||
};
|
||||
|
@ -375,7 +376,8 @@ gst_vaapi_display_egl_new (GstVaapiDisplay * display, guint gles_version)
|
|||
params.display_type = GST_VAAPI_DISPLAY_VADISPLAY_TYPE (display);
|
||||
}
|
||||
|
||||
return gst_vaapi_display_new (g_object_new (GST_TYPE_VAAPI_DISPLAY_EGL, NULL),
|
||||
wrapper_display = g_object_new (GST_TYPE_VAAPI_DISPLAY_EGL, NULL);
|
||||
return gst_vaapi_display_config (wrapper_display,
|
||||
GST_VAAPI_DISPLAY_INIT_FROM_NATIVE_DISPLAY, ¶ms);
|
||||
}
|
||||
|
||||
|
@ -399,6 +401,7 @@ GstVaapiDisplay *
|
|||
gst_vaapi_display_egl_new_with_native_display (gpointer native_display,
|
||||
GstVaapiDisplayType display_type, guint gles_version)
|
||||
{
|
||||
GstVaapiDisplay *display;
|
||||
InitParams params = {
|
||||
.display_type = display_type,
|
||||
.gl_display = native_display,
|
||||
|
@ -407,7 +410,8 @@ gst_vaapi_display_egl_new_with_native_display (gpointer native_display,
|
|||
|
||||
g_return_val_if_fail (native_display != NULL, NULL);
|
||||
|
||||
return gst_vaapi_display_new (g_object_new (GST_TYPE_VAAPI_DISPLAY_EGL, NULL),
|
||||
display = g_object_new (GST_TYPE_VAAPI_DISPLAY_EGL, NULL);
|
||||
return gst_vaapi_display_config (display,
|
||||
GST_VAAPI_DISPLAY_INIT_FROM_NATIVE_DISPLAY, ¶ms);
|
||||
}
|
||||
|
||||
|
|
|
@ -128,7 +128,10 @@ gst_vaapi_display_glx_class_init (GstVaapiDisplayGLXClass * klass)
|
|||
GstVaapiDisplay *
|
||||
gst_vaapi_display_glx_new (const gchar * display_name)
|
||||
{
|
||||
return gst_vaapi_display_new (g_object_new (GST_TYPE_VAAPI_DISPLAY_GLX, NULL),
|
||||
GstVaapiDisplay *display;
|
||||
|
||||
display = g_object_new (GST_TYPE_VAAPI_DISPLAY_GLX, NULL);
|
||||
return gst_vaapi_display_config (display,
|
||||
GST_VAAPI_DISPLAY_INIT_FROM_DISPLAY_NAME, (gpointer) display_name);
|
||||
}
|
||||
|
||||
|
@ -146,8 +149,11 @@ gst_vaapi_display_glx_new (const gchar * display_name)
|
|||
GstVaapiDisplay *
|
||||
gst_vaapi_display_glx_new_with_display (Display * x11_display)
|
||||
{
|
||||
GstVaapiDisplay *display;
|
||||
|
||||
g_return_val_if_fail (x11_display != NULL, NULL);
|
||||
|
||||
return gst_vaapi_display_new (g_object_new (GST_TYPE_VAAPI_DISPLAY_GLX, NULL),
|
||||
display = g_object_new (GST_TYPE_VAAPI_DISPLAY_GLX, NULL);
|
||||
return gst_vaapi_display_config (display,
|
||||
GST_VAAPI_DISPLAY_INIT_FROM_NATIVE_DISPLAY, x11_display);
|
||||
}
|
||||
|
|
|
@ -201,7 +201,7 @@ enum _GstVaapiDisplayInitType
|
|||
};
|
||||
|
||||
GstVaapiDisplay *
|
||||
gst_vaapi_display_new (GstVaapiDisplay * display,
|
||||
gst_vaapi_display_config (GstVaapiDisplay * display,
|
||||
GstVaapiDisplayInitType init_type, gpointer init_value);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -325,9 +325,11 @@ gst_vaapi_display_wayland_class_init (GstVaapiDisplayWaylandClass * klass)
|
|||
GstVaapiDisplay *
|
||||
gst_vaapi_display_wayland_new (const gchar * display_name)
|
||||
{
|
||||
return gst_vaapi_display_new (g_object_new (GST_TYPE_VAAPI_DISPLAY_WAYLAND,
|
||||
NULL), GST_VAAPI_DISPLAY_INIT_FROM_DISPLAY_NAME,
|
||||
(gpointer) display_name);
|
||||
GstVaapiDisplay *display;
|
||||
|
||||
display = g_object_new (GST_TYPE_VAAPI_DISPLAY_WAYLAND, NULL);
|
||||
return gst_vaapi_display_config (display,
|
||||
GST_VAAPI_DISPLAY_INIT_FROM_DISPLAY_NAME, (gpointer) display_name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -344,10 +346,13 @@ gst_vaapi_display_wayland_new (const gchar * display_name)
|
|||
GstVaapiDisplay *
|
||||
gst_vaapi_display_wayland_new_with_display (struct wl_display * wl_display)
|
||||
{
|
||||
GstVaapiDisplay *display;
|
||||
|
||||
g_return_val_if_fail (wl_display, NULL);
|
||||
|
||||
return gst_vaapi_display_new (g_object_new (GST_TYPE_VAAPI_DISPLAY_WAYLAND,
|
||||
NULL), GST_VAAPI_DISPLAY_INIT_FROM_NATIVE_DISPLAY, wl_display);
|
||||
display = g_object_new (GST_TYPE_VAAPI_DISPLAY_WAYLAND, NULL);
|
||||
return gst_vaapi_display_config (display,
|
||||
GST_VAAPI_DISPLAY_INIT_FROM_NATIVE_DISPLAY, wl_display);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -368,6 +373,7 @@ GstVaapiDisplay *
|
|||
gst_vaapi_display_wayland_new_with_va_display (VADisplay va_display,
|
||||
struct wl_display * wl_display)
|
||||
{
|
||||
GstVaapiDisplay *display;
|
||||
GstVaapiDisplayInfo info = {
|
||||
.va_display = va_display,
|
||||
.native_display = wl_display,
|
||||
|
@ -375,8 +381,14 @@ gst_vaapi_display_wayland_new_with_va_display (VADisplay va_display,
|
|||
|
||||
g_return_val_if_fail (wl_display, NULL);
|
||||
|
||||
return gst_vaapi_display_new (g_object_new (GST_TYPE_VAAPI_DISPLAY_WAYLAND,
|
||||
NULL), GST_VAAPI_DISPLAY_INIT_FROM_VA_DISPLAY, &info);
|
||||
display = g_object_new (GST_TYPE_VAAPI_DISPLAY_WAYLAND, NULL);
|
||||
if (!gst_vaapi_display_config (display,
|
||||
GST_VAAPI_DISPLAY_INIT_FROM_VA_DISPLAY, &info)) {
|
||||
gst_object_unref (display);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return display;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -348,7 +348,10 @@ gst_vaapi_display_x11_init (GstVaapiDisplayX11 * display)
|
|||
GstVaapiDisplay *
|
||||
gst_vaapi_display_x11_new (const gchar * display_name)
|
||||
{
|
||||
return gst_vaapi_display_new (g_object_new (GST_TYPE_VAAPI_DISPLAY_X11, NULL),
|
||||
GstVaapiDisplay *display;
|
||||
|
||||
display = g_object_new (GST_TYPE_VAAPI_DISPLAY_X11, NULL);
|
||||
return gst_vaapi_display_config (display,
|
||||
GST_VAAPI_DISPLAY_INIT_FROM_DISPLAY_NAME, (gpointer) display_name);
|
||||
}
|
||||
|
||||
|
@ -366,9 +369,12 @@ gst_vaapi_display_x11_new (const gchar * display_name)
|
|||
GstVaapiDisplay *
|
||||
gst_vaapi_display_x11_new_with_display (Display * x11_display)
|
||||
{
|
||||
GstVaapiDisplay *display;
|
||||
|
||||
g_return_val_if_fail (x11_display, NULL);
|
||||
|
||||
return gst_vaapi_display_new (g_object_new (GST_TYPE_VAAPI_DISPLAY_X11, NULL),
|
||||
display = g_object_new (GST_TYPE_VAAPI_DISPLAY_X11, NULL);
|
||||
return gst_vaapi_display_config (display,
|
||||
GST_VAAPI_DISPLAY_INIT_FROM_NATIVE_DISPLAY, x11_display);
|
||||
}
|
||||
|
||||
|
@ -376,6 +382,7 @@ GstVaapiDisplay *
|
|||
gst_vaapi_display_x11_new_with_va_display (VADisplay va_display,
|
||||
Display * x11_display)
|
||||
{
|
||||
GstVaapiDisplay *display;
|
||||
GstVaapiDisplayInfo info = {
|
||||
.va_display = va_display,
|
||||
.native_display = x11_display,
|
||||
|
@ -383,7 +390,8 @@ gst_vaapi_display_x11_new_with_va_display (VADisplay va_display,
|
|||
|
||||
g_return_val_if_fail (x11_display, NULL);
|
||||
|
||||
return gst_vaapi_display_new (g_object_new (GST_TYPE_VAAPI_DISPLAY_X11, NULL),
|
||||
display = g_object_new (GST_TYPE_VAAPI_DISPLAY_X11, NULL);
|
||||
return gst_vaapi_display_config (display,
|
||||
GST_VAAPI_DISPLAY_INIT_FROM_VA_DISPLAY, &info);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue