Fix build without X11.

This commit is contained in:
Gwenole Beauchesne 2012-07-24 15:07:48 +02:00
parent 9e00c87367
commit 0bf1e761f9
4 changed files with 34 additions and 3 deletions

View file

@ -90,8 +90,10 @@ gst_vaapi_display_type_get_type(void)
static const GEnumValue display_types[] = { static const GEnumValue display_types[] = {
{ GST_VAAPI_DISPLAY_TYPE_ANY, { GST_VAAPI_DISPLAY_TYPE_ANY,
"Auto detection", "any" }, "Auto detection", "any" },
#if USE_X11
{ GST_VAAPI_DISPLAY_TYPE_X11, { GST_VAAPI_DISPLAY_TYPE_X11,
"VA/X11 display", "x11" }, "VA/X11 display", "x11" },
#endif
#if USE_GLX #if USE_GLX
{ GST_VAAPI_DISPLAY_TYPE_GLX, { GST_VAAPI_DISPLAY_TYPE_GLX,
"VA/GLX display", "glx" }, "VA/GLX display", "glx" },

View file

@ -45,8 +45,10 @@ static const char *display_types[] = {
"wl-display", "wl-display",
"wl-display-name", "wl-display-name",
#endif #endif
#if USE_X11
"x11-display", "x11-display",
"x11-display-name", "x11-display-name",
#endif
NULL NULL
}; };
@ -146,6 +148,7 @@ gst_vaapi_set_display(
g_return_if_fail(G_VALUE_HOLDS_OBJECT(value)); g_return_if_fail(G_VALUE_HOLDS_OBJECT(value));
dpy = g_value_dup_object(value); dpy = g_value_dup_object(value);
} }
#if USE_X11
else if (!strcmp(type, "x11-display-name")) { else if (!strcmp(type, "x11-display-name")) {
g_return_if_fail(G_VALUE_HOLDS_STRING(value)); g_return_if_fail(G_VALUE_HOLDS_STRING(value));
#if USE_GLX #if USE_GLX
@ -162,6 +165,7 @@ gst_vaapi_set_display(
if (!dpy) if (!dpy)
dpy = gst_vaapi_display_x11_new_with_display(g_value_get_pointer(value)); dpy = gst_vaapi_display_x11_new_with_display(g_value_get_pointer(value));
} }
#endif
#if USE_WAYLAND #if USE_WAYLAND
else if (!strcmp(type, "wl-display")) { else if (!strcmp(type, "wl-display")) {
struct wl_display *wl_display; struct wl_display *wl_display;
@ -215,6 +219,7 @@ gst_vaapi_reply_to_query(GstQuery *query, GstVaapiDisplay *display)
} }
else { else {
switch (display_type) { switch (display_type) {
#if USE_X11
#if USE_GLX #if USE_GLX
case GST_VAAPI_DISPLAY_TYPE_GLX: case GST_VAAPI_DISPLAY_TYPE_GLX:
#endif #endif
@ -232,6 +237,7 @@ gst_vaapi_reply_to_query(GstQuery *query, GstVaapiDisplay *display)
res = FALSE; res = FALSE;
break; break;
} }
#endif
#if USE_WAYLAND #if USE_WAYLAND
case GST_VAAPI_DISPLAY_TYPE_WAYLAND: { case GST_VAAPI_DISPLAY_TYPE_WAYLAND: {
GstVaapiDisplayWayland * const wlvadpy = GstVaapiDisplayWayland * const wlvadpy =

View file

@ -35,8 +35,10 @@
#include <gst/video/videocontext.h> #include <gst/video/videocontext.h>
#include <gst/vaapi/gstvaapivideobuffer.h> #include <gst/vaapi/gstvaapivideobuffer.h>
#include <gst/vaapi/gstvaapivideosink.h> #include <gst/vaapi/gstvaapivideosink.h>
#include <gst/vaapi/gstvaapidisplay_x11.h> #if USE_X11
#include <gst/vaapi/gstvaapiwindow_x11.h> # include <gst/vaapi/gstvaapidisplay_x11.h>
# include <gst/vaapi/gstvaapiwindow_x11.h>
#endif
#if USE_GLX #if USE_GLX
# include <gst/vaapi/gstvaapidisplay_glx.h> # include <gst/vaapi/gstvaapidisplay_glx.h>
# include <gst/vaapi/gstvaapiwindow_glx.h> # include <gst/vaapi/gstvaapiwindow_glx.h>
@ -141,8 +143,10 @@ gst_vaapisink_video_context_iface_init(GstVideoContextInterface *iface)
/* GstXOverlay interface */ /* GstXOverlay interface */
#if USE_X11
static gboolean static gboolean
gst_vaapisink_ensure_window_xid(GstVaapiSink *sink, guintptr window_id); gst_vaapisink_ensure_window_xid(GstVaapiSink *sink, guintptr window_id);
#endif
static GstFlowReturn static GstFlowReturn
gst_vaapisink_show_frame(GstBaseSink *base_sink, GstBuffer *buffer); gst_vaapisink_show_frame(GstBaseSink *base_sink, GstBuffer *buffer);
@ -158,7 +162,16 @@ gst_vaapisink_xoverlay_set_window_handle(GstXOverlay *overlay, guintptr window)
sink->display_type = GST_VAAPI_DISPLAY_TYPE_X11; sink->display_type = GST_VAAPI_DISPLAY_TYPE_X11;
sink->foreign_window = TRUE; sink->foreign_window = TRUE;
switch (sink->display_type) {
#if USE_X11
case GST_VAAPI_DISPLAY_TYPE_X11:
gst_vaapisink_ensure_window_xid(sink, window); gst_vaapisink_ensure_window_xid(sink, window);
break;
#endif
default:
break;
}
} }
static void static void
@ -213,6 +226,7 @@ gst_vaapisink_destroy(GstVaapiSink *sink)
gst_caps_replace(&sink->caps, NULL); gst_caps_replace(&sink->caps, NULL);
} }
#if USE_X11
/* Checks whether a ConfigureNotify event is in the queue */ /* Checks whether a ConfigureNotify event is in the queue */
typedef struct _ConfigureNotifyEventPendingArgs ConfigureNotifyEventPendingArgs; typedef struct _ConfigureNotifyEventPendingArgs ConfigureNotifyEventPendingArgs;
struct _ConfigureNotifyEventPendingArgs { struct _ConfigureNotifyEventPendingArgs {
@ -263,6 +277,7 @@ configure_notify_event_pending(
); );
return args.match; return args.match;
} }
#endif
static const gchar * static const gchar *
get_display_type_name(GstVaapiDisplayType display_type) get_display_type_name(GstVaapiDisplayType display_type)
@ -360,6 +375,7 @@ gst_vaapisink_ensure_window(GstVaapiSink *sink, guint width, guint height)
sink->window = gst_vaapi_window_glx_new(display, width, height); sink->window = gst_vaapi_window_glx_new(display, width, height);
goto notify_xoverlay_interface; goto notify_xoverlay_interface;
#endif #endif
#if USE_X11
case GST_VAAPI_DISPLAY_TYPE_X11: case GST_VAAPI_DISPLAY_TYPE_X11:
sink->window = gst_vaapi_window_x11_new(display, width, height); sink->window = gst_vaapi_window_x11_new(display, width, height);
notify_xoverlay_interface: notify_xoverlay_interface:
@ -370,6 +386,7 @@ gst_vaapisink_ensure_window(GstVaapiSink *sink, guint width, guint height)
gst_vaapi_window_x11_get_xid(GST_VAAPI_WINDOW_X11(sink->window)) gst_vaapi_window_x11_get_xid(GST_VAAPI_WINDOW_X11(sink->window))
); );
break; break;
#endif
#if USE_WAYLAND #if USE_WAYLAND
case GST_VAAPI_DISPLAY_TYPE_WAYLAND: case GST_VAAPI_DISPLAY_TYPE_WAYLAND:
sink->window = gst_vaapi_window_wayland_new(display, width, height); sink->window = gst_vaapi_window_wayland_new(display, width, height);
@ -383,6 +400,7 @@ gst_vaapisink_ensure_window(GstVaapiSink *sink, guint width, guint height)
return sink->window != NULL; return sink->window != NULL;
} }
#if USE_X11
static gboolean static gboolean
gst_vaapisink_ensure_window_xid(GstVaapiSink *sink, guintptr window_id) gst_vaapisink_ensure_window_xid(GstVaapiSink *sink, guintptr window_id)
{ {
@ -432,6 +450,7 @@ gst_vaapisink_ensure_window_xid(GstVaapiSink *sink, guintptr window_id)
} }
return sink->window != NULL; return sink->window != NULL;
} }
#endif
static gboolean static gboolean
gst_vaapisink_start(GstBaseSink *base_sink) gst_vaapisink_start(GstBaseSink *base_sink)
@ -735,9 +754,11 @@ gst_vaapisink_show_frame(GstBaseSink *base_sink, GstBuffer *buffer)
success = gst_vaapisink_show_frame_glx(sink, surface, flags); success = gst_vaapisink_show_frame_glx(sink, surface, flags);
break; break;
#endif #endif
#if USE_X11
case GST_VAAPI_DISPLAY_TYPE_X11: case GST_VAAPI_DISPLAY_TYPE_X11:
success = gst_vaapisink_put_surface(sink, surface, flags); success = gst_vaapisink_put_surface(sink, surface, flags);
break; break;
#endif
#if USE_WAYLAND #if USE_WAYLAND
case GST_VAAPI_DISPLAY_TYPE_WAYLAND: case GST_VAAPI_DISPLAY_TYPE_WAYLAND:
success = gst_vaapisink_put_surface(sink, surface, flags); success = gst_vaapisink_put_surface(sink, surface, flags);

View file

@ -1,5 +1,7 @@
pcfiles_in = gstreamer-vaapi.pc.in pcfiles_in = gstreamer-vaapi.pc.in
if USE_X11
pcfiles_in += gstreamer-vaapi-x11.pc.in pcfiles_in += gstreamer-vaapi-x11.pc.in
endif
if USE_GLX if USE_GLX
pcfiles_in += gstreamer-vaapi-glx.pc.in pcfiles_in += gstreamer-vaapi-glx.pc.in
endif endif