Change caps to use new video/x-surface generic type.
authorNicolas Dufresne <nicolas.dufresne@collabora.co.uk>
Fri, 4 Nov 2011 21:16:23 +0000 (17:16 -0400)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Thu, 8 Dec 2011 13:58:58 +0000 (14:58 +0100)
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
gst-libs/gst/vaapi/Makefile.am
gst-libs/gst/vaapi/gstvaapicontext.c
gst-libs/gst/vaapi/gstvaapisurface.h
gst/vaapi/gstvaapiconvert.c
gst/vaapi/gstvaapisink.c
tests/Makefile.am
tests/test-surfaces.c

index 17ead8b..a68e045 100644 (file)
@@ -134,6 +134,7 @@ libgstvaapi_@GST_MAJORMINOR@includedir =    \
        $(libgstvaapi_includedir)
 
 libgstvaapi_@GST_MAJORMINOR@_la_CFLAGS =       \
+       -DGST_USE_UNSTABLE_API                  \
        -I$(top_srcdir)/gst-libs                \
        $(GST_BASE_CFLAGS)                      \
        $(GST_CFLAGS)                           \
@@ -165,6 +166,7 @@ libgstvaapi_x11_@GST_MAJORMINOR@includedir =        \
        $(libgstvaapi_includedir)
 
 libgstvaapi_x11_@GST_MAJORMINOR@_la_CFLAGS =   \
+       -DGST_USE_UNSTABLE_API                  \
        -I$(top_srcdir)/gst-libs                \
        $(GLIB_CFLAGS)                          \
        $(GST_BASE_CFLAGS)                      \
@@ -196,6 +198,7 @@ libgstvaapi_glx_@GST_MAJORMINOR@includedir =        \
        $(libgstvaapi_includedir)
 
 libgstvaapi_glx_@GST_MAJORMINOR@_la_CFLAGS =   \
+       -DGST_USE_UNSTABLE_API                  \
        -I$(top_srcdir)/gst-libs                \
        $(GLIB_CFLAGS)                          \
        $(GST_BASE_CFLAGS)                      \
index b5c4092..2ab62bb 100644 (file)
@@ -143,7 +143,8 @@ gst_vaapi_context_create_surfaces(GstVaapiContext *context)
 
     if (!priv->surfaces_pool) {
         caps = gst_caps_new_simple(
-            "video/x-vaapi-surface",
+            GST_VAAPI_SURFACE_CAPS_NAME,
+            "type", G_TYPE_STRING, "vaapi",
             "width",  G_TYPE_INT, priv->width,
             "height", G_TYPE_INT, priv->height,
             NULL
index bc513f7..05dffcf 100644 (file)
@@ -27,6 +27,7 @@
 #include <gst/vaapi/gstvaapidisplay.h>
 #include <gst/vaapi/gstvaapiimage.h>
 #include <gst/vaapi/gstvaapisubpicture.h>
+#include <gst/video/gstsurfacebuffer.h>
 
 G_BEGIN_DECLS
 
@@ -39,18 +40,19 @@ typedef enum _GstVaapiSurfaceRenderFlags        GstVaapiSurfaceRenderFlags;
  *
  * Generic caps type for VA surfaces.
  */
-#define GST_VAAPI_SURFACE_CAPS_NAME     \
-    "video/x-vaapi-surface"
+#define GST_VAAPI_SURFACE_CAPS_NAME GST_VIDEO_CAPS_SURFACE
 
 /**
  * GST_VAAPI_SURFACE_CAPS:
  *
  * Generic caps for VA surfaces.
  */
-#define GST_VAAPI_SURFACE_CAPS          \
-    GST_VAAPI_SURFACE_CAPS_NAME ", "    \
-    "width  = (int) [ 1, MAX ],"        \
-    "height = (int) [ 1, MAX ],"        \
+#define GST_VAAPI_SURFACE_CAPS                  \
+    GST_VAAPI_SURFACE_CAPS_NAME ", "            \
+    "type = vaapi, "                            \
+    "opengl = (boolean) { true, false }, "      \
+    "width  = (int) [ 1, MAX ], "               \
+    "height = (int) [ 1, MAX ], "               \
     "framerate = (fraction) [ 0, MAX ]"
 
 /**
index f871940..1574de7 100644 (file)
@@ -462,7 +462,7 @@ gst_vaapiconvert_transform_caps(
         out_caps = gst_caps_from_string(gst_vaapiconvert_vaapi_caps_str);
     }
     else {
-        if (!gst_structure_has_name(structure, "video/x-vaapi-surface"))
+        if (!gst_structure_has_name(structure, GST_VAAPI_SURFACE_CAPS_NAME))
             return NULL;
         out_caps = gst_caps_from_string(gst_vaapiconvert_yuv_caps_str);
         if (convert->display) {
@@ -667,7 +667,7 @@ gst_vaapiconvert_get_unit_size(
     GstVideoFormat format;
     gint width, height;
 
-    if (gst_structure_has_name(structure, "video/x-vaapi-surface"))
+    if (gst_structure_has_name(structure, GST_VAAPI_SURFACE_CAPS_NAME))
         *size = 0;
     else {
         if (!gst_video_format_parse_caps(caps, &format, &width, &height))
index b2477c3..067e2f0 100644 (file)
@@ -499,7 +499,7 @@ gst_vaapisink_buffer_alloc(
         goto error_ensure_display;
 
     structure = gst_caps_get_structure(caps, 0);
-    if (!gst_structure_has_name(structure, "video/x-vaapi-surface"))
+    if (!gst_structure_has_name(structure, GST_VAAPI_SURFACE_CAPS_NAME))
         goto error_invalid_caps;
 
     buffer = gst_vaapi_video_buffer_new(sink->display);
index ba6490a..8a27305 100644 (file)
@@ -11,7 +11,7 @@ noinst_PROGRAMS +=    \
        $(NULL)
 endif
 
-TEST_CFLAGS            = $(LIBVA_CFLAGS) -I$(top_srcdir)/gst-libs $(GST_CFLAGS)
+TEST_CFLAGS            = $(LIBVA_CFLAGS) -I$(top_srcdir)/gst-libs $(GST_CFLAGS) -DGST_USE_UNSTABLE_API
 TEST_X11_CFLAGS                = -DUSE_X11 $(X11_CFLAGS)
 TEST_GLX_CFLAGS                = -DUSE_GLX $(GLX_CFLAGS)
 TEST_MIX_CFLAGS                = $(TEST_X11_CFLAGS)
index 9cd23e3..17e9751 100644 (file)
@@ -66,7 +66,8 @@ main(int argc, char *argv[])
     g_object_unref(surface);
 
     caps = gst_caps_new_simple(
-        "video/x-vaapi-surface",
+        GST_VAAPI_SURFACE_CAPS_NAME,
+        "type", G_TYPE_STRING, "vaapi",
         "width", G_TYPE_INT, width,
         "height", G_TYPE_INT, height,
         NULL