Add set_video_roi_area interface for setting ROI area of video source
authorHyunil <hyunil46.park@samsung.com>
Tue, 7 Aug 2018 06:48:35 +0000 (15:48 +0900)
committerHyunil <hyunil46.park@samsung.com>
Fri, 10 Aug 2018 07:32:41 +0000 (16:32 +0900)
Change-Id: I150a2a0e8ce6f59b38e59789a0bb59e4ccd88c07
Signed-off-by: Hyunil <hyunil46.park@samsung.com>
gst-libs/gst/video/videooverlay.c
gst-libs/gst/video/videooverlay.h

index be0ce21..ba22b5f 100644 (file)
@@ -380,6 +380,42 @@ gst_video_overlay_set_display_roi_area (GstVideoOverlay * overlay,
   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:
index 1a9f3b1..4654dc9 100644 (file)
@@ -72,6 +72,10 @@ struct _GstVideoOverlayInterface {
   void (*set_display_roi_area) (GstVideoOverlay *overlay,
                                 gint x, gint y,
                                 gint width, gint height);
+
+  void (*set_video_roi_area)   (GstVideoOverlay *overlay,
+                                gdouble x_scale, gdouble y_scale,
+                                gdouble w_scale, gdouble h_scale);
 };
 
 GType   gst_video_overlay_get_type (void);
@@ -106,7 +110,9 @@ void gst_video_overlay_set_wl_window_wl_surface_id (GstVideoOverlay * overlay,
 gboolean gst_video_overlay_set_display_roi_area         (GstVideoOverlay * overlay,
                                                          gint x, gint y,
                                                          gint width, gint height);
-
+gboolean gst_video_overlay_set_video_roi_area           (GstVideoOverlay * overlay,
+                                                         gdouble x_scale, gdouble y_scale,
+                                                         gdouble w_scale, gdouble h_scale);
 
 G_END_DECLS