From 7809c58664519e8af2266fbb1da8dd93e78b5bc3 Mon Sep 17 00:00:00 2001 From: He Junyan Date: Fri, 14 May 2021 12:04:04 +0800 Subject: [PATCH] Display: Add a property to export the VA display handle. Just like what we do in VA plugins. The display can be seen as a generic gst object and we can add a property to get the internal VA handle. Part-of: --- gst-libs/gst/vaapi/gstvaapidisplay.c | 15 +++++++++++++++ gst/vaapi/gstvaapivideocontext.c | 3 +++ 2 files changed, 18 insertions(+) diff --git a/gst-libs/gst/vaapi/gstvaapidisplay.c b/gst-libs/gst/vaapi/gstvaapidisplay.c index 26c216e7e8..878761af83 100644 --- a/gst-libs/gst/vaapi/gstvaapidisplay.c +++ b/gst-libs/gst/vaapi/gstvaapidisplay.c @@ -86,6 +86,7 @@ enum PROP_SATURATION, PROP_BRIGHTNESS, PROP_CONTRAST, + PROP_VA_DISPLAY, N_PROPERTIES }; @@ -1123,6 +1124,11 @@ gst_vaapi_display_get_property (GObject * object, guint property_id, GstVaapiDisplay *display = GST_VAAPI_DISPLAY (object); const GstVaapiProperty *prop; + if (property_id == PROP_VA_DISPLAY) { + g_value_set_pointer (value, gst_vaapi_display_get_display (display)); + return; + } + if (!ensure_properties (display)) return; @@ -1224,6 +1230,15 @@ gst_vaapi_display_class_init (GstVaapiDisplayClass * klass) "contrast", "The display contrast value", 0.0, 2.0, 1.0, G_PARAM_READWRITE); + /** + * GstVaapiDisplay:va-display: + * + * The VA display handle, expressed as a #VADisplay. + */ + g_properties[PROP_VA_DISPLAY] = + g_param_spec_pointer ("va-display", "VADisplay", + "VA Display handler", G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); + g_object_class_install_properties (object_class, N_PROPERTIES, g_properties); gst_type_mark_as_plugin_api (gst_vaapi_display_type_get_type (), 0); } diff --git a/gst/vaapi/gstvaapivideocontext.c b/gst/vaapi/gstvaapivideocontext.c index ae3af85dc1..cc2967b833 100644 --- a/gst/vaapi/gstvaapivideocontext.c +++ b/gst/vaapi/gstvaapivideocontext.c @@ -64,6 +64,9 @@ gst_vaapi_video_context_set_display (GstContext * context, structure = gst_context_writable_structure (context); gst_structure_set (structure, GST_VAAPI_DISPLAY_CONTEXT_TYPE_NAME, GST_TYPE_VAAPI_DISPLAY, display, NULL); + /* The outside user may access it as a generic Gobject. */ + gst_structure_set (structure, "gst.vaapi.Display.GObject", + GST_TYPE_OBJECT, display, NULL); } GstContext *