Merge branch 'upstream/1.16' into tizen_gst_1.16.2
[platform/upstream/gst-plugins-base.git] / gst-libs / gst / video / videooverlay.c
index f37f172..00dac44 100644 (file)
@@ -327,6 +327,101 @@ gst_video_overlay_get_type (void)
   return gst_video_overlay_type;
 }
 
+#ifdef TIZEN_FEATURE_WAYLAND_ENHANCEMENT
+/**
+* gst_video_overlay_set_wl_window_wl_surface_id:
+* @overlay: a #GstVideoOverlay to set the window on.
+* @wl_surface_id: a global resource id of wl_surface referencing the wayland window.
+
+* This will call the video overlay's set_wayland_window_handle method.  You
+* should use this medtod  to tell to an overlay to display video output to a
+* specific window(e.g. an Wayland Window on Wayland).
+* But you can also set handle to waylandsink with gst_video_overlay_set_window_handle().
+*/
+void
+gst_video_overlay_set_wl_window_wl_surface_id (GstVideoOverlay * overlay,
+    gint wl_surface_id)
+{
+  GstVideoOverlayInterface *iface;
+
+  g_return_if_fail (overlay != NULL);
+  g_return_if_fail (GST_IS_VIDEO_OVERLAY (overlay));
+
+  iface = GST_VIDEO_OVERLAY_GET_INTERFACE (overlay);
+
+  if (iface->set_wl_window_wl_surface_id) {
+    iface->set_wl_window_wl_surface_id (overlay, wl_surface_id);
+  }
+}
+
+
+/**
+ * gst_video_overlay_set_display_roi_area:
+ * @overlay: a #GstVideoOverlay
+ * @x: the horizontal offset of the render area inside the window
+ * @y: the vertical offset of the render area inside the window
+ * @width: the width of the render area inside the window
+ * @height: the height of the render area inside the window
+ *
+ * Set the ROI(Region of Interest) area of wayland window.
+ * Returns: %FALSE if not supported by the sink.
+ */
+gboolean
+gst_video_overlay_set_display_roi_area (GstVideoOverlay * overlay,
+    gint x, gint y, gint width, gint height)
+{
+  GstVideoOverlayInterface *iface;
+
+  g_return_val_if_fail (overlay != NULL, FALSE);
+  g_return_val_if_fail (GST_IS_VIDEO_OVERLAY (overlay), FALSE);
+  g_return_val_if_fail (width > 0 && height > 0, FALSE);
+
+  iface = GST_VIDEO_OVERLAY_GET_INTERFACE (overlay);
+
+  if (iface->set_display_roi_area) {
+    iface->set_display_roi_area (overlay, x, y, width, height);
+    return TRUE;
+  }
+  return FALSE;
+}
+
+/**
+ * gst_video_overlay_set_video_roi_area:
+ * @overlay: a #GstVideoOverlay
+ * @x_scale: x coordinate ratio value of video source area
+ *           based on video width size, valid range is from 0.0 to 1.0.
+ * @y_scale: y coordinate ratio value of video source area
+ *           based on video width size, valid range is from 0.0 to 1.0.
+ * @w_scale: width ratio value of the video source area
+ *           based on video width size, valid range is from greater than 0.0 to 1.0.
+ * @h_scale: height ratio value of the video source area
+ *           based on video width size, valid range is from greater than 0.0 to 1.0.
+ *
+ * Sets the ROI(Region Of Interest) area of video source.
+ * Returns: %FALSE if not supported by the sink.
+**/
+gboolean
+gst_video_overlay_set_video_roi_area (GstVideoOverlay * overlay,
+    gdouble x_scale, gdouble y_scale, gdouble w_scale, gdouble h_scale)
+{
+  GstVideoOverlayInterface *iface;
+
+  g_return_val_if_fail (overlay != NULL, FALSE);
+  g_return_val_if_fail (GST_IS_VIDEO_OVERLAY (overlay), FALSE);
+  g_return_val_if_fail (x_scale >= 0.0 && x_scale <= 1.0, FALSE);
+  g_return_val_if_fail (y_scale >= 0.0 && y_scale <= 1.0, FALSE);
+  g_return_val_if_fail (w_scale > 0.0 && w_scale <= 1.0, FALSE);
+  g_return_val_if_fail (h_scale > 0.0 && h_scale <= 1.0, FALSE);
+
+  iface = GST_VIDEO_OVERLAY_GET_INTERFACE (overlay);
+
+  if (iface->set_video_roi_area) {
+    iface->set_video_roi_area (overlay, x_scale, y_scale, w_scale, h_scale);
+    return TRUE;
+  }
+  return FALSE;
+}
+#endif
 /**
  * gst_video_overlay_set_window_handle:
  * @overlay: a #GstVideoOverlay to set the window on.