summaryrefslogtreecommitdiff
path: root/tests/examples
diff options
context:
space:
mode:
authorgb <gb@5584edef-b1fe-4b99-b61b-dd2bab72e969>2010-03-11 15:21:43 +0000
committergb <gb@5584edef-b1fe-4b99-b61b-dd2bab72e969>2010-03-11 15:21:43 +0000
commite4ae48029f479651f97f9cd0300fe4729bbdd993 (patch)
tree34e9966df9ef38db64b2fab07b56ca93793cdcfb /tests/examples
parent0d4b65b7587012cd92a77467fd2544a638173d5a (diff)
Add gst_vaapi_display_x11_new_with_display() API.
Diffstat (limited to 'tests/examples')
-rw-r--r--tests/examples/generic/test-display.c75
1 files changed, 65 insertions, 10 deletions
diff --git a/tests/examples/generic/test-display.c b/tests/examples/generic/test-display.c
index dbbf1f98..4a510d53 100644
--- a/tests/examples/generic/test-display.c
+++ b/tests/examples/generic/test-display.c
@@ -68,18 +68,11 @@ print_caps(GstCaps *caps, const gchar *name)
}
}
-int
-main(int argc, char *argv[])
+static void
+dump_caps(GstVaapiDisplay *display)
{
- GstVaapiDisplay *display;
GstCaps *caps;
- gst_init(&argc, &argv);
-
- display = gst_vaapi_display_x11_new(NULL);
- if (!display)
- g_error("could not create VA-API display");
-
caps = gst_vaapi_display_get_image_caps(display);
if (!caps)
g_error("could not get VA image caps");
@@ -93,8 +86,70 @@ main(int argc, char *argv[])
print_caps(caps, "subpicture");
gst_caps_unref(caps);
+}
+
+int
+main(int argc, char *argv[])
+{
+ Display *x11_display;
+ VADisplay va_display;
+ GstVaapiDisplay *display;
+
+ gst_init(&argc, &argv);
+
+ g_print("#\n");
+ g_print("# Create display with gst_vaapi_display_x11_new()\n");
+ g_print("#\n");
+ {
+ display = gst_vaapi_display_x11_new(NULL);
+ if (!display)
+ g_error("could not create Gst/VA display");
+
+ dump_caps(display);
+ g_object_unref(display);
+ }
+ g_print("\n");
+
+ g_print("#\n");
+ g_print("# Create display with gst_vaapi_display_x11_new_with_display()\n");
+ g_print("#\n");
+ {
+ x11_display = XOpenDisplay(NULL);
+ if (!x11_display)
+ g_error("could not create X11 display");
+
+ display = gst_vaapi_display_x11_new_with_display(x11_display);
+ if (!display)
+ g_error("could not create Gst/VA display");
+
+ dump_caps(display);
+ g_object_unref(display);
+ XCloseDisplay(x11_display);
+ }
+ g_print("\n");
+
+ g_print("#\n");
+ g_print("# Create display with gst_vaapi_display_new_with_display()\n");
+ g_print("#\n");
+ {
+ x11_display = XOpenDisplay(NULL);
+ if (!x11_display)
+ g_error("could not create X11 display");
+
+ va_display = vaGetDisplay(x11_display);
+ if (!va_display)
+ g_error("could not create VA display");
+
+ display = gst_vaapi_display_new_with_display(va_display);
+ if (!display)
+ g_error("could not create Gst/VA display");
+
+ dump_caps(display);
+ g_object_unref(display);
+ XCloseDisplay(x11_display);
+ }
+ g_print("\n");
- g_object_unref(display);
gst_deinit();
return 0;
}