From 4731b2d6b739699c6163f90832b92013e1d47c2f Mon Sep 17 00:00:00 2001 From: Zhao Halley Date: Mon, 18 Mar 2013 17:14:48 +0800 Subject: [PATCH] implemented Tizen customized message 'prepare-xid' for webkit-efl - it is similar to 'prepare-xwindow-id' message - with additional information required from app side (for pixmap creation): video-width, video-height, display-width, display-height --- gst/vaapi/gstvaapisink.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/gst/vaapi/gstvaapisink.c b/gst/vaapi/gstvaapisink.c index e898d86..46246db 100755 --- a/gst/vaapi/gstvaapisink.c +++ b/gst/vaapi/gstvaapisink.c @@ -114,6 +114,45 @@ enum { #define DEFAULT_ROTATION GST_VAAPI_ROTATION_0 /* GstImplementsInterface interface */ +/** + * gst_vaapisink_prepare_xid: + * @overlay: a #GstXOverlay which does not yet have an XWindow or XPixmap. + * + * This will post a "prepare-xid" element message with video size and display size on the bus + * to give applications an opportunity to call + * gst_x_overlay_set_xwindow_id() before a plugin creates its own + * window or pixmap. + * + * This function should only be used by video overlay plugin developers. + */ +static void +gst_vaapisink_prepare_xid (GstXOverlay * overlay) +{ + GstStructure *s; + GstMessage *msg; + guint display_width, display_height; + + g_return_if_fail (overlay != NULL); + g_return_if_fail (GST_IS_X_OVERLAY (overlay)); + + GstVaapiSink *sink; + sink = GST_VAAPISINK (GST_OBJECT (overlay)); + + gst_vaapi_display_get_size(sink->display, &display_width, &display_height); + + GST_DEBUG ("post \"prepare-xid\" element message with video-width(%d), video-height(%d), display-width(%d), display-height(%d)", + sink->video_width, sink->video_height, display_width, display_height); + + GST_LOG_OBJECT (GST_OBJECT (overlay), "prepare xid"); + s = gst_structure_new ("prepare-xid", + "video-width", G_TYPE_INT, sink->video_width, + "video-height", G_TYPE_INT, sink->video_height, + "display-width", G_TYPE_INT, display_width, + "display-height", G_TYPE_INT, display_height, + NULL); + msg = gst_message_new_element (GST_OBJECT (overlay), s); + gst_element_post_message (GST_ELEMENT (overlay), msg); +} static gboolean gst_vaapisink_implements_interface_supported( @@ -657,6 +696,8 @@ gst_vaapisink_set_caps(GstBaseSink *base_sink, GstCaps *caps) else { gst_vaapi_display_lock(sink->display); gst_x_overlay_prepare_xwindow_id(GST_X_OVERLAY(sink)); + if (!sink->window) + gst_vaapisink_prepare_xid(GST_X_OVERLAY(sink)); // tizen customized interface/message for webkit-efl gst_vaapi_display_unlock(sink->display); if (sink->window) return TRUE; -- 2.7.4