waylandsink : supporting re-setting ROI after ROI setting is done. 92/101392/1
authorHyunil <hyunil46.park@samsung.com>
Thu, 1 Dec 2016 01:54:21 +0000 (10:54 +0900)
committerHyunil Park <hyunil46.park@samsung.com>
Thu, 1 Dec 2016 05:36:06 +0000 (21:36 -0800)
Change-Id: Ia2a50f3befac4778c007e4b38252beda92fd2280
Signed-off-by: Hyunil <hyunil46.park@samsung.com>
(cherry picked from commit 655cfca81ad12bb87abfd532555c975163f2bb10)

ext/wayland/gstwaylandsink.c
ext/wayland/wlwindow.c
ext/wayland/wlwindow.h

index c19509b..1e42ec2 100755 (executable)
@@ -2250,8 +2250,11 @@ gst_wayland_sink_set_render_rectangle (GstVideoOverlay * overlay,
 
   GST_DEBUG_OBJECT (sink, "window geometry changed to (%d, %d) %d x %d",
       x, y, w, h);
-  gst_wl_window_set_render_rectangle (sink->window, x, y, w, h);
-
+  if (gst_wl_window_set_render_rectangle (sink->window, x, y, w, h)) {
+    sink->video_info_changed = TRUE;
+    if (sink->window && GST_STATE (sink) == GST_STATE_PAUSED)
+      gst_wayland_sink_update_last_buffer_geometry (sink);
+  }
   g_mutex_unlock (&sink->render_lock);
 }
 
index e1fad62..7502ce0 100644 (file)
@@ -610,7 +610,7 @@ gst_wl_window_resize_tizen_video_viewport (GstWlWindow * window,
   }
 
   /*set tizen destination mode */
-  if (window->disp_geo_method.changed) {
+  if (window->disp_geo_method.changed || window->roi_area_changed) {
     int tizen_disp_mode = -1;
     switch (window->disp_geo_method.value) {
 
@@ -656,6 +656,7 @@ gst_wl_window_resize_tizen_video_viewport (GstWlWindow * window,
           window->roi.w, window->roi.h);
       tizen_viewport_set_destination (window->tizen_video_viewport,
           window->roi.x, window->roi.y, window->roi.w, window->roi.h);
+      window->roi_area_changed = FALSE;
     }
     window->disp_geo_method.changed = FALSE;
   }
@@ -921,23 +922,23 @@ gst_wl_window_render (GstWlWindow * window, GstWlBuffer * buffer,
 #endif
 }
 
-void
+#if TIZEN_FEATURE_WLSINK_ENHANCEMENT
+gboolean
 gst_wl_window_set_render_rectangle (GstWlWindow * window, gint x, gint y,
     gint w, gint h)
 {
-#if TIZEN_FEATURE_WLSINK_ENHANCEMENT
   FUNCTION;
-  g_return_if_fail (window != NULL);
+  g_return_val_if_fail (window != NULL, FALSE);
 
   if (window->disp_geo_method.value != DISP_GEO_METHOD_CUSTOM_ROI) {
     GST_ERROR
         ("must be set display-geometry-method to DISP_GEO_METHOD_CUSTOM_ROI before setting render rectangle()");
-    return;
+    return FALSE;
   }
 
   if (w < 0 || h < 0) {
     GST_ERROR ("Error : wrong roi size w(%d), h(%d)", w, h);
-    return;
+    return FALSE;
   }
 
   window->roi.x = x;
@@ -945,10 +946,15 @@ gst_wl_window_set_render_rectangle (GstWlWindow * window, gint x, gint y,
   window->roi.w = w;
   window->roi.h = h;
   GST_LOG ("set roi x(%d), y(%d), w(%d), h(%d)", x, y, w, h);
+  window->roi_area_changed = TRUE;
 
-  return;
-
+  return TRUE;
+}
 #else /* open source */
+void
+gst_wl_window_set_render_rectangle (GstWlWindow * window, gint x, gint y,
+    gint w, gint h)
+{
 
   g_return_if_fail (window != NULL);
 
@@ -975,8 +981,8 @@ gst_wl_window_set_render_rectangle (GstWlWindow * window, gint x, gint y,
   if (window->video_width != 0)
     wl_subsurface_set_desync (window->video_subsurface);
 
-#endif
 }
+#endif
 
 #ifdef TIZEN_FEATURE_WLSINK_ENHANCEMENT
 void
index 28780e1..6f5397d 100644 (file)
@@ -111,6 +111,7 @@ struct _GstWlWindow
   WinGeometryRange mode_align;
 #endif
   GstVideoRectangle roi;
+  gboolean roi_area_changed;
 #endif
 
   /* the size and position of the area_(sub)surface */
@@ -139,9 +140,9 @@ gboolean gst_wl_window_is_toplevel (GstWlWindow * window);
 
 void gst_wl_window_render (GstWlWindow * window, GstWlBuffer * buffer,
     const GstVideoInfo * info);
-void gst_wl_window_set_render_rectangle (GstWlWindow * window, gint x, gint y,
-    gint w, gint h);
 #ifdef TIZEN_FEATURE_WLSINK_ENHANCEMENT
+gboolean gst_wl_window_set_render_rectangle (GstWlWindow * window, gint x, gint y,
+    gint w, gint h);
 void gst_wl_window_set_video_info (GstWlWindow * window,
     const GstVideoInfo * info);
 void gst_wl_window_set_rotate_angle (GstWlWindow * window, guint rotate_angle);
@@ -157,6 +158,9 @@ void gst_wl_window_set_destination_mode_scale (GstWlWindow * window, gdouble w,
 void gst_wl_window_set_destination_mode_align (GstWlWindow * window, gdouble w, gdouble h);
 #endif
 void gst_wl_window_set_video_info_change (GstWlWindow * window, guint changed);
+#else
+void gst_wl_window_set_render_rectangle (GstWlWindow * window, gint x, gint y,
+    gint w, gint h);
 #endif
 
 G_END_DECLS