summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-07-25 14:51:28 +0200
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-07-25 15:03:48 +0200
commitefe623c25335bdbed3cc21601cc7a47aae0de82b (patch)
tree90ec162cc48c5429d0d083d985cb2dff11546500 /gst
parentcff117b54dbfbd58a8bf483dd710a85989b057e2 (diff)
plugins: use new display types more.
In particular, simplify gst_vaapi_reply_to_query() with display types. Likewise for creating new video buffers.
Diffstat (limited to 'gst')
-rw-r--r--gst/vaapi/gstvaapipluginbuffer.c16
-rw-r--r--gst/vaapi/gstvaapipluginutil.c44
2 files changed, 38 insertions, 22 deletions
diff --git a/gst/vaapi/gstvaapipluginbuffer.c b/gst/vaapi/gstvaapipluginbuffer.c
index 225318e1..7005a2b8 100644
--- a/gst/vaapi/gstvaapipluginbuffer.c
+++ b/gst/vaapi/gstvaapipluginbuffer.c
@@ -30,14 +30,22 @@
#endif
#include "gstvaapipluginbuffer.h"
-static inline GType
+static GType
get_type(GstVaapiDisplay *display)
{
+ GType type;
+
+ switch (gst_vaapi_display_get_display_type(display)) {
#if USE_GLX
- if (GST_VAAPI_IS_DISPLAY_GLX(display))
- return GST_VAAPI_TYPE_VIDEO_BUFFER_GLX;
+ case GST_VAAPI_DISPLAY_TYPE_GLX:
+ type = GST_VAAPI_TYPE_VIDEO_BUFFER_GLX;
+ break;
#endif
- return GST_VAAPI_TYPE_VIDEO_BUFFER;
+ default:
+ type = GST_VAAPI_TYPE_VIDEO_BUFFER;
+ break;
+ }
+ return type;
}
GstBuffer *
diff --git a/gst/vaapi/gstvaapipluginutil.c b/gst/vaapi/gstvaapipluginutil.c
index 6c731a69..3ae3d235 100644
--- a/gst/vaapi/gstvaapipluginutil.c
+++ b/gst/vaapi/gstvaapipluginutil.c
@@ -161,6 +161,7 @@ gst_vaapi_set_display(
gboolean
gst_vaapi_reply_to_query(GstQuery *query, GstVaapiDisplay *display)
{
+ GstVaapiDisplayType display_type;
const gchar **types;
const gchar *type;
gint i;
@@ -174,9 +175,11 @@ gst_vaapi_reply_to_query(GstQuery *query, GstVaapiDisplay *display)
if (!types)
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];
+ res = TRUE;
if (!strcmp(type, "gst-vaapi-display")) {
gst_video_context_query_set_object(query, type, G_OBJECT(display));
}
@@ -184,25 +187,30 @@ gst_vaapi_reply_to_query(GstQuery *query, GstVaapiDisplay *display)
VADisplay vadpy = gst_vaapi_display_get_display(display);
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 {
- continue;
+ switch (display_type) {
+#if USE_GLX
+ case GST_VAAPI_DISPLAY_TYPE_GLX:
+#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;
+ }
+ default:
+ res = FALSE;
+ break;
+ }
}
-
- res = TRUE;
- break;
}
return res;
}