Updated the Copyright related to Xilinx in the first line of the nvidia patch to handle the licensing issue. All the patches are ported from the 2016.4 EA release.
Signed-off-by: Dhaval Shah <[email protected]> --- ...e-nvidia-gstomx-templates-as-ref-for-hevc.patch | 714 +++++++++++++++++++++ ...reate-base-for-zynqultrascaleplus-devices.patch | 119 ++++ ...sing-requirement-for-h265-encoder-element.patch | 398 ++++++++++++ .../0004-Fix-Invalid-type-error-for-h265enc.patch | 89 +++ ...005-Link-omxh265enc-with-allegro-omx-core.patch | 64 ++ .../0006-Add-omxh265dec-element-support.patch | 105 +++ ...r-not-getting-change-event-from-output-po.patch | 32 + ...-Add-omxh264enc-dec-and-omxh265dec-suppor.patch | 92 +++ ...pport-for-hw-related-properties-of-OMX-IL.patch | 176 +++++ ...0010-Remove-memcopy-from-Input-of-gst-omx.patch | 166 +++++ ...-Gstreamer-property-in-Encoder-for-stride.patch | 99 +++ ...ling-for-dynamic-numbers-of-input-buffers.patch | 124 ++++ .../gstreamer/gstreamer1.0-omx_%.bbappend | 22 + 13 files changed, 2200 insertions(+) create mode 100644 recipes-multimedia/gstreamer/gstreamer1.0-omx/0001-Use-nvidia-gstomx-templates-as-ref-for-hevc.patch create mode 100644 recipes-multimedia/gstreamer/gstreamer1.0-omx/0002-configure-Create-base-for-zynqultrascaleplus-devices.patch create mode 100644 recipes-multimedia/gstreamer/gstreamer1.0-omx/0003-Add-missing-requirement-for-h265-encoder-element.patch create mode 100644 recipes-multimedia/gstreamer/gstreamer1.0-omx/0004-Fix-Invalid-type-error-for-h265enc.patch create mode 100644 recipes-multimedia/gstreamer/gstreamer1.0-omx/0005-Link-omxh265enc-with-allegro-omx-core.patch create mode 100644 recipes-multimedia/gstreamer/gstreamer1.0-omx/0006-Add-omxh265dec-element-support.patch create mode 100644 recipes-multimedia/gstreamer/gstreamer1.0-omx/0007-Add-hack-for-not-getting-change-event-from-output-po.patch create mode 100644 recipes-multimedia/gstreamer/gstreamer1.0-omx/0008-gstomx.conf-Add-omxh264enc-dec-and-omxh265dec-suppor.patch create mode 100644 recipes-multimedia/gstreamer/gstreamer1.0-omx/0009-Add-support-for-hw-related-properties-of-OMX-IL.patch create mode 100644 recipes-multimedia/gstreamer/gstreamer1.0-omx/0010-Remove-memcopy-from-Input-of-gst-omx.patch create mode 100644 recipes-multimedia/gstreamer/gstreamer1.0-omx/0011-Add-Gstreamer-property-in-Encoder-for-stride.patch create mode 100644 recipes-multimedia/gstreamer/gstreamer1.0-omx/0012-Handling-for-dynamic-numbers-of-input-buffers.patch create mode 100644 recipes-multimedia/gstreamer/gstreamer1.0-omx_%.bbappend diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-omx/0001-Use-nvidia-gstomx-templates-as-ref-for-hevc.patch b/recipes-multimedia/gstreamer/gstreamer1.0-omx/0001-Use-nvidia-gstomx-templates-as-ref-for-hevc.patch new file mode 100644 index 0000000..ca86132 --- /dev/null +++ b/recipes-multimedia/gstreamer/gstreamer1.0-omx/0001-Use-nvidia-gstomx-templates-as-ref-for-hevc.patch @@ -0,0 +1,714 @@ +From 7d92c60323ce3958ff4b402f3855b7a87b9aa1d8 Mon Sep 17 00:00:00 2001 +From: Devarsh Thakkar <[email protected]> +Date: Tue, 20 Sep 2016 17:20:41 +0530 +Subject: [PATCH 1/9] Use nvidia gstomx templates as ref for hevc + +Signed-off-by: Devarsh Thakkar <[email protected]> +--- + omx/gstomxh265dec.c | 104 ++++++++++++ + omx/gstomxh265dec.h | 56 +++++++ + omx/gstomxh265enc.c | 453 ++++++++++++++++++++++++++++++++++++++++++++++++++++ + omx/gstomxh265enc.h | 57 +++++++ + 4 files changed, 666 insertions(+) + create mode 100644 omx/gstomxh265dec.c + create mode 100644 omx/gstomxh265dec.h + create mode 100644 omx/gstomxh265enc.c + create mode 100644 omx/gstomxh265enc.h + +diff --git a/omx/gstomxh265dec.c b/omx/gstomxh265dec.c +new file mode 100644 +index 0000000..dcbd1cd +--- /dev/null ++++ b/omx/gstomxh265dec.c +@@ -0,0 +1,104 @@ ++/* GStreamer ++ * Copyright (C) 2017 Xilinx, Inc. based on ++ * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved. ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library General Public ++ * License along with this library; if not, write to the ++ * Free Software Foundation, Inc., 51 Franklin Street, Suite 500, ++ * Boston, MA 02110-1335, USA. ++ */ ++ ++#ifdef HAVE_CONFIG_H ++#include "config.h" ++#endif ++ ++#include <gst/gst.h> ++ ++#include "gstomxh265dec.h" ++ ++GST_DEBUG_CATEGORY_STATIC (gst_omx_h265_dec_debug_category); ++#define GST_CAT_DEFAULT gst_omx_h265_dec_debug_category ++ ++/* prototypes */ ++static gboolean gst_omx_h265_dec_is_format_change (GstOMXVideoDec * dec, ++ GstOMXPort * port, GstVideoCodecState * state); ++static gboolean gst_omx_h265_dec_set_format (GstOMXVideoDec * dec, ++ GstOMXPort * port, GstVideoCodecState * state); ++ ++enum ++{ ++ PROP_0 ++}; ++ ++/* class initialization */ ++ ++#define DEBUG_INIT \ ++ GST_DEBUG_CATEGORY_INIT (gst_omx_h265_dec_debug_category, "omxh265dec", 0, \ ++ "debug category for gst-omx video decoder base class"); ++ ++G_DEFINE_TYPE_WITH_CODE (GstOMXH265Dec, gst_omx_h265_dec, ++ GST_TYPE_OMX_VIDEO_DEC, DEBUG_INIT); ++ ++static void ++gst_omx_h265_dec_class_init (GstOMXH265DecClass * klass) ++{ ++ GstOMXVideoDecClass *videodec_class = GST_OMX_VIDEO_DEC_CLASS (klass); ++ GstElementClass *element_class = GST_ELEMENT_CLASS (klass); ++ ++ videodec_class->is_format_change = ++ GST_DEBUG_FUNCPTR (gst_omx_h265_dec_is_format_change); ++ videodec_class->set_format = GST_DEBUG_FUNCPTR (gst_omx_h265_dec_set_format); ++ ++ videodec_class->cdata.default_sink_template_caps = "video/x-h265, " ++ "parsed=(boolean) true, " ++ "alignment=(string) au, " ++ "stream-format=(string) byte-stream, " ++ "width=(int) [1,MAX], " "height=(int) [1,MAX]"; ++ ++ gst_element_class_set_static_metadata (element_class, ++ "OpenMAX H.265 Video Decoder", ++ "Codec/Decoder/Video", ++ "Decode H.265 video streams", ++ "Sanket Kothari <[email protected]>"); ++ ++ gst_omx_set_default_role (&videodec_class->cdata, "video_decoder.hevc"); ++} ++ ++static void ++gst_omx_h265_dec_init (GstOMXH265Dec * self) ++{ ++ ++} ++ ++static gboolean ++gst_omx_h265_dec_is_format_change (GstOMXVideoDec * dec, ++ GstOMXPort * port, GstVideoCodecState * state) ++{ ++ return FALSE; ++} ++ ++ ++static gboolean ++gst_omx_h265_dec_set_format (GstOMXVideoDec * dec, GstOMXPort * port, ++ GstVideoCodecState * state) ++{ ++ gboolean ret; ++ OMX_PARAM_PORTDEFINITIONTYPE port_def; ++ ++ gst_omx_port_get_port_definition (port, &port_def); ++ port_def.format.video.eCompressionFormat = NVX_VIDEO_CodingHEVC; ++ ++ ret = gst_omx_port_update_port_definition (port, &port_def) == OMX_ErrorNone; ++ ++ return ret; ++} +diff --git a/omx/gstomxh265dec.h b/omx/gstomxh265dec.h +new file mode 100644 +index 0000000..941e281 +--- /dev/null ++++ b/omx/gstomxh265dec.h +@@ -0,0 +1,56 @@ ++/* GStreamer ++ * Copyright (C) 2017 Xilinx, Inc. based on ++ * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved. ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library General Public ++ * License along with this library; if not, write to the ++ * Free Software Foundation, Inc., 51 Franklin Street, Suite 500, ++ * Boston, MA 02110-1335, USA. ++ */ ++ ++#ifndef __GST_OMX_H265_DEC_H__ ++#define __GST_OMX_H265_DEC_H__ ++ ++#include <gst/gst.h> ++#include "gstomxvideodec.h" ++ ++G_BEGIN_DECLS ++#define GST_TYPE_OMX_H265_DEC \ ++ (gst_omx_h265_dec_get_type()) ++#define GST_OMX_H265_DEC(obj) \ ++ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OMX_H265_DEC,GstOMXH265Dec)) ++#define GST_OMX_H265_DEC_CLASS(klass) \ ++ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OMX_H265_DEC,GstOMXH265DecClass)) ++#define GST_OMX_H265_DEC_GET_CLASS(obj) \ ++ (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_OMX_H265_DEC,GstOMXH265DecClass)) ++#define GST_IS_OMX_H265_DEC(obj) \ ++ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OMX_H265_DEC)) ++#define GST_IS_OMX_H265_DEC_CLASS(obj) \ ++ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OMX_H265_DEC)) ++typedef struct _GstOMXH265Dec GstOMXH265Dec; ++typedef struct _GstOMXH265DecClass GstOMXH265DecClass; ++ ++struct _GstOMXH265Dec ++{ ++ GstOMXVideoDec parent; ++}; ++ ++struct _GstOMXH265DecClass ++{ ++ GstOMXVideoDecClass parent_class; ++}; ++ ++GType gst_omx_h265_dec_get_type (void); ++ ++G_END_DECLS ++#endif /* __GST_OMX_H265_DEC_H__ */ +diff --git a/omx/gstomxh265enc.c b/omx/gstomxh265enc.c +new file mode 100644 +index 0000000..10bdc97 +--- /dev/null ++++ b/omx/gstomxh265enc.c +@@ -0,0 +1,453 @@ ++/* GStreamer ++ * Copyright (C) 2017 Xilinx, Inc. based on ++ * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved. ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library General Public ++ * License along with this library; if not, write to the ++ * Free Software Foundation, Inc., 51 Franklin Street, Suite 500, ++ * Boston, MA 02110-1335, USA. ++ */ ++ ++#ifdef HAVE_CONFIG_H ++#include "config.h" ++#endif ++#include <stdlib.h> ++#include <gst/gst.h> ++ ++#include "gstomxh265enc.h" ++ ++GST_DEBUG_CATEGORY_STATIC (gst_omx_h265_enc_debug_category); ++#define GST_CAT_DEFAULT gst_omx_h265_enc_debug_category ++ ++/* prototypes */ ++static gboolean gst_omx_h265_enc_set_format (GstOMXVideoEnc * enc, ++ GstOMXPort * port, GstVideoCodecState * state); ++static GstCaps *gst_omx_h265_enc_get_caps (GstOMXVideoEnc * enc, ++ GstOMXPort * port, GstVideoCodecState * state); ++static GstFlowReturn gst_omx_h265_enc_handle_output_frame (GstOMXVideoEnc * ++ self, GstOMXPort * port, GstOMXBuffer * buf, GstVideoCodecFrame * frame); ++ ++static OMX_ERRORTYPE gst_omx_h265_enc_set_insert_sps_pps (GstOMXVideoEnc * enc); ++ ++enum ++{ ++ PROP_0 ++}; ++ ++/* class initialization */ ++ ++#define DEBUG_INIT \ ++ GST_DEBUG_CATEGORY_INIT (gst_omx_h265_enc_debug_category, "omxh265enc", 0, \ ++ "debug category for gst-omx video encoder base class"); ++ ++G_DEFINE_TYPE_WITH_CODE (GstOMXH265Enc, gst_omx_h265_enc, ++ GST_TYPE_OMX_VIDEO_ENC, DEBUG_INIT); ++ ++static void ++gst_omx_h265_enc_class_init (GstOMXH265EncClass * klass) ++{ ++ GstElementClass *element_class = GST_ELEMENT_CLASS (klass); ++ GstOMXVideoEncClass *videoenc_class = GST_OMX_VIDEO_ENC_CLASS (klass); ++ ++ videoenc_class->set_format = GST_DEBUG_FUNCPTR (gst_omx_h265_enc_set_format); ++ videoenc_class->get_caps = GST_DEBUG_FUNCPTR (gst_omx_h265_enc_get_caps); ++ videoenc_class->handle_output_frame = ++ GST_DEBUG_FUNCPTR (gst_omx_h265_enc_handle_output_frame); ++ ++ videoenc_class->cdata.default_src_template_caps = "video/x-h265, " ++ "width=(int) [ 1, MAX ], " "height=(int) [ 1, MAX ], " ++ "framerate = (fraction) [0, MAX], " ++ "stream-format=(string) { byte-stream, hvc1, hev1 }, " ++ "alignment=(string) au "; ++ ++ gst_element_class_set_static_metadata (element_class, ++ "OpenMAX H.265 Video Encoder", ++ "Codec/Encoder/Video", ++ "Encode H.265 video streams", "Sanket Kothari <[email protected]>"); ++ ++ gst_omx_set_default_role (&videoenc_class->cdata, "video_encoder.hevc"); ++} ++ ++static void ++gst_omx_h265_enc_init (GstOMXH265Enc * self) ++{ ++ self->insert_sps_pps = TRUE; ++} ++ ++static gboolean ++gst_omx_h265_enc_set_format (GstOMXVideoEnc * enc, GstOMXPort * port, ++ GstVideoCodecState * state) ++{ ++ GstOMXH265Enc *self = GST_OMX_H265_ENC (enc); ++ GstCaps *peercaps; ++ OMX_PARAM_PORTDEFINITIONTYPE port_def; ++ OMX_VIDEO_PARAM_PROFILELEVELTYPE param; ++ OMX_ERRORTYPE err; ++ const gchar *profile_string = NULL, *level_string = NULL; ++ ++ gst_omx_port_get_port_definition (GST_OMX_VIDEO_ENC (self)->enc_out_port, ++ &port_def); ++ port_def.format.video.eCompressionFormat = NVX_VIDEO_CodingHEVC; ++ err = ++ gst_omx_port_update_port_definition (GST_OMX_VIDEO_ENC ++ (self)->enc_out_port, &port_def); ++ if (err != OMX_ErrorNone) ++ return FALSE; ++ ++ GST_OMX_INIT_STRUCT (¶m); ++ param.nPortIndex = GST_OMX_VIDEO_ENC (self)->enc_out_port->index; ++ ++ err = ++ gst_omx_component_get_parameter (GST_OMX_VIDEO_ENC (self)->enc, ++ OMX_IndexParamVideoProfileLevelCurrent, ¶m); ++ if (err != OMX_ErrorNone) { ++ GST_WARNING_OBJECT (self, ++ "Setting profile/level not supported by component"); ++ } ++ ++ peercaps = gst_pad_peer_query_caps (GST_VIDEO_ENCODER_SRC_PAD (enc), ++ gst_pad_get_pad_template_caps (GST_VIDEO_ENCODER_SRC_PAD (enc))); ++ if (peercaps) { ++ GstStructure *s; ++ ++ if (gst_caps_is_empty (peercaps)) { ++ gst_caps_unref (peercaps); ++ GST_ERROR_OBJECT (self, "Empty caps"); ++ return FALSE; ++ } ++ ++ s = gst_caps_get_structure (peercaps, 0); ++ ++ if (err == OMX_ErrorNone) { ++ profile_string = gst_structure_get_string (s, "profile"); ++ if (profile_string) { ++ if (g_str_equal (profile_string, "main")) { ++ param.eProfile = OMX_VIDEO_HEVCProfileMain; ++ } else if (g_str_equal (profile_string, "main-10")) { ++ param.eProfile = OMX_VIDEO_HEVCProfileMain10; ++ } else if (g_str_equal (profile_string, "mainstillpicture")) { ++ param.eProfile = OMX_VIDEO_HEVCProfileMainStillPicture; ++ } else { ++ goto unsupported_profile; ++ } ++ } ++ ++ level_string = gst_structure_get_string (s, "level"); ++ if (level_string) { ++ if (g_str_equal (level_string, "main1")) { ++ param.eLevel = OMX_VIDEO_HEVCMainTierLevel1; ++ } else if (g_str_equal (level_string, "main2")) { ++ param.eLevel = OMX_VIDEO_HEVCMainTierLevel2; ++ } else if (g_str_equal (level_string, "main2.1")) { ++ param.eLevel = OMX_VIDEO_HEVCMainTierLevel21; ++ } else if (g_str_equal (level_string, "main3")) { ++ param.eLevel = OMX_VIDEO_HEVCMainTierLevel3; ++ } else if (g_str_equal (level_string, "main3.1")) { ++ param.eLevel = OMX_VIDEO_HEVCMainTierLevel31; ++ } else if (g_str_equal (level_string, "main4")) { ++ param.eLevel = OMX_VIDEO_HEVCMainTierLevel4; ++ } else if (g_str_equal (level_string, "main4.1")) { ++ param.eLevel = OMX_VIDEO_HEVCMainTierLevel41; ++ } else if (g_str_equal (level_string, "main5")) { ++ param.eLevel = OMX_VIDEO_HEVCMainTierLevel5; ++ } else if (g_str_equal (level_string, "main5.1")) { ++ param.eLevel = OMX_VIDEO_HEVCMainTierLevel51; ++ } else if (g_str_equal (level_string, "main5.2")) { ++ param.eLevel = OMX_VIDEO_HEVCMainTierLevel52; ++ } else if (g_str_equal (level_string, "main6")) { ++ param.eLevel = OMX_VIDEO_HEVCMainTierLevel6; ++ } else if (g_str_equal (level_string, "main6.1")) { ++ param.eLevel = OMX_VIDEO_HEVCMainTierLevel61; ++ } else if (g_str_equal (level_string, "main6.2")) { ++ param.eLevel = OMX_VIDEO_HEVCMainTierLevel62; ++ } else if (g_str_equal (level_string, "high1")) { ++ param.eLevel = OMX_VIDEO_HEVCHighTierLevel1; ++ } else if (g_str_equal (level_string, "high2")) { ++ param.eLevel = OMX_VIDEO_HEVCHighTierLevel2; ++ } else if (g_str_equal (level_string, "high2.1")) { ++ param.eLevel = OMX_VIDEO_HEVCHighTierLevel21; ++ } else if (g_str_equal (level_string, "high3")) { ++ param.eLevel = OMX_VIDEO_HEVCHighTierLevel3; ++ } else if (g_str_equal (level_string, "high3.1")) { ++ param.eLevel = OMX_VIDEO_HEVCHighTierLevel31; ++ } else if (g_str_equal (level_string, "high4")) { ++ param.eLevel = OMX_VIDEO_HEVCHighTierLevel4; ++ } else if (g_str_equal (level_string, "high4.1")) { ++ param.eLevel = OMX_VIDEO_HEVCHighTierLevel41; ++ } else if (g_str_equal (level_string, "high5")) { ++ param.eLevel = OMX_VIDEO_HEVCHighTierLevel5; ++ } else if (g_str_equal (level_string, "high5.1")) { ++ param.eLevel = OMX_VIDEO_HEVCHighTierLevel51; ++ } else if (g_str_equal (level_string, "high5.2")) { ++ param.eLevel = OMX_VIDEO_HEVCHighTierLevel52; ++ } else if (g_str_equal (level_string, "high6")) { ++ param.eLevel = OMX_VIDEO_HEVCHighTierLevel6; ++ } else if (g_str_equal (level_string, "high6.1")) { ++ param.eLevel = OMX_VIDEO_HEVCHighTierLevel61; ++ } else if (g_str_equal (level_string, "high6.2")) { ++ param.eLevel = OMX_VIDEO_HEVCHighTierLevel62; ++ } else { ++ goto unsupported_level; ++ } ++ } ++ ++ err = ++ gst_omx_component_set_parameter (GST_OMX_VIDEO_ENC (self)->enc, ++ OMX_IndexParamVideoProfileLevelCurrent, ¶m); ++ if (err == OMX_ErrorUnsupportedIndex) { ++ GST_WARNING_OBJECT (self, ++ "Setting profile/level not supported by component"); ++ } else if (err != OMX_ErrorNone) { ++ GST_ERROR_OBJECT (self, ++ "Error setting profile %u and level %u: %s (0x%08x)", ++ (guint) param.eProfile, (guint) param.eLevel, ++ gst_omx_error_to_string (err), err); ++ return FALSE; ++ } ++ } ++ ++ gst_caps_unref (peercaps); ++ } ++ ++ ++ if (self->insert_sps_pps) { ++ err = gst_omx_h265_enc_set_insert_sps_pps (enc); ++ if (err != OMX_ErrorNone) { ++ GST_WARNING_OBJECT (self, ++ "Error setting insert sps pps: %s (0x%08x)", ++ gst_omx_error_to_string (err), err); ++ return FALSE; ++ } ++ } ++ ++ ++ return TRUE; ++ ++unsupported_profile: ++ GST_ERROR_OBJECT (self, "Unsupported profile %s", profile_string); ++ gst_caps_unref (peercaps); ++ return FALSE; ++ ++unsupported_level: ++ GST_ERROR_OBJECT (self, "Unsupported level %s", level_string); ++ gst_caps_unref (peercaps); ++ return FALSE; ++} ++ ++static GstCaps * ++gst_omx_h265_enc_get_caps (GstOMXVideoEnc * enc, GstOMXPort * port, ++ GstVideoCodecState * state) ++{ ++ GstOMXH265Enc *self = GST_OMX_H265_ENC (enc); ++ GstCaps *caps; ++ OMX_ERRORTYPE err; ++ OMX_VIDEO_PARAM_PROFILELEVELTYPE param; ++ const gchar *profile, *level; ++ ++ caps = gst_caps_new_simple ("video/x-h265", ++ "alignment", G_TYPE_STRING, "au", NULL); ++ ++ GST_OMX_INIT_STRUCT (¶m); ++ param.nPortIndex = GST_OMX_VIDEO_ENC (self)->enc_out_port->index; ++ ++ err = ++ gst_omx_component_get_parameter (GST_OMX_VIDEO_ENC (self)->enc, ++ OMX_IndexParamVideoProfileLevelCurrent, ¶m); ++ if (err != OMX_ErrorNone && err != OMX_ErrorUnsupportedIndex ++ && err != OMX_ErrorNotImplemented) ++ return NULL; ++ ++ if (err == OMX_ErrorNone) { ++ switch (param.eProfile) { ++ case OMX_VIDEO_HEVCProfileMain: ++ profile = "main"; ++ break; ++ case OMX_VIDEO_HEVCProfileMain10: ++ profile = "main-10"; ++ break; ++ case OMX_VIDEO_HEVCProfileMainStillPicture: ++ profile = "mainstillpicture"; ++ break; ++ ++ default: ++ g_assert_not_reached (); ++ return NULL; ++ } ++ ++ switch (param.eLevel) { ++ case OMX_VIDEO_HEVCMainTierLevel1: ++ level = "main1"; ++ break; ++ case OMX_VIDEO_HEVCMainTierLevel2: ++ level = "main2"; ++ break; ++ case OMX_VIDEO_HEVCMainTierLevel21: ++ level = "main2.1"; ++ break; ++ case OMX_VIDEO_HEVCMainTierLevel3: ++ level = "main3"; ++ break; ++ case OMX_VIDEO_HEVCMainTierLevel31: ++ level = "main3.1"; ++ break; ++ case OMX_VIDEO_HEVCMainTierLevel4: ++ level = "main4"; ++ break; ++ case OMX_VIDEO_HEVCMainTierLevel41: ++ level = "main4.1"; ++ break; ++ case OMX_VIDEO_HEVCMainTierLevel5: ++ level = "main5"; ++ break; ++ case OMX_VIDEO_HEVCMainTierLevel51: ++ level = "main5.1"; ++ break; ++ case OMX_VIDEO_HEVCMainTierLevel52: ++ level = "main5.2"; ++ break; ++ case OMX_VIDEO_HEVCMainTierLevel6: ++ level = "main6"; ++ break; ++ case OMX_VIDEO_HEVCMainTierLevel61: ++ level = "main6.1"; ++ break; ++ case OMX_VIDEO_HEVCMainTierLevel62: ++ level = "main6.2"; ++ break; ++ case OMX_VIDEO_HEVCHighTierLevel1: ++ level = "high1"; ++ break; ++ case OMX_VIDEO_HEVCHighTierLevel2: ++ level = "high2"; ++ break; ++ case OMX_VIDEO_HEVCHighTierLevel21: ++ level = "high2.1"; ++ break; ++ case OMX_VIDEO_HEVCHighTierLevel3: ++ level = "high3"; ++ break; ++ case OMX_VIDEO_HEVCHighTierLevel31: ++ level = "high3.1"; ++ break; ++ case OMX_VIDEO_HEVCHighTierLevel4: ++ level = "high4"; ++ break; ++ case OMX_VIDEO_HEVCHighTierLevel41: ++ level = "high4.1"; ++ break; ++ case OMX_VIDEO_HEVCHighTierLevel5: ++ level = "high5"; ++ break; ++ case OMX_VIDEO_HEVCHighTierLevel51: ++ level = "high5.1"; ++ break; ++ case OMX_VIDEO_HEVCHighTierLevel52: ++ level = "high5.2"; ++ break; ++ case OMX_VIDEO_HEVCHighTierLevel6: ++ level = "high6"; ++ break; ++ case OMX_VIDEO_HEVCHighTierLevel61: ++ level = "high6.1"; ++ break; ++ case OMX_VIDEO_HEVCHighTierLevel62: ++ level = "high6.2"; ++ break; ++ ++ default: ++ g_assert_not_reached (); ++ return NULL; ++ } ++ ++ gst_caps_set_simple (caps, ++ "profile", G_TYPE_STRING, profile, "level", G_TYPE_STRING, level, NULL); ++ } ++ ++ return caps; ++} ++ ++static GstFlowReturn ++gst_omx_h265_enc_handle_output_frame (GstOMXVideoEnc * self, GstOMXPort * port, ++ GstOMXBuffer * buf, GstVideoCodecFrame * frame) ++{ ++ if (buf->omx_buf->nFlags & OMX_BUFFERFLAG_CODECCONFIG) { ++ /* The codec data is SPS/PPS with a startcode => bytestream stream format ++ * For bytestream stream format the SPS/PPS is only in-stream and not ++ * in the caps! ++ */ ++ ++ if (buf->omx_buf->nFilledLen >= 4 && ++ GST_READ_UINT32_BE (buf->omx_buf->pBuffer + ++ buf->omx_buf->nOffset) == 0x00000001) { ++#ifndef USE_OMX_TARGET_TEGRA ++ GList *l = NULL; ++ GstBuffer *hdrs; ++ GstMapInfo map = GST_MAP_INFO_INIT; ++ ++ GST_DEBUG_OBJECT (self, "got codecconfig in byte-stream format"); ++ buf->omx_buf->nFlags &= ~OMX_BUFFERFLAG_CODECCONFIG; ++ ++ hdrs = gst_buffer_new_and_alloc (buf->omx_buf->nFilledLen); ++ ++ gst_buffer_map (hdrs, &map, GST_MAP_WRITE); ++ memcpy (map.data, ++ buf->omx_buf->pBuffer + buf->omx_buf->nOffset, ++ buf->omx_buf->nFilledLen); ++ gst_buffer_unmap (hdrs, &map); ++ l = g_list_append (l, hdrs); ++ gst_video_encoder_set_headers (GST_VIDEO_ENCODER (self), l); ++#else ++ /* No need to send headers in case of byte-stream. ++ * Attach SPS and PPS instead */ ++ gst_video_codec_frame_unref (frame); ++ return GST_FLOW_OK; ++#endif ++ } ++ } ++ ++ return ++ GST_OMX_VIDEO_ENC_CLASS ++ (gst_omx_h265_enc_parent_class)->handle_output_frame (self, port, buf, ++ frame); ++} ++ ++static OMX_ERRORTYPE ++gst_omx_h265_enc_set_insert_sps_pps (GstOMXVideoEnc * enc) ++{ ++ OMX_INDEXTYPE eIndex; ++ OMX_ERRORTYPE eError = OMX_ErrorNone; ++ NVX_PARAM_VIDENCPROPERTY oEncodeProp; ++ GstOMXH265Enc *self = GST_OMX_H265_ENC (enc); ++ ++ if (self->insert_sps_pps) { ++ GST_OMX_INIT_STRUCT (&oEncodeProp); ++ oEncodeProp.nPortIndex = enc->enc_out_port->index; ++ ++ eError = gst_omx_component_get_index (GST_OMX_VIDEO_ENC (self)->enc, ++ (gpointer) NVX_INDEX_PARAM_VIDEO_ENCODE_PROPERTY, &eIndex); ++ ++ if (eError == OMX_ErrorNone) { ++ eError = ++ gst_omx_component_get_parameter (GST_OMX_VIDEO_ENC (self)->enc, ++ eIndex, &oEncodeProp); ++ if (eError == OMX_ErrorNone) { ++ oEncodeProp.bInsertSPSPPSAtIDR = self->insert_sps_pps; ++ ++ eError = ++ gst_omx_component_set_parameter (GST_OMX_VIDEO_ENC (self)->enc, ++ eIndex, &oEncodeProp); ++ } ++ } ++ } ++ return eError; ++} +diff --git a/omx/gstomxh265enc.h b/omx/gstomxh265enc.h +new file mode 100644 +index 0000000..38e1bab +--- /dev/null ++++ b/omx/gstomxh265enc.h +@@ -0,0 +1,57 @@ ++/* GStreamer ++ * Copyright (C) 2017 Xilinx, Inc. based on ++ * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved. ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library General Public ++ * License along with this library; if not, write to the ++ * Free Software Foundation, Inc., 51 Franklin Street, Suite 500, ++ * Boston, MA 02110-1335, USA. ++ */ ++ ++#ifndef __GST_OMX_H265_ENC_H__ ++#define __GST_OMX_H265_ENC_H__ ++ ++#include <gst/gst.h> ++#include "gstomxvideoenc.h" ++ ++G_BEGIN_DECLS ++#define GST_TYPE_OMX_H265_ENC \ ++ (gst_omx_h265_enc_get_type()) ++#define GST_OMX_H265_ENC(obj) \ ++ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OMX_H265_ENC,GstOMXH265Enc)) ++#define GST_OMX_H265_ENC_CLASS(klass) \ ++ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OMX_H265_ENC,GstOMXH265EncClass)) ++#define GST_OMX_H265_ENC_GET_CLASS(obj) \ ++ (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_OMX_H265_ENC,GstOMXH265EncClass)) ++#define GST_IS_OMX_H265_ENC(obj) \ ++ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OMX_H265_ENC)) ++#define GST_IS_OMX_H265_ENC_CLASS(obj) \ ++ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OMX_H265_ENC)) ++typedef struct _GstOMXH265Enc GstOMXH265Enc; ++typedef struct _GstOMXH265EncClass GstOMXH265EncClass; ++ ++struct _GstOMXH265Enc ++{ ++ GstOMXVideoEnc parent; ++ gboolean insert_sps_pps; ++}; ++ ++struct _GstOMXH265EncClass ++{ ++ GstOMXVideoEncClass parent_class; ++}; ++ ++GType gst_omx_h265_enc_get_type (void); ++ ++G_END_DECLS ++#endif /* __GST_OMX_H265_ENC_H__ */ +-- +2.5.0 + diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-omx/0002-configure-Create-base-for-zynqultrascaleplus-devices.patch b/recipes-multimedia/gstreamer/gstreamer1.0-omx/0002-configure-Create-base-for-zynqultrascaleplus-devices.patch new file mode 100644 index 0000000..588fa0e --- /dev/null +++ b/recipes-multimedia/gstreamer/gstreamer1.0-omx/0002-configure-Create-base-for-zynqultrascaleplus-devices.patch @@ -0,0 +1,119 @@ +From c64f722dc42fec80ab7bfa6e0d76b19d9303f30b Mon Sep 17 00:00:00 2001 +From: Devarsh Thakkar <[email protected]> +Date: Tue, 20 Sep 2016 17:47:58 +0530 +Subject: [PATCH 2/9] configure : Create base for zynqultrascaleplus devices + +Generate separate gstomx.conf for zynqultrascaleplus device when +with-omx-target set zynqmpsoc+ as shown below : + +Usage : +./configure --prefix=<path_to_prefix> --with-omx-target=zynqultrascaleplus + +Note : Right now zynqultrascaleplus uses bellagio implementation as +reference + +Signed-off-by: Devarsh Thakkar <[email protected]> +--- + config/zynqultrascaleplus/Makefile.am | 6 ++++++ + config/zynqultrascaleplus/gstomx.conf | 35 +++++++++++++++++++++++++++++++++++ + configure.ac | 9 +++++++-- + 3 files changed, 48 insertions(+), 2 deletions(-) + create mode 100644 config/zynqultrascaleplus/Makefile.am + create mode 100644 config/zynqultrascaleplus/gstomx.conf + +diff --git a/config/zynqultrascaleplus/Makefile.am b/config/zynqultrascaleplus/Makefile.am +new file mode 100644 +index 0000000..01671c2 +--- /dev/null ++++ b/config/zynqultrascaleplus/Makefile.am +@@ -0,0 +1,6 @@ ++EXTRA_DIST = gstomx.conf ++ ++if USE_OMX_TARGET_ZYNQ_USCALE_PLUS ++configdir = $(sysconfdir)/xdg ++config_DATA = gstomx.conf ++endif +diff --git a/config/zynqultrascaleplus/gstomx.conf b/config/zynqultrascaleplus/gstomx.conf +new file mode 100644 +index 0000000..5ca8ba6 +--- /dev/null ++++ b/config/zynqultrascaleplus/gstomx.conf +@@ -0,0 +1,35 @@ ++[omxmpeg4videodec] ++type-name=GstOMXMPEG4VideoDec ++core-name=/usr/local/lib/libomxil-bellagio.so.0 ++component-name=OMX.st.video_decoder.mpeg4 ++rank=257 ++in-port-index=0 ++out-port-index=1 ++hacks=event-port-settings-changed-ndata-parameter-swap;event-port-settings-changed-port-0-to-1 ++ ++[omxh264dec] ++type-name=GstOMXH264Dec ++core-name=/usr/local/lib/libomxil-bellagio.so.0 ++component-name=OMX.st.video_decoder.avc ++rank=257 ++in-port-index=0 ++out-port-index=1 ++hacks=event-port-settings-changed-ndata-parameter-swap;event-port-settings-changed-port-0-to-1 ++ ++[omxmpeg4videoenc] ++type-name=GstOMXMPEG4VideoEnc ++core-name=/usr/local/lib/libomxil-bellagio.so.0 ++component-name=OMX.st.video_encoder.mpeg4 ++rank=0 ++in-port-index=0 ++out-port-index=1 ++hacks=event-port-settings-changed-ndata-parameter-swap;video-framerate-integer;syncframe-flag-not-used ++ ++[omxaacenc] ++type-name=GstOMXAACEnc ++core-name=/usr/local/lib/libomxil-bellagio.so.0 ++component-name=OMX.st.audio_encoder.aac ++rank=0 ++in-port-index=0 ++out-port-index=1 ++hacks=event-port-settings-changed-ndata-parameter-swap +diff --git a/configure.ac b/configure.ac +index e87d240..7bce920 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -221,7 +221,7 @@ AC_ARG_ENABLE(Bsymbolic, + LDFLAGS="${SAVED_LDFLAGS}"]) + + AC_ARG_WITH([omx-target], +- AS_HELP_STRING([--with-omx-target],[Use this OpenMAX IL target (generic, bellagio, rpi)]), ++ AS_HELP_STRING([--with-omx-target],[Use this OpenMAX IL target (generic, bellagio, rpi, zynqultrascaleplus)]), + [ac_cv_omx_target="$withval"], [ac_cv_omx_target="none"]) + + ac_cv_omx_target_struct_packing="none" +@@ -237,13 +237,17 @@ case "${ac_cv_omx_target}" in + bellagio) + AC_DEFINE(USE_OMX_TARGET_BELLAGIO, 1, [Use Bellagio OpenMAX IL target]) + ;; ++ zynqultrascaleplus) ++ AC_DEFINE(USE_OMX_TARGET_ZYNQ_USCALE_PLUS, 1, [Use Bellagio OpenMAX IL target]) ++ ;; + none|*) +- AC_ERROR([invalid OpenMAX IL target, you must specify one of --with-omx-target={generic,rpi,bellagio}]) ++ AC_ERROR([invalid OpenMAX IL target, you must specify one of --with-omx-target={generic,rpi,bellagio,zynqultrascaleplus}]) + ;; + esac + AM_CONDITIONAL(USE_OMX_TARGET_GENERIC, test "x$ac_cv_omx_target" = "xgeneric") + AM_CONDITIONAL(USE_OMX_TARGET_BELLAGIO, test "x$ac_cv_omx_target" = "xbellagio") + AM_CONDITIONAL(USE_OMX_TARGET_RPI, test "x$ac_cv_omx_target" = "xrpi") ++AM_CONDITIONAL(USE_OMX_TARGET_ZYNQ_USCALE_PLUS, test "x$ac_cv_omx_target" = "xzynqultrascaleplus") + + AC_ARG_WITH([omx-struct-packing], + AS_HELP_STRING([--with-omx-struct-packing],[Force OpenMAX struct packing, (default is none)]), +@@ -387,6 +391,7 @@ tools/Makefile + config/Makefile + config/bellagio/Makefile + config/rpi/Makefile ++config/zynqultrascaleplus/Makefile + examples/Makefile + examples/egl/Makefile + ) +-- +2.5.0 + diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-omx/0003-Add-missing-requirement-for-h265-encoder-element.patch b/recipes-multimedia/gstreamer/gstreamer1.0-omx/0003-Add-missing-requirement-for-h265-encoder-element.patch new file mode 100644 index 0000000..cb596bb --- /dev/null +++ b/recipes-multimedia/gstreamer/gstreamer1.0-omx/0003-Add-missing-requirement-for-h265-encoder-element.patch @@ -0,0 +1,398 @@ +From d040395728baf602c36a48857cb51874d13c2a18 Mon Sep 17 00:00:00 2001 +From: Devarsh Thakkar <[email protected]> +Date: Tue, 20 Sep 2016 19:47:48 +0530 +Subject: [PATCH 3/9] Add missing requirement for h265 encoder element + +-Add generic OMX macros which are also + compatible with OMX implementation of allegro + +-Add separate "config" support for zynqultrascaleplus + +Signed-off-by: Devarsh Thakkar <[email protected]> +--- + config/Makefile.am | 2 +- + config/zynqultrascaleplus/gstomx.conf | 6 + + configure.ac | 2 +- + omx/Makefile.am | 11 ++ + omx/gstomx.h | 2 +- + omx/gstomxh265enc.c | 8 +- + omx/openmax/OMX_VideoExt.h | 225 +++++++++++++++++++++++++++++++++- + 7 files changed, 249 insertions(+), 7 deletions(-) + +diff --git a/config/Makefile.am b/config/Makefile.am +index 3b467a2..bffcbb3 100644 +--- a/config/Makefile.am ++++ b/config/Makefile.am +@@ -1 +1 @@ +-SUBDIRS = bellagio rpi ++SUBDIRS = bellagio rpi zynqultrascaleplus +diff --git a/config/zynqultrascaleplus/gstomx.conf b/config/zynqultrascaleplus/gstomx.conf +index 5ca8ba6..c723e3e 100644 +--- a/config/zynqultrascaleplus/gstomx.conf ++++ b/config/zynqultrascaleplus/gstomx.conf +@@ -25,6 +25,12 @@ in-port-index=0 + out-port-index=1 + hacks=event-port-settings-changed-ndata-parameter-swap;video-framerate-integer;syncframe-flag-not-used + ++[omxh265enc] ++type-name=GstOMXH265Enc ++core-name=/usr/lib/arm-linux-gnueabihf/tegra/libnvomx.so ++component-name=OMX.Nvidia.h265.encoder ++rank=266 ++ + [omxaacenc] + type-name=GstOMXAACEnc + core-name=/usr/local/lib/libomxil-bellagio.so.0 +diff --git a/configure.ac b/configure.ac +index 7bce920..5eeb102 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -238,7 +238,7 @@ case "${ac_cv_omx_target}" in + AC_DEFINE(USE_OMX_TARGET_BELLAGIO, 1, [Use Bellagio OpenMAX IL target]) + ;; + zynqultrascaleplus) +- AC_DEFINE(USE_OMX_TARGET_ZYNQ_USCALE_PLUS, 1, [Use Bellagio OpenMAX IL target]) ++ AC_DEFINE(USE_OMX_TARGET_ZYNQ_USCALE_PLUS, 1, [Use ZynqUscale plus OpenMAX IL target]) + ;; + none|*) + AC_ERROR([invalid OpenMAX IL target, you must specify one of --with-omx-target={generic,rpi,bellagio,zynqultrascaleplus}]) +diff --git a/omx/Makefile.am b/omx/Makefile.am +index ad95334..1492ad1 100644 +--- a/omx/Makefile.am ++++ b/omx/Makefile.am +@@ -10,6 +10,11 @@ THEORA_C_FILES=gstomxtheoradec.c + THEORA_H_FILES=gstomxtheoradec.h + endif + ++if USE_OMX_TARGET_ZYNQ_USCALE_PLUS ++ $(H265_C_FILES)=gstomxh265enc.c ++ $(H265_H_FILES)=gstomxh265enc.h ++endif ++ + libgstomx_la_SOURCES = \ + gstomx.c \ + gstomxbufferpool.c \ +@@ -27,6 +32,8 @@ libgstomx_la_SOURCES = \ + $(VP8_C_FILES) \ + $(THEORA_C_FILES) \ + gstomxmpeg4videoenc.c \ ++ $(H265_C_FILES) \ ++ $(H265_H_FILES) \ + gstomxh264enc.c \ + gstomxh263enc.c \ + gstomxaacdec.c \ +@@ -66,6 +73,10 @@ if !HAVE_EXTERNAL_OMX + OMX_INCLUDEPATH = -I$(abs_srcdir)/openmax + endif + ++if USE_OMX_TARGET_ZYNQ_USCALE_PLUS ++OMX_INCLUDEPATH = -I$(abs_srcdir)/openmax ++endif ++ + libgstomx_la_CFLAGS = \ + -DGST_USE_UNSTABLE_API=1 \ + $(OMX_INCLUDEPATH) \ +diff --git a/omx/gstomx.h b/omx/gstomx.h +index 9ad8e2f..0342e14 100644 +--- a/omx/gstomx.h ++++ b/omx/gstomx.h +@@ -52,7 +52,7 @@ + #include <OMX_Broadcom.h> + #endif + +-#ifdef HAVE_VIDEO_EXT ++#if defined(HAVE_VIDEO_EXT) || defined(USE_OMX_TARGET_ZYNQ_USCALE_PLUS) + #include <OMX_VideoExt.h> + #endif + +diff --git a/omx/gstomxh265enc.c b/omx/gstomxh265enc.c +index 10bdc97..58b47f1 100644 +--- a/omx/gstomxh265enc.c ++++ b/omx/gstomxh265enc.c +@@ -96,7 +96,7 @@ gst_omx_h265_enc_set_format (GstOMXVideoEnc * enc, GstOMXPort * port, + + gst_omx_port_get_port_definition (GST_OMX_VIDEO_ENC (self)->enc_out_port, + &port_def); +- port_def.format.video.eCompressionFormat = NVX_VIDEO_CodingHEVC; ++ port_def.format.video.eCompressionFormat = OMX_VIDEO_CodingVendorStartUnused; + err = + gst_omx_port_update_port_definition (GST_OMX_VIDEO_ENC + (self)->enc_out_port, &port_def); +@@ -218,7 +218,7 @@ gst_omx_h265_enc_set_format (GstOMXVideoEnc * enc, GstOMXPort * port, + gst_caps_unref (peercaps); + } + +- ++#if 0 + if (self->insert_sps_pps) { + err = gst_omx_h265_enc_set_insert_sps_pps (enc); + if (err != OMX_ErrorNone) { +@@ -228,7 +228,7 @@ gst_omx_h265_enc_set_format (GstOMXVideoEnc * enc, GstOMXPort * port, + return FALSE; + } + } +- ++#endif + + return TRUE; + +@@ -420,6 +420,7 @@ gst_omx_h265_enc_handle_output_frame (GstOMXVideoEnc * self, GstOMXPort * port, + frame); + } + ++#if 0 + static OMX_ERRORTYPE + gst_omx_h265_enc_set_insert_sps_pps (GstOMXVideoEnc * enc) + { +@@ -450,3 +451,4 @@ gst_omx_h265_enc_set_insert_sps_pps (GstOMXVideoEnc * enc) + } + return eError; + } ++#endif +diff --git a/omx/openmax/OMX_VideoExt.h b/omx/openmax/OMX_VideoExt.h +index a9b5d45..9f07a94 100644 +--- a/omx/openmax/OMX_VideoExt.h ++++ b/omx/openmax/OMX_VideoExt.h +@@ -50,7 +50,6 @@ typedef enum OMX_NALUFORMATSTYPE { + OMX_NaluFormatCodingMax = 0x7FFFFFFF + } OMX_NALUFORMATSTYPE; + +- + /** NAL Stream Format */ + typedef struct OMX_NALSTREAMFORMATTYPE{ + OMX_U32 nSize; +@@ -59,7 +58,231 @@ typedef struct OMX_NALSTREAMFORMATTYPE{ + OMX_NALUFORMATSTYPE eNaluFormat; + } OMX_NALSTREAMFORMATTYPE; + ++/** VP8 profiles */ ++typedef enum OMX_VIDEO_VP8PROFILETYPE { ++ OMX_VIDEO_VP8ProfileMain = 0x01, ++ OMX_VIDEO_VP8ProfileUnknown = 0x6EFFFFFF, ++ OMX_VIDEO_VP8ProfileMax = 0x7FFFFFFF ++} OMX_VIDEO_VP8PROFILETYPE; ++ ++/** VP8 levels */ ++typedef enum OMX_VIDEO_VP8LEVELTYPE { ++ OMX_VIDEO_VP8Level_Version0 = 0x01, ++ OMX_VIDEO_VP8Level_Version1 = 0x02, ++ OMX_VIDEO_VP8Level_Version2 = 0x04, ++ OMX_VIDEO_VP8Level_Version3 = 0x08, ++ OMX_VIDEO_VP8LevelUnknown = 0x6EFFFFFF, ++ OMX_VIDEO_VP8LevelMax = 0x7FFFFFFF ++} OMX_VIDEO_VP8LEVELTYPE; ++ ++/** VP8 Param */ ++typedef struct OMX_VIDEO_PARAM_VP8TYPE { ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_U32 nPortIndex; ++ OMX_VIDEO_VP8PROFILETYPE eProfile; ++ OMX_VIDEO_VP8LEVELTYPE eLevel; ++ OMX_U32 nDCTPartitions; ++ OMX_BOOL bErrorResilientMode; ++} OMX_VIDEO_PARAM_VP8TYPE; ++ ++/** Structure for configuring VP8 reference frames */ ++typedef struct OMX_VIDEO_VP8REFERENCEFRAMETYPE { ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_U32 nPortIndex; ++ OMX_BOOL bPreviousFrameRefresh; ++ OMX_BOOL bGoldenFrameRefresh; ++ OMX_BOOL bAlternateFrameRefresh; ++ OMX_BOOL bUsePreviousFrame; ++ OMX_BOOL bUseGoldenFrame; ++ OMX_BOOL bUseAlternateFrame; ++} OMX_VIDEO_VP8REFERENCEFRAMETYPE; ++ ++/** Structure for querying VP8 reference frame type */ ++typedef struct OMX_VIDEO_VP8REFERENCEFRAMEINFOTYPE { ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_U32 nPortIndex; ++ OMX_BOOL bIsIntraFrame; ++ OMX_BOOL bIsGoldenOrAlternateFrame; ++} OMX_VIDEO_VP8REFERENCEFRAMEINFOTYPE; + ++/** Maximum number of VP8 temporal layers */ ++#define OMX_VIDEO_ANDROID_MAXVP8TEMPORALLAYERS 3 ++ ++/** VP8 temporal layer patterns */ ++typedef enum OMX_VIDEO_ANDROID_VPXTEMPORALLAYERPATTERNTYPE { ++ OMX_VIDEO_VPXTemporalLayerPatternNone = 0, ++ OMX_VIDEO_VPXTemporalLayerPatternWebRTC = 1, ++ OMX_VIDEO_VPXTemporalLayerPatternMax = 0x7FFFFFFF ++} OMX_VIDEO_ANDROID_VPXTEMPORALLAYERPATTERNTYPE; ++ ++/** ++ * Android specific VP8 encoder params ++ * ++ * STRUCT MEMBERS: ++ * nSize : Size of the structure in bytes ++ * nVersion : OMX specification version information ++ * nPortIndex : Port that this structure applies to ++ * nKeyFrameInterval : Key frame interval in frames ++ * eTemporalPattern : Type of temporal layer pattern ++ * nTemporalLayerCount : Number of temporal coding layers ++ * nTemporalLayerBitrateRatio : Bitrate ratio allocation between temporal ++ * streams in percentage ++ * nMinQuantizer : Minimum (best quality) quantizer ++ * nMaxQuantizer : Maximum (worst quality) quantizer ++ */ ++typedef struct OMX_VIDEO_PARAM_ANDROID_VP8ENCODERTYPE { ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_U32 nPortIndex; ++ OMX_U32 nKeyFrameInterval; ++ OMX_VIDEO_ANDROID_VPXTEMPORALLAYERPATTERNTYPE eTemporalPattern; ++ OMX_U32 nTemporalLayerCount; ++ OMX_U32 nTemporalLayerBitrateRatio[OMX_VIDEO_ANDROID_MAXVP8TEMPORALLAYERS]; ++ OMX_U32 nMinQuantizer; ++ OMX_U32 nMaxQuantizer; ++} OMX_VIDEO_PARAM_ANDROID_VP8ENCODERTYPE; ++ ++/** HEVC Profile enum type */ ++typedef enum OMX_VIDEO_HEVCPROFILETYPE { ++ OMX_VIDEO_HEVCProfileUnknown = 0x0, ++ OMX_VIDEO_HEVCProfileMain = 0x1, ++ OMX_VIDEO_HEVCProfileMain10 = 0x2, ++ OMX_VIDEO_HEVCProfileMainStillPicture = 0x4, ++ OMX_VIDEO_HEVCProfileMax = 0x7FFFFFFF ++} OMX_VIDEO_HEVCPROFILETYPE; ++ ++/** HEVC Level enum type */ ++typedef enum OMX_VIDEO_HEVCLEVELTYPE { ++ OMX_VIDEO_HEVCLevelUnknown = 0x0, ++ OMX_VIDEO_HEVCMainTierLevel1 = 0x1, ++ OMX_VIDEO_HEVCHighTierLevel1 = 0x2, ++ OMX_VIDEO_HEVCMainTierLevel2 = 0x4, ++ OMX_VIDEO_HEVCHighTierLevel2 = 0x8, ++ OMX_VIDEO_HEVCMainTierLevel21 = 0x10, ++ OMX_VIDEO_HEVCHighTierLevel21 = 0x20, ++ OMX_VIDEO_HEVCMainTierLevel3 = 0x40, ++ OMX_VIDEO_HEVCHighTierLevel3 = 0x80, ++ OMX_VIDEO_HEVCMainTierLevel31 = 0x100, ++ OMX_VIDEO_HEVCHighTierLevel31 = 0x200, ++ OMX_VIDEO_HEVCMainTierLevel4 = 0x400, ++ OMX_VIDEO_HEVCHighTierLevel4 = 0x800, ++ OMX_VIDEO_HEVCMainTierLevel41 = 0x1000, ++ OMX_VIDEO_HEVCHighTierLevel41 = 0x2000, ++ OMX_VIDEO_HEVCMainTierLevel5 = 0x4000, ++ OMX_VIDEO_HEVCHighTierLevel5 = 0x8000, ++ OMX_VIDEO_HEVCMainTierLevel51 = 0x10000, ++ OMX_VIDEO_HEVCHighTierLevel51 = 0x20000, ++ OMX_VIDEO_HEVCMainTierLevel52 = 0x40000, ++ OMX_VIDEO_HEVCHighTierLevel52 = 0x80000, ++ OMX_VIDEO_HEVCMainTierLevel6 = 0x100000, ++ OMX_VIDEO_HEVCHighTierLevel6 = 0x200000, ++ OMX_VIDEO_HEVCMainTierLevel61 = 0x400000, ++ OMX_VIDEO_HEVCHighTierLevel61 = 0x800000, ++ OMX_VIDEO_HEVCMainTierLevel62 = 0x1000000, ++ OMX_VIDEO_HEVCHighTierLevel62 = 0x2000000, ++ OMX_VIDEO_HEVCLevelMax = 0x7FFFFFFF ++} OMX_VIDEO_HEVCLEVELTYPE; ++ ++/** Structure to define if temporal motion vector prediction should be used */ ++typedef enum OMX_VIDEO_HEVCTMVPTYPE { ++ OMX_VIDEO_HEVCTMVPDisable = 0x01, /**< Disabled for all slices */ ++ OMX_VIDEO_HEVCTMVPEnable = 0x02, /**< Enabled for all slices */ ++ OMX_VIDEO_HEVCTMVPDisableFirstFrame = 0x04, /**< Disable only for first picture of each GOP size */ ++ OMX_VIDEO_HEVCTMVPMax = 0x7FFFFFFF ++} OMX_VIDEO_HEVCTMVPTYPE; ++ ++/** Structure to define if loop filter should be used */ ++typedef enum OMX_VIDEO_HEVCLOOPFILTERTYPE { ++ OMX_VIDEO_HEVCLoopFilterEnable = 0, /**< Enable HEVC Loop Filter */ ++ OMX_VIDEO_HEVCLoopFilterDisable, /**< Disable HEVC Loop Filter */ ++ OMX_VIDEO_HEVCLoopFilterDisableSliceBoundary, /**< Disables HEVC Loop Filter on slice boundary */ ++ OMX_VIDEO_HEVCLoopFilterDisableTileBoundary, /**< Disables HEVC Loop Filter on tile boundary */ ++ OMX_VIDEO_HEVCLoopFilterDisablePCM, /**< Disables HEVC Loop Filter for the reconstructed PCM samples */ ++ OMX_VIDEO_HEVCLoopFilterMax = 0x7FFFFFFF ++} OMX_VIDEO_HEVCLOOPFILTERTYPE; ++ ++/** ++ * HEVC params ++ * ++ * STRUCT MEMBERS: ++ * nSize : Size of the structure in bytes ++ * nVersion : OMX specification version information ++ * nPortIndex : Port that this structure applies to ++ * nPFrames : Number of P frames between each I frame ++ * nBFrames : Number of B frames between each I frame ++ * eProfile : HEVC profile(s) to use ++ * eLevel : HEVC level(s) to use ++ * nRefFrames : Number of reference frames to use for inter- ++ * motion search ++ * nNumLayers : Number of layers in the bitstream ++ * nNumSubLayers : Number of temporal sub-layers in the ++ * bitstream (range [0, 6]) ++ * bEnableSCP : Enable/disable separate plane coding for ++ * YUV 4:4:4 inputs ++ * bEnableScalingList : Enable/disable scaling process for transform ++ * coefficients ++ * bEnableAMP : Enable/disable asymmetric motion partitions ++ * bEnablePCM : Enable/disable PCM data in the bitstream ++ * bEnableSIS : Enable/disable strong intra smoothing filtering ++ * bWeightedPPrediction : Enable/disable weighted prediction applied ++ * to P slices ++ * bWeightedBPrediction : Enable/disable weighted prediction applied ++ * to B slices ++ * bEnableTiles : Enable/disable multiple tiles in each picture ++ * bEnableECSync : Enable/disable entropy coding synchronization ++ * bEnableUniformSpacing : Enable/disable uniform spacing of tile column ++ * and row boundaries across the picture ++ * bEnableSAO : Enable/disable sample adaptive offset filter ++ * bEnableConstrainedIntraPred : Enable/disable constrained intra prediction ++ * bEnableTransquantBypass : Enable/disable ability to bypass transform, ++ * quantization and filtering ++ * eTMVPMode : Control temporal motion vector prediction ++ * bEnableTransformSkip : Enable/disable transform-skipping for ++ * 4x4 TUs ++ * eLoopFilterType : Enable/disable HEVC loop filter ++ * nMaxTemporalId : Maximum temporal id of NAL units ++ */ ++typedef struct OMX_VIDEO_PARAM_HEVCTYPE { ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_U32 nPortIndex; ++ OMX_U32 nPFrames; ++ OMX_U32 nBFrames; ++ OMX_VIDEO_HEVCPROFILETYPE eProfile; ++ OMX_VIDEO_HEVCLEVELTYPE eLevel; ++ OMX_U32 nRefFrames; ++ OMX_U32 nNumLayers; ++ OMX_U32 nNumSubLayers; ++ OMX_BOOL bEnableSCP; ++ OMX_BOOL bEnableScalingList; ++ OMX_BOOL bEnableAMP; ++ OMX_BOOL bEnablePCM; ++ OMX_BOOL bEnableSIS; ++ OMX_BOOL bWeightedPPrediction; ++ OMX_BOOL bWeightedBPrediction; ++ OMX_BOOL bEnableTiles; ++ OMX_BOOL bEnableECSync; ++ OMX_BOOL bEnableUniformSpacing; ++ OMX_BOOL bEnableSAO; ++ OMX_BOOL bEnableConstrainedIntraPred; ++ OMX_BOOL bEnableTransquantBypass; ++ OMX_VIDEO_HEVCTMVPTYPE eTMVPMode; ++ OMX_BOOL bEnableTransformSkip; ++ OMX_VIDEO_HEVCLOOPFILTERTYPE eLoopFilterMode; ++ OMX_U32 nMaxTemporalId; ++} OMX_VIDEO_PARAM_HEVCTYPE; ++ ++/** Structure to define if dependent slice segments should be used */ ++typedef struct OMX_VIDEO_SLICESEGMENTSTYPE { ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_U32 nPortIndex; ++ OMX_BOOL bDepedentSegments; ++ OMX_BOOL bEnableLoopFilterAcrossSlices; ++} OMX_VIDEO_SLICESEGMENTSTYPE; + + #ifdef __cplusplus + } +-- +2.5.0 + diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-omx/0004-Fix-Invalid-type-error-for-h265enc.patch b/recipes-multimedia/gstreamer/gstreamer1.0-omx/0004-Fix-Invalid-type-error-for-h265enc.patch new file mode 100644 index 0000000..acb3fa9 --- /dev/null +++ b/recipes-multimedia/gstreamer/gstreamer1.0-omx/0004-Fix-Invalid-type-error-for-h265enc.patch @@ -0,0 +1,89 @@ +From c9837eaeee52214cb427817e0f16f5af53ff4039 Mon Sep 17 00:00:00 2001 +From: Devarsh Thakkar <[email protected]> +Date: Wed, 21 Sep 2016 17:04:48 +0530 +Subject: [PATCH 4/9] Fix Invalid type error for h265enc + +- This fixes invalid type error for h265 enc element + shown while running "gst-inspect-1.0 omx". + +- Declare get_type function for h265 enc element and + fix compilation for generating .lo file for h265 enc + element. + +Signed-off-by: Devarsh Thakkar <[email protected]> +--- + omx/Makefile.am | 8 ++++---- + omx/gstomx.c | 4 +++- + 2 files changed, 7 insertions(+), 5 deletions(-) + +diff --git a/omx/Makefile.am b/omx/Makefile.am +index 1492ad1..80e3c92 100644 +--- a/omx/Makefile.am ++++ b/omx/Makefile.am +@@ -32,8 +32,7 @@ libgstomx_la_SOURCES = \ + $(VP8_C_FILES) \ + $(THEORA_C_FILES) \ + gstomxmpeg4videoenc.c \ +- $(H265_C_FILES) \ +- $(H265_H_FILES) \ ++ gstomxh265enc.c \ + gstomxh264enc.c \ + gstomxh263enc.c \ + gstomxaacdec.c \ +@@ -41,7 +40,7 @@ libgstomx_la_SOURCES = \ + gstomxaacenc.c \ + gstomxaudiosink.c \ + gstomxanalogaudiosink.c \ +- gstomxhdmiaudiosink.c ++ gstomxhdmiaudiosink.c + + noinst_HEADERS = \ + gstomx.h \ +@@ -60,6 +59,7 @@ noinst_HEADERS = \ + $(VP8_H_FILES) \ + $(THEORA_H_FILES) \ + gstomxmpeg4videoenc.h \ ++ gstomxh265enc.h \ + gstomxh264enc.h \ + gstomxh263enc.h \ + gstomxaacdec.h \ +@@ -67,7 +67,7 @@ noinst_HEADERS = \ + gstomxaacenc.h \ + gstomxaudiosink.h \ + gstomxanalogaudiosink.h \ +- gstomxhdmiaudiosink.h ++ gstomxhdmiaudiosink.h + + if !HAVE_EXTERNAL_OMX + OMX_INCLUDEPATH = -I$(abs_srcdir)/openmax +diff --git a/omx/gstomx.c b/omx/gstomx.c +index 9a77e5b..8e2cb61 100644 +--- a/omx/gstomx.c ++++ b/omx/gstomx.c +@@ -32,12 +32,14 @@ + #include "gstomxmpeg2videodec.h" + #include "gstomxmpeg4videodec.h" + #include "gstomxh264dec.h" ++#include "gstomxh265dec.h" + #include "gstomxh263dec.h" + #include "gstomxvp8dec.h" + #include "gstomxtheoradec.h" + #include "gstomxwmvdec.h" + #include "gstomxmpeg4videoenc.h" + #include "gstomxh264enc.h" ++#include "gstomxh265enc.h" + #include "gstomxh263enc.h" + #include "gstomxaacdec.h" + #include "gstomxmp3dec.h" +@@ -2246,7 +2248,7 @@ static const GGetTypeFunction types[] = { + gst_omx_h264_dec_get_type, gst_omx_h263_dec_get_type, + gst_omx_wmv_dec_get_type, gst_omx_mpeg4_video_enc_get_type, + gst_omx_h264_enc_get_type, gst_omx_h263_enc_get_type, +- gst_omx_aac_enc_get_type, gst_omx_mjpeg_dec_get_type, ++ gst_omx_h265_enc_get_type, gst_omx_aac_enc_get_type, gst_omx_mjpeg_dec_get_type, + gst_omx_aac_dec_get_type, gst_omx_mp3_dec_get_type + #ifdef HAVE_VP8 + , gst_omx_vp8_dec_get_type +-- +2.5.0 + diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-omx/0005-Link-omxh265enc-with-allegro-omx-core.patch b/recipes-multimedia/gstreamer/gstreamer1.0-omx/0005-Link-omxh265enc-with-allegro-omx-core.patch new file mode 100644 index 0000000..4a0cac9 --- /dev/null +++ b/recipes-multimedia/gstreamer/gstreamer1.0-omx/0005-Link-omxh265enc-with-allegro-omx-core.patch @@ -0,0 +1,64 @@ +From 52753c133d897bdbb784e71b6293fd36d43cf26e Mon Sep 17 00:00:00 2001 +From: Devarsh Thakkar <[email protected]> +Date: Wed, 21 Sep 2016 19:32:58 +0530 +Subject: [PATCH 5/9] Link omxh265enc with allegro omx core + +- This links gstreamer omxh26enc element with + allegro OMX core library. + +- Allegro OMX core library is expected in /usr/local/lib/ location + so copy in that path only. + +- Allegro OMX core library has not implemented OMX_SetupTunnel yet + so we remove that check temporarily + +Signed-off-by: Devarsh Thakkar <[email protected]> +--- + config/zynqultrascaleplus/gstomx.conf | 8 +++++--- + omx/gstomx.c | 3 ++- + 2 files changed, 7 insertions(+), 4 deletions(-) + +diff --git a/config/zynqultrascaleplus/gstomx.conf b/config/zynqultrascaleplus/gstomx.conf +index c723e3e..0ccc0c1 100644 +--- a/config/zynqultrascaleplus/gstomx.conf ++++ b/config/zynqultrascaleplus/gstomx.conf +@@ -27,8 +27,10 @@ hacks=event-port-settings-changed-ndata-parameter-swap;video-framerate-integer;s + + [omxh265enc] + type-name=GstOMXH265Enc +-core-name=/usr/lib/arm-linux-gnueabihf/tegra/libnvomx.so +-component-name=OMX.Nvidia.h265.encoder ++core-name=/usr/local/lib/libOMX.allegro.core.so ++component-name=OMX.allegro.h265.encoder ++in-port-index=0 ++out-port-index=1 + rank=266 + + [omxaacenc] +@@ -38,4 +40,4 @@ component-name=OMX.st.audio_encoder.aac + rank=0 + in-port-index=0 + out-port-index=1 +-hacks=event-port-settings-changed-ndata-parameter-swap ++hacks=event-port-settings-changed-ndata-parameter-swap +\ No newline at end of file +diff --git a/omx/gstomx.c b/omx/gstomx.c +index 8e2cb61..ae741de 100644 +--- a/omx/gstomx.c ++++ b/omx/gstomx.c +@@ -128,10 +128,11 @@ gst_omx_core_acquire (const gchar * filename) + if (!g_module_symbol (core->module, "OMX_FreeHandle", + (gpointer *) & core->free_handle)) + goto symbol_error; ++/* + if (!g_module_symbol (core->module, "OMX_SetupTunnel", + (gpointer *) & core->setup_tunnel)) + goto symbol_error; +- ++*/ + GST_DEBUG ("Successfully loaded core '%s'", filename); + } + +-- +2.5.0 + diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-omx/0006-Add-omxh265dec-element-support.patch b/recipes-multimedia/gstreamer/gstreamer1.0-omx/0006-Add-omxh265dec-element-support.patch new file mode 100644 index 0000000..a7a9aec --- /dev/null +++ b/recipes-multimedia/gstreamer/gstreamer1.0-omx/0006-Add-omxh265dec-element-support.patch @@ -0,0 +1,105 @@ +From 38e982ceda64be8385750036ec498b33e45e0919 Mon Sep 17 00:00:00 2001 +From: Devarsh Thakkar <[email protected]> +Date: Fri, 23 Sep 2016 18:50:14 +0530 +Subject: [PATCH 6/9] Add omxh265dec element support + +Added support for omxh265dec element and linked +it with allegro decoder core. + +Signed-off-by: Devarsh Thakkar <[email protected]> +--- + config/zynqultrascaleplus/gstomx.conf | 10 +++++++++- + omx/Makefile.am | 5 ++++- + omx/gstomx.c | 3 ++- + omx/gstomxh265dec.c | 5 ++--- + 4 files changed, 17 insertions(+), 6 deletions(-) + +diff --git a/config/zynqultrascaleplus/gstomx.conf b/config/zynqultrascaleplus/gstomx.conf +index 0ccc0c1..155f858 100644 +--- a/config/zynqultrascaleplus/gstomx.conf ++++ b/config/zynqultrascaleplus/gstomx.conf +@@ -33,6 +33,14 @@ in-port-index=0 + out-port-index=1 + rank=266 + ++[omxh265dec] ++type-name=GstOMXH265Dec ++core-name=/usr/lib/libOMX.allegro.core.so ++component-name=OMX.allegro.h265.decoder ++in-port-index=0 ++out-port-index=1 ++rank=266 ++ + [omxaacenc] + type-name=GstOMXAACEnc + core-name=/usr/local/lib/libomxil-bellagio.so.0 +@@ -40,4 +48,4 @@ component-name=OMX.st.audio_encoder.aac + rank=0 + in-port-index=0 + out-port-index=1 +-hacks=event-port-settings-changed-ndata-parameter-swap +\ No newline at end of file ++hacks=event-port-settings-changed-ndata-parameter-swap +diff --git a/omx/Makefile.am b/omx/Makefile.am +index 80e3c92..62f89c8 100644 +--- a/omx/Makefile.am ++++ b/omx/Makefile.am +@@ -12,7 +12,9 @@ endif + + if USE_OMX_TARGET_ZYNQ_USCALE_PLUS + $(H265_C_FILES)=gstomxh265enc.c +- $(H265_H_FILES)=gstomxh265enc.h ++ $(H265_C_FILES)=gstomxh265enc.c ++ $(H265DEC_H_FILES)=gstomxh265dec.h ++ $(H265DEC_H_FILES)=gstomxh265dec.h + endif + + libgstomx_la_SOURCES = \ +@@ -33,6 +35,7 @@ libgstomx_la_SOURCES = \ + $(THEORA_C_FILES) \ + gstomxmpeg4videoenc.c \ + gstomxh265enc.c \ ++ gstomxh265dec.c \ + gstomxh264enc.c \ + gstomxh263enc.c \ + gstomxaacdec.c \ +diff --git a/omx/gstomx.c b/omx/gstomx.c +index ae741de..025fba2 100644 +--- a/omx/gstomx.c ++++ b/omx/gstomx.c +@@ -2249,7 +2249,8 @@ static const GGetTypeFunction types[] = { + gst_omx_h264_dec_get_type, gst_omx_h263_dec_get_type, + gst_omx_wmv_dec_get_type, gst_omx_mpeg4_video_enc_get_type, + gst_omx_h264_enc_get_type, gst_omx_h263_enc_get_type, +- gst_omx_h265_enc_get_type, gst_omx_aac_enc_get_type, gst_omx_mjpeg_dec_get_type, ++ gst_omx_h265_enc_get_type, gst_omx_h265_dec_get_type, ++ gst_omx_aac_enc_get_type, gst_omx_mjpeg_dec_get_type, + gst_omx_aac_dec_get_type, gst_omx_mp3_dec_get_type + #ifdef HAVE_VP8 + , gst_omx_vp8_dec_get_type +diff --git a/omx/gstomxh265dec.c b/omx/gstomxh265dec.c +index dcbd1cd..38f973c 100644 +--- a/omx/gstomxh265dec.c ++++ b/omx/gstomxh265dec.c +@@ -67,8 +67,7 @@ gst_omx_h265_dec_class_init (GstOMXH265DecClass * klass) + gst_element_class_set_static_metadata (element_class, + "OpenMAX H.265 Video Decoder", + "Codec/Decoder/Video", +- "Decode H.265 video streams", +- "Sanket Kothari <[email protected]>"); ++ "Decode H.265 video streams", "Sanket Kothari <[email protected]>"); + + gst_omx_set_default_role (&videodec_class->cdata, "video_decoder.hevc"); + } +@@ -95,7 +94,7 @@ gst_omx_h265_dec_set_format (GstOMXVideoDec * dec, GstOMXPort * port, + OMX_PARAM_PORTDEFINITIONTYPE port_def; + + gst_omx_port_get_port_definition (port, &port_def); +- port_def.format.video.eCompressionFormat = NVX_VIDEO_CodingHEVC; ++ port_def.format.video.eCompressionFormat = OMX_VIDEO_CodingVendorStartUnused; + + ret = gst_omx_port_update_port_definition (port, &port_def) == OMX_ErrorNone; + +-- +2.5.0 + diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-omx/0007-Add-hack-for-not-getting-change-event-from-output-po.patch b/recipes-multimedia/gstreamer/gstreamer1.0-omx/0007-Add-hack-for-not-getting-change-event-from-output-po.patch new file mode 100644 index 0000000..2cb89cb --- /dev/null +++ b/recipes-multimedia/gstreamer/gstreamer1.0-omx/0007-Add-hack-for-not-getting-change-event-from-output-po.patch @@ -0,0 +1,32 @@ +From b24712e8ce1bf9ba3bfa585f16d1da44878f8ce6 Mon Sep 17 00:00:00 2001 +From: Devarsh Thakkar <[email protected]> +Date: Fri, 23 Sep 2016 19:12:43 +0530 +Subject: [PATCH 7/9] Add hack for not getting change event from output port + +It seems that gstreamer is not able to recieve port +setting change event from allegro OMX IL core. +For such cases there is a facility already available in +gstreamer, which can be enabled by adding a hack in gstomx.conf file. + +Reference http://marc.info/?l=gstreamer-cvs&m=140015299702880&w=2 + +Signed-off-by: Devarsh Thakkar <[email protected]> +--- + config/zynqultrascaleplus/gstomx.conf | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/config/zynqultrascaleplus/gstomx.conf b/config/zynqultrascaleplus/gstomx.conf +index 155f858..af8e47f 100644 +--- a/config/zynqultrascaleplus/gstomx.conf ++++ b/config/zynqultrascaleplus/gstomx.conf +@@ -32,6 +32,7 @@ component-name=OMX.allegro.h265.encoder + in-port-index=0 + out-port-index=1 + rank=266 ++hacks=no-disable-outport + + [omxh265dec] + type-name=GstOMXH265Dec +-- +2.5.0 + diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-omx/0008-gstomx.conf-Add-omxh264enc-dec-and-omxh265dec-suppor.patch b/recipes-multimedia/gstreamer/gstreamer1.0-omx/0008-gstomx.conf-Add-omxh264enc-dec-and-omxh265dec-suppor.patch new file mode 100644 index 0000000..39951e2 --- /dev/null +++ b/recipes-multimedia/gstreamer/gstreamer1.0-omx/0008-gstomx.conf-Add-omxh264enc-dec-and-omxh265dec-suppor.patch @@ -0,0 +1,92 @@ +From dcf0cadabdf170ad6ef32392629a8a0e43ddce95 Mon Sep 17 00:00:00 2001 +From: Devarsh Thakkar <[email protected]> +Date: Mon, 26 Sep 2016 16:05:50 +0530 +Subject: [PATCH 8/9] [gstomx.conf] Add omxh264enc/dec and omxh265dec support + +Add remaining omx elements support, also updated +the OMX IL path to /usr/lib for all OMX related +shared libraries in gstomx.conf for which make below +changes in setup environment : + +1.Copy OMX IL (and it's dependencies) from Allegro OMX Encoder release +$sudo cp libOMX.allegro.core.so /usr/lib/libOMX.allegro_enc.core.so +$sudo cp libOMX.allegro.video_encoder.so /usr/lib/. + +2.Copy OMX IL from Allegro OMX Decoder (and it's dependecies) release +$sudo cp libOMX.allegro.core.so /usr/lib/libOMX.allegro_dec.core.so +$sudo cp libOMX.allegro.video_decoder.so /usr/lib/. + +3.Set path to encoder and decoder libs : +$export OMX_ALLEGRO_PATH=/usr/lib/. + +Signed-off-by: Devarsh Thakkar <[email protected]> +--- + config/zynqultrascaleplus/gstomx.conf | 33 ++++++++++++++++++++++----------- + 1 file changed, 22 insertions(+), 11 deletions(-) + +diff --git a/config/zynqultrascaleplus/gstomx.conf b/config/zynqultrascaleplus/gstomx.conf +index af8e47f..bdf4dcf 100644 +--- a/config/zynqultrascaleplus/gstomx.conf ++++ b/config/zynqultrascaleplus/gstomx.conf +@@ -7,15 +7,6 @@ in-port-index=0 + out-port-index=1 + hacks=event-port-settings-changed-ndata-parameter-swap;event-port-settings-changed-port-0-to-1 + +-[omxh264dec] +-type-name=GstOMXH264Dec +-core-name=/usr/local/lib/libomxil-bellagio.so.0 +-component-name=OMX.st.video_decoder.avc +-rank=257 +-in-port-index=0 +-out-port-index=1 +-hacks=event-port-settings-changed-ndata-parameter-swap;event-port-settings-changed-port-0-to-1 +- + [omxmpeg4videoenc] + type-name=GstOMXMPEG4VideoEnc + core-name=/usr/local/lib/libomxil-bellagio.so.0 +@@ -27,20 +18,40 @@ hacks=event-port-settings-changed-ndata-parameter-swap;video-framerate-integer;s + + [omxh265enc] + type-name=GstOMXH265Enc +-core-name=/usr/local/lib/libOMX.allegro.core.so ++core-name=/usr/lib/libOMX.allegro_enc.core.so + component-name=OMX.allegro.h265.encoder + in-port-index=0 + out-port-index=1 + rank=266 + hacks=no-disable-outport + ++[omxh264enc] ++type-name=GstOMXH264Enc ++core-name=/usr/lib/libOMX.allegro_enc.core.so ++component-name=OMX.allegro.h264.encoder ++in-port-index=0 ++out-port-index=1 ++rank=266 ++hacks=no-disable-outport ++ + [omxh265dec] + type-name=GstOMXH265Dec +-core-name=/usr/lib/libOMX.allegro.core.so ++core-name=/usr/lib/libOMX.allegro_dec.core.so + component-name=OMX.allegro.h265.decoder + in-port-index=0 + out-port-index=1 + rank=266 ++hacks=no-disable-outport ++ ++[omxh264dec] ++type-name=GstOMXH264Dec ++core-name=/usr/lib/libOMX.allegro_dec.core.so ++component-name=OMX.allegro.h264.decoder ++in-port-index=0 ++out-port-index=1 ++rank=266 ++hacks=no-disable-outport ++ + + [omxaacenc] + type-name=GstOMXAACEnc +-- +2.5.0 + diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-omx/0009-Add-support-for-hw-related-properties-of-OMX-IL.patch b/recipes-multimedia/gstreamer/gstreamer1.0-omx/0009-Add-support-for-hw-related-properties-of-OMX-IL.patch new file mode 100644 index 0000000..bafa577 --- /dev/null +++ b/recipes-multimedia/gstreamer/gstreamer1.0-omx/0009-Add-support-for-hw-related-properties-of-OMX-IL.patch @@ -0,0 +1,176 @@ +From 77c5fb4f5765916ba6a311819ae2ee163bafdd17 Mon Sep 17 00:00:00 2001 +From: Devarsh Thakkar <[email protected]> +Date: Mon, 26 Sep 2016 16:19:42 +0530 +Subject: [PATCH 9/9] Add support for hw related properties of OMX IL + +This adds support for following properties : +1. DMA bufpool enable/disable +2. Bypass mode enable/disable +3. MCU mode enable/disable + +Signed-off-by: Devarsh Thakkar <[email protected]> +--- + omx/gstomxvideodec.c | 31 ++++++++++++++++++++++++++++++ + omx/gstomxvideoenc.c | 30 +++++++++++++++++++++++++++++ + omx/openmax/OMX_VideoExt.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 109 insertions(+) + +diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c +index 8590301..8598376 100644 +--- a/omx/gstomxvideodec.c ++++ b/omx/gstomxvideodec.c +@@ -150,6 +150,14 @@ gst_omx_video_dec_open (GstVideoDecoder * decoder) + GstOMXVideoDecClass *klass = GST_OMX_VIDEO_DEC_GET_CLASS (self); + gint in_port_index, out_port_index; + ++#ifdef USE_OMX_TARGET_ZYNQ_USCALE_PLUS ++ OMX_INDEXTYPE type, DMAtype, MCUtype; ++ OMX_VIDEO_PARAM_ENABLEBOARD enable_board; ++ OMX_VIDEO_PARAM_ENABLEDMABUFFER enable_dmabuf; ++ OMX_VIDEO_PARAM_ENABLEMCU enable_mcu; ++ static int use_dmabuf = 0, use_mcu = 1, use_board = 0; ++#endif ++ + GST_DEBUG_OBJECT (self, "Opening decoder"); + + self->dec = +@@ -193,6 +201,29 @@ gst_omx_video_dec_open (GstVideoDecoder * decoder) + self->dec_in_port = gst_omx_component_add_port (self->dec, in_port_index); + self->dec_out_port = gst_omx_component_add_port (self->dec, out_port_index); + ++#ifdef USE_OMX_TARGET_ZYNQ_USCALE_PLUS ++ GST_INFO_OBJECT (self, "Custom settings needed for zynq VCU"); ++ OMX_GetExtensionIndex (self->dec->handle, ++ (OMX_STRING) "OMX.allegro.enableBoard", &type); ++ memset (&enable_board, 0, sizeof (enable_board)); ++ enable_board.bEnable = use_board; ++ OMX_SetParameter (self->dec->handle, type, &enable_board); ++ ++ OMX_GetExtensionIndex (self->dec->handle, ++ (OMX_STRING) "OMX.allegro.linux.enableDMA", &DMAtype); ++ ++ memset (&enable_dmabuf, 0, sizeof (enable_dmabuf)); ++ enable_dmabuf.bEnable = (OMX_BOOL) use_dmabuf; ++ OMX_SetParameter (self->dec->handle, DMAtype, &enable_dmabuf); ++ ++ OMX_GetExtensionIndex (self->dec->handle, ++ (OMX_STRING) "OMX.allegro.enableMCU", &MCUtype); ++ memset (&enable_mcu, 0, sizeof (enable_mcu)); ++ enable_mcu.bEnable = (OMX_BOOL) use_mcu; ++ OMX_SetParameter (self->dec->handle, MCUtype, &enable_mcu); ++#endif ++ ++ + if (!self->dec_in_port || !self->dec_out_port) + return FALSE; + +diff --git a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c +index 0f64a02..35f5fb0 100644 +--- a/omx/gstomxvideoenc.c ++++ b/omx/gstomxvideoenc.c +@@ -209,6 +209,14 @@ gst_omx_video_enc_open (GstVideoEncoder * encoder) + GstOMXVideoEncClass *klass = GST_OMX_VIDEO_ENC_GET_CLASS (self); + gint in_port_index, out_port_index; + ++#ifdef USE_OMX_TARGET_ZYNQ_USCALE_PLUS ++ OMX_INDEXTYPE type, DMAtype, MCUtype; ++ OMX_VIDEO_PARAM_ENABLEBOARD enable_board; ++ OMX_VIDEO_PARAM_ENABLEDMABUFFER enable_dmabuf; ++ OMX_VIDEO_PARAM_ENABLEMCU enable_mcu; ++ static int use_dmabuf = 0, use_mcu = 1, use_board = 0; ++#endif ++ + self->enc = + gst_omx_component_new (GST_OBJECT_CAST (self), klass->cdata.core_name, + klass->cdata.component_name, klass->cdata.component_role, +@@ -251,6 +259,28 @@ gst_omx_video_enc_open (GstVideoEncoder * encoder) + self->enc_in_port = gst_omx_component_add_port (self->enc, in_port_index); + self->enc_out_port = gst_omx_component_add_port (self->enc, out_port_index); + ++#ifdef USE_OMX_TARGET_ZYNQ_USCALE_PLUS ++ GST_INFO_OBJECT (self, "Custom settings needed for zynq VCU"); ++ OMX_GetExtensionIndex (self->enc->handle, ++ (OMX_STRING) "OMX.allegro.enableBoard", &type); ++ memset (&enable_board, 0, sizeof (enable_board)); ++ enable_board.bEnable = use_board; ++ OMX_SetParameter (self->enc->handle, type, &enable_board); ++ ++ OMX_GetExtensionIndex (self->enc->handle, ++ (OMX_STRING) "OMX.allegro.linux.enableDMA", &DMAtype); ++ ++ memset (&enable_dmabuf, 0, sizeof (enable_dmabuf)); ++ enable_dmabuf.bEnable = (OMX_BOOL) use_dmabuf; ++ OMX_SetParameter (self->enc->handle, DMAtype, &enable_dmabuf); ++ ++ OMX_GetExtensionIndex (self->enc->handle, ++ (OMX_STRING) "OMX.allegro.enableMCU", &MCUtype); ++ memset (&enable_mcu, 0, sizeof (enable_mcu)); ++ enable_mcu.bEnable = (OMX_BOOL) use_mcu; ++ OMX_SetParameter (self->enc->handle, MCUtype, &enable_mcu); ++#endif ++ + if (!self->enc_in_port || !self->enc_out_port) + return FALSE; + +diff --git a/omx/openmax/OMX_VideoExt.h b/omx/openmax/OMX_VideoExt.h +index 9f07a94..bd57a1d 100644 +--- a/omx/openmax/OMX_VideoExt.h ++++ b/omx/openmax/OMX_VideoExt.h +@@ -284,6 +284,54 @@ typedef struct OMX_VIDEO_SLICESEGMENTSTYPE { + OMX_BOOL bEnableLoopFilterAcrossSlices; + } OMX_VIDEO_SLICESEGMENTSTYPE; + ++#ifdef USE_OMX_TARGET_ZYNQ_USCALE_PLUS ++// Use Board ++#ifndef bUSELIBREF ++#define bUSELIBREF true ++#endif ++ ++/** ++ * ++ * Define Index Param Video ++ * ++ */ ++typedef enum AL_INDEX_PARAM_VIDEO_TYPE ++{ ++ OMX_IndexParamVideoHevc = OMX_IndexVendorStartUnused, ++ OMX_IndexParamVideoEnableBoard, ++ OMX_IndexParamVideoEnableMCU, ++ OMX_IndexParamVideoEnableDMA, ++}AL_INDEX_PARAM_VIDEO_TYPE; ++ ++#define OMX_AL_CUSTOMPARAM_ENABLE_BOARD "OMX.allegro.enableBoard" ++#define OMX_AL_CUSTOMPARAM_ENABLE_MCU "OMX.allegro.enableMCU" ++ ++typedef struct OMX_VIDEO_PARAM_ENABLEMCU ++{ ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_BOOL bEnable; ++}OMX_VIDEO_PARAM_ENABLEMCU; ++ ++#define OMX_AL_CUSTOMPARAM_ENABLE_DMA "OMX.allegro.linux.enableDMA" ++ ++typedef struct OMX_VIDEO_PARAM_ENABLEDMABUFFER ++{ ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_U32 nPortIndex; ++ OMX_BOOL bEnable; ++}OMX_VIDEO_PARAM_ENABLEDMABUFFER; ++ ++typedef struct OMX_VIDEO_PARAM_ENABLEBOARD ++{ ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_BOOL bEnable; ++}OMX_VIDEO_PARAM_ENABLEBOARD; ++ ++#endif ++ + #ifdef __cplusplus + } + #endif /* __cplusplus */ +-- +2.5.0 + diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-omx/0010-Remove-memcopy-from-Input-of-gst-omx.patch b/recipes-multimedia/gstreamer/gstreamer1.0-omx/0010-Remove-memcopy-from-Input-of-gst-omx.patch new file mode 100644 index 0000000..feec465 --- /dev/null +++ b/recipes-multimedia/gstreamer/gstreamer1.0-omx/0010-Remove-memcopy-from-Input-of-gst-omx.patch @@ -0,0 +1,166 @@ +From f3fc1465f7ac5aaab918322c5a7fa8944e2f14aa Mon Sep 17 00:00:00 2001 +From: Jeegar Patel <[email protected]> +Date: Fri, 25 Nov 2016 05:56:31 +0530 +Subject: [PATCH 1/2] Remove memcopy from Input of gst-omx + +Remove memcopy of GstBuffer into GstOMXBuffer +for input path of gst-omx +--- + omx/gstomxvideodec.c | 46 ++++++++++++++++++++++++++++++++++++++++++---- + omx/gstomxvideoenc.c | 48 ++++++++++++++++++++++++++++++++++++++++++++---- + 2 files changed, 86 insertions(+), 8 deletions(-) + +diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c +index 8598376..9555701 100644 +--- a/omx/gstomxvideodec.c ++++ b/omx/gstomxvideodec.c +@@ -1491,6 +1491,7 @@ gst_omx_video_dec_loop (GstOMXVideoDec * self) + goto invalid_buffer; + } + ++ /* FIXME: If stride mismatch happen then only copy happen for o/p frame */ + if (GST_OMX_BUFFER_POOL (self->out_port_pool)->need_copy) + outbuf = + copy_frame (&GST_OMX_BUFFER_POOL (self->out_port_pool)->video_info, +@@ -2053,10 +2054,34 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder, + return FALSE; + + /* Need to allocate buffers to reach Idle state */ +- if (gst_omx_port_allocate_buffers (self->dec_in_port) != OMX_ErrorNone) ++ ++ /* Moving from OMX_AllocateBuffers to OMX_UseBuffers, ++ Idea is to give address of GstBuffer's data received from previos element in pipeline ++ to GstOMXBuffer's data pointer. But at _set_format stage we do not have those GstBuffer ++ So below is hack of dummpy memory for OMX component initializing */ ++ ++ /* if (gst_omx_port_allocate_buffers (self->dec_in_port) != OMX_ErrorNone) ++ return FALSE; */ ++ ++ GstMapInfo info; ++ GstBuffer *mem = gst_buffer_new_allocate (NULL, 1024, NULL); ++ gst_buffer_map (mem, &info, GST_MAP_READ); ++ ++ GList *buffer_list = NULL; ++ buffer_list = g_list_append (buffer_list, info.data); ++ buffer_list = g_list_append (buffer_list, info.data); ++ ++ if (gst_omx_port_use_buffers (self->dec_in_port, ++ buffer_list) != OMX_ErrorNone) + return FALSE; ++ ++ gst_buffer_unmap (mem, &info); ++ gst_buffer_unref (mem); ++ g_list_free (buffer_list); ++ + if (gst_omx_port_allocate_buffers (self->dec_out_port) != OMX_ErrorNone) + return FALSE; ++ + } + + if (gst_omx_component_get_state (self->dec, +@@ -2354,9 +2379,22 @@ gst_omx_video_dec_handle_frame (GstVideoDecoder * decoder, + * by the port */ + buf->omx_buf->nFilledLen = + MIN (size - offset, buf->omx_buf->nAllocLen - buf->omx_buf->nOffset); +- gst_buffer_extract (frame->input_buffer, offset, +- buf->omx_buf->pBuffer + buf->omx_buf->nOffset, +- buf->omx_buf->nFilledLen); ++ ++ /* Instead of copying GstOMXBuffer to GstBuffer, ++ Updating data pointer of GstOMXBuffer with GstBuffer data pointer */ ++ ++ /* gst_buffer_extract (frame->input_buffer, offset, ++ buf->omx_buf->pBuffer + buf->omx_buf->nOffset, ++ buf->omx_buf->nFilledLen); */ ++ ++ GstMapInfo map = GST_MAP_INFO_INIT; ++ ++ if (!gst_buffer_map (frame->input_buffer, &map, GST_MAP_READ)) { ++ GST_ERROR_OBJECT (self, "Failed to map input buffer"); ++ } ++ buf->omx_buf->pBuffer = map.data; ++ gst_buffer_unmap (frame->input_buffer, &map); ++ + + if (timestamp != GST_CLOCK_TIME_NONE) { + buf->omx_buf->nTimeStamp = +diff --git a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c +index 35f5fb0..e5c2b94 100644 +--- a/omx/gstomxvideoenc.c ++++ b/omx/gstomxvideoenc.c +@@ -613,9 +613,15 @@ gst_omx_video_enc_handle_output_frame (GstOMXVideoEnc * self, GstOMXPort * port, + outbuf = gst_buffer_new_and_alloc (buf->omx_buf->nFilledLen); + + gst_buffer_map (outbuf, &map, GST_MAP_WRITE); ++ ++ /* FIXME: Instead of copying GstOMXbuffer into GstBuffer, Lets just assign pointer ++ of GstOMXBuffer to GstBuffer, Need support of GstBufferPool, Ref implementation is ++ there in gstomxvideodec.c */ ++ + memcpy (map.data, + buf->omx_buf->pBuffer + buf->omx_buf->nOffset, + buf->omx_buf->nFilledLen); ++ + gst_buffer_unmap (outbuf, &map); + } else { + outbuf = gst_buffer_new (); +@@ -1164,8 +1170,31 @@ gst_omx_video_enc_set_format (GstVideoEncoder * encoder, + return FALSE; + + /* Need to allocate buffers to reach Idle state */ +- if (gst_omx_port_allocate_buffers (self->enc_in_port) != OMX_ErrorNone) ++ ++ /* Moving from OMX_AllocateBuffers to OMX_UseBuffers, ++ Idea is to give address of GstBuffer's data received from previos element in pipeline ++ to GstOMXBuffer's data pointer. But at _set_format stage we do not have those GstBuffer ++ So below is hack of dummpy memory for OMX component initializing */ ++ ++ /* if (gst_omx_port_allocate_buffers (self->enc_in_port) != OMX_ErrorNone) ++ return FALSE; */ ++ ++ GstMapInfo info; ++ GstBuffer *mem = gst_buffer_new_allocate (NULL, 1024, NULL); ++ gst_buffer_map (mem, &info, GST_MAP_READ); ++ ++ GList *buffer_list = NULL; ++ buffer_list = g_list_append (buffer_list, info.data); ++ buffer_list = g_list_append (buffer_list, info.data); ++ ++ if (gst_omx_port_use_buffers (self->enc_in_port, ++ buffer_list) != OMX_ErrorNone) + return FALSE; ++ ++ gst_buffer_unmap (mem, &info); ++ gst_buffer_unref (mem); ++ g_list_free (buffer_list); ++ + if (gst_omx_port_allocate_buffers (self->enc_out_port) != OMX_ErrorNone) + return FALSE; + } +@@ -1265,9 +1294,20 @@ gst_omx_video_enc_fill_buffer (GstOMXVideoEnc * self, GstBuffer * inbuf, + outbuf->omx_buf->nAllocLen - outbuf->omx_buf->nOffset) { + outbuf->omx_buf->nFilledLen = gst_buffer_get_size (inbuf); + +- gst_buffer_extract (inbuf, 0, +- outbuf->omx_buf->pBuffer + outbuf->omx_buf->nOffset, +- outbuf->omx_buf->nFilledLen); ++ /* Instead of copying GstOMXBuffer to GstBuffer, ++ Updating data pointer of GstOMXBuffer with GstBuffer data pointer */ ++ ++ /* gst_buffer_extract (inbuf, 0, ++ outbuf->omx_buf->pBuffer + outbuf->omx_buf->nOffset, ++ outbuf->omx_buf->nFilledLen); */ ++ ++ GstMapInfo map = GST_MAP_INFO_INIT; ++ if (!gst_buffer_map (inbuf, &map, GST_MAP_READ)) { ++ GST_ERROR_OBJECT (self, "Failed to map input buffer"); ++ } ++ outbuf->omx_buf->pBuffer = map.data; ++ gst_buffer_unmap (inbuf, &map); ++ + ret = TRUE; + goto done; + } +-- +2.5.0 + diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-omx/0011-Add-Gstreamer-property-in-Encoder-for-stride.patch b/recipes-multimedia/gstreamer/gstreamer1.0-omx/0011-Add-Gstreamer-property-in-Encoder-for-stride.patch new file mode 100644 index 0000000..b59c57e --- /dev/null +++ b/recipes-multimedia/gstreamer/gstreamer1.0-omx/0011-Add-Gstreamer-property-in-Encoder-for-stride.patch @@ -0,0 +1,99 @@ +From 56d1df45092fce0167c3b227f181d456e629db66 Mon Sep 17 00:00:00 2001 +From: Jeegar Patel <[email protected]> +Date: Wed, 4 Jan 2017 15:46:17 +0530 +Subject: [PATCH 2/2] Add Gstreamer property in Encoder for stride + +For omxh264dec->omxh264enc usecase, o/p of decoder has +stride allignment so i/p of Encoder should take care +of this stride. +Need to enable stride=true in gstreamer pipeline +--- + omx/gstomxvideoenc.c | 24 ++++++++++++++++++++++-- + omx/gstomxvideoenc.h | 1 + + 2 files changed, 23 insertions(+), 2 deletions(-) + +diff --git a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c +index e5c2b94..dce886d 100644 +--- a/omx/gstomxvideoenc.c ++++ b/omx/gstomxvideoenc.c +@@ -96,7 +96,8 @@ enum + PROP_TARGET_BITRATE, + PROP_QUANT_I_FRAMES, + PROP_QUANT_P_FRAMES, +- PROP_QUANT_B_FRAMES ++ PROP_QUANT_B_FRAMES, ++ PROP_STRIDE + }; + + /* FIXME: Better defaults */ +@@ -163,6 +164,12 @@ gst_omx_video_enc_class_init (GstOMXVideoEncClass * klass) + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | + GST_PARAM_MUTABLE_READY)); + ++ g_object_class_install_property (gobject_class, PROP_STRIDE, ++ g_param_spec_boolean ("stride", "stride of Encoder input", ++ "stride of Encoder's raw input data, " ++ "Enable it when Decoder's o/p(with stride) given to Encoder", FALSE, ++ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); ++ + element_class->change_state = + GST_DEBUG_FUNCPTR (gst_omx_video_enc_change_state); + +@@ -470,6 +477,9 @@ gst_omx_video_enc_set_property (GObject * object, guint prop_id, + case PROP_QUANT_B_FRAMES: + self->quant_b_frames = g_value_get_uint (value); + break; ++ case PROP_STRIDE: ++ self->stride = g_value_get_boolean (value); ++ break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; +@@ -498,6 +508,9 @@ gst_omx_video_enc_get_property (GObject * object, guint prop_id, GValue * value, + case PROP_QUANT_B_FRAMES: + g_value_set_uint (value, self->quant_b_frames); + break; ++ case PROP_STRIDE: ++ g_value_set_boolean (value, self->stride); ++ break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; +@@ -1053,6 +1066,9 @@ gst_omx_video_enc_set_format (GstVideoEncoder * encoder, + } + + port_def.format.video.nFrameWidth = info->width; ++ if (self->stride) { ++ port_def.nBufferAlignment = 256; ++ } + if (port_def.nBufferAlignment) + port_def.format.video.nStride = + (info->width + port_def.nBufferAlignment - 1) & +@@ -1061,7 +1077,11 @@ gst_omx_video_enc_set_format (GstVideoEncoder * encoder, + port_def.format.video.nStride = GST_ROUND_UP_4 (info->width); /* safe (?) default */ + + port_def.format.video.nFrameHeight = info->height; +- port_def.format.video.nSliceHeight = info->height; ++ if (self->stride) { ++ port_def.format.video.nSliceHeight = GST_ROUND_UP_64 (info->height); ++ } else { ++ port_def.format.video.nSliceHeight = info->height; ++ } + + switch (port_def.format.video.eColorFormat) { + case OMX_COLOR_FormatYUV420Planar: +diff --git a/omx/gstomxvideoenc.h b/omx/gstomxvideoenc.h +index e266537..4b74742 100644 +--- a/omx/gstomxvideoenc.h ++++ b/omx/gstomxvideoenc.h +@@ -76,6 +76,7 @@ struct _GstOMXVideoEnc + guint32 quant_i_frames; + guint32 quant_p_frames; + guint32 quant_b_frames; ++ guint32 stride; + + GstFlowReturn downstream_flow_ret; + }; +-- +2.5.0 + diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-omx/0012-Handling-for-dynamic-numbers-of-input-buffers.patch b/recipes-multimedia/gstreamer/gstreamer1.0-omx/0012-Handling-for-dynamic-numbers-of-input-buffers.patch new file mode 100644 index 0000000..8e8e2a9 --- /dev/null +++ b/recipes-multimedia/gstreamer/gstreamer1.0-omx/0012-Handling-for-dynamic-numbers-of-input-buffers.patch @@ -0,0 +1,124 @@ +From 3267e083ca0341737164f838c72f9c144d11772e Mon Sep 17 00:00:00 2001 +From: Jeegar Patel <[email protected]> +Date: Tue, 10 Jan 2017 20:19:59 +0530 +Subject: [PATCH] Handling for dynamic numbers of input buffers + +Currently we have assumed OMX i/p buffers will be 2(fixed), +But it can be updated from OMX component. So we should +query OMX component for number of buffers and then +perform OMX_Usebuffer. +--- + omx/gstomxvideodec.c | 26 +++++++++++++++----------- + omx/gstomxvideoenc.c | 19 ++++++++++++------- + 2 files changed, 27 insertions(+), 18 deletions(-) + +diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c +index 9555701..c45fc3d 100644 +--- a/omx/gstomxvideodec.c ++++ b/omx/gstomxvideodec.c +@@ -938,8 +938,8 @@ gst_omx_video_dec_deallocate_output_buffers (GstOMXVideoDec * self) + } + #if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_GL) + err = +- gst_omx_port_deallocate_buffers (self-> +- eglimage ? self->egl_out_port : self->dec_out_port); ++ gst_omx_port_deallocate_buffers (self->eglimage ? self-> ++ egl_out_port : self->dec_out_port); + #else + err = gst_omx_port_deallocate_buffers (self->dec_out_port); + #endif +@@ -1336,8 +1336,8 @@ gst_omx_video_dec_loop (GstOMXVideoDec * self) + OMX_VIDEO_CodingUnused); + + format = +- gst_omx_video_get_format_from_omx (port_def.format. +- video.eColorFormat); ++ gst_omx_video_get_format_from_omx (port_def.format.video. ++ eColorFormat); + + if (format == GST_VIDEO_FORMAT_UNKNOWN) { + GST_ERROR_OBJECT (self, "Unsupported color format: %d", +@@ -1846,6 +1846,10 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder, + gboolean is_format_change = FALSE; + gboolean needs_disable = FALSE; + OMX_PARAM_PORTDEFINITIONTYPE port_def; ++ GList *buffer_list = NULL; ++ GstMapInfo map_info; ++ GstBuffer *mem = NULL; ++ gint i; + + self = GST_OMX_VIDEO_DEC (decoder); + klass = GST_OMX_VIDEO_DEC_GET_CLASS (decoder); +@@ -2063,19 +2067,19 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder, + /* if (gst_omx_port_allocate_buffers (self->dec_in_port) != OMX_ErrorNone) + return FALSE; */ + +- GstMapInfo info; +- GstBuffer *mem = gst_buffer_new_allocate (NULL, 1024, NULL); +- gst_buffer_map (mem, &info, GST_MAP_READ); ++ mem = gst_buffer_new_allocate (NULL, 1024, NULL); ++ gst_buffer_map (mem, &map_info, GST_MAP_READ); + +- GList *buffer_list = NULL; +- buffer_list = g_list_append (buffer_list, info.data); +- buffer_list = g_list_append (buffer_list, info.data); ++ gst_omx_port_update_port_definition (self->dec_in_port, NULL); ++ ++ for (i = 0; i < self->dec_in_port->port_def.nBufferCountActual; i++) ++ buffer_list = g_list_append (buffer_list, map_info.data); + + if (gst_omx_port_use_buffers (self->dec_in_port, + buffer_list) != OMX_ErrorNone) + return FALSE; + +- gst_buffer_unmap (mem, &info); ++ gst_buffer_unmap (mem, &map_info); + gst_buffer_unref (mem); + g_list_free (buffer_list); + +diff --git a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c +index dce886d..516c201 100644 +--- a/omx/gstomxvideoenc.c ++++ b/omx/gstomxvideoenc.c +@@ -982,6 +982,11 @@ gst_omx_video_enc_set_format (GstVideoEncoder * encoder, + OMX_PARAM_PORTDEFINITIONTYPE port_def; + GstVideoInfo *info = &state->info; + GList *negotiation_map = NULL, *l; ++ GList *buffer_list = NULL; ++ GstMapInfo map_info; ++ GstBuffer *mem = NULL; ++ gint i; ++ + + self = GST_OMX_VIDEO_ENC (encoder); + klass = GST_OMX_VIDEO_ENC_GET_CLASS (encoder); +@@ -1199,19 +1204,19 @@ gst_omx_video_enc_set_format (GstVideoEncoder * encoder, + /* if (gst_omx_port_allocate_buffers (self->enc_in_port) != OMX_ErrorNone) + return FALSE; */ + +- GstMapInfo info; +- GstBuffer *mem = gst_buffer_new_allocate (NULL, 1024, NULL); +- gst_buffer_map (mem, &info, GST_MAP_READ); ++ mem = gst_buffer_new_allocate (NULL, 1024, NULL); ++ gst_buffer_map (mem, &map_info, GST_MAP_READ); ++ ++ gst_omx_port_update_port_definition (self->enc_in_port, NULL); + +- GList *buffer_list = NULL; +- buffer_list = g_list_append (buffer_list, info.data); +- buffer_list = g_list_append (buffer_list, info.data); ++ for (i = 0; i < self->enc_in_port->port_def.nBufferCountActual; i++) ++ buffer_list = g_list_append (buffer_list, map_info.data); + + if (gst_omx_port_use_buffers (self->enc_in_port, + buffer_list) != OMX_ErrorNone) + return FALSE; + +- gst_buffer_unmap (mem, &info); ++ gst_buffer_unmap (mem, &map_info); + gst_buffer_unref (mem); + g_list_free (buffer_list); + +-- +2.5.0 + diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-omx_%.bbappend b/recipes-multimedia/gstreamer/gstreamer1.0-omx_%.bbappend new file mode 100644 index 0000000..10be4a0 --- /dev/null +++ b/recipes-multimedia/gstreamer/gstreamer1.0-omx_%.bbappend @@ -0,0 +1,22 @@ +# +# Need to make this conditional to gstreamer1 +# +SRC_URI_append_zynqmp = " \ + file://0001-Use-nvidia-gstomx-templates-as-ref-for-hevc.patch \ + file://0002-configure-Create-base-for-zynqultrascaleplus-devices.patch \ + file://0003-Add-missing-requirement-for-h265-encoder-element.patch \ + file://0004-Fix-Invalid-type-error-for-h265enc.patch \ + file://0005-Link-omxh265enc-with-allegro-omx-core.patch \ + file://0006-Add-omxh265dec-element-support.patch \ + file://0007-Add-hack-for-not-getting-change-event-from-output-po.patch \ + file://0008-gstomx.conf-Add-omxh264enc-dec-and-omxh265dec-suppor.patch \ + file://0009-Add-support-for-hw-related-properties-of-OMX-IL.patch \ + file://0010-Remove-memcopy-from-Input-of-gst-omx.patch \ + file://0011-Add-Gstreamer-property-in-Encoder-for-stride.patch \ + file://0012-Handling-for-dynamic-numbers-of-input-buffers.patch \ +" + +FILESEXTRAPATHS_prepend := "${THISDIR}/gstreamer1.0-omx:" + +GSTREAMER_1_0_OMX_TARGET_zynqmp = "zynqultrascaleplus" +GSTREAMER_1_0_OMX_CORE_NAME_zynqmp = "${libdir}/libomx.allegro.core.so" -- 2.11.0.3.g119133d -- _______________________________________________ meta-xilinx mailing list [email protected] https://lists.yoctoproject.org/listinfo/meta-xilinx
