#include "wlshmallocator.h"
#include "wlbuffer.h"
+enum
+{
+ ROTATE_0,
+ ROTATE_90,
+ ROTATE_180,
+ ROTATE_270,
+};
+
+
enum
{
ROTATE_0_FLIP_NONE,
handle_popup_done
};
+static void
+parent_size (void *data, struct tizen_viewport *tizen_viewport, uint32_t width,
+ uint32_t height)
+{
+ GstWlWindow *self = data;
+ FUNCTION;
+ g_return_if_fail (self != NULL);
+ self->parent_win.w = width;
+ self->parent_win.h = height;
+ GST_LOG ("parent size is (w)%d x (h)%d", self->parent_win.w,
+ self->parent_win.h);
+}
+
+static void
+destination_changed (void *data, struct tizen_viewport *tizen_viewport,
+ uint32_t transform, int32_t x, int32_t y, uint32_t width, uint32_t height)
+{
+}
+
+static const struct tizen_viewport_listener viewport_listener = {
+ destination_changed,
+ parent_size,
+};
+
+
static void
gst_wl_window_class_init (GstWlWindowClass * klass)
{
gst_wl_window_init (GstWlWindow * self)
{
g_return_if_fail (self != NULL);
- self->buffer_width = self->buffer_height = self->buffer_x = self->buffer_y =
- 0;
+ self->buffer_width = self->buffer_height = 0;
+ self->buffer_x = self->buffer_y = 0;
+ self->parent_win.x = self->parent_win.y = 0;
+ self->parent_win.w = self->parent_win.h = 0;
+ self->roi.x = self->roi.y = self->roi.w = self->roi.h = 0;
}
static void
GST_INFO
("tizen_area_viewport(tizen_viewport)@%p = tizen_video_get_viewport(tizen_video@%p, area_surface(wl_surface)@%p)",
window->tizen_area_viewport, display->tizen_video, window->area_surface);
+
+ /* query parent size */
+ if (window->tizen_area_viewport) {
+ tizen_viewport_query_parent_size (window->tizen_area_viewport);
+ tizen_viewport_add_listener (window->tizen_area_viewport,
+ &viewport_listener, window);
+ /* to execute query(tizen_viewport_query_parent_size) immediately */
+ wl_display_roundtrip (display->display);
+ }
+
window->tizen_video_viewport =
tizen_video_get_viewport (display->tizen_video, window->video_surface);
GST_INFO
#endif
}
+static void
+gst_wl_window_calculate_wl_roi_rectangle (GstWlWindow * window)
+{
+ FUNCTION;
+ g_return_if_fail (window != NULL);
+
+ switch (window->rotate_angle.value) {
+ case ROTATE_0:
+ window->wl_roi.x = window->roi.x;
+ window->wl_roi.y = window->roi.y;
+ window->wl_roi.w = window->roi.w;
+ window->wl_roi.h = window->roi.h;
+ break;
+ case ROTATE_90:
+ window->wl_roi.x = window->roi.y;
+ window->wl_roi.y = window->parent_win.h - (window->roi.w + window->roi.x);
+ window->wl_roi.w = window->roi.h;
+ window->wl_roi.h = window->roi.w;
+ break;
+ case ROTATE_180:
+ window->wl_roi.x = window->parent_win.w - (window->roi.w + window->roi.x);
+ window->wl_roi.y = window->parent_win.h - (window->roi.h + window->roi.y);
+ window->wl_roi.w = window->roi.w;
+ window->wl_roi.h = window->roi.h;
+ break;
+ case ROTATE_270:
+ window->wl_roi.x = window->parent_win.w - (window->roi.h + window->roi.y);
+ window->wl_roi.y = window->roi.x;
+ window->wl_roi.w = window->roi.h;
+ window->wl_roi.h = window->roi.w;
+ break;
+ default:
+ break;
+ }
+ GST_DEBUG ("wl roi : x(%d) y(%d) w(%d) h(%d)", window->wl_roi.x,
+ window->wl_roi.y, window->wl_roi.w, window->wl_roi.h);
+}
+
void
gst_wl_window_set_render_rectangle (GstWlWindow * window, gint x, gint y,
gint w, gint h)
("must be set display-geometry-method to DISP_GEO_METHOD_CUSTOM_ROI before setting render rectangle()");
return;
}
+ if (window->parent_win.w <= 0 || window->parent_win.h <= 0) {
+ GST_ERROR ("Error : get parent win size");
+ }
+ if (w <= 0 || h <= 0) {
+ GST_ERROR ("Error : wrong roi size w(%d), h(%d)", w, h);
+ }
+
+ window->roi.x = x;
+ window->roi.y = y;
+ window->roi.w = w;
+ window->roi.h = h;
+ window->wl_roi.x = window->wl_roi.y = window->wl_roi.w = window->wl_roi.h = 0;
+ /* calculate wl roi area */
+ gst_wl_window_calculate_wl_roi_rectangle (window);
/* position the area inside the parent - needs a parent commit to apply */
/* use tizen view port */
if (window->tizen_area_viewport) {
GST_INFO
("tizen_viewport_set_destination (tizen_area_viewport(tizen_viewport)@%p, x@%d, y@%d, w@%d, h@%d)",
- window->tizen_area_viewport, x, y, w, h);
- tizen_viewport_set_destination (window->tizen_area_viewport, x, y, w, h);
+ window->tizen_area_viewport, window->wl_roi.x, window->wl_roi.y,
+ window->wl_roi.w, window->wl_roi.h);
+ tizen_viewport_set_destination (window->tizen_area_viewport,
+ window->wl_roi.x, window->wl_roi.y, window->wl_roi.w, window->wl_roi.h);
}
if (window->video_width != 0) {
window->rotate_angle.value = rotate_angle;
GST_LOG ("rotate_angle value is (%d)", window->rotate_angle.value);
window->rotate_angle.changed = TRUE;
+ /* if set ROI */
+ if (window->disp_geo_method.value == DISP_GEO_METHOD_CUSTOM_ROI
+ && window->roi.w > 0 && window->roi.h > 0)
+ gst_wl_window_set_render_rectangle (window, window->roi.x, window->roi.y,
+ window->roi.w, window->roi.h);
}
void