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;
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);