From 6118e76b62e3a89144d5152ddcd31bf5f8f8ac96 Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Wed, 1 Aug 2012 15:46:19 +0200 Subject: [PATCH] plugins: add support for headless pipelines. --- gst/vaapi/Makefile.am | 5 +++++ gst/vaapi/gstvaapipluginutil.c | 44 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/gst/vaapi/Makefile.am b/gst/vaapi/Makefile.am index c8940c5..0c1097c 100644 --- a/gst/vaapi/Makefile.am +++ b/gst/vaapi/Makefile.am @@ -9,6 +9,11 @@ libgstvaapi_CFLAGS = \ libgstvaapi_LIBS = +if USE_DRM +libgstvaapi_LIBS += \ + $(top_builddir)/gst-libs/gst/vaapi/libgstvaapi-drm-$(GST_MAJORMINOR).la +endif + if USE_X11 libgstvaapi_LIBS += \ $(top_builddir)/gst-libs/gst/vaapi/libgstvaapi-x11-$(GST_MAJORMINOR).la diff --git a/gst/vaapi/gstvaapipluginutil.c b/gst/vaapi/gstvaapipluginutil.c index 504d53a..0a56893 100644 --- a/gst/vaapi/gstvaapipluginutil.c +++ b/gst/vaapi/gstvaapipluginutil.c @@ -26,6 +26,9 @@ #endif #include #include +#if USE_DRM +# include +#endif #if USE_X11 # include #endif @@ -49,6 +52,10 @@ static const char *display_types[] = { "x11-display", "x11-display-name", #endif +#if USE_DRM + "drm-device", + "drm-device-path", +#endif NULL }; @@ -74,6 +81,11 @@ static const DisplayMap g_display_map[] = { GST_VAAPI_DISPLAY_TYPE_GLX, gst_vaapi_display_glx_new }, #endif +#if USE_DRM + { "drm", + GST_VAAPI_DISPLAY_TYPE_DRM, + gst_vaapi_display_drm_new }, +#endif { NULL, } }; @@ -148,6 +160,20 @@ gst_vaapi_set_display( g_return_if_fail(G_VALUE_HOLDS_OBJECT(value)); dpy = g_value_dup_object(value); } +#if USE_DRM + else if (!strcmp(type, "drm-device")) { + gint device; + g_return_if_fail(G_VALUE_HOLDS_INT(value)); + device = g_value_get_int(value); + dpy = gst_vaapi_display_drm_new_with_device(device); + } + else if (!strcmp(type, "drm-device-path")) { + const gchar *device_path; + g_return_if_fail(G_VALUE_HOLDS_STRING(value)); + device_path = g_value_get_string(value); + dpy = gst_vaapi_display_drm_new(device_path); + } +#endif #if USE_X11 else if (!strcmp(type, "x11-display-name")) { g_return_if_fail(G_VALUE_HOLDS_STRING(value)); @@ -219,6 +245,24 @@ gst_vaapi_reply_to_query(GstQuery *query, GstVaapiDisplay *display) } else { switch (display_type) { +#if USE_DRM + case GST_VAAPI_DISPLAY_TYPE_DRM: { + GstVaapiDisplayDRM * const drm_dpy = + GST_VAAPI_DISPLAY_DRM(display); + if (!strcmp(type, "drm-device-path")) + gst_video_context_query_set_string(query, type, + gst_vaapi_display_drm_get_device_path(drm_dpy)); +#if 0 + /* XXX: gst_video_context_query_set_int() does not exist yet */ + else if (!strcmp(type, "drm-device")) + gst_video_context_query_set_int(query, type, + gst_vaapi_display_drm_get_device(drm_dpy)); +#endif + else + res = FALSE; + break; + } +#endif #if USE_X11 #if USE_GLX case GST_VAAPI_DISPLAY_TYPE_GLX: -- 2.7.4