diff options
author | Víctor Manuel Jáquez Leal <vjaquez@igalia.com> | 2017-12-01 23:03:32 +0100 |
---|---|---|
committer | Víctor Manuel Jáquez Leal <vjaquez@igalia.com> | 2017-12-06 20:39:33 +0100 |
commit | af0bf7212bcf7d1064e15b7cbcb1bd901f093622 (patch) | |
tree | 289ae990c184256d870bc68c13dc0d131d28a4ea /tests | |
parent | 4d29f4c8c499507568ba41b73a385d2a2435da80 (diff) |
test: vaapicontext: process have-context bus message
Diffstat (limited to 'tests')
-rw-r--r-- | tests/elements/test-vaapicontext.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/elements/test-vaapicontext.c b/tests/elements/test-vaapicontext.c index 4b37a2cb..0085ca96 100644 --- a/tests/elements/test-vaapicontext.c +++ b/tests/elements/test-vaapicontext.c @@ -50,6 +50,7 @@ typedef struct _CustomData VADisplay va_display; GstElement *pipeline; guintptr videoarea_handle[2]; + GstObject *gstvaapidisplay; } AppData; static void @@ -133,6 +134,18 @@ bus_sync_handler (GstBus * bus, GstMessage * msg, gpointer data) gst_println ("Got need context %s from %s", context_type, GST_MESSAGE_SRC_NAME (msg)); + if (g_strcmp0 (context_type, "gst.vaapi.Display") == 0) { + if (app->gstvaapidisplay) { + GstStructure *s; + + context = gst_context_new ("gst.vaapi.Display", FALSE); + s = gst_context_writable_structure (context); + gst_structure_set (s, "gst.vaapi.Display", + GST_TYPE_OBJECT, app->gstvaapidisplay, NULL); + } + break; + } + if (g_strcmp0 (context_type, "gst.vaapi.app.Display") != 0) break; @@ -156,6 +169,32 @@ bus_sync_handler (GstBus * bus, GstMessage * msg, gpointer data) (GST_MESSAGE_SRC (msg)), app->videoarea_handle[0]); break; } + case GST_MESSAGE_HAVE_CONTEXT:{ + const gchar *context_type; + const GstStructure *s; + GstContext *context = NULL; + const GValue *value; + + gst_message_parse_have_context (msg, &context); + if (!context) + break; + + context_type = gst_context_get_context_type (context); + gst_println ("Got have context %s from %s", context_type, + GST_MESSAGE_SRC_NAME (msg)); + + if (g_strcmp0 (context_type, "gst.vaapi.Display") != 0) + break; + s = gst_context_get_structure (context); + if (!s) + break; + value = gst_structure_get_value (s, "gst.vaapi.Display"); + if (!value) + break; + app->gstvaapidisplay = g_value_dup_object (value); + gst_println ("found display %s", GST_OBJECT_NAME (app->gstvaapidisplay)); + break; + } case GST_MESSAGE_EOS: gtk_main_quit (); break; @@ -308,6 +347,7 @@ main (gint argc, gchar ** argv) gtk_main (); gst_object_unref (app.pipeline); + gst_object_unref (app.gstvaapidisplay); /* there is no need to call vaTerminate() because it is done by the * vaapi elements */ return 0; |