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 <sw.multimedia@starfivetech.com> Signed-off-by: andy.hu <andy.hu@starfivetech.com> Signed-off-by: michael.yan <michael.yan@starfivetech.com> Signed-off-by: david.li <david.li@starfivetech.com> Signed-off-by: Curry Zhang <curry.zhang@starfivetech.com> Signed-off-by: keithzhao <keith.zhao@starfivetech.com> (cherry picked from http://192.168.110.45/jh7100/buildroot/-/commit/fce6b25d98f81388fa4372739631c49222bf8eea)
This commit is contained in:
@@ -2572,7 +2572,6 @@ menu "Text editors and viewers"
|
||||
source "package/vim/Config.in"
|
||||
endmenu
|
||||
|
||||
|
||||
menu "starfive packages"
|
||||
source "package/starfive/Config.in"
|
||||
endmenu
|
||||
|
||||
@@ -7,6 +7,7 @@ source "package/starfive/sf-omx-il/Config.in"
|
||||
source "package/starfive/sf-omx-il-test/Config.in"
|
||||
source "package/starfive/v4l2_test/Config.in"
|
||||
source "package/starfive/libcamera-apps/Config.in"
|
||||
source "package/starfive/sf-gst-omx/Config.in"
|
||||
source "package/starfive/ispsdk/Config.in"
|
||||
source "package/starfive/mailbox-test/Config.in"
|
||||
source "package/starfive/e24-test/Config.in"
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
diff --git a/config/meson.build b/config/meson.build
|
||||
index 1068c6d..7f8abe9 100755
|
||||
--- a/config/meson.build
|
||||
+++ b/config/meson.build
|
||||
@@ -6,6 +6,8 @@ elif omx_target == 'zynqultrascaleplus'
|
||||
sub = 'zynqultrascaleplus'
|
||||
elif omx_target == 'tizonia'
|
||||
sub = 'tizonia'
|
||||
+ elif omx_target == 'stf'
|
||||
+ sub = 'stf'
|
||||
else
|
||||
# No config file defined for the 'generic' target
|
||||
sub = ''
|
||||
diff --git a/config/stf/gstomx.conf b/config/stf/gstomx.conf
|
||||
new file mode 100644
|
||||
index 0000000..b4cdebb
|
||||
--- /dev/null
|
||||
+++ b/config/stf/gstomx.conf
|
||||
@@ -0,0 +1,17 @@
|
||||
+[omxh265dec]
|
||||
+type-name=GstOMXH265Dec
|
||||
+core-name=/usr/lib/libsf-omx-il.so
|
||||
+component-name=sf.dec.decoder.h265
|
||||
+in-port-index=0
|
||||
+out-port-index=1
|
||||
+rank=0
|
||||
+hacks=pass-profile-to-decoder;pass-color-format-to-decoder;ensure-buffer-count-actual
|
||||
+
|
||||
+[omxh264dec]
|
||||
+type-name=GstOMXH264Dec
|
||||
+core-name=/usr/lib/libsf-omx-il.so
|
||||
+component-name=sf.dec.decoder.h264
|
||||
+in-port-index=0
|
||||
+out-port-index=1
|
||||
+rank=1
|
||||
+hacks=pass-profile-to-decoder;pass-color-format-to-decoder;ensure-buffer-count-actual
|
||||
diff --git a/config/stf/meson.build b/config/stf/meson.build
|
||||
new file mode 100644
|
||||
index 0000000..dc99c08
|
||||
--- /dev/null
|
||||
+++ b/config/stf/meson.build
|
||||
@@ -0,0 +1 @@
|
||||
+install_data (['gstomx.conf'], install_dir : omx_conf_dir)
|
||||
diff --git a/meson.build b/meson.build
|
||||
index 32c7fa7..aeda56a 100755
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -216,6 +216,8 @@ elif omx_target == 'tizonia'
|
||||
tizil_includedir = tizil_dep.get_pkgconfig_variable('includedir')
|
||||
gst_omx_args += ['-I' + tizil_includedir + '/tizonia']
|
||||
omx_inc = []
|
||||
+elif omx_target == 'stf'
|
||||
+ warning('stf selected')
|
||||
else
|
||||
error ('Unsupported omx target specified. Use the -Dtarget option')
|
||||
endif
|
||||
diff --git a/meson_options.txt b/meson_options.txt
|
||||
index e18beb2..4fc6139 100755
|
||||
--- a/meson_options.txt
|
||||
+++ b/meson_options.txt
|
||||
@@ -1,7 +1,7 @@
|
||||
option('header_path', type : 'string', value : '',
|
||||
description : 'An extra include directory to find the OpenMax headers')
|
||||
option('target', type : 'combo',
|
||||
- choices : ['none', 'generic', 'rpi', 'bellagio', 'tizonia', 'zynqultrascaleplus'], value : 'none',
|
||||
+ choices : ['none', 'generic', 'rpi', 'bellagio', 'tizonia', 'zynqultrascaleplus', 'stf'], value : 'none',
|
||||
description : 'The OMX platform to target')
|
||||
option('struct_packing', type : 'combo',
|
||||
choices : ['0', '1', '2', '4', '8'], value : '0',
|
||||
Executable
+70
@@ -0,0 +1,70 @@
|
||||
From 810800c303965e5cb0cf135210667c003f050ee0 Mon Sep 17 00:00:00 2001
|
||||
From: "andy.hu" <andy.hu@starfive.com>
|
||||
Date: Tue, 10 Aug 2021 19:18:00 +0800
|
||||
Subject: [PATCH] Fix(gst-omx): Enable the gst-omx VPU decoding and encoding
|
||||
support h264 High L5.2
|
||||
|
||||
---
|
||||
|
||||
diff --git a/meson.build b/meson.build
|
||||
index aeda56a..48121ab 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -217,6 +217,7 @@ elif omx_target == 'tizonia'
|
||||
gst_omx_args += ['-I' + tizil_includedir + '/tizonia']
|
||||
omx_inc = []
|
||||
elif omx_target == 'stf'
|
||||
+ cdata.set('USE_OMX_TARGET_STARFIVE', 1)
|
||||
warning('stf selected')
|
||||
else
|
||||
error ('Unsupported omx target specified. Use the -Dtarget option')
|
||||
diff --git a/omx/gstomxh264enc.c b/omx/gstomxh264enc.c
|
||||
index 51d84a8..875f974 100644
|
||||
--- a/omx/gstomxh264enc.c
|
||||
+++ b/omx/gstomxh264enc.c
|
||||
@@ -824,6 +824,11 @@ gst_omx_h264_enc_get_caps (GstOMXVideoEnc * enc, GstOMXPort * port,
|
||||
case OMX_VIDEO_AVCLevel51:
|
||||
level = "5.1";
|
||||
break;
|
||||
+#ifdef USE_OMX_TARGET_STARFIVE
|
||||
+ case OMX_VIDEO_AVCLevel52:
|
||||
+ level = "5.2";
|
||||
+ break;
|
||||
+#else
|
||||
#ifdef USE_OMX_TARGET_ZYNQ_USCALE_PLUS
|
||||
case OMX_ALG_VIDEO_AVCLevel52:
|
||||
level = "5.2";
|
||||
@@ -837,6 +842,7 @@ gst_omx_h264_enc_get_caps (GstOMXVideoEnc * enc, GstOMXPort * port,
|
||||
case OMX_ALG_VIDEO_AVCLevel62:
|
||||
level = "6.2";
|
||||
break;
|
||||
+#endif
|
||||
#endif
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
diff --git a/omx/gstomxh264utils.c b/omx/gstomxh264utils.c
|
||||
index ba29211..a6e95e3 100644
|
||||
--- a/omx/gstomxh264utils.c
|
||||
+++ b/omx/gstomxh264utils.c
|
||||
@@ -115,6 +115,10 @@ gst_omx_h264_utils_get_level_from_str (const gchar * level)
|
||||
return OMX_VIDEO_AVCLevel5;
|
||||
} else if (g_str_equal (level, "5.1")) {
|
||||
return OMX_VIDEO_AVCLevel51;
|
||||
+#ifdef USE_OMX_TARGET_STARFIVE
|
||||
+ } else if (g_str_equal (level, "5.2")) {
|
||||
+ return OMX_VIDEO_AVCLevel52;
|
||||
+#else
|
||||
#ifdef USE_OMX_TARGET_ZYNQ_USCALE_PLUS
|
||||
} else if (g_str_equal (level, "5.2")) {
|
||||
return (OMX_VIDEO_AVCLEVELTYPE) OMX_ALG_VIDEO_AVCLevel52;
|
||||
@@ -124,6 +128,7 @@ gst_omx_h264_utils_get_level_from_str (const gchar * level)
|
||||
return (OMX_VIDEO_AVCLEVELTYPE) OMX_ALG_VIDEO_AVCLevel61;
|
||||
} else if (g_str_equal (level, "6.2")) {
|
||||
return (OMX_VIDEO_AVCLEVELTYPE) OMX_ALG_VIDEO_AVCLevel62;
|
||||
+#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
--- a/omx/gstomxvideodec.c 2020-10-26 19:17:03.000000000 +0800
|
||||
+++ b/omx/gstomxvideodec.c 2021-08-16 16:23:08.082113380 +0800
|
||||
@@ -2185,6 +2185,7 @@
|
||||
gst_omx_video_dec_negotiate (GstOMXVideoDec * self)
|
||||
{
|
||||
OMX_VIDEO_PARAM_PORTFORMATTYPE param;
|
||||
+ OMX_PARAM_PORTDEFINITIONTYPE port_def;
|
||||
OMX_ERRORTYPE err;
|
||||
GstCaps *comp_supported_caps;
|
||||
GList *negotiation_map = NULL, *l;
|
||||
@@ -2192,6 +2193,7 @@
|
||||
GstVideoFormat format;
|
||||
GstStructure *s;
|
||||
const gchar *format_str;
|
||||
+ gint width, height;
|
||||
|
||||
GST_DEBUG_OBJECT (self, "Trying to negotiate a video format with downstream");
|
||||
|
||||
@@ -2281,6 +2283,31 @@
|
||||
gst_omx_error_to_string (err), err);
|
||||
}
|
||||
|
||||
+ if (gst_structure_get_int(s, "width", &width) && gst_structure_get_int(s, "height", &height))
|
||||
+ {
|
||||
+ GST_OMX_INIT_STRUCT (&port_def);
|
||||
+ port_def.nPortIndex = self->dec_out_port->index;
|
||||
+ err = gst_omx_component_get_parameter (self->dec,
|
||||
+ OMX_IndexParamPortDefinition, &port_def);
|
||||
+ if (err != OMX_ErrorNone) {
|
||||
+ GST_ERROR_OBJECT (self, "Failed to get video port definition: %s (0x%08x)",
|
||||
+ gst_omx_error_to_string (err), err);
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
+ port_def.format.video.nFrameHeight = height;
|
||||
+ port_def.format.video.nFrameWidth = width;
|
||||
+
|
||||
+ err =
|
||||
+ gst_omx_component_set_parameter (self->dec,
|
||||
+ OMX_IndexParamPortDefinition, &port_def);
|
||||
+ if (err != OMX_ErrorNone) {
|
||||
+ GST_ERROR_OBJECT (self, "Failed to set video port definition: %s (0x%08x)",
|
||||
+ gst_omx_error_to_string (err), err);
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
gst_caps_unref (intersection);
|
||||
return (err == OMX_ErrorNone);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
diff -Naur a/config/stf/gstomx.conf b/config/stf/gstomx.conf
|
||||
--- a/config/stf/gstomx.conf 2021-08-23 16:04:48.928905742 +0800
|
||||
+++ b/config/stf/gstomx.conf 2021-08-23 16:03:38.590578856 +0800
|
||||
@@ -4,7 +4,7 @@
|
||||
component-name=sf.dec.decoder.h265
|
||||
in-port-index=0
|
||||
out-port-index=1
|
||||
-rank=0
|
||||
+rank=257
|
||||
hacks=pass-profile-to-decoder;pass-color-format-to-decoder;ensure-buffer-count-actual
|
||||
|
||||
[omxh264dec]
|
||||
@@ -13,5 +13,5 @@
|
||||
component-name=sf.dec.decoder.h264
|
||||
in-port-index=0
|
||||
out-port-index=1
|
||||
-rank=1
|
||||
+rank=257
|
||||
hacks=pass-profile-to-decoder;pass-color-format-to-decoder;ensure-buffer-count-actual
|
||||
@@ -0,0 +1,11 @@
|
||||
config SF_PACKAGE_GST_OMX
|
||||
bool "sf-gst-omx"
|
||||
depends on BR2_PACKAGE_SF_OMX_IL
|
||||
select BR2_PACKAGE_GST1_PLUGINS_BASE
|
||||
help
|
||||
GStreamer plug-in to use OpenMAX API.
|
||||
|
||||
https://cgit.freedesktop.org/gstreamer/gst-omx
|
||||
|
||||
comment "gst-omx requires a OpenMAX implementation"
|
||||
depends on !BR2_PACKAGE_SF_OMX_IL
|
||||
@@ -0,0 +1,3 @@
|
||||
# From https://gstreamer.freedesktop.org/src/gst-omx/gst-omx-1.18.5.tar.xz.sha256sum
|
||||
sha256 2cd457c1e8deb1a9b39608048fb36a44f6c9a864a6b6115b1453a32e7be93b42 gst-omx-1.18.5.tar.xz
|
||||
sha256 dc626520dcd53a22f727af3ee42c770e56c97a64fe3adb063799d8ab032fe551 COPYING
|
||||
@@ -0,0 +1,36 @@
|
||||
################################################################################
|
||||
#
|
||||
# sf-gst-omx
|
||||
#
|
||||
################################################################################
|
||||
|
||||
SF_GST_OMX_VERSION = 1.18.5
|
||||
SF_GST_OMX_SOURCE = gst-omx-$(GST_OMX_VERSION).tar.xz
|
||||
SF_GST_OMX_SITE = https://gstreamer.freedesktop.org/src/gst-omx
|
||||
|
||||
SF_GST_OMX_LICENSE = LGPL-2.1
|
||||
SF_GST_OMX_LICENSE_FILES = COPYING
|
||||
|
||||
SF_GST_OMX_CONF_OPTS = \
|
||||
-Dexamples=disabled \
|
||||
-Dtests=disabled \
|
||||
-Dtools=disabled \
|
||||
-Ddoc=disabled
|
||||
|
||||
|
||||
SF_GST_OMX_VARIANT = stf
|
||||
SF_GST_OMX_CONF_OPTS += -Dheader_path=$(STAGING_DIR)/usr/include/omx-il
|
||||
|
||||
SF_GST_OMX_CONF_OPTS += -Dtarget=$(SF_GST_OMX_VARIANT)
|
||||
|
||||
SF_GST_OMX_DEPENDENCIES = gstreamer1 gst1-plugins-base sf-omx-il
|
||||
|
||||
# adjust library paths to where buildroot installs them
|
||||
define SF_GST_OMX_FIXUP_CONFIG_PATHS
|
||||
find $(@D)/config -name gstomx.conf | \
|
||||
xargs $(SED) 's|/usr/local|/usr|g' -e 's|/opt/vc|/usr|g'
|
||||
endef
|
||||
|
||||
SF_GST_OMX_POST_PATCH_HOOKS += SF_GST_OMX_FIXUP_CONFIG_PATHS
|
||||
|
||||
$(eval $(meson-package))
|
||||
Reference in New Issue
Block a user