From: Hyunil Date: Fri, 9 Jun 2017 00:45:40 +0000 (+0900) Subject: Waylandsink: Add plane_size info to tbm_surface for s/w codec output X-Git-Tag: submit/tizen/20170609.042751~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d3005b413f4d2d7aa43d7412bf7d3c75ccf22c3b;p=platform%2Fupstream%2Fgst-plugins-bad.git Waylandsink: Add plane_size info to tbm_surface for s/w codec output Signed-off-by: Hyunil Change-Id: I8579f88ea423dac399153ac66deb7e192cd0b154 --- diff --git a/ext/wayland/wlshmallocator.c b/ext/wayland/wlshmallocator.c index 9cc70f755..91ead3ba8 100644 --- a/ext/wayland/wlshmallocator.c +++ b/ext/wayland/wlshmallocator.c @@ -357,6 +357,7 @@ gst_wl_shm_memory_construct_wl_buffer (GstMemory * mem, GstWlDisplay * display, GstWlShmMemory *shm_mem = (GstWlShmMemory *) mem; gint width, height, stride, offset; gsize size; + gint plane_size[GST_VIDEO_MAX_PLANES], n_planes, i; enum wl_shm_format format; struct wl_shm_pool *wl_pool; struct wl_buffer *wbuffer; @@ -429,17 +430,43 @@ gst_wl_shm_memory_construct_wl_buffer (GstMemory * mem, GstWlDisplay * display, display->dump_video = FALSE; } + n_planes = GST_VIDEO_INFO_N_PLANES (info); + switch (n_planes) { + case 1: + plane_size[0] = info->size; + break; + case 2: + plane_size[0] = GST_VIDEO_INFO_PLANE_OFFSET (info, 1); + plane_size[1] = info->size - plane_size[0]; + break; + case 3: + plane_size[0] = GST_VIDEO_INFO_PLANE_OFFSET (info, 1); + plane_size[1] = GST_VIDEO_INFO_PLANE_OFFSET (info, 2) - plane_size[0]; + plane_size[2] = info->size - GST_VIDEO_INFO_PLANE_OFFSET (info, 2); + break; + case 4: + plane_size[0] = GST_VIDEO_INFO_PLANE_OFFSET (info, 1); + plane_size[1] = GST_VIDEO_INFO_PLANE_OFFSET (info, 2) - plane_size[0]; + plane_size[2] = GST_VIDEO_INFO_PLANE_OFFSET (info, 3) + - GST_VIDEO_INFO_PLANE_OFFSET (info, 2); + plane_size[3] = info->size - GST_VIDEO_INFO_PLANE_OFFSET (info, 3); + break; + + default: + break; + } + ts_info.width = width; ts_info.height = height; ts_info.format = format; ts_info.bpp = tbm_surface_internal_get_bpp (ts_info.format); ts_info.num_planes = tbm_surface_internal_get_num_planes (ts_info.format); - ts_info.planes[0].stride = GST_VIDEO_INFO_PLANE_STRIDE (info, 0); - ts_info.planes[1].stride = GST_VIDEO_INFO_PLANE_STRIDE (info, 1); - ts_info.planes[2].stride = GST_VIDEO_INFO_PLANE_STRIDE (info, 2); - ts_info.planes[0].offset = GST_VIDEO_INFO_PLANE_OFFSET (info, 0); - ts_info.planes[1].offset = GST_VIDEO_INFO_PLANE_OFFSET (info, 1); - ts_info.planes[2].offset = GST_VIDEO_INFO_PLANE_OFFSET (info, 2); + + for (i = 0; i < n_planes; i++) { + ts_info.planes[i].stride = GST_VIDEO_INFO_PLANE_STRIDE (info, i); + ts_info.planes[i].offset = GST_VIDEO_INFO_PLANE_OFFSET (info, i); + ts_info.planes[i].size = plane_size[i]; + } GST_LOG ("tbm_bo (%p)", shm_mem->tbm_bo_ptr); diff --git a/packaging/gst-plugins-bad.spec b/packaging/gst-plugins-bad.spec index 4660f0dd6..799ba63f3 100644 --- a/packaging/gst-plugins-bad.spec +++ b/packaging/gst-plugins-bad.spec @@ -4,7 +4,7 @@ Name: gst-plugins-bad Version: 1.6.1 -Release: 13 +Release: 14 Summary: GStreamer Streaming-Media Framework Plug-Ins License: LGPL-2.0+ Group: Multimedia/Framework