From 13dfa298519c70fffb54e3ea9a085d4ee6455584 Mon Sep 17 00:00:00 2001 From: "sw.multimedia" Date: Fri, 27 Aug 2021 16:40:43 +0800 Subject: [PATCH] Add Multimedia Feature: 1. add starfive private packages: v4l2_test, pp_test, sf-gst-omx, sf-omx-il, stfisp_setfile, wave511, wave521 v4l2_test: used to test v4l2 device pp_test: used to switch format and resolution for framebuffer framework sf-gst-omx: from gst-omx and compatible with the omx-il library sf-omx-il: starfive openmax il library for VPU hardware decode stfisp_setfile: this is the host build package, used to generate the isp registrer setting bin for v4l2 framework wave511: this is chip&media decode hardware wave511 vendor code building wave521: this is chip&media encode hardware wave521 vendor code building 2. Add the following gstreamer patch: add patch to support gstreamer plugin fbdevsink NV12 format add patch to support gst-play take priority to decoding h264/h265 with gst-omx plugin Signed-off-by: sw.multimedia Signed-off-by: andy.hu Signed-off-by: michael.yan Signed-off-by: david.li Signed-off-by: Curry Zhang Signed-off-by: keithzhao --- .../gst1-plugins-bad/0001-add-I420.patch | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100755 package/gstreamer1/gst1-plugins-bad/0001-add-I420.patch diff --git a/package/gstreamer1/gst1-plugins-bad/0001-add-I420.patch b/package/gstreamer1/gst1-plugins-bad/0001-add-I420.patch new file mode 100755 index 00000000..b532de14 --- /dev/null +++ b/package/gstreamer1/gst1-plugins-bad/0001-add-I420.patch @@ -0,0 +1,72 @@ +--- a/sys/fbdev/gstfbdevsink.c 2021-07-06 16:02:46.304928800 +0800 ++++ b/sys/fbdev/gstfbdevsink.c 2021-07-06 16:02:11.593693100 +0800 +@@ -73,7 +73,7 @@ + static GstStateChangeReturn gst_fbdevsink_change_state (GstElement * element, + GstStateChange transition); + +-#define VIDEO_CAPS "{ RGB, BGR, BGRx, xBGR, RGB, RGBx, xRGB, RGB15, RGB16 }" ++#define VIDEO_CAPS "{ RGB, BGR, BGRx, xBGR, RGB, RGBx, xRGB, RGB15, RGB16, I420, NV12, NV21 }" + + static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, +@@ -133,7 +133,10 @@ + /* FIXME: locking */ + if (!fbdevsink->framebuffer) + goto done; +- ++ if (fbdevsink->varinfo.grayscale == 1) { ++ format = GST_VIDEO_FORMAT_NV12; ++ goto common; ++ } + bpp = fbdevsink->varinfo.bits_per_pixel; + + rmask = ((1 << fbdevsink->varinfo.red.length) - 1) +@@ -182,6 +185,8 @@ + if (format == GST_VIDEO_FORMAT_UNKNOWN) + goto unknown_format; + ++common: ++ + caps = gst_caps_make_writable (caps); + gst_caps_set_simple (caps, "format", G_TYPE_STRING, + gst_video_format_to_string (format), NULL); +@@ -272,12 +277,33 @@ + if (!gst_buffer_map (buf, &map, GST_MAP_READ)) + return GST_FLOW_ERROR; + +- for (i = 0; i < fbdevsink->lines; i++) { +- memcpy (fbdevsink->framebuffer +- + (i + fbdevsink->cy) * fbdevsink->fixinfo.line_length +- + fbdevsink->cx * fbdevsink->bytespp, +- map.data + i * fbdevsink->width * fbdevsink->bytespp, +- fbdevsink->linelen); ++ if (fbdevsink->varinfo.grayscale == 1) { ++ int screen_offset = fbdevsink->varinfo.xres * fbdevsink->varinfo.yres; ++ int buffer_offset = fbdevsink->height * fbdevsink->width; ++ ++ for (i = 0; i < fbdevsink->lines; i++) { ++ memcpy (fbdevsink->framebuffer ++ + (i + fbdevsink->cy) * fbdevsink->varinfo.xres ++ + fbdevsink->cx * 1, ++ map.data + i * fbdevsink->width * 1, ++ fbdevsink->width); ++ } ++ ++ for (i = 0; i < fbdevsink->lines/2; i++) { ++ memcpy (fbdevsink->framebuffer + screen_offset ++ + (i + fbdevsink->cy/2) * fbdevsink->varinfo.xres ++ + fbdevsink->cx * 1, ++ map.data + buffer_offset + i * fbdevsink->width * 1, ++ fbdevsink->width); ++ } ++ } else { ++ for (i = 0; i < fbdevsink->lines; i++) { ++ memcpy (fbdevsink->framebuffer ++ + (i + fbdevsink->cy) * fbdevsink->fixinfo.line_length ++ + fbdevsink->cx * fbdevsink->bytespp, ++ map.data + i * fbdevsink->width * fbdevsink->bytespp, ++ fbdevsink->linelen); ++ } + } + + gst_buffer_unmap (buf, &map);