diff options
author | gb <gb@5584edef-b1fe-4b99-b61b-dd2bab72e969> | 2010-03-10 12:25:38 +0000 |
---|---|---|
committer | gb <gb@5584edef-b1fe-4b99-b61b-dd2bab72e969> | 2010-03-10 12:25:38 +0000 |
commit | 4f1725345f91c18af931b82605c5073db32eda68 (patch) | |
tree | a0674b687c5cc6a849d47fecb857ded2c41a9db4 /tests/examples | |
parent | 5fdc1dc9433e0582bf94ba0b1473d5ff874b31c6 (diff) |
Dump caps.
Diffstat (limited to 'tests/examples')
-rw-r--r-- | tests/examples/generic/test-display.c | 66 |
1 files changed, 65 insertions, 1 deletions
diff --git a/tests/examples/generic/test-display.c b/tests/examples/generic/test-display.c index 5c05511a..bfe40558 100644 --- a/tests/examples/generic/test-display.c +++ b/tests/examples/generic/test-display.c @@ -18,14 +18,62 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include <gst/vaapi/gstvaapidisplay.h> +#include <gst/video/video.h> #include <gst/vaapi/gstvaapidisplay_x11.h> +static void +print_caps(GstCaps *caps, const gchar *name) +{ + guint i, n_caps = gst_caps_get_size(caps); + + g_print("%u %s caps\n", n_caps, name); + + for (i = 0; i < gst_caps_get_size(caps); i++) { + GstStructure * const structure = gst_caps_get_structure(caps, i); + if (!structure) + g_error("could not get caps structure %d", i); + + g_print(" %s:", gst_structure_get_name(structure)); + + if (gst_structure_has_name(structure, "video/x-raw-yuv")) { + guint32 fourcc; + + gst_structure_get_fourcc(structure, "format", &fourcc); + + g_print(" fourcc '%c%c%c%c'", + fourcc & 0xff, + (fourcc >> 8) & 0xff, + (fourcc >> 16) & 0xff, + (fourcc >> 24) & 0xff); + } + else { + gint bpp, endian, rmask, gmask, bmask, amask; + gboolean has_alpha; + + gst_structure_get_int(structure, "bpp", &bpp); + gst_structure_get_int(structure, "endianness", &endian); + gst_structure_get_int(structure, "red_mask", &rmask); + gst_structure_get_int(structure, "blue_mask", &bmask); + gst_structure_get_int(structure, "green_mask", &gmask); + has_alpha = gst_structure_get_int(structure, "alpha_mask", &amask); + + g_print(" %d bits per pixel, %s endian,", + bpp, endian == G_BIG_ENDIAN ? "big" : "little"); + g_print(" %s masks", has_alpha ? "rgba" : "rgb"); + g_print(" 0x%08x 0x%08x 0x%08x", rmask, gmask, bmask); + if (has_alpha) + g_print(" 0x%08x", amask); + } + g_print("\n"); + } +} + int main(int argc, char *argv[]) { Display *x11_display; GstVaapiDisplay *display; + GstCaps *caps; gst_init(&argc, &argv); @@ -37,6 +85,22 @@ main(int argc, char *argv[]) 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"); + + print_caps(caps, "image"); + gst_caps_unref(caps); + + caps = gst_vaapi_display_get_subpicture_caps(display); + if (!caps) + g_error("could not get VA subpicture caps"); + + print_caps(caps, "subpicture"); + gst_caps_unref(caps); + g_object_unref(G_OBJECT(display)); + XCloseDisplay(x11_display); + gst_deinit(); return 0; } |