if (sink->window)
gst_tizen_wl_sink_update_window_geometry (sink);
-#else /*open source */
- /* create a new pool for the new configuration */
- newpool = gst_video_buffer_pool_new ();
- if (!newpool)
- goto pool_failed;
-
- structure = gst_buffer_pool_get_config (newpool);
- gst_buffer_pool_config_set_params (structure, caps, info.size, 6, 0);
- gst_buffer_pool_config_set_allocator (structure,
- gst_tizen_wl_shm_allocator_get (), NULL);
- if (!gst_buffer_pool_set_config (newpool, structure))
- goto config_failed;
-
- /* store the video info */
- sink->video_info = info;
- sink->video_info_changed = TRUE;
-
- gst_object_replace ((GstObject **) & sink->pool, (GstObject *) newpool);
- gst_object_unref (newpool);
#endif
return TRUE;
else /*USE SHM */
GST_DEBUG_OBJECT (sink, "Format %s is not available on the display",
gst_wl_shm_format_to_string (format));
-#else /*open source */
- GST_DEBUG_OBJECT (sink, "Format %s is not available on the display",
- gst_wl_shm_format_to_string (format));
#endif
return FALSE;
}
goto done;
-#else /* open source */
-
- GstTizenWlSink *sink = GST_TIZEN_WL_SINK (bsink);
- GstBuffer *to_render = NULL;
- GstFlowReturn ret = GST_FLOW_OK;
-
- g_mutex_lock (&sink->render_lock);
-
- if (G_UNLIKELY (!sink->window)) {
- /* ask for window handle. Unlock render_lock while doing that because
- * set_window_handle & friends will lock it in this context */
- g_mutex_unlock (&sink->render_lock);
- gst_video_overlay_prepare_window_handle (GST_VIDEO_OVERLAY (sink));
- g_mutex_lock (&sink->render_lock);
-
- if (!sink->window) {
- /* if we were not provided a window, create one ourselves */
- sink->window =
- gst_wl_window_new_toplevel (sink->display, &sink->video_info);
- }
- }
-
- /* drop buffers until we get a frame callback */
- if (g_atomic_int_get (&sink->redraw_pending) == TRUE
- && !gst_tizen_wl_sink_is_gapless (sink))
- goto done;
-
- /* make sure that the application has called set_render_rectangle() */
- if (G_UNLIKELY (sink->window->render_rectangle.w == 0))
- goto no_window_size;
-
- wlbuffer = gst_buffer_get_wl_buffer (buffer);
-
- if (G_LIKELY (wlbuffer && wlbuffer->display == sink->display)) {
- GST_LOG_OBJECT (sink,
- "buffer %p has a wl_buffer from our display, " "writing directly",
- buffer);
- GST_LOG ("wl_buffer (%p)", wlbuffer->wlbuffer);
- to_render = buffer;
-
- } else {
- GstMemory *mem;
- struct wl_buffer *wbuf = NULL;
-
- GST_LOG_OBJECT (sink,
- "buffer %p does not have a wl_buffer from our " "display, creating it",
- buffer);
- mem = gst_buffer_peek_memory (buffer, 0);
- if (gst_is_wl_shm_memory (mem)) { /* is wayland memory */
- FUNCTION;
- wbuf = gst_tizen_wl_shm_memory_construct_wl_buffer (mem, sink->display,
- &sink->video_info);
- }
- if (wbuf) {
- gst_buffer_add_wl_buffer (buffer, wbuf, sink->display);
- to_render = buffer;
-
- } else {
- GstMapInfo src;
- /* we don't know how to create a wl_buffer directly from the provided
- * memory, so we have to copy the data to a memory that we know how
- * to handle... */
-
- GST_LOG_OBJECT (sink, "buffer %p is not from our pool", buffer);
- GST_LOG_OBJECT (sink, "buffer %p cannot have a wl_buffer, " "copying",
- buffer);
- /* sink->pool always exists (created in set_caps), but it may not
- * be active if upstream is not using it */
- if (!gst_buffer_pool_is_active (sink->pool) &&
- !gst_buffer_pool_set_active (sink->pool, TRUE))
- goto activate_failed;
-
- ret = gst_buffer_pool_acquire_buffer (sink->pool, &to_render, NULL);
- if (ret != GST_FLOW_OK)
- goto no_buffer;
-
- /* the first time we acquire a buffer,
- * we need to attach a wl_buffer on it */
- wlbuffer = gst_buffer_get_wl_buffer (buffer);
- if (G_UNLIKELY (!wlbuffer)) {
- mem = gst_buffer_peek_memory (to_render, 0);
- wbuf = gst_tizen_wl_shm_memory_construct_wl_buffer (mem, sink->display,
- &sink->video_info);
- if (G_UNLIKELY (!wbuf))
- goto no_wl_buffer;
-
- gst_buffer_add_wl_buffer (to_render, wbuf, sink->display);
- }
-
- gst_buffer_map (buffer, &src, GST_MAP_READ);
- gst_buffer_fill (to_render, 0, src.data, src.size);
- gst_buffer_unmap (buffer, &src);
- }
- }
- /* drop double rendering */
- if (G_UNLIKELY (buffer == sink->last_buffer)) {
- GST_LOG_OBJECT (sink, "Buffer already being rendered");
- goto done;
- }
-
- gst_buffer_replace (&sink->last_buffer, to_render);
- render_last_buffer (sink);
-
- if (buffer != to_render)
- gst_buffer_unref (to_render);
-
- goto done;
-
-#endif /* TIZEN_FEATURE_WLSINK_ENHANCEMENT */
-
-#ifndef TIZEN_FEATURE_WLSINK_ENHANCEMENT
no_window_size:
{
GST_ELEMENT_ERROR (sink, RESOURCE, WRITE,
window->video_subsurface);
}
return window;
-
-#else /* open source */
-
- GstWlWindow *window;
- window = gst_wl_window_new_internal (display, parent); //add parent for enlightment
-
- /*for enlightment , move to gst_wl_window_new_internal() */
-#if 0
- /* embed in parent */
- window->area_subsurface =
- wl_subcompositor_get_subsurface (display->subcompositor,
- window->area_surface, parent);
- wl_subsurface_set_desync (window->area_subsurface);
-#endif
-
- return window;
-
#endif
}
}
wl_display_flush (window->display->display);
-
-#else /* open source */
-
- if (G_UNLIKELY (info)) {
- window->video_width =
- gst_util_uint64_scale_int_round (info->width, info->par_n, info->par_d);
- window->video_height = info->height;
-
- wl_subsurface_set_sync (window->video_subsurface);
- gst_wl_window_resize_video_surface (window, FALSE);
- }
-
- GST_LOG ("GstWlBuffer(%p)", buffer);
- if (G_LIKELY (buffer))
- gst_wl_buffer_attach (buffer, window->video_surface);
- else
- wl_surface_attach (window->video_surface, NULL, 0, 0);
-
- wl_surface_damage (window->video_surface, 0, 0, window->surface_width,
- window->surface_height);
- wl_surface_commit (window->video_surface);
-
- if (G_UNLIKELY (info)) {
- /* commit also the parent (area_surface) in order to change
- * the position of the video_subsurface */
- wl_surface_damage (window->area_surface, 0, 0, window->render_rectangle.w,
- window->render_rectangle.h);
- wl_surface_commit (window->area_surface);
- wl_subsurface_set_desync (window->video_subsurface);
- }
-
- wl_display_flush (window->display->display);
#endif
}
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);
-
- window->render_rectangle.x = x;
- window->render_rectangle.y = y;
- window->render_rectangle.w = w;
- window->render_rectangle.h = h;
-
- /* position the area inside the parent - needs a parent commit to apply */
- if (window->area_subsurface)
- wl_subsurface_set_position (window->area_subsurface, x, y);
-
- /* change the size of the area */
- wl_viewport_set_destination (window->area_viewport, w, h);
-
- if (window->video_width != 0) {
- wl_subsurface_set_sync (window->video_subsurface);
- gst_wl_window_resize_video_surface (window, TRUE);
- }
-
- wl_surface_damage (window->area_surface, 0, 0, w, h);
- wl_surface_commit (window->area_surface);
-
- if (window->video_width != 0)
- wl_subsurface_set_desync (window->video_subsurface);
-
-}
-#endif
-#ifdef TIZEN_FEATURE_WLSINK_ENHANCEMENT
void
gst_wl_window_set_rotate_angle (GstWlWindow * window, guint rotate_angle)
{