mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
plugins: use new display types more.
In particular, simplify gst_vaapi_reply_to_query() with display types. Likewise for creating new video buffers.
This commit is contained in:
parent
cff117b54d
commit
efe623c253
2 changed files with 38 additions and 22 deletions
|
@ -30,14 +30,22 @@
|
||||||
#endif
|
#endif
|
||||||
#include "gstvaapipluginbuffer.h"
|
#include "gstvaapipluginbuffer.h"
|
||||||
|
|
||||||
static inline GType
|
static GType
|
||||||
get_type(GstVaapiDisplay *display)
|
get_type(GstVaapiDisplay *display)
|
||||||
{
|
{
|
||||||
|
GType type;
|
||||||
|
|
||||||
|
switch (gst_vaapi_display_get_display_type(display)) {
|
||||||
#if USE_GLX
|
#if USE_GLX
|
||||||
if (GST_VAAPI_IS_DISPLAY_GLX(display))
|
case GST_VAAPI_DISPLAY_TYPE_GLX:
|
||||||
return GST_VAAPI_TYPE_VIDEO_BUFFER_GLX;
|
type = GST_VAAPI_TYPE_VIDEO_BUFFER_GLX;
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
return GST_VAAPI_TYPE_VIDEO_BUFFER;
|
default:
|
||||||
|
type = GST_VAAPI_TYPE_VIDEO_BUFFER;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
GstBuffer *
|
GstBuffer *
|
||||||
|
|
|
@ -161,6 +161,7 @@ gst_vaapi_set_display(
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_reply_to_query(GstQuery *query, GstVaapiDisplay *display)
|
gst_vaapi_reply_to_query(GstQuery *query, GstVaapiDisplay *display)
|
||||||
{
|
{
|
||||||
|
GstVaapiDisplayType display_type;
|
||||||
const gchar **types;
|
const gchar **types;
|
||||||
const gchar *type;
|
const gchar *type;
|
||||||
gint i;
|
gint i;
|
||||||
|
@ -174,9 +175,11 @@ gst_vaapi_reply_to_query(GstQuery *query, GstVaapiDisplay *display)
|
||||||
if (!types)
|
if (!types)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
for (i = 0; types[i]; i++) {
|
display_type = gst_vaapi_display_get_display_type(display);
|
||||||
|
for (i = 0; types[i] && !res; i++) {
|
||||||
type = types[i];
|
type = types[i];
|
||||||
|
|
||||||
|
res = TRUE;
|
||||||
if (!strcmp(type, "gst-vaapi-display")) {
|
if (!strcmp(type, "gst-vaapi-display")) {
|
||||||
gst_video_context_query_set_object(query, type, G_OBJECT(display));
|
gst_video_context_query_set_object(query, type, G_OBJECT(display));
|
||||||
}
|
}
|
||||||
|
@ -184,26 +187,31 @@ gst_vaapi_reply_to_query(GstQuery *query, GstVaapiDisplay *display)
|
||||||
VADisplay vadpy = gst_vaapi_display_get_display(display);
|
VADisplay vadpy = gst_vaapi_display_get_display(display);
|
||||||
gst_video_context_query_set_pointer(query, type, vadpy);
|
gst_video_context_query_set_pointer(query, type, vadpy);
|
||||||
}
|
}
|
||||||
else if (!strcmp(type, "x11-display") &&
|
|
||||||
GST_VAAPI_IS_DISPLAY_X11(display)) {
|
|
||||||
GstVaapiDisplayX11 *xvadpy = GST_VAAPI_DISPLAY_X11(display);
|
|
||||||
Display *x11dpy = gst_vaapi_display_x11_get_display(xvadpy);
|
|
||||||
gst_video_context_query_set_pointer(query, type, x11dpy);
|
|
||||||
|
|
||||||
}
|
|
||||||
else if (!strcmp(type, "x11-display-name") &&
|
|
||||||
GST_VAAPI_IS_DISPLAY_X11(display)) {
|
|
||||||
GstVaapiDisplayX11 *xvadpy = GST_VAAPI_DISPLAY_X11(display);
|
|
||||||
Display *x11dpy = gst_vaapi_display_x11_get_display(xvadpy);
|
|
||||||
gst_video_context_query_set_string(query, type, DisplayString(x11dpy));
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
continue;
|
switch (display_type) {
|
||||||
}
|
#if USE_GLX
|
||||||
|
case GST_VAAPI_DISPLAY_TYPE_GLX:
|
||||||
res = TRUE;
|
#endif
|
||||||
|
case GST_VAAPI_DISPLAY_TYPE_X11: {
|
||||||
|
GstVaapiDisplayX11 * const xvadpy =
|
||||||
|
GST_VAAPI_DISPLAY_X11(display);
|
||||||
|
Display * const x11dpy =
|
||||||
|
gst_vaapi_display_x11_get_display(xvadpy);
|
||||||
|
if (!strcmp(type, "x11-display"))
|
||||||
|
gst_video_context_query_set_pointer(query, type, x11dpy);
|
||||||
|
else if (!strcmp(type, "x11-display-name"))
|
||||||
|
gst_video_context_query_set_string(query, type,
|
||||||
|
DisplayString(x11dpy));
|
||||||
|
else
|
||||||
|
res = FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
res = FALSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue