1 From 1364ee6e60eb09a3fe3b072fe4671c5d645e523a Mon Sep 17 00:00:00 2001
2 From: Eric Ruei <e-ruei1@ti.com>
3 Date: Wed, 22 Feb 2017 10:49:01 -0500
4 Subject: [PATCH 1/3] gstwaylandsink: add input format I420 support
6 The software-based video decoder produces the output in I420 format. To display
7 the output without additional ARM MHz consumed in video format conversion,
8 the function gst_wl_memory_construct_wl_buffer is enhanced to support I420 format.
10 Signed-off-by: Eric Ruei <e-ruei1@ti.com>
12 ext/wayland/wldrm.c | 41 ++++++++++++++++++++++++++++++++++-------
13 1 file changed, 34 insertions(+), 7 deletions(-)
15 diff --git a/ext/wayland/wldrm.c b/ext/wayland/wldrm.c
16 index 3dc9c21..ecbdc88 100644
17 --- a/ext/wayland/wldrm.c
18 +++ b/ext/wayland/wldrm.c
20 #include <omap_drmif.h>
21 #include <wayland-client.h>
23 +GST_DEBUG_CATEGORY_EXTERN (gstwayland_debug);
24 +#define GST_CAT_DEFAULT gstwayland_debug
28 gst_wl_drm_memory_construct_wl_buffer (GstMemory * mem, GstWlDisplay * display,
29 const GstVideoInfo * info)
31 gint video_width = GST_VIDEO_INFO_WIDTH (info);
32 gint video_height = GST_VIDEO_INFO_HEIGHT (info);
33 + GstVideoFormat format = GST_VIDEO_INFO_FORMAT (info);
36 struct wl_buffer *buffer;
38 - /* TODO get format, etc from caps.. and query device for
39 - * supported formats, and make this all more flexible to
40 - * cope with various formats:
42 - uint32_t fourcc = GST_MAKE_FOURCC ('N', 'V', '1', '2');
45 /* note: wayland and mesa use the terminology:
46 * stride - rowstride in bytes
47 * pitch - rowstride in pixels
49 uint32_t strides[3] = {
50 - GST_ROUND_UP_4 (video_width), GST_ROUND_UP_4 (video_width), 0,
51 + GST_ROUND_UP_4 (video_width), 0, 0,
53 uint32_t offsets[3] = {
54 0, strides[0] * video_height, 0
57 + if (format == GST_VIDEO_FORMAT_NV12)
60 + fourcc = GST_MAKE_FOURCC ('N', 'V', '1', '2');
61 + strides[1] = GST_ROUND_UP_4 (video_width);
63 + else if(format == GST_VIDEO_FORMAT_I420)
66 + fourcc = GST_MAKE_FOURCC ('Y', 'U', '1', '2');
67 + strides[1] = strides[2] = GST_ROUND_UP_4 (video_width/2);
68 + offsets[2] = offsets[1] + strides[1] * video_height/2;
73 + GST_DEBUG ("Unsupported video format: %d", format);
75 + * There are two xRGB frames with width and height = 1 required in the begining of a video stream.
76 + * If we consider them as errot, then it will case libwayland-clent.so crashes
77 + * due to invalid error handling.
78 + * Consider them as NV12 until we can figure out a better solution
80 + fourcc = GST_MAKE_FOURCC ('N', 'V', '1', '2');
81 + strides[1] = GST_ROUND_UP_4 (video_width);
84 fd = gst_fd_memory_get_fd (mem);