Merge remote-tracking branch 'coral/staging' into staging-merge
Change-Id: I25992dd78e6dc455ad78517d1b07d00befcefa1e
diff --git a/configure.ac b/configure.ac
index a0eef5a..421360b 100755
--- a/configure.ac
+++ b/configure.ac
@@ -3,7 +3,7 @@
dnl initialize autoconf
dnl releases only do -Wall, git and prerelease does -Werror too
dnl use a three digit version number for releases, and four for git/prerelease
-AC_INIT(GStreamer i.MX Plug-ins, 4.3.4, http://www.freescale.com, imx-gst1.0-plugin)
+AC_INIT(GStreamer i.MX Plug-ins, 4.4.5, http://www.freescale.com, imx-gst1.0-plugin)
dnl initialize automake
AM_INIT_AUTOMAKE([foreign])
@@ -191,7 +191,7 @@
dnl Give a warning if we don't have gstreamer libs
if test "x$HAVE_GST_BAD_BASE" = "xno"; then
- AC_MSG_ERROR(no GStreamer bad-base found)
+ AC_MSG_WARN(no GStreamer bad-base found)
fi
dnl make GST_BAD_BASE_CFLAGS and GST_BAD_BASE_LIBS available
@@ -214,7 +214,8 @@
dnl check ion allocator headfile
old_CFLAGS=$CFLAGS
-CFLAGS="$CFLAGS `$PKG_CONFIG --cflags gstreamer-bad-allocators-1.0`"
+PKG_CHECK_MODULES(GST, gstreamer-$GST_MAJORMINOR >= 1.14, CFLAGS="$CFLAGS `$PKG_CONFIG --cflags gstreamer-allocators-1.0`",\
+ CFLAGS="$CFLAGS `$PKG_CONFIG --cflags gstreamer-bad-allocators-1.0`")
AC_CHECK_HEADERS([linux/ion.h gst/allocators/gstionmemory.h], HAVE_ION="yes", HAVE_ION="no")
AM_CONDITIONAL(USE_ION, test "x$HAVE_ION" = "xyes")
CFLAGS=$old_CFLAGS
@@ -223,12 +224,18 @@
AC_CHECK_LIB(gstbadallocators-$GST_MAJORMINOR, gst_buffer_is_phymem, [HAVE_BAD_ALLOCATOR=yes])
AM_CONDITIONAL(USE_BAD_ALLOCATOR, test "x$HAVE_BAD_ALLOCATOR" = "xyes")
+PKG_CHECK_MODULES(GST, gstreamer-$GST_MAJORMINOR >= 1.14, HAVE_BAD_BASE=no, HAVE_BAD_BASE=yes)
+AM_CONDITIONAL(USE_BAD_BASE, test "x$HAVE_BAD_BASE" = "xyes")
+
+AC_CHECK_HEADERS([hantro_enc/ewl.h], [HAVE_H1_ENC=yes], [HAVE_H1_ENC=no])
+AM_CONDITIONAL(USE_H1_ENC, test "x$HAVE_H1_ENC" = "xyes")
+
AC_CHECK_HEADERS([vpu_lib.h], [HAVE_VPU_LIB=yes], [HAVE_VPU_LIB=no])
if test "x$HAVE_VPU_LIB" = "xyes"; then
VPU_LIBS=`$PKG_CONFIG --libs libfslvpuwrap 2>/dev/null`
VPU_LIBS+=" -lvpu"
fi
-AC_CHECK_HEADERS([codec.h dwl.h], [HAVE_VPU_LIB=yes], [HAVE_VPU_LIB=no])
+AC_CHECK_HEADERS([hantro_dec/dwl.h], [HAVE_VPU_LIB=yes], [HAVE_VPU_LIB=no])
if test "x$HAVE_VPU_LIB" = "xyes"; then
VPU_LIBS=`$PKG_CONFIG --libs libfslvpuwrap 2>/dev/null`
fi
diff --git a/ext-includes/fsl_parser.h b/ext-includes/fsl_parser.h
index 0512194..96fb75d 100755
--- a/ext-includes/fsl_parser.h
+++ b/ext-includes/fsl_parser.h
@@ -2,6 +2,7 @@
/*
* Copyright (c) 2009-2016, Freescale Semiconductor, Inc.
+* Copyright 2017-2018 NXP
*/
/*
@@ -196,6 +197,13 @@
#define FLAG_SAMPLE_CODEC_DATA 0x40 /* This is a sample of codec data */
+#define FLAG_SAMPLE_PCR_INFO 0x80 /* This is a sample of PCR data, the data is stored in struct PCRInfo type */
+
+#define FLAG_SAMPLE_H264_SEI_POS_DATA 0x100 /* This is a sample of h264 sei position data, the position data gives the offset and
+ * size of the sei nalu in the h264 frame it belongs to */
+
+#define FLAG_SAMPLE_COMPRESSED_SAMPLE 0x200 //drm sample flag, need to call drm api to get drm info
+
/*********************************************************************
* seeking flags :
when to seek, must set one of the following flags
@@ -205,7 +213,8 @@
#define SEEK_FLAG_NO_EARLIER 0X03 /* The actual seeked time shall be no earlier than the given time */
#define SEEK_FLAG_FUZZ 0X04 /* Reserved. No accurate request on time but request quick response.
Parsers shall optimize performances with other flags.*/
-
+#define SEEK_FLAG_CLOSEST 0X05 /* this flag is only used for android when read options is ReadOptions::SEEK_CLOSEST in mp4 parser. */
+#define SEEK_FLAG_FRAME_INDEX 0X06 /* android cts requires this feature for mp4 parser */
/*********************************************************************
* direction for trick mode/sync sample reading
@@ -235,6 +244,10 @@
#define FLAG_OUTPUT_PTS 0x08
//if set the flag, do not convert id3 data to utf8 in parser, other components will do it.
#define FLAG_ID3_FORMAT_NON_UTF8 0x10
+//if set the flag, send out PCR data
+#define FLAG_OUTPUT_PCR 0x20
+//if set the flag, output sei position data in a sample buffer
+#define FLAG_OUTPUT_H264_SEI_POS_DATA 0x40
/*********************************************************************
* User data ID
@@ -292,6 +305,7 @@
USER_DATA_ANDROID_VERSION,
USER_DATA_CAPTURE_FPS,
USER_DATA_PSSH,
+ USER_DATA_MP4_CREATION_TIME, //in seconds since midnite, Jan,1, 1904, in UTC time
USER_DATA_MAX
} UserDataID;
@@ -555,6 +569,52 @@
PMTInfo *m_ptPMTInfo;
}PMTInfoList;
+//struct for FslParserGetTrackExtTag
+typedef struct _TrackExtTagItem
+{
+ uint32 index;
+ uint32 type;
+ uint32 size;
+ uint8* data;
+ struct _TrackExtTagItem * nextItemPtr;
+}TrackExtTagItem;
+
+typedef struct TrackExtTagList
+{
+ int32 num;
+ TrackExtTagItem * m_ptr;
+}TrackExtTagList;
+
+enum{
+ FSL_PARSER_TRACKEXTTAG_CRPYTOKEY = 0,
+ FSL_PARSER_TRACKEXTTAG_TX3G,
+ FSL_PARSER_TRACKEXTTAG_CRPYTOMODE,
+ FSL_PARSER_TRACKEXTTAG_CRPYTODEFAULTIVSIZE
+}TrackExtTagIndex;
+
+typedef struct _SeiPosition
+{
+ uint32 offset;
+ uint32 size;
+}SeiPosition;
+
+typedef struct
+{
+ uint32 maxCLL;
+ uint32 maxFALL;
+ bool hasMasteringMetadata;
+ float PrimaryRChromaticityX;
+ float PrimaryRChromaticityY;
+ float PrimaryGChromaticityX;
+ float PrimaryGChromaticityY;
+ float PrimaryBChromaticityX;
+ float PrimaryBChromaticityY;
+ float WhitePointChromaticityX;
+ float WhitePointChromaticityY;
+ float LuminanceMax;
+ float LuminanceMin;
+}VideoHDRColorInfo;
+
/*********************************************************************************************************
* API Function Prototypes List
*
@@ -635,6 +695,10 @@
uint32 * numTracks,
uint32 ** ppTrackNumList);
+typedef int32 (*FslParserGetPCR)( FslParserHandle parserHandle,
+ uint32 programNum,
+ uint64* usPCR);
+
/************************************************************************************************************
*
* General Track Properties
@@ -664,6 +728,9 @@
uint8 ** data,
uint32 * size);
+typedef int32 (*FslParserGetTrackExtTag)( FslParserHandle parserHandle,
+ uint32 trackNum,
+ TrackExtTagList **pList);
/************************************************************************************************************
*
@@ -683,6 +750,20 @@
typedef int32 (*FslParserGetVideoFrameRotation)(FslParserHandle parserHandle, uint32 trackNum, uint32 *rotation);
+/* optional */
+typedef int32 (*FslParserGetVideoColorInfo)(FslParserHandle parserHandle, uint32 trackNum
+ , int32* primaries,int32 * transfer, int32* coeff, int32* fullRange);
+
+
+typedef int32 (*FslParserGetVideoHDRColorInfo)(FslParserHandle parserHandle, uint32 trackNum, VideoHDRColorInfo *pInfo);
+
+typedef int32 (*FslParserGetVideoDisplayWidth)(FslParserHandle parserHandle, uint32 trackNum, uint32 *width);
+
+typedef int32 (*FslParserGetVideoDisplayHeight)(FslParserHandle parserHandle, uint32 trackNum, uint32 *height);
+
+typedef int32 (*FslParserGetVideoFrameCount)(FslParserHandle parserHandle, uint32 trackNum, uint32 *count);
+
+
/************************************************************************************************************
*
* Audio Properties
@@ -729,7 +810,9 @@
uint32 trackNum,
uint32 * height);
-
+typedef int32 (*FslParserGetTextTrackMime)( FslParserHandle parserHandle,
+ uint32 trackNum,
+ uint8 ** sampleBuffer,uint32 * dataSize);
/************************************************************************************************************
*
* Sample Reading, Seek & Trick Mode
@@ -789,6 +872,15 @@
uint64 * usDuration,
uint32 * flags); /* only for trick mode on video track */
+//crypto info for android widevine
+typedef int32 (*FslParserGetSampleCryptoInfo)(FslParserHandle parserHandle,
+ uint32 trackNum,
+ uint8** iv,
+ uint32 * ivSize,
+ uint8 ** clearBuffer,
+ uint32 * clearSize,
+ uint8 ** encryptedBuffer,
+ uint32 * encryptedSize);
/* mandatory */
typedef int32 (*FslParserSeek)( FslParserHandle parserHandle,
@@ -828,6 +920,7 @@
PARSER_API_GET_NUM_PROGRAMS = 26,
PARSER_API_GET_PROGRAM_TRACKS = 27,
+ PARSER_API_GET_PCR = 28,
/* generic track properties */
@@ -836,14 +929,18 @@
PARSER_API_GET_LANGUAGE = 32,
PARSER_API_GET_BITRATE = 36,
PARSER_API_GET_DECODER_SPECIFIC_INFO = 37,
-
+ PARSER_API_GET_TRACK_EXT_TAG = 38,
/* video properties */
PARSER_API_GET_VIDEO_FRAME_WIDTH = 50,
PARSER_API_GET_VIDEO_FRAME_HEIGHT = 51,
PARSER_API_GET_VIDEO_FRAME_RATE = 52,
PARSER_API_GET_VIDEO_FRAME_ROTATION = 53,
-
+ PARSER_API_GET_VIDEO_COLOR_INFO = 54,
+ PARSER_API_GET_VIDEO_HDR_COLOR_INFO = 55,
+ PARSER_API_GET_VIDEO_DISPLAY_WIDTH = 56,
+ PARSER_API_GET_VIDEO_DISPLAY_HEIGHT = 57,
+ PARSER_API_GET_VIDEO_FRAME_COUNT = 58,
/* audio properties */
PARSER_API_GET_AUDIO_NUM_CHANNELS = 60,
@@ -858,6 +955,7 @@
/* text/subtitle properties */
PARSER_API_GET_TEXT_TRACK_WIDTH = 80,
PARSER_API_GET_TEXT_TRACK_HEIGHT= 81,
+ PARSER_API_GET_TEXT_TRACK_MIME = 82,
/* sample reading, seek & trick mode */
PARSER_API_GET_READ_MODE = 100,
@@ -872,6 +970,7 @@
PARSER_API_GET_FILE_NEXT_SAMPLE = 115,
PARSER_API_GET_FILE_NEXT_SYNC_SAMPLE = 116,
+ PARSER_API_GET_SAMPLE_CRYPTO_INFO = 117,
PARSER_API_SEEK = 120
diff --git a/ext-includes/g2d.h b/ext-includes/g2d.h
index 63d56fb..4a24e1e 100755
--- a/ext-includes/g2d.h
+++ b/ext-includes/g2d.h
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2013-2016 Freescale Semiconductor, Inc.
- *
+ * Copyright (C) 2013-2015 Freescale Semiconductor, Inc.
+ * Copyright 2018 NXP
*/
/*
* This library is free software; you can redistribute it and/or
@@ -33,6 +33,9 @@
* 2015-04-10 Meng Mingming 0.9 support multiple source blit
* 2015-11-03 Meng Mingming 1.0 support query 2D hardware type and feature
* 2016-05-24 Meng Mingming 1.1 support get g2d_buf from dma fd
+ * 2017-07-04 Prabhu Sundararaj 1.2 support get g2d_buf to export dma fd
+ * 2018-04-24 Yuchou Gan 1.3 Add AMPHION_TILED support
+
*/
#ifndef __G2D_H__
@@ -132,6 +135,13 @@
G2D_HARDWARE_VG = 1,
};
+enum g2d_status
+{
+ G2D_STATUS_FAIL =-1,
+ G2D_STATUS_OK = 0,
+ G2D_STATUS_NOT_SUPPORTED = 1,
+};
+
struct g2d_surface
{
enum g2d_format format;
@@ -206,6 +216,7 @@
int g2d_cache_op(struct g2d_buf *buf, enum g2d_cache_mode op);
struct g2d_buf *g2d_alloc(int size, int cacheable);
struct g2d_buf *g2d_buf_from_fd(int fd);
+int g2d_buf_export_fd(struct g2d_buf *);
struct g2d_buf *g2d_buf_from_virt_addr(void *vaddr, int size);
int g2d_free(struct g2d_buf *buf);
diff --git a/ext-includes/g2dExt.h b/ext-includes/g2dExt.h
new file mode 100644
index 0000000..65bf36a
--- /dev/null
+++ b/ext-includes/g2dExt.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2013-2015 Freescale Semiconductor, Inc.
+ * Copyright 2018 NXP
+ */
+/*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+/*
+ * g2dExt.h
+ * g2dExt.h is a extension to g2d.h. It's private and should not be exported to customer.
+ * So any extension which is private should be here, others will still be updated in g2d.h.
+ * History :
+ * Date(y.m.d) Author Version Description
+ *
+*/
+
+#ifndef __G2DEXT_H__
+#define __G2DEXT_H__
+
+#include "g2d.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum g2d_tiling
+{
+ G2D_LINEAR = 0x1,
+ G2D_TILED = 0x2,
+ G2D_SUPERTILED = 0x4,
+ G2D_AMPHION_TILED = 0x8,
+ G2D_AMPHION_INTERLACED = 0x10,
+};
+
+struct g2d_surfaceEx
+{
+ struct g2d_surface base;
+ enum g2d_tiling tiling;
+};
+
+int g2d_blitEx(void *handle, struct g2d_surfaceEx *srcEx, struct g2d_surfaceEx *dstEx);
+int g2d_blitEx_dispatch(void *handle, struct g2d_surfaceEx *srcEx, struct g2d_surfaceEx *dstEx, int imxdpu_id);
+
+int g2d_set_clipping(void *handle, int left, int top, int right, int bottom);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/ext-includes/vpu_wrapper.h b/ext-includes/vpu_wrapper.h
old mode 100755
new mode 100644
index 66fa421..22c2aac
--- a/ext-includes/vpu_wrapper.h
+++ b/ext-includes/vpu_wrapper.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2010-2016, Freescale Semiconductor, Inc.
- * Copyright 2017 NXP
+ * Copyright 2017-2018 NXP
*/
/*
@@ -61,6 +61,13 @@
//typedef DecParam VpuDecParam;
typedef enum {
+ VPU_TYPE_UNKNOWN = 0,
+ VPU_TYPE_CHIPSMEDIA,
+ VPU_TYPE_MALONE,
+ VPU_TYPE_HANTRO,
+} VpuType;
+
+typedef enum {
VPU_DEC_ERR_UNFOUND=0,
VPU_DEC_ERR_NOT_SUPPORTED, /*the profile/level/features/... outrange the vpu's capability*/
VPU_DEC_ERR_CORRUPT, /*some syntax errors are detected*/
@@ -262,6 +269,7 @@
int nAdaptiveMode;
void* pAppCxt; /*reserved for future application extension*/
int nSecureMode;
+ int nSecureBufferAllocSize;
} VpuDecOpenParam;
@@ -369,6 +377,7 @@
int nReserved[3]; /*reserved for future extension*/
void* pSpecialInfo; /*reserved for future special extension*/
+ int hasColorDesc;
int hasHdr10Meta;
VpuHDR10Meta Hdr10Meta; /* HDR10 meta data */
VpuColourDesc ColourDesc;
@@ -490,7 +499,7 @@
/**************************** encoder part **********************************/
-typedef unsigned int VpuEncHandle;
+typedef void * VpuEncHandle;
typedef enum
{
@@ -500,6 +509,13 @@
VPU_COLOR_422V=2,
VPU_COLOR_444=3,
VPU_COLOR_400=4,
+ VPU_COLOR_422YUYV=13,
+ VPU_COLOR_422UYVY=14,
+ VPU_COLOR_ARGB8888=15,
+ VPU_COLOR_BGRA8888=16,
+ VPU_COLOR_RGB565=17,
+ VPU_COLOR_RGB555=18,
+ VPU_COLOR_BGR565=19,
}VpuColorFormat;
typedef enum {
@@ -512,6 +528,7 @@
typedef struct {
int nMinFrameBufferCount;
int nAddressAlignment; /*address alignment for Y/Cb/Cr (unit: bytes)*/
+ VpuType eType;
} VpuEncInitInfo;
typedef enum
@@ -656,11 +673,11 @@
int nFrameRate;
int nQuantParam;
- unsigned int nInPhyInput; //input buffer address
- unsigned int nInVirtInput;
+ unsigned long nInPhyInput; //input buffer address
+ unsigned long nInVirtInput;
int nInInputSize;
- unsigned int nInPhyOutput; //output frame address
- unsigned int nInVirtOutput;
+ unsigned long nInPhyOutput; //output frame address
+ unsigned long nInVirtOutput;
unsigned int nInOutputBufLen;
/*advanced options*/
diff --git a/libs/Makefile.am b/libs/Makefile.am
index 3e46aeb..aaf0a94 100755
--- a/libs/Makefile.am
+++ b/libs/Makefile.am
@@ -1,7 +1,6 @@
lib_LTLIBRARIES = libgstfsl-@GST_API_VERSION@.la
libgstfsl_@GST_API_VERSION@includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/imx-mm/
-libgstfsl_@GST_API_VERSION@include_HEADERS = gstimxcommon.h
if USE_V4L2_CORE
V4L2_CORE_SOURCE = v4l2_core/gstimxv4l2.c
diff --git a/libs/device-2d/imx_2d_device.h b/libs/device-2d/imx_2d_device.h
index cbea3fd..b3d918e 100755
--- a/libs/device-2d/imx_2d_device.h
+++ b/libs/device-2d/imx_2d_device.h
@@ -1,5 +1,6 @@
/* GStreamer IMX Video 2D Device Abstract
* Copyright (c) 2014-2016, Freescale Semiconductor, Inc. All rights reserved.
+ * Copyright 2018 NXP
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -22,6 +23,7 @@
#include <gst/video/video.h>
#include "gstimxcommon.h"
+#include "gstimx.h"
#include "imx_2d_device_allocator.h"
#define ALIGNMENT (16)
@@ -47,6 +49,11 @@
} Imx2DDeviceCap;
typedef enum {
+ IMX_2D_TILE_NULL,
+ IMX_2D_TILE_AMHPION
+} Imx2DTileType;
+
+typedef enum {
IMX_2D_ROTATION_0,
IMX_2D_ROTATION_90,
IMX_2D_ROTATION_180,
@@ -87,6 +94,7 @@
guint w;
guint h;
guint stride;
+ Imx2DTileType tile_type;
} Imx2DVideoInfo;
typedef struct _Imx2DFrame {
diff --git a/libs/device-2d/imx_2d_device_g2d.c b/libs/device-2d/imx_2d_device_g2d.c
index e75bf42..be34b31 100755
--- a/libs/device-2d/imx_2d_device_g2d.c
+++ b/libs/device-2d/imx_2d_device_g2d.c
@@ -1,5 +1,6 @@
/* GStreamer IMX G2D Device
* Copyright (c) 2014-2016, Freescale Semiconductor, Inc. All rights reserved.
+ * Copyright 2018 NXP
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -20,6 +21,7 @@
#include <fcntl.h>
#include <sys/ioctl.h>
#include "g2d.h"
+#include "g2dExt.h"
#include "imx_2d_device.h"
GST_DEBUG_CATEGORY_EXTERN (imx2ddevice_debug);
@@ -27,8 +29,8 @@
typedef struct _Imx2DDeviceG2d {
gint capabilities;
- struct g2d_surface src;
- struct g2d_surface dst;
+ struct g2d_surfaceEx src;
+ struct g2d_surfaceEx dst;
} Imx2DDeviceG2d;
typedef struct {
@@ -287,14 +289,19 @@
if (!in_map)
return -1;
- g2d->src.width = in_info->w;
- g2d->src.height = in_info->h;
- g2d->src.stride = g2d->src.width;//stride / (in_map->bpp/8);
- g2d->src.format = in_map->g2d_format;
- g2d->src.left = 0;
- g2d->src.top = 0;
- g2d->src.right = in_info->w;
- g2d->src.bottom = in_info->h;
+ g2d->src.base.width = in_info->w;
+ g2d->src.base.height = in_info->h;
+ g2d->src.base.stride = g2d->src.base.width;//stride / (in_map->bpp/8);
+ g2d->src.base.format = in_map->g2d_format;
+ g2d->src.base.left = 0;
+ g2d->src.base.top = 0;
+ g2d->src.base.right = in_info->w;
+ g2d->src.base.bottom = in_info->h;
+ if (in_info->tile_type == IMX_2D_TILE_AMHPION) {
+ g2d->src.base.stride = in_info->stride / (in_map->bpp/8);
+ g2d->src.tiling = G2D_AMPHION_TILED;
+ } else
+ g2d->src.tiling = G2D_LINEAR;
GST_TRACE("input format = %s", gst_video_format_to_string(in_info->fmt));
return 0;
@@ -310,18 +317,18 @@
if (!out_map)
return -1;
- g2d->dst.width = out_info->w;
- g2d->dst.height = out_info->h;
+ g2d->dst.base.width = out_info->w;
+ g2d->dst.base.height = out_info->h;
// G2D stride is pixel, not bytes.
- if (out_info->stride < g2d->dst.width * (out_map->bpp / 8))
- g2d->dst.stride = g2d->dst.width;
+ if (out_info->stride < g2d->dst.base.width * (out_map->bpp / 8))
+ g2d->dst.base.stride = g2d->dst.base.width;
else
- g2d->dst.stride = out_info->stride / (out_map->bpp / 8);
- g2d->dst.format = out_map->g2d_format;
- g2d->dst.left = 0;
- g2d->dst.top = 0;
- g2d->dst.right = out_info->w;
- g2d->dst.bottom = out_info->h;
+ g2d->dst.base.stride = out_info->stride / (out_map->bpp / 8);
+ g2d->dst.base.format = out_map->g2d_format;
+ g2d->dst.base.left = 0;
+ g2d->dst.base.top = 0;
+ g2d->dst.base.right = out_info->w;
+ g2d->dst.base.bottom = out_info->h;
GST_TRACE("output format = %s", gst_video_format_to_string(out_info->fmt));
return 0;
@@ -429,95 +436,110 @@
GST_DEBUG ("src paddr: %p dst paddr: %p", src->mem->paddr, dst->mem->paddr);
// Set input
- g2d->src.global_alpha = src->alpha;
- g2d->src.left = src->crop.x;
- g2d->src.top = src->crop.y;
- g2d->src.right = src->crop.x + MIN(src->crop.w, g2d->src.width-src->crop.x);
- g2d->src.bottom = src->crop.y + MIN(src->crop.h, g2d->src.height-src->crop.y);
+ g2d->src.base.global_alpha = src->alpha;
+ g2d->src.base.left = src->crop.x;
+ g2d->src.base.top = src->crop.y;
+ g2d->src.base.right = src->crop.x + MIN(src->crop.w, g2d->src.base.width-src->crop.x);
+ g2d->src.base.bottom = src->crop.y + MIN(src->crop.h, g2d->src.base.height-src->crop.y);
- if (g2d->src.left >= g2d->src.width || g2d->src.top >= g2d->src.height ||
- g2d->src.right <= 0 || g2d->src.bottom <= 0) {
+ if (g2d->src.base.left >= g2d->src.base.width || g2d->src.base.top >= g2d->src.base.height ||
+ g2d->src.base.right <= 0 || g2d->src.base.bottom <= 0) {
GST_WARNING("input crop outside of source");
g2d_close (g2d_handle);
return 0;
}
- if (g2d->src.left < 0)
- g2d->src.left = 0;
- if (g2d->src.top < 0)
- g2d->src.top = 0;
- if (g2d->src.right > g2d->src.width)
- g2d->src.right = g2d->src.width;
- if (g2d->src.bottom > g2d->src.height)
- g2d->src.bottom = g2d->src.height;
+ if (g2d->src.base.left < 0)
+ g2d->src.base.left = 0;
+ if (g2d->src.base.top < 0)
+ g2d->src.base.top = 0;
+ if (g2d->src.base.right > g2d->src.base.width)
+ g2d->src.base.right = g2d->src.base.width;
+ if (g2d->src.base.bottom > g2d->src.base.height)
+ g2d->src.base.bottom = g2d->src.base.height;
- if (imx_g2d_set_src_plane (&g2d->src, src->mem->paddr) < 0) {
+ if (imx_g2d_set_src_plane (&g2d->src.base, src->mem->paddr) < 0) {
g2d_close (g2d_handle);
return -1;
}
- GST_TRACE ("g2d src : %dx%d,%d(%d,%d-%d,%d), alpha=%d, format=%d",
- g2d->src.width, g2d->src.height,g2d->src.stride, g2d->src.left,
- g2d->src.top, g2d->src.right, g2d->src.bottom, g2d->src.global_alpha,
- g2d->src.format);
+ if (g2d->src.tiling == G2D_AMPHION_TILED && src->fd[1] >= 0)
+ {
+ if (!src->mem->user_data)
+ src->mem->user_data = g2d->src.base.planes[1] = phy_addr_from_fd (src->fd[1]);
+ else
+ g2d->src.base.planes[1] = src->mem->user_data;
+ }
+ switch (src->interlace_type) {
+ case IMX_2D_INTERLACE_INTERLEAVED:
+ g2d->src.tiling |= G2D_AMPHION_INTERLACED;
+ break;
+ default:
+ break;
+ }
+
+ GST_TRACE ("g2d src : %dx%d,%d(%d,%d-%d,%d), alpha=%d, format=%d, deinterlace: %d",
+ g2d->src.base.width, g2d->src.base.height,g2d->src.base.stride, g2d->src.base.left,
+ g2d->src.base.top, g2d->src.base.right, g2d->src.base.bottom, g2d->src.base.global_alpha,
+ g2d->src.base.format, g2d->src.tiling);
// Set output
- g2d->dst.global_alpha = dst->alpha;
- g2d->dst.planes[0] = (gint)(dst->mem->paddr);
- g2d->dst.left = dst->crop.x;
- g2d->dst.top = dst->crop.y;
- g2d->dst.right = dst->crop.x + dst->crop.w;
- g2d->dst.bottom = dst->crop.y + dst->crop.h;
+ g2d->dst.base.global_alpha = dst->alpha;
+ g2d->dst.base.planes[0] = (gint)(dst->mem->paddr);
+ g2d->dst.base.left = dst->crop.x;
+ g2d->dst.base.top = dst->crop.y;
+ g2d->dst.base.right = dst->crop.x + dst->crop.w;
+ g2d->dst.base.bottom = dst->crop.y + dst->crop.h;
- if (g2d->dst.left >= g2d->dst.width || g2d->dst.top >= g2d->dst.height ||
- g2d->dst.right <= 0 || g2d->dst.bottom <= 0) {
+ if (g2d->dst.base.left >= g2d->dst.base.width || g2d->dst.base.top >= g2d->dst.base.height ||
+ g2d->dst.base.right <= 0 || g2d->dst.base.bottom <= 0) {
GST_WARNING("output crop outside of destination");
g2d_close (g2d_handle);
return 0;
}
- if (g2d->dst.left < 0)
- g2d->dst.left = 0;
- if (g2d->dst.top < 0)
- g2d->dst.top = 0;
- if (g2d->dst.right > g2d->dst.width)
- g2d->dst.right = g2d->dst.width;
- if (g2d->dst.bottom > g2d->dst.height)
- g2d->dst.bottom = g2d->dst.height;
+ if (g2d->dst.base.left < 0)
+ g2d->dst.base.left = 0;
+ if (g2d->dst.base.top < 0)
+ g2d->dst.base.top = 0;
+ if (g2d->dst.base.right > g2d->dst.base.width)
+ g2d->dst.base.right = g2d->dst.base.width;
+ if (g2d->dst.base.bottom > g2d->dst.base.height)
+ g2d->dst.base.bottom = g2d->dst.base.height;
//adjust incrop size by outcrop size and output resolution
guint src_w, src_h, dst_w, dst_h, org_src_left, org_src_top;
- src_w = g2d->src.right-g2d->src.left;
- src_h = g2d->src.bottom-g2d->src.top;
+ src_w = g2d->src.base.right-g2d->src.base.left;
+ src_h = g2d->src.base.bottom-g2d->src.base.top;
dst_w = dst->crop.w;
dst_h = dst->crop.h;
- org_src_left = g2d->src.left;
- org_src_top = g2d->src.top;
+ org_src_left = g2d->src.base.left;
+ org_src_top = g2d->src.base.top;
- g2d->src.left = org_src_left + (g2d->dst.left-dst->crop.x) * src_w / dst_w;
- g2d->src.top = org_src_top + (g2d->dst.top-dst->crop.y) * src_h / dst_h;
- g2d->src.right = org_src_left + (g2d->dst.right-dst->crop.x) * src_w / dst_w;
- g2d->src.bottom = org_src_top + (g2d->dst.bottom-dst->crop.y) * src_h / dst_h;
+ g2d->src.base.left = org_src_left + (g2d->dst.base.left-dst->crop.x) * src_w / dst_w;
+ g2d->src.base.top = org_src_top + (g2d->dst.base.top-dst->crop.y) * src_h / dst_h;
+ g2d->src.base.right = org_src_left + (g2d->dst.base.right-dst->crop.x) * src_w / dst_w;
+ g2d->src.base.bottom = org_src_top + (g2d->dst.base.bottom-dst->crop.y) * src_h / dst_h;
GST_TRACE ("g2d dest : %dx%d,%d(%d,%d-%d,%d), alpha=%d, format=%d",
- g2d->dst.width, g2d->dst.height,g2d->dst.stride, g2d->dst.left,
- g2d->dst.top, g2d->dst.right, g2d->dst.bottom, g2d->dst.global_alpha,
- g2d->dst.format);
+ g2d->dst.base.width, g2d->dst.base.height,g2d->dst.base.stride, g2d->dst.base.left,
+ g2d->dst.base.top, g2d->dst.base.right, g2d->dst.base.bottom, g2d->dst.base.global_alpha,
+ g2d->dst.base.format);
// Final blending
if (alpha_en &&
- (g2d->src.global_alpha < 0xFF || is_format_has_alpha(g2d->src.format))) {
- g2d->src.blendfunc = G2D_ONE;
- g2d->dst.blendfunc = G2D_ONE_MINUS_SRC_ALPHA;
+ (g2d->src.base.global_alpha < 0xFF || is_format_has_alpha(g2d->src.base.format))) {
+ g2d->src.base.blendfunc = G2D_ONE;
+ g2d->dst.base.blendfunc = G2D_ONE_MINUS_SRC_ALPHA;
g2d_enable(g2d_handle, G2D_BLEND);
g2d_enable(g2d_handle, G2D_GLOBAL_ALPHA);
- ret = g2d_blit(g2d_handle, &g2d->src, &g2d->dst);
+ ret = g2d_blitEx(g2d_handle, &g2d->src, &g2d->dst);
g2d_disable(g2d_handle, G2D_GLOBAL_ALPHA);
g2d_disable(g2d_handle, G2D_BLEND);
} else {
- ret = g2d_blit(g2d_handle, &g2d->src, &g2d->dst);
+ ret = g2d_blitEx(g2d_handle, &g2d->src, &g2d->dst);
}
ret |= g2d_finish(g2d_handle);
@@ -549,7 +571,7 @@
default: g2d_rotate = G2D_ROTATION_0; break;
}
- g2d->dst.rot = g2d_rotate;
+ g2d->dst.base.rot = g2d_rotate;
return 0;
}
@@ -566,7 +588,7 @@
Imx2DDeviceG2d *g2d = (Imx2DDeviceG2d *) (device->priv);
Imx2DRotationMode rot = IMX_2D_ROTATION_0;
- switch (g2d->dst.rot) {
+ switch (g2d->dst.base.rot) {
case G2D_ROTATION_0: rot = IMX_2D_ROTATION_0; break;
case G2D_ROTATION_90: rot = IMX_2D_ROTATION_90; break;
case G2D_ROTATION_180: rot = IMX_2D_ROTATION_180; break;
@@ -669,18 +691,18 @@
}
GST_DEBUG ("dst paddr: %p", dst->mem->paddr);
- g2d->dst.clrcolor = RGBA8888;
- g2d->dst.planes[0] = (gint)(dst->mem->paddr);
- g2d->dst.left = 0;
- g2d->dst.top = 0;
- g2d->dst.right = g2d->dst.width;
- g2d->dst.bottom = g2d->dst.height;
+ g2d->dst.base.clrcolor = RGBA8888;
+ g2d->dst.base.planes[0] = (gint)(dst->mem->paddr);
+ g2d->dst.base.left = 0;
+ g2d->dst.base.top = 0;
+ g2d->dst.base.right = g2d->dst.base.width;
+ g2d->dst.base.bottom = g2d->dst.base.height;
GST_TRACE ("g2d clear : %dx%d,%d(%d,%d-%d,%d), format=%d",
- g2d->dst.width, g2d->dst.height, g2d->dst.stride, g2d->dst.left,
- g2d->dst.top, g2d->dst.right, g2d->dst.bottom, g2d->dst.format);
+ g2d->dst.base.width, g2d->dst.base.height, g2d->dst.base.stride, g2d->dst.base.left,
+ g2d->dst.base.top, g2d->dst.base.right, g2d->dst.base.bottom, g2d->dst.base.format);
- ret = g2d_clear(g2d_handle, &g2d->dst);
+ ret = g2d_clear(g2d_handle, &g2d->dst.base);
ret |= g2d_finish(g2d_handle);
g2d_close(g2d_handle);
diff --git a/libs/device-2d/imx_2d_device_pxp.c b/libs/device-2d/imx_2d_device_pxp.c
index 99378a9..db4d4b9 100755
--- a/libs/device-2d/imx_2d_device_pxp.c
+++ b/libs/device-2d/imx_2d_device_pxp.c
@@ -1,5 +1,6 @@
/* GStreamer IMX PXP Device
* Copyright (c) 2015, Freescale Semiconductor, Inc. All rights reserved.
+ * Copyright 2017-2018 NXP
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
diff --git a/libs/gstimx.h b/libs/gstimx.h
new file mode 100644
index 0000000..de318a0
--- /dev/null
+++ b/libs/gstimx.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2018 NXP
+ *
+ * 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __IMX_H__
+#define __IMX_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+unsigned long phy_addr_from_fd(int dmafd);
+unsigned long phy_addr_from_vaddr(void *vaddr, int size);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __IMX_H__ */
diff --git a/libs/gstimxcommon.c b/libs/gstimxcommon.c
old mode 100755
new mode 100644
index 9f891ba..eb808b9
--- a/libs/gstimxcommon.c
+++ b/libs/gstimxcommon.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2016, Freescale Semiconductor, Inc. All rights reserved.
- * Copyright 2017 NXP
+ * Copyright 2017,2018 NXP
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -19,259 +19,15 @@
*/
#include "gstimxcommon.h"
+#include "gstimx.h"
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
+#include <linux/version.h>
+#include <linux/dma-buf.h>
#ifdef USE_ION
#include <linux/ion.h>
#endif
-
-/* define rotate and flip glib enum for overlaysink and imxv4l2sink */
-static const GEnumValue rotate_methods[] = {
- {GST_IMX_ROTATION_0, "no rotation", "none"},
- {GST_IMX_ROTATION_90, "Rotate clockwise 90 degrees", "rotate-90"},
- {GST_IMX_ROTATION_180, "Rotate clockwise 180 degrees", "rotate-180"},
- {GST_IMX_ROTATION_270, "Rotate clockwise 270 degrees", "rotate-270"},
- {GST_IMX_ROTATION_HFLIP, "Flip horizontally", "horizontal-flip"},
- {GST_IMX_ROTATION_VFLIP, "Flip vertically", "vertically-flip"},
- {0, NULL, NULL}
-};
-
-GType
-gst_imx_rotate_method_get_type()
-{
- static GType rotate_method_type = 0;
- static volatile gsize once = 0;
-
- if (g_once_init_enter (&once)) {
- rotate_method_type = g_enum_register_static ("GstImxRotateMethod",
- rotate_methods);
- g_once_init_leave (&once, rotate_method_type);
- }
-
- return rotate_method_type;
-}
-
-/*=============================================================================
-FUNCTION: get_chipname
-
-DESCRIPTION: To get chipname from /proc/cpuinfo
-
-ARGUMENTS PASSED: STR of chipname
-
-RETURN VALUE: chip code
-=============================================================================*/
-//*
-
-static CPU_INFO cpu_info[] = {
- {CC_MX23, 0x23},
- {CC_MX25, 0x25},
- {CC_MX27, 0x27},
- {CC_MX28, 0x28},
- {CC_MX31, 0x31},
- {CC_MX35, 0x35},
- {CC_MX37, 0x37},
- {CC_MX50, 0x50},
- {CC_MX51, 0x51},
- {CC_MX53, 0x53},
- {CC_MX6Q, 0x61},
- {CC_MX6Q, 0x63},
- {CC_MX60, 0x60}
-};
-
-CHIP_CODE getChipCodeFromCpuinfo (void)
-{
- FILE *fp = NULL;
- char buf[100], *p, *rev;
- char chip_name[3];
- int len = 0, i;
- int chip_num = -1;
- CHIP_CODE cc = CC_UNKN;
- fp = fopen ("/proc/cpuinfo", "r");
- if (fp == NULL) {
- return cc;
- }
- while (!feof (fp)) {
- p = fgets (buf, 100, fp);
- p = strstr (buf, "Revision");
- if (p != NULL) {
- rev = index (p, ':');
- if (rev != NULL) {
- rev++;
- chip_num = strtoul (rev, NULL, 16);
- chip_num >>= 12;
- break;
- }
- }
- }
-
- fclose (fp);
-
- if (chip_num < 0) {
- return cc;
- }
-
- int num = sizeof(cpu_info) / sizeof(CPU_INFO);
- for(i=0; i<num; i++) {
- if(chip_num == cpu_info[i].chip_num) {
- cc = cpu_info[i].code;
- break;
- }
- }
-
- return cc;
-}
-
-static SOC_INFO soc_info[] = {
- {CC_MX23, "i.MX23"},
- {CC_MX25, "i.MX25"},
- {CC_MX27, "i.MX27"},
- {CC_MX28, "i.MX28"},
- {CC_MX31, "i.MX31"},
- {CC_MX35, "i.MX35"},
- {CC_MX37, "i.MX37"},
- {CC_MX50, "i.MX50"},
- {CC_MX51, "i.MX51"},
- {CC_MX53, "i.MX53"},
- {CC_MX6Q, "i.MX6DL"},
- {CC_MX6Q, "i.MX6Q"},
- {CC_MX6Q, "i.MX6QP"},
- {CC_MX6SL, "i.MX6SL"},
- {CC_MX6SLL, "i.MX6SLL"},
- {CC_MX6SX, "i.MX6SX"},
- {CC_MX6UL, "i.MX6UL"},
- {CC_MX6UL, "i.MX6ULL"},
- {CC_MX7D, "i.MX7D"},
- {CC_MX7ULP, "i.MX7ULP"},
- {CC_MX8, "i.MX8DV"},
- {CC_MX8QM, "i.MX8QM"},
- {CC_MX8QXP, "i.MX8QXP"},
- {CC_MX8M, "i.MX8MQ"},
-};
-
-CHIP_CODE getChipCodeFromSocid (void)
-{
- FILE *fp = NULL;
- char soc_name[100];
- CHIP_CODE code = CC_UNKN;
-
- fp = fopen("/sys/devices/soc0/soc_id", "r");
- if (fp == NULL) {
- g_print("open /sys/devices/soc0/soc_id failed.\n");
- return CC_UNKN;
- }
-
- if (fscanf(fp, "%100s", soc_name) != 1) {
- g_print("fscanf soc_id failed.\n");
- fclose(fp);
- return CC_UNKN;
- }
- fclose(fp);
-
- //GST_INFO("SOC is %s\n", soc_name);
-
- int num = sizeof(soc_info) / sizeof(SOC_INFO);
- int i;
- for(i=0; i<num; i++) {
- if(!strcmp(soc_name, soc_info[i].name)) {
- code = soc_info[i].code;
- break;
- }
- }
-
- return code;
-}
-
-
-#define KERN_VER(a, b, c) (((a) << 16) + ((b) << 8) + (c))
-
-static CHIP_CODE gimx_chip_code = CC_UNKN;
-
-CHIP_CODE imx_chip_code (void)
-{
- struct utsname sys_name;
- int kv, kv_major, kv_minor, kv_rel;
- char soc_name[255];
- int rev_major, rev_minor;
- int idx, num;
-
- if (gimx_chip_code != CC_UNKN)
- return gimx_chip_code;
-
- if (uname(&sys_name) < 0) {
- g_print("get kernel version via uname failed.\n");
- return CC_UNKN;
- }
-
- if (sscanf(sys_name.release, "%d.%d.%d", &kv_major, &kv_minor, &kv_rel) != 3) {
- g_print("sscanf kernel version failed.\n");
- return CC_UNKN;
- }
-
- kv = ((kv_major << 16) + (kv_minor << 8) + kv_rel);
- //GST_INFO("kernel:%s, %d.%d.%d\n", sys_name.release, kv_major, kv_minor, kv_rel);
-
- if (kv < KERN_VER(3, 10, 0))
- gimx_chip_code = getChipCodeFromCpuinfo();
- else
- gimx_chip_code = getChipCodeFromSocid();
-
- return gimx_chip_code;
-}
-
-static IMXV4l2FeatureMap g_imxv4l2feature_maps[] = {
- /* chip_name, g3d, g2d, ipu, pxp, vpu, dpu, dcss*/
- {CC_MX6Q, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE},
- {CC_MX6SL, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE},
- {CC_MX6SLL, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
- {CC_MX6SX, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE},
- {CC_MX6UL, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
- {CC_MX7D, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
- {CC_MX7ULP, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE},
- {CC_MX8, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE},
- {CC_MX8QM, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE},
- {CC_MX8QXP, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE},
- {CC_MX8M, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE},
-};
-
-
-gboolean check_feature(CHIP_CODE chip_name, CHIP_FEATURE feature)
-{
- int i;
- gboolean ret = FALSE;
- for (i=0; i<sizeof(g_imxv4l2feature_maps)/sizeof(IMXV4l2FeatureMap); i++) {
- if ( chip_name== g_imxv4l2feature_maps[i].chip_name) {
- switch (feature) {
- case G3D:
- ret = g_imxv4l2feature_maps[i].g3d;
- break;
- case G2D:
- ret = g_imxv4l2feature_maps[i].g2d;
- break;
- case IPU:
- ret = g_imxv4l2feature_maps[i].ipu;
- break;
- case PXP:
- ret = g_imxv4l2feature_maps[i].pxp;
- break;
- case VPU:
- ret = g_imxv4l2feature_maps[i].vpu;
- break;
- case DPU:
- ret = g_imxv4l2feature_maps[i].dpu;
- break;
- case DCSS:
- ret = g_imxv4l2feature_maps[i].dcss;
- break;
- default:
- break;
- }
- break;
- }
- }
- return ret;
-}
-
const char *dev_ion = "/dev/ion";
unsigned long phy_addr_from_fd(int dmafd)
@@ -282,6 +38,7 @@
if (dmafd < 0)
return NULL;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 34)
fd = open(dev_ion, O_RDWR);
if(fd < 0) {
return NULL;
@@ -305,6 +62,15 @@
return data.phys;
#else
+ struct dma_buf_phys dma_phys;
+
+ ret = ioctl(dmafd, DMA_BUF_IOCTL_PHYS, &dma_phys);
+ if (ret < 0)
+ return NULL;
+
+ return dma_phys.phys;
+#endif
+#else
return NULL;
#endif
}
@@ -317,6 +83,7 @@
if (!vaddr)
return NULL;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 34)
fd = open(dev_ion, O_RDWR);
if(fd < 0) {
return NULL;
@@ -342,4 +109,7 @@
#else
return NULL;
#endif
+#else
+ return NULL;
+#endif
}
diff --git a/libs/gstimxcommon.h b/libs/gstimxcommon.h
deleted file mode 100755
index 828acb1..0000000
--- a/libs/gstimxcommon.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright (c) 2013-2016, Freescale Semiconductor, Inc. All rights reserved.
- * Copyright 2017 NXP
- *
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __IMX_COMMON_H__
-#define __IMX_COMMON_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/utsname.h>
-#include <gst/gst.h>
-#include <string.h>
-
-#define IMX_GST_PLUGIN_AUTHOR "Multimedia Team <shmmmw@freescale.com>"
-#define IMX_GST_PLUGIN_PACKAGE_NAME "Freescle Gstreamer Multimedia Plugins"
-#define IMX_GST_PLUGIN_PACKAGE_ORIG "http://www.freescale.com"
-#define IMX_GST_PLUGIN_LICENSE "LGPL"
-
-#define IMX_GST_PLUGIN_RANK (GST_RANK_PRIMARY+1)
-
-#define IMX_GST_PLUGIN_DEFINE(name, description, initfunc)\
- GST_PLUGIN_DEFINE(GST_VERSION_MAJOR,\
- GST_VERSION_MINOR,\
- name.imx,\
- description,\
- initfunc,\
- VERSION,\
- IMX_GST_PLUGIN_LICENSE,\
- IMX_GST_PLUGIN_PACKAGE_NAME, IMX_GST_PLUGIN_PACKAGE_ORIG)
-
-#define CHIPCODE(a,b,c,d)( (((unsigned int)((a)))<<24) | (((unsigned int)((b)))<<16)|(((unsigned int)((c)))<<8)|(((unsigned int)((d)))))
-typedef enum
-{
- CC_MX23 = CHIPCODE ('M', 'X', '2', '3'),
- CC_MX25 = CHIPCODE ('M', 'X', '2', '5'),
- CC_MX27 = CHIPCODE ('M', 'X', '2', '7'),
- CC_MX28 = CHIPCODE ('M', 'X', '2', '8'),
- CC_MX31 = CHIPCODE ('M', 'X', '3', '1'),
- CC_MX35 = CHIPCODE ('M', 'X', '3', '5'),
- CC_MX37 = CHIPCODE ('M', 'X', '3', '7'),
- CC_MX50 = CHIPCODE ('M', 'X', '5', '0'),
- CC_MX51 = CHIPCODE ('M', 'X', '5', '1'),
- CC_MX53 = CHIPCODE ('M', 'X', '5', '3'),
- CC_MX6Q = CHIPCODE ('M', 'X', '6', 'Q'),
- CC_MX60 = CHIPCODE ('M', 'X', '6', '0'),
- CC_MX6SL = CHIPCODE ('M', 'X', '6', '1'),
- CC_MX6SX = CHIPCODE ('M', 'X', '6', '2'),
- CC_MX6UL = CHIPCODE ('M', 'X', '6', '3'),
- CC_MX6SLL = CHIPCODE ('M', 'X', '6', '4'),
- CC_MX7D = CHIPCODE ('M', 'X', '7', 'D'),
- CC_MX7ULP = CHIPCODE ('M', 'X', '7', 'U'),
- CC_MX8 = CHIPCODE ('M', 'X', '8', '0'),
- CC_MX8QM = CHIPCODE ('M', 'X', '8', '1'),
- CC_MX8QXP = CHIPCODE ('M', 'X', '8', '3'),
- CC_MX8M = CHIPCODE ('M', 'X', '8', '2'),
- CC_UNKN = CHIPCODE ('U', 'N', 'K', 'N')
-
-} CHIP_CODE;
-
-typedef struct {
- CHIP_CODE code;
- int chip_num;
-} CPU_INFO;
-
-typedef struct {
- CHIP_CODE code;
- char *name;
-} SOC_INFO;
-
-typedef struct {
- CHIP_CODE chip_name;
- gboolean g3d;
- gboolean g2d;
- gboolean ipu;
- gboolean pxp;
- gboolean vpu;
- gboolean dpu;
- gboolean dcss;
-} IMXV4l2FeatureMap;
-
-typedef enum {
- G3D = 1,
- G2D,
- IPU,
- PXP,
- VPU,
- DPU,
- DCSS
-} CHIP_FEATURE;
-
-CHIP_CODE getChipCodeFromCpuinfo (void);
-CHIP_CODE getChipCodeFromSocid (void);
-CHIP_CODE imx_chip_code (void);
-gboolean check_feature(CHIP_CODE chip_name, CHIP_FEATURE feature);
-
-#define HAS_G3D() check_feature(imx_chip_code(), G3D)
-#define HAS_G2D() check_feature(imx_chip_code(), G2D)
-#define HAS_IPU() check_feature(imx_chip_code(), IPU)
-#define HAS_PXP() check_feature(imx_chip_code(), PXP)
-#define HAS_VPU() check_feature(imx_chip_code(), VPU)
-#define HAS_DPU() check_feature(imx_chip_code(), DPU)
-#define HAS_DCSS() check_feature(imx_chip_code(), DCSS)
-
-#define IS_HANTRO() (CC_MX8M == imx_chip_code())
-#define IS_AMPHION() (CC_MX8QXP == imx_chip_code())
-
-/* define rotate and flip glib enum for overlaysink and imxv4l2sink */
-typedef enum
-{
- GST_IMX_ROTATION_0 = 0,
- GST_IMX_ROTATION_90,
- GST_IMX_ROTATION_180,
- GST_IMX_ROTATION_270,
- GST_IMX_ROTATION_HFLIP,
- GST_IMX_ROTATION_VFLIP
-}GstImxRotateMethod;
-
-GType gst_imx_rotate_method_get_type();
-
-#define DEFAULT_IMX_ROTATE_METHOD GST_IMX_ROTATION_0
-#define GST_TYPE_IMX_ROTATE_METHOD (gst_imx_rotate_method_get_type())
-
-unsigned long phy_addr_from_fd(int dmafd);
-unsigned long phy_addr_from_vaddr(void *vaddr, int size);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __IMX_COMMON_H__ */
diff --git a/libs/overlaycompositionmeta/imxoverlaycompositionmeta.c b/libs/overlaycompositionmeta/imxoverlaycompositionmeta.c
index f617a4c..c0367cb 100755
--- a/libs/overlaycompositionmeta/imxoverlaycompositionmeta.c
+++ b/libs/overlaycompositionmeta/imxoverlaycompositionmeta.c
@@ -1,5 +1,6 @@
/* Process video overlay composition meta by IMX 2D devices
* Copyright (c) 2015-2016, Freescale Semiconductor, Inc. All rights reserved.
+ * Copyright 2018 NXP
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -602,6 +603,10 @@
}
dst.mem = out_v->mem;
+ dst.fd[0] = out_v->fd[0];
+ dst.fd[1] = out_v->fd[1];
+ dst.fd[2] = out_v->fd[2];
+ dst.fd[3] = out_v->fd[3];
dst.info.fmt = out_v->fmt;
dst.alpha = 0xFF;
dst.rotate = out_v->rotate;
diff --git a/plugins/aiurdemux/aiur.c b/plugins/aiurdemux/aiur.c
index 5eecd19..2a52465 100755
--- a/plugins/aiurdemux/aiur.c
+++ b/plugins/aiurdemux/aiur.c
@@ -15,7 +15,8 @@
*/
/*
- * Copyright (C) 2010-2011 Freescale Semiconductor, Inc. All rights reserved.
+ * Copyright (C) 2010-2011, 2014 Freescale Semiconductor, Inc. All rights reserved.
+ * Copyright 2018 NXP
*
*/
@@ -53,4 +54,4 @@
}
-IMX_GST_PLUGIN_DEFINE (aiur, "aiur universal demux", plugin_init);
+IMX_GST_PLUGIN_DEFINE (aiurdemux, "aiur universal demux", plugin_init);
diff --git a/plugins/aiurdemux/aiurdemux.c b/plugins/aiurdemux/aiurdemux.c
index cca8351..f2bdc19 100755
--- a/plugins/aiurdemux/aiurdemux.c
+++ b/plugins/aiurdemux/aiurdemux.c
@@ -16,7 +16,7 @@
/*
* Copyright (c) 2013-2015, Freescale Semiconductor, Inc.
- * Copyright 2017 NXP
+ * Copyright 2017-2019 NXP
*/
@@ -342,7 +342,7 @@
-
+#define SUBTITLE_GAP_INTERVAL (GST_SECOND/5)
#define AIUR_MEDIATYPE2STR(media) \
(((media)==MEDIA_VIDEO)?"video":(((media)==MEDIA_AUDIO)?"audio":"subtitle"))
@@ -430,7 +430,7 @@
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_aiurdemux_subsrc_template));
- gst_element_class_set_static_metadata (gstelement_class, "Aiur universal demuxer",
+ gst_element_class_set_static_metadata (gstelement_class, "IMX Aiur universal demuxer",
"Codec/Demuxer",
"demux container file to video, audio, and subtitle",
"FreeScale Multimedia Team <shamm@freescale.com>");
@@ -609,6 +609,7 @@
if (segment->stop < segment->start) {
gst_event_unref (event);
+ GST_ERROR_OBJECT (demux, "failed to handle sink event GST_EVENT_SEGMENT");
return FALSE;
}
@@ -665,6 +666,13 @@
goto drop;
break;
}
+ case GST_EVENT_CUSTOM_DOWNSTREAM_STICKY:
+ {
+ /* drop this event to avoid typefind push event error */
+ GST_WARNING ("need to drop sink event GST_EVENT_CUSTOM_DOWNSTREAM_STICKY");
+ gst_event_unref (event);
+ goto drop;
+ }
default:
GST_LOG_OBJECT(demux,"gst_aiurdemux_handle_sink_event event=%x",GST_EVENT_TYPE (event));
break;
@@ -673,6 +681,8 @@
res = gst_pad_event_default (demux->sinkpad, parent, event);
drop:
+ if (res == FALSE)
+ GST_ERROR_OBJECT (demux, "failed to handle sink event %" GST_PTR_FORMAT, event);
return res;
}
@@ -2458,7 +2468,7 @@
codec = "Dobly Digital Plus (E-AC3)";
mime =
g_strdup_printf
- ("audio/eac3, channels=(int)%ld, rate=(int)%ld, bitrate=(int)%ld",
+ ("audio/x-eac3, channels=(int)%ld, rate=(int)%ld, bitrate=(int)%ld",
stream->info.audio.n_channels, stream->info.audio.rate,
stream->bitrate);
break;
@@ -2738,7 +2748,7 @@
stream = aiurdemux_trackidx_to_stream (demux, *track_idx);
if((parser_ret == PARSER_EOS) || (PARSER_BOS == parser_ret)
- || (PARSER_READ_ERROR == parser_ret)){
+ || (PARSER_READ_ERROR == parser_ret) || (PARSER_ERR_INVALID_PARAMETER == parser_ret)){
if (demux->read_mode == PARSER_READ_MODE_FILE_BASED) {
aiurdemux_send_stream_eos_all (demux);
ret = GST_FLOW_EOS;
@@ -2783,16 +2793,18 @@
GST_INFO ("min_time=%lld\n", min_time);
+ /* sutitle gap is used to inform the downstream elements that there is no data for a
+ * certain amount of time, SUBTITLE_GAP_INTERVAL is set to avoid video being blocked. */
if (GST_CLOCK_TIME_IS_VALID(stream->time_position) &&
min_time != G_MAXINT64 &&
- stream->time_position + GST_SECOND <= min_time) {
+ stream->time_position + SUBTITLE_GAP_INTERVAL <= min_time) {
if (stream->new_segment) {
aiurdemux_send_stream_newsegment (demux, stream);
}
- GstEvent *gap = gst_event_new_gap (stream->time_position, GST_SECOND);
+ GstEvent *gap = gst_event_new_gap (stream->time_position, SUBTITLE_GAP_INTERVAL);
stream->last_start = stream->time_position;
- stream->last_stop = stream->time_position + GST_SECOND;
+ stream->last_stop = stream->time_position + SUBTITLE_GAP_INTERVAL;
gst_pad_push_event (stream->pad, gap);
GST_INFO ("TEXT GAP event sent %d, time_position=%lld, "
@@ -3828,6 +3840,8 @@
memcpy (&seeksegment, &demux->segment, sizeof (GstSegment));
if (event) {
+ if (cur > seeksegment.stop)
+ seeksegment.stop = cur;
gst_segment_do_seek (&seeksegment, rate, format, flags,
cur_type, cur, stop_type, stop, &update);
}
diff --git a/plugins/beepdec/beep.c b/plugins/beepdec/beep.c
old mode 100644
new mode 100755
index 34cccee..3543352
--- a/plugins/beepdec/beep.c
+++ b/plugins/beepdec/beep.c
@@ -16,6 +16,7 @@
/*
* Copyright (c) 2011-2014, Freescale Semiconductor, Inc. All rights reserved.
+ * Copyright 2018 NXP
*
*/
@@ -50,5 +51,5 @@
return TRUE;
}
-IMX_GST_PLUGIN_DEFINE (beep, "universal audio decoder", plugin_init);
+IMX_GST_PLUGIN_DEFINE (beepdec, "universal audio decoder", plugin_init);
diff --git a/plugins/beepdec/beep_registry_1.0.arm.cf.in b/plugins/beepdec/beep_registry_1.0.arm.cf.in
index 86bde83..5d79e6e 100755
--- a/plugins/beepdec/beep_registry_1.0.arm.cf.in
+++ b/plugins/beepdec/beep_registry_1.0.arm.cf.in
@@ -32,12 +32,13 @@
description = Decode Vorbis compressed audio to raw data
rank = 259
mime = audio/x-vorbis
+dsp_lib = @dsp_arm_SONAME@
library = @vorbisd_arm_SONAME@
[ddplus]
longname = DDplus decoder
description = Decode Dobly Digital Plus audio to raw data
-mime = audio/eac3
+mime = audio/x-eac3
library = @ddpd_arm_SONAME@
[amr-nb]
diff --git a/plugins/beepdec/beep_registry_1.0.arm12.cf.in b/plugins/beepdec/beep_registry_1.0.arm12.cf.in
index e4e2172..bd64132 100755
--- a/plugins/beepdec/beep_registry_1.0.arm12.cf.in
+++ b/plugins/beepdec/beep_registry_1.0.arm12.cf.in
@@ -35,7 +35,7 @@
[ddplus]
longname = DDplus decoder
description = Decode Dobly Digital Plus audio to raw data
-mime = audio/eac3
+mime = audio/x-eac3
library = @ddpd_arm12_SONAME@
[amr-nb]
diff --git a/plugins/beepdec/beepdec.c b/plugins/beepdec/beepdec.c
index fbece93..2737892 100755
--- a/plugins/beepdec/beepdec.c
+++ b/plugins/beepdec/beepdec.c
@@ -194,7 +194,7 @@
//base_class->parse = GST_DEBUG_FUNCPTR (beep_dec_parse_and_decode);
base_class->flush = GST_DEBUG_FUNCPTR (beep_dec_flush);
- gst_element_class_set_static_metadata (gstelement_class, "Beep universal decoder",
+ gst_element_class_set_static_metadata (gstelement_class, "IMX Beep universal decoder",
"Codec/Decoder/Audio",
"Decode compressed audio to raw data",
"FreeScale Multimedia Team <shamm@freescale.com>");
@@ -457,10 +457,13 @@
type = DAB_PLUS;
} else if (!strcmp (IDecoder->name, "sbc")) {
type = SBCDEC;
- } else {
+ } else if (!strcmp (IDecoder->name, "vorbis")) {
+ type = OGG;
+ }else {
goto dsp_fail;
}
- beepdec->handle = IDecoder->createDecoderplus(&ops, type);
+ if (beepdec->handle == NULL)
+ beepdec->handle = IDecoder->createDecoderplus(&ops, type);
if (beepdec->handle == NULL) {
/* create fail, dsp not support */
GST_INFO (" dsp create decoder fail ");
@@ -499,7 +502,8 @@
ops.ReAlloc = beepdec_core_mem_realloc;
ops.Free = beepdec_core_mem_free;
- beepdec->handle = IDecoder->createDecoder (&ops);
+ if(beepdec->handle == NULL)
+ beepdec->handle = IDecoder->createDecoder (&ops);
if(beepdec->handle == NULL)
break;
@@ -864,7 +868,7 @@
GST_LOG_OBJECT (beepdec,"decode RET=%x input size=%d,used size=%d,output_size=%d"
,core_ret,inbuf_size,offset,out_size);
- if (ACODEC_ERROR_STREAM == core_ret) {
+ if ((ACODEC_ERROR_STREAM == core_ret) || (ACODEC_ERR_UNKNOWN == core_ret)){
GST_WARNING("decode END error = %x\n", core_ret);
IDecoder->resetDecoder(handle);
//send null frame to delete the timestamp
diff --git a/plugins/beepdec/beepdec.h b/plugins/beepdec/beepdec.h
index da71a67..b4bdbe4 100755
--- a/plugins/beepdec/beepdec.h
+++ b/plugins/beepdec/beepdec.h
@@ -16,6 +16,7 @@
/*
* Copyright (c) 2011-2014, Freescale Semiconductor, Inc. All rights reserved.
+ * Copyright 2017-2018 NXP
*
*/
diff --git a/plugins/compositor/Makefile.am b/plugins/compositor/Makefile.am
index c7ecf7b..592e8ea 100755
--- a/plugins/compositor/Makefile.am
+++ b/plugins/compositor/Makefile.am
@@ -17,13 +17,16 @@
libgstimxcompositor_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) \
$(GST_BASE_LIBS) \
- -lgstbadbase-$(GST_API_VERSION) \
-lgstbadvideo-$(GST_API_VERSION) \
$(GST_PLUGINS_BASE_LIBS) \
-lgstvideo-$(GST_API_VERSION) \
$(GST_LIBS) \
../../libs/libgstfsl-@GST_API_VERSION@.la
+if USE_BAD_BASE
+libgstimxcompositor_la_LIBADD += -lgstbadbase-$(GST_API_VERSION)
+endif
+
libgstimxcompositor_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstimxcompositor_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
diff --git a/plugins/compositor/gstimxcompositor.c b/plugins/compositor/gstimxcompositor.c
index ac08932..92d611b 100755
--- a/plugins/compositor/gstimxcompositor.c
+++ b/plugins/compositor/gstimxcompositor.c
@@ -1,5 +1,6 @@
/* GStreamer IMX video compositor plugin
* Copyright (c) 2015-2016, Freescale Semiconductor, Inc. All rights reserved.
+ * Copyright 2018 NXP
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -119,6 +120,8 @@
#include <string.h>
#include <gst/allocators/gstdmabuf.h>
+#include <gst/allocators/gstdmabufmeta.h>
+#include <libdrm/drm_fourcc_imx.h>
#include <gst/allocators/gstallocatorphymem.h>
#include <gst/allocators/gstphymemmeta.h>
#ifdef USE_ION
@@ -1036,6 +1039,8 @@
1, G_MAXINT32, G_MAXINT32, 1, NULL);
}
+ vagg->info = info;
+
return ret;
}
@@ -1143,6 +1148,8 @@
{
GstVideoAggregatorPad *ppad = (GstVideoAggregatorPad *)pad;
guint i, n_mem;
+ GstDmabufMeta *dmabuf_meta;
+ gint64 drm_modifier = 0;
src->info.fmt = GST_VIDEO_INFO_FORMAT(&(ppad->aggregated_frame->info));
src->info.w = ppad->aggregated_frame->info.width +
@@ -1151,6 +1158,17 @@
pad->align.padding_top + pad->align.padding_bottom;
src->info.stride = ppad->aggregated_frame->info.stride[0];
+ dmabuf_meta = gst_buffer_get_dmabuf_meta (ppad->aggregated_frame->buffer);
+ if (dmabuf_meta)
+ drm_modifier = dmabuf_meta->drm_modifier;
+
+ GST_INFO_OBJECT (pad, "buffer modifier type %d", drm_modifier);
+
+ if (drm_modifier == DRM_FORMAT_MOD_AMPHION_TILED)
+ src->info.tile_type = IMX_2D_TILE_AMHPION;
+ else
+ src->info.tile_type = IMX_2D_TILE_NULL;
+
GST_LOG_OBJECT (pad, "Input: %s, %dx%d(%d), crop(%d,%d,%d,%d)",
GST_VIDEO_FORMAT_INFO_NAME(ppad->aggregated_frame->info.finfo),
src->info.w, src->info.h, src->info.stride,
@@ -1600,8 +1618,13 @@
GST_ERROR ("Couldn't create caps for device '%s'", in_plugin->name);
caps = gst_caps_new_empty_simple ("video/x-raw");
}
+#if GST_CHECK_VERSION(1, 14, 0)
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_pad_template_new_with_gtype ("sink_%u", GST_PAD_SINK, GST_PAD_REQUEST, caps, GST_TYPE_IMXCOMPOSITOR_PAD));
+#else
gst_element_class_add_pad_template (gstelement_class,
gst_pad_template_new ("sink_%u", GST_PAD_SINK, GST_PAD_REQUEST, caps));
+#endif
list = dev->get_supported_out_fmts(dev);
caps = imx_compositor_caps_from_fmt_list(list);
@@ -1611,20 +1634,26 @@
GST_ERROR ("Couldn't create caps for device '%s'", in_plugin->name);
caps = gst_caps_new_empty_simple ("video/x-raw");
}
- gst_element_class_add_pad_template (gstelement_class,
- gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, caps));
klass->in_plugin = in_plugin;
in_plugin->destroy(dev);
+#if GST_CHECK_VERSION(1, 14, 0)
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_pad_template_new_with_gtype ("src", GST_PAD_SRC, GST_PAD_ALWAYS, caps, GST_TYPE_AGGREGATOR_PAD));
+ agg_class->negotiated_src_caps = gst_imxcompositor_negotiated_caps;
+#else
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, caps));
agg_class->sinkpads_type = GST_TYPE_IMXCOMPOSITOR_PAD;
+ videoaggregator_class->negotiated_caps = gst_imxcompositor_negotiated_caps;
+#endif
agg_class->sink_query = gst_imxcompositor_sink_query;
agg_class->src_query = gst_imxcompositor_src_query;
videoaggregator_class->find_best_format = gst_imxcompositor_find_best_format;
videoaggregator_class->update_caps = gst_imxcompositor_update_caps;
videoaggregator_class->aggregate_frames = gst_imxcompositor_aggregate_frames;
- videoaggregator_class->negotiated_caps = gst_imxcompositor_negotiated_caps;
videoaggregator_class->get_output_buffer=gst_imxcompositor_get_output_buffer;
g_object_class_install_property (gobject_class,
diff --git a/plugins/compositor/gstimxcompositorpad.c b/plugins/compositor/gstimxcompositorpad.c
index 5d88bdb..e1ac442 100755
--- a/plugins/compositor/gstimxcompositorpad.c
+++ b/plugins/compositor/gstimxcompositorpad.c
@@ -1,5 +1,6 @@
/* GStreamer IMX video compositor plugin
* Copyright (c) 2015-2016, Freescale Semiconductor, Inc. All rights reserved.
+ * Copyright 2018 NXP
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -473,8 +474,13 @@
frame = g_slice_new0 (GstVideoFrame);
+#if GST_CHECK_VERSION(1, 14, 0)
+ if (!gst_video_frame_map (frame, &pad->info, pad->buffer,
+#else
if (!gst_video_frame_map (frame, &pad->buffer_vinfo, pad->buffer,
+#endif
GST_MAP_READ)) {
+
GST_WARNING_OBJECT (vagg, "Could not map input buffer");
g_slice_free (GstVideoFrame, frame);
return FALSE;
diff --git a/plugins/fbdevsink/gstimxfbdevsink.c b/plugins/fbdevsink/gstimxfbdevsink.c
old mode 100644
new mode 100755
index 956d56b..cfd7792
--- a/plugins/fbdevsink/gstimxfbdevsink.c
+++ b/plugins/fbdevsink/gstimxfbdevsink.c
@@ -1,5 +1,5 @@
/* i.Mx GStreamer fbdev plugin
- * Copyright 2017 NXP
+ * Copyright 2017-2018 NXP
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -41,6 +41,7 @@
#include "gstimxfbdevsink.h"
#include "gstimxcommon.h"
+#include "gstimx.h"
#include "gstimxvideooverlay.h"
GST_DEBUG_CATEGORY (imx_fbdevsink_debug);
@@ -848,7 +849,7 @@
videosink_class->show_frame = GST_DEBUG_FUNCPTR (gst_imx_fbdevsink_show_frame);
- gst_element_class_set_static_metadata (gstelement_class, "imx fbdev video sink",
+ gst_element_class_set_static_metadata (gstelement_class, "IMX fbdev video sink",
"Sink/Video", "Linux framebuffer videosink for i.Mx",
IMX_GST_PLUGIN_AUTHOR);
diff --git a/plugins/overlay_sink/Makefile.am b/plugins/overlay_sink/Makefile.am
index f2de16a..df7fbdf 100755
--- a/plugins/overlay_sink/Makefile.am
+++ b/plugins/overlay_sink/Makefile.am
@@ -1,11 +1,11 @@
-plugin_LTLIBRARIES = libgstoverlaysinkplugins.la
+plugin_LTLIBRARIES = libgstoverlaysink.la
-libgstoverlaysinkplugins_la_SOURCES = gstosink.c \
+libgstoverlaysink_la_SOURCES = gstosink.c \
gstosinkallocator.c \
osink_object.c \
compositor.c
-libgstoverlaysinkplugins_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) \
+libgstoverlaysink_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) \
$(GST_BASE_CFLAGS) \
$(GST_CFLAGS) \
-I$(top_srcdir)/libs \
@@ -18,20 +18,20 @@
-I$(top_srcdir)/libs/video-overlay
if USE_FB_DISPLAY
-libgstoverlaysinkplugins_la_SOURCES += displaysfb.c
+libgstoverlaysink_la_SOURCES += displaysfb.c
else
-libgstoverlaysinkplugins_la_SOURCES += displaysv4l2.c
+libgstoverlaysink_la_SOURCES += displaysv4l2.c
endif
if PLATFORM_IS_MX8
-libgstoverlaysinkplugins_la_CFLAGS += -DUSE_FB_API
+libgstoverlaysink_la_CFLAGS += -DUSE_FB_API
endif
if USE_ION
-libgstoverlaysinkplugins_la_CFLAGS += -DUSE_ION
+libgstoverlaysink_la_CFLAGS += -DUSE_ION
endif
-libgstoverlaysinkplugins_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) \
+libgstoverlaysink_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) \
$(GST_BASE_LIBS) \
$(GST_PLUGINS_BASE_LIBS) \
-lgstvideo-$(GST_API_VERSION) \
@@ -40,11 +40,11 @@
../../libs/libgstfsl-@GST_API_VERSION@.la
if USE_BAD_ALLOCATOR
-libgstoverlaysinkplugins_la_LIBADD += -lgstbadallocators-$(GST_API_VERSION)
+libgstoverlaysink_la_LIBADD += -lgstbadallocators-$(GST_API_VERSION)
endif
-libgstoverlaysinkplugins_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstoverlaysinkplugins_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
+libgstoverlaysink_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgstoverlaysink_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
noinst_HEADERS = osink_common.h gstosink.h gstosinkallocator.h osink_object.h compositor.h displays.h
diff --git a/plugins/overlay_sink/gstosink.c b/plugins/overlay_sink/gstosink.c
index af7f704..f14b4ae 100755
--- a/plugins/overlay_sink/gstosink.c
+++ b/plugins/overlay_sink/gstosink.c
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2014-2016, Freescale Semiconductor, Inc. All rights reserved.
+ * Copyright 2018 NXP
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -44,6 +45,7 @@
{
OVERLAY_SINK_PROP_0,
OVERLAY_SINK_PROP_COMPOSITION_META_ENABLE,
+ OVERLAY_SINK_PROP_VIDEO_DIRECTION,
OVERLAY_SINK_PROP_DISP_ON_0,
OVERLAY_SINK_PROP_DISPWIN_X_0,
OVERLAY_SINK_PROP_DISPWIN_Y_0,
@@ -59,6 +61,35 @@
#define OVERLAY_SINK_PROP_DISP_LENGTH (OVERLAY_SINK_PROP_DISP_MAX_0-OVERLAY_SINK_PROP_DISP_ON_0)
#define OVERLAY_SINK_COMPOMETA_DEFAULT TRUE
+#define DEFAULT_IMX_ROTATE_METHOD GST_IMX_ROTATION_0
+#define GST_TYPE_IMX_ROTATE_METHOD (gst_imx_rotate_method_get_type())
+
+static const GEnumValue rotate_methods[] = {
+ {GST_IMX_ROTATION_0, "no rotation", "none"},
+ {GST_IMX_ROTATION_90, "Rotate clockwise 90 degrees", "rotate-90"},
+ {GST_IMX_ROTATION_180, "Rotate clockwise 180 degrees", "rotate-180"},
+ {GST_IMX_ROTATION_270, "Rotate clockwise 270 degrees", "rotate-270"},
+ {GST_IMX_ROTATION_HFLIP, "Flip horizontally", "horizontal-flip"},
+ {GST_IMX_ROTATION_VFLIP, "Flip vertically", "vertically-flip"},
+ {0, NULL, NULL}
+};
+
+GType
+gst_imx_rotate_method_get_type()
+{
+ static GType rotate_method_type = 0;
+ static volatile gsize once = 0;
+
+ if (g_once_init_enter (&once)) {
+ rotate_method_type = g_enum_register_static ("GstImxRotateMethod",
+ rotate_methods);
+ g_once_init_leave (&once, rotate_method_type);
+ }
+
+ return rotate_method_type;
+}
+
+
static GstFlowReturn
gst_overlay_sink_show_frame (GstBaseSink * bsink, GstBuffer * buffer);
@@ -97,10 +128,20 @@
osink_object_set_color_key(osink->osink_obj, 0, enable, color_key);
}
+static void
+gst_overlay_sink_video_direction_interface_init (GstVideoDirectionInterface *
+ iface)
+{
+ /* We implement the video-direction property */
+}
+
#define gst_overlay_sink_parent_class parent_class
+
G_DEFINE_TYPE_WITH_CODE (GstOverlaySink, gst_overlay_sink, GST_TYPE_VIDEO_SINK,
G_IMPLEMENT_INTERFACE (GST_TYPE_VIDEO_OVERLAY,
- gst_overlay_sink_video_overlay_interface_init));
+ gst_overlay_sink_video_overlay_interface_init);
+ G_IMPLEMENT_INTERFACE (GST_TYPE_VIDEO_DIRECTION,
+ gst_overlay_sink_video_direction_interface_init));
//G_DEFINE_TYPE (GstOverlaySink, gst_overlay_sink, GST_TYPE_VIDEO_SINK);
@@ -143,7 +184,10 @@
sink->composition_meta_enable = g_value_get_boolean(value);
return;
}
-
+ if (prop_id == OVERLAY_SINK_PROP_VIDEO_DIRECTION) {
+ sink->overlay[0].rot = g_value_get_enum (value);
+ return;
+ }
idx = (prop_id - OVERLAY_SINK_PROP_DISP_ON_0) / OVERLAY_SINK_PROP_DISP_LENGTH;
prop = prop_id - idx * OVERLAY_SINK_PROP_DISP_LENGTH;
switch (prop) {
@@ -199,7 +243,10 @@
g_value_set_boolean(value, sink->composition_meta_enable);
return;
}
-
+ if (prop_id == OVERLAY_SINK_PROP_VIDEO_DIRECTION) {
+ g_value_set_enum (value, sink->overlay[0].rot);
+ return;
+ }
idx = (prop_id - OVERLAY_SINK_PROP_DISP_ON_0) / OVERLAY_SINK_PROP_DISP_LENGTH;
prop = prop_id - idx * OVERLAY_SINK_PROP_DISP_LENGTH;
switch (prop) {
@@ -986,15 +1033,20 @@
g_free (prop_name);
prop++;
- if (i == 0)
- prop_name = g_strdup_printf ("rotate");
- else
+
+ if (i == 0) {
+ prop_name = g_strdup_printf("video-direction");
+ g_object_class_override_property (gobject_class, OVERLAY_SINK_PROP_VIDEO_DIRECTION, "video-direction");
+
+ }
+ else {
prop_name = g_strdup_printf ("rotate-%d", i);
- g_object_class_install_property (gobject_class, prop,
+ g_object_class_install_property (gobject_class, prop,
g_param_spec_enum (prop_name,
prop_name,
"get/set the rotation of the video", GST_TYPE_IMX_ROTATE_METHOD, DEFAULT_IMX_ROTATE_METHOD,
G_PARAM_READWRITE));
+ }
g_free (prop_name);
prop++;
diff --git a/plugins/v4l2/Makefile.am b/plugins/v4l2/Makefile.am
index 8d74878..b5fae56 100755
--- a/plugins/v4l2/Makefile.am
+++ b/plugins/v4l2/Makefile.am
@@ -1,11 +1,11 @@
-plugin_LTLIBRARIES = libgstimxv4l2plugins.la
+plugin_LTLIBRARIES = libgstimxv4l2.la
-libgstimxv4l2plugins_la_SOURCES = gstimxv4l2plugins.c \
+libgstimxv4l2_la_SOURCES = gstimxv4l2plugins.c \
gstimxv4l2allocator.c \
gstimxv4l2sink.c \
gstimxv4l2src.c
-libgstimxv4l2plugins_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) \
+libgstimxv4l2_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) \
$(GST_BASE_CFLAGS) \
$(GST_CFLAGS) \
-I$(top_srcdir)/libs \
@@ -15,7 +15,7 @@
-I$(top_srcdir)/libs/overlaycompositionmeta \
-I$(top_srcdir)/libs/video-overlay
-libgstimxv4l2plugins_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) \
+libgstimxv4l2_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) \
$(GST_BASE_LIBS) \
$(GST_PLUGINS_BASE_LIBS) \
-lgstvideo-$(GST_API_VERSION) \
@@ -23,10 +23,10 @@
../../libs/libgstfsl-@GST_API_VERSION@.la
if USE_BAD_ALLOCATOR
-libgstimxv4l2plugins_la_LIBADD += -lgstbadallocators-$(GST_API_VERSION)
+libgstimxv4l2_la_LIBADD += -lgstbadallocators-$(GST_API_VERSION)
endif
-libgstimxv4l2plugins_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstimxv4l2plugins_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
+libgstimxv4l2_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgstimxv4l2_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
noinst_HEADERS = gstimxv4l2allocator.h gstimxv4l2sink.h gstimxv4l2src.h
diff --git a/plugins/v4l2/gstimxv4l2sink.c b/plugins/v4l2/gstimxv4l2sink.c
index b34d6b1..df43b89 100755
--- a/plugins/v4l2/gstimxv4l2sink.c
+++ b/plugins/v4l2/gstimxv4l2sink.c
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2013-2015, Freescale Semiconductor, Inc. All rights reserved.
+ * Copyright 2018 NXP
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -47,12 +48,12 @@
PROP_CROP_LEFT,
PROP_CROP_WIDTH,
PROP_CROP_HEIGHT,
- PROP_ROTATE,
PROP_KEEP_VIDEO_RATIO,
PROP_DEINTERLACE_ENABLE,
PROP_DEINTERLACE_MOTION,
PROP_CONFIG,
- PROP_COMPOSITION_META_ENABLE
+ PROP_COMPOSITION_META_ENABLE,
+ PROP_VIDEO_DIRECTION,
};
enum {
@@ -92,10 +93,19 @@
gst_imx_v4l2out_config_color_key(v4l2sink->v4l2handle, enable, color_key);
}
+static void
+gst_imx_v4l2sink_video_direction_interface_init (GstVideoDirectionInterface *
+ iface)
+{
+ /* We implement the video-direction property */
+}
+
#define gst_imx_v4l2sink_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstImxV4l2Sink, gst_imx_v4l2sink, GST_TYPE_VIDEO_SINK,
G_IMPLEMENT_INTERFACE (GST_TYPE_VIDEO_OVERLAY,
- gst_imx_v4l2sink_video_overlay_interface_init));
+ gst_imx_v4l2sink_video_overlay_interface_init);
+ G_IMPLEMENT_INTERFACE (GST_TYPE_VIDEO_DIRECTION,
+ gst_imx_v4l2sink_video_direction_interface_init));
//G_DEFINE_TYPE (GstImxV4l2Sink, gst_imx_v4l2sink, GST_TYPE_VIDEO_SINK);
@@ -144,7 +154,7 @@
v4l2sink->crop.height = g_value_get_uint (value);
v4l2sink->config_flag |= CONFIG_CROP;
break;
- case PROP_ROTATE:
+ case PROP_VIDEO_DIRECTION:
v4l2sink->rotate = g_value_get_enum (value);
v4l2sink->config_flag |= CONFIG_ROTATE;
break;
@@ -204,7 +214,7 @@
case PROP_CROP_HEIGHT:
g_value_set_uint (value, v4l2sink->crop.height);
break;
- case PROP_ROTATE:
+ case PROP_VIDEO_DIRECTION:
g_value_set_enum (value, v4l2sink->rotate);
break;
case PROP_KEEP_VIDEO_RATIO:
@@ -1010,11 +1020,6 @@
"The height of the video crop; default is equal to negotiated image height",
0, G_MAXINT, 0, G_PARAM_READWRITE));
- g_object_class_install_property (gobject_class, PROP_ROTATE,
- g_param_spec_enum ("rotate", "Rotate",
- "The orientation degree of the video; default is 0 degree",
- GST_TYPE_IMX_ROTATE_METHOD, DEFAULT_IMX_ROTATE_METHOD, G_PARAM_READWRITE));
-
g_object_class_install_property (gobject_class, PROP_KEEP_VIDEO_RATIO,
g_param_spec_boolean ("force-aspect-ratio", "Force aspect ratio",
"When enabled, scaling will respect original aspect ratio",
@@ -1044,6 +1049,9 @@
TRUE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_override_property (gobject_class, PROP_VIDEO_DIRECTION,
+ "video-direction");
+
return;
}
diff --git a/plugins/v4l2/gstimxv4l2src.c b/plugins/v4l2/gstimxv4l2src.c
index b332955..6d32701 100755
--- a/plugins/v4l2/gstimxv4l2src.c
+++ b/plugins/v4l2/gstimxv4l2src.c
@@ -848,7 +848,7 @@
pushsrc_class->create = GST_DEBUG_FUNCPTR (gst_imx_v4l2src_create);
gst_element_class_set_static_metadata (element_class, \
- "IMX Video (video4linux2) Source", "Src/Video", \
+ "IMX Video (video4linux2) Source", "Source/Video", \
"Capture frames from IMX SoC video4linux2 device", IMX_GST_PLUGIN_AUTHOR);
GST_DEBUG_CATEGORY_INIT (imxv4l2src_debug, "imxv4l2src", 0, "Freescale IMX V4L2 source element");
diff --git a/plugins/videoconvert/gstimxvideoconvert.c b/plugins/videoconvert/gstimxvideoconvert.c
index 88e9279..f7644e7 100755
--- a/plugins/videoconvert/gstimxvideoconvert.c
+++ b/plugins/videoconvert/gstimxvideoconvert.c
@@ -1,5 +1,6 @@
/* GStreamer IMX video convert plugin
* Copyright (c) 2014-2016, Freescale Semiconductor, Inc. All rights reserved.
+ * Copyright 2017-2018 NXP
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -23,6 +24,8 @@
#include <gst/video/video.h>
#include <gst/allocators/gstdmabuf.h>
+#include <gst/allocators/gstdmabufmeta.h>
+#include <libdrm/drm_fourcc_imx.h>
#include <gst/allocators/gstallocatorphymem.h>
#ifdef USE_ION
#include <gst/allocators/gstionmemory.h>
@@ -1216,6 +1219,20 @@
return TRUE;
}
+static guint8 *
+_get_cached_phyaddr (GstMemory * mem)
+{
+ return gst_mini_object_get_qdata (GST_MINI_OBJECT (mem),
+ g_quark_from_static_string ("phyaddr"));
+}
+
+static void
+_set_cached_phyaddr (GstMemory * mem, guint8 * phyadd)
+{
+ return gst_mini_object_set_qdata (GST_MINI_OBJECT (mem),
+ g_quark_from_static_string ("phyaddr"), phyadd, NULL);
+}
+
static GstFlowReturn imx_video_convert_transform_frame(GstVideoFilter *filter,
GstVideoFrame *in, GstVideoFrame *out)
{
@@ -1230,6 +1247,8 @@
guint i, n_mem;
GstVideoCropMeta *in_crop = NULL, *out_crop = NULL;
GstVideoInfo info;
+ GstDmabufMeta *dmabuf_meta;
+ gint64 drm_modifier = 0;
if (!device)
return GST_FLOW_ERROR;
@@ -1353,6 +1372,22 @@
imxvct->in_video_align.padding_bottom;
src.info.stride = in->info.stride[0];
+ dmabuf_meta = gst_buffer_get_dmabuf_meta (in->buffer);
+ if (dmabuf_meta) {
+ drm_modifier = dmabuf_meta->drm_modifier;
+ dmabuf_meta->drm_modifier = 0;
+ }
+
+ dmabuf_meta = gst_buffer_get_dmabuf_meta (out->buffer);
+ if (dmabuf_meta) {
+ dmabuf_meta->drm_modifier = 0;
+ }
+
+ GST_INFO_OBJECT (imxvct, "buffer modifier type %d", drm_modifier);
+
+ if (drm_modifier == DRM_FORMAT_MOD_AMPHION_TILED)
+ src.info.tile_type = IMX_2D_TILE_AMHPION;
+
gint ret = device->config_input(device, &src.info);
GST_LOG ("Input: %s, %dx%d(%d)", GST_VIDEO_FORMAT_INFO_NAME(in->info.finfo),
@@ -1439,6 +1474,11 @@
src.interlace_type = IMX_2D_INTERLACE_PROGRESSIVE;
break;
}
+ if (GST_BUFFER_FLAG_IS_SET (input_frame->buffer, GST_VIDEO_BUFFER_FLAG_INTERLACED)) {
+ src.interlace_type = IMX_2D_INTERLACE_INTERLEAVED;
+ GST_BUFFER_FLAG_UNSET (input_frame->buffer, GST_VIDEO_BUFFER_FLAG_INTERLACED);
+ GST_BUFFER_FLAG_UNSET (out->buffer, GST_VIDEO_BUFFER_FLAG_INTERLACED);
+ }
if (gst_is_dmabuf_memory (gst_buffer_peek_memory (out->buffer, 0))) {
dst.mem = &dst_mem;
@@ -1467,10 +1507,24 @@
dst.crop.h = MIN(out_crop->height, (out->info.height - out_crop->y));
}
+ if (!src.mem->paddr)
+ src.mem->paddr = _get_cached_phyaddr (gst_buffer_peek_memory (input_frame->buffer, 0));
+ if (!src.mem->user_data && src.fd[1])
+ src.mem->user_data = _get_cached_phyaddr (gst_buffer_peek_memory (input_frame->buffer, 1));
+ if (!dst.mem->paddr)
+ dst.mem->paddr = _get_cached_phyaddr (gst_buffer_peek_memory (out->buffer, 0));
+
//convert
if (device->convert(device, &dst, &src) == 0) {
GST_TRACE ("frame conversion done");
+ if (!_get_cached_phyaddr (gst_buffer_peek_memory (input_frame->buffer, 0)))
+ _set_cached_phyaddr (gst_buffer_peek_memory (input_frame->buffer, 0), src.mem->paddr);
+ if (src.fd[1] && !_get_cached_phyaddr (gst_buffer_peek_memory (input_frame->buffer, 1)))
+ _set_cached_phyaddr (gst_buffer_peek_memory (input_frame->buffer, 1), src.mem->user_data);
+ if (!_get_cached_phyaddr (gst_buffer_peek_memory (out->buffer, 0)))
+ _set_cached_phyaddr (gst_buffer_peek_memory (out->buffer, 0), dst.mem->paddr);
+
if (imxvct->composition_meta_enable) {
if (imx_video_overlay_composition_has_meta(in->buffer)) {
VideoCompositionVideoInfo in_v, out_v;
diff --git a/plugins/vpu/Makefile.am b/plugins/vpu/Makefile.am
index c56d714..286086f 100755
--- a/plugins/vpu/Makefile.am
+++ b/plugins/vpu/Makefile.am
@@ -25,6 +25,10 @@
libgstvpu_la_CFLAGS += -DUSE_ION
endif
+if USE_H1_ENC
+libgstvpu_la_CFLAGS += -DUSE_H1_ENC
+endif
+
if USE_BAD_ALLOCATOR
libgstvpu_la_LIBADD += -lgstbadallocators-$(GST_API_VERSION)
endif
diff --git a/plugins/vpu/gstvpu.c b/plugins/vpu/gstvpu.c
old mode 100755
new mode 100644
index e744f2b..c2454bc
--- a/plugins/vpu/gstvpu.c
+++ b/plugins/vpu/gstvpu.c
@@ -68,9 +68,6 @@
for (i = 0; i < vpu_internal_mem->mem_info.nSubBlockNum; ++i) {
size = vpu_internal_mem->mem_info.MemSubBlock[i].nAlignment \
+ vpu_internal_mem->mem_info.MemSubBlock[i].nSize;
- GST_DEBUG_OBJECT(vpu_internal_mem, "sub block %d type: %s size: %d", i, \
- (vpu_internal_mem->mem_info.MemSubBlock[i].MemType == VPU_MEM_VIRT) ? \
- "virtual" : "phys", size);
if (vpu_internal_mem->mem_info.MemSubBlock[i].MemType == VPU_MEM_VIRT) {
ptr = g_malloc(size);
@@ -152,9 +149,9 @@
vpu_frame->pbufCr = vpu_frame->pbufCb + \
(GST_VIDEO_FRAME_COMP_DATA (&frame, 2) - GST_VIDEO_FRAME_COMP_DATA (&frame, 1));
- vpu_frame->pbufVirtY = GST_VIDEO_FRAME_COMP_DATA (&frame, 0);
- vpu_frame->pbufVirtCb = GST_VIDEO_FRAME_COMP_DATA (&frame, 1);
- vpu_frame->pbufVirtCr = GST_VIDEO_FRAME_COMP_DATA (&frame, 2);
+ vpu_frame->pbufVirtY = GST_VIDEO_FRAME_PLANE_DATA (&frame, 0);
+ vpu_frame->pbufVirtCb = GST_VIDEO_FRAME_PLANE_DATA (&frame, 1);
+ vpu_frame->pbufVirtCr = GST_VIDEO_FRAME_PLANE_DATA (&frame, 2);
gst_video_frame_unmap (&frame);
}
diff --git a/plugins/vpu/gstvpu.h b/plugins/vpu/gstvpu.h
index 8bb2a41..db86024 100755
--- a/plugins/vpu/gstvpu.h
+++ b/plugins/vpu/gstvpu.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2014, Freescale Semiconductor, Inc. All rights reserved.
- * Copyright 2017 NXP
+ * Copyright 2017-2018 NXP
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -29,6 +29,7 @@
#define DEFAULT_FRAME_BUFFER_ALIGNMENT_H_HANTRO_TILE 8
#define DEFAULT_FRAME_BUFFER_ALIGNMENT_V 16
#define DEFAULT_FRAME_BUFFER_ALIGNMENT_V_HANTRO 8
+#define DEFAULT_FRAME_BUFFER_ALIGNMENT_H_HANTRO 8
#define DEFAULT_FRAME_BUFFER_ALIGNMENT_H_AMPHION 256
#define DEFAULT_FRAME_BUFFER_ALIGNMENT_V_AMPHION 256
#define ALIGN(ptr,align) ((align) ? ((((unsigned long)(ptr))+(align)-1)/(align)*(align)) : ((unsigned long)(ptr)))
diff --git a/plugins/vpu/gstvpudec.c b/plugins/vpu/gstvpudec.c
index 6c207f1..dc698c4 100755
--- a/plugins/vpu/gstvpudec.c
+++ b/plugins/vpu/gstvpudec.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2015, Freescale Semiconductor, Inc. All rights reserved.
- * Copyright 2017 NXP
+ * Copyright 2017-2018 NXP
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -149,7 +149,7 @@
gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
gst_vpu_dec_object_get_src_caps ()));
gst_element_class_set_static_metadata (element_class,
- "VPU-based video decoder", "Codec/Decoder/Video",
+ "IMX VPU-based video decoder", "Codec/Decoder/Video",
"Decode compressed video to raw data",
IMX_GST_PLUGIN_AUTHOR);
diff --git a/plugins/vpu/gstvpudecobject.c b/plugins/vpu/gstvpudecobject.c
old mode 100755
new mode 100644
index 46d6fc4..07ad86b
--- a/plugins/vpu/gstvpudecobject.c
+++ b/plugins/vpu/gstvpudecobject.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013, Freescale Semiconductor, Inc. All rights reserved.
- * Copyright 2017 NXP
+ * Copyright 2017-2018 NXP
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -142,6 +142,11 @@
map++;
continue;
}
+ if (IS_IMX8MM() && (map->std != VPU_V_HEVC && map->std != VPU_V_VP9
+ && map->std != VPU_V_AVC && map->std != VPU_V_VP8)) {
+ map++;
+ continue;
+ }
if (caps) {
GstCaps *newcaps = gst_caps_from_string (map->mime);
if (newcaps) {
@@ -523,6 +528,8 @@
|| open_param->CodecFormat == VPU_V_AVC))
|| IS_AMPHION()) {
open_param->nTiled2LinearEnable = 1;
+ if (IS_IMX8MM())
+ open_param->nTiled2LinearEnable = 0;
vpu_dec_object->implement_config = TRUE;
if (open_param->CodecFormat == VPU_V_HEVC
|| open_param->CodecFormat == VPU_V_VP9)
@@ -533,6 +540,10 @@
open_param->nTiled2LinearEnable = 0;
}
open_param->nEnableVideoCompressor = 1;
+ if (IS_IMX8MM()) {
+ open_param->nEnableVideoCompressor = 0;
+ open_param->nPixelFormat = 1;
+ }
vpu_dec_object->output_format_decided = GST_VIDEO_FORMAT_NV12;
if (open_param->CodecFormat == VPU_V_MJPG) {
vpu_dec_object->is_mjpeg = TRUE;
@@ -556,6 +567,7 @@
open_param->nChromaInterleave = 1;
vpu_dec_object->chroma_interleaved = TRUE;
}
+ open_param->nAdaptiveMode = 1;
open_param->nReorderEnable = 1;
open_param->nEnableFileMode = 0;
open_param->nPicWidth = GST_VIDEO_INFO_WIDTH(info);
@@ -632,6 +644,8 @@
if (vpu_dec_object->vpu_report_resolution_change == FALSE \
&& vpu_dec_object->state >= STATE_REGISTRIED_FRAME_BUFFER) {
+ /* drain output */
+ gst_vpu_dec_object_decode (vpu_dec_object, bdec, NULL);
dec_ret = VPU_DecClose(vpu_dec_object->handle);
if (dec_ret != VPU_DEC_RET_SUCCESS) {
GST_ERROR_OBJECT(vpu_dec_object, "closing decoder failed: %s", \
@@ -878,7 +892,12 @@
if (IS_HANTRO() && vpu_dec_object->implement_config) {
VpuBufferNode in_data = {0};
int buf_ret;
- VPU_DecDecodeBuf(vpu_dec_object->handle, &in_data, &buf_ret);
+ dec_ret = VPU_DecDecodeBuf(vpu_dec_object->handle, &in_data, &buf_ret);
+ if (dec_ret == VPU_DEC_RET_FAILURE) {
+ GST_ERROR_OBJECT(vpu_dec_object, "VPU_DecDecodeBuf fail: %s", \
+ gst_vpu_dec_object_strerror(dec_ret));
+ return GST_FLOW_ERROR;
+ }
}
if (!gst_vpu_dec_object_register_frame_buffer (vpu_dec_object, bdec)) {
@@ -899,6 +918,11 @@
vpu_dec_object->gstbuffer_in_vpudec = g_list_append ( \
vpu_dec_object->gstbuffer_in_vpudec, buffer);
frame_buffer = g_hash_table_lookup(vpu_dec_object->gstbuffer2frame_table, buffer);
+ if (!frame_buffer) {
+ GST_ERROR_OBJECT(vpu_dec_object, "buffer 0x%x not in gstbuffer2frame_table, "
+ "pool returned a newly allocated buffer which is not supported", buffer);
+ return FALSE;
+ }
GST_DEBUG_OBJECT (vpu_dec_object, "gstbuffer_in_vpudec list length: %d\n", \
g_list_length (vpu_dec_object->gstbuffer_in_vpudec));
@@ -1120,7 +1144,7 @@
pmeta->rfc_chroma_offset = out_frame_info.pExtInfo->rfc_chroma_offset;
}
- if (vpu_dec_object->init_info.hasHdr10Meta) {
+ if (vpu_dec_object->init_info.hasHdr10Meta || vpu_dec_object->init_info.hasColorDesc) {
GstVideoHdr10Meta *meta = gst_buffer_add_video_hdr10_meta (out_frame->output_buffer);
meta->hdr10meta.redPrimary[0] = vpu_dec_object->init_info.Hdr10Meta.redPrimary[0];
meta->hdr10meta.redPrimary[1] = vpu_dec_object->init_info.Hdr10Meta.redPrimary[1];
diff --git a/plugins/vpu/gstvpudecobject.h b/plugins/vpu/gstvpudecobject.h
index 51e6c7c..3a1ed0d 100755
--- a/plugins/vpu/gstvpudecobject.h
+++ b/plugins/vpu/gstvpudecobject.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013, Freescale Semiconductor, Inc. All rights reserved.
- * Copyright 2017 NXP
+ * Copyright 2017-2018 NXP
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
diff --git a/plugins/vpu/gstvpuenc.c b/plugins/vpu/gstvpuenc.c
old mode 100755
new mode 100644
index 36921c5..65f1ef6
--- a/plugins/vpu/gstvpuenc.c
+++ b/plugins/vpu/gstvpuenc.c
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2014, Freescale Semiconductor, Inc. All rights reserved.
+ * Copyright 2018 NXP
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -39,12 +40,17 @@
#include <gst/video/video.h>
#include <gst/video/gstvideometa.h>
#include <gst/video/gstvideopool.h>
+#include <gst/allocators/gstdmabuf.h>
#include "gstimxcommon.h"
#include "gstvpuallocator.h"
#include "gstvpuenc.h"
#define DEFAULT_BITRATE 0
+#ifdef USE_H1_ENC
+#define DEFAULT_GOP_SIZE 30
+#else
#define DEFAULT_GOP_SIZE 15
+#endif
#define DEFAULT_QUANT -1
#define DEFAULT_H264_QUANT 35
#define DEFAULT_MPEG4_QUANT 15
@@ -61,24 +67,31 @@
static const VpuEncInfo VpuEncInfos[] = {
{ .name = "h264",
.std = VPU_V_AVC,
- .description = "VPU-based AVC/H264 video encoder",
+ .description = "IMX VPU-based AVC/H264 video encoder",
.detail = "Encode raw data to compressed video",
},
{ .name = "mpeg4",
.std = VPU_V_MPEG4,
- .description = "VPU-based MPEG4 video encoder",
+ .description = "IMX VPU-based MPEG4 video encoder",
.detail = "Encode raw data to compressed video",
},
{ .name = "h263",
.std = VPU_V_H263,
- .description = "VPU-based H263 video encoder",
+ .description = "IMX VPU-based H263 video encoder",
.detail = "Encode raw data to compressed video",
},
{ .name = "jpeg",
.std = VPU_V_MJPG,
- .description = "VPU-based JPEG video encoder",
+ .description = "IMX VPU-based JPEG video encoder",
.detail = "Encode raw data to compressed video",
},
+#ifdef USE_H1_ENC
+ { .name = "vp8",
+ .std = VPU_V_VP8,
+ .description = "IMX VPU-based VP8 video encoder",
+ .detail = "Encode raw data to compressed video",
+ },
+#endif
{
NULL
}
@@ -98,7 +111,11 @@
GST_PAD_ALWAYS,
GST_STATIC_CAPS(
"video/x-raw,"
- "format = (string) { NV12, I420, YV12 }, "
+#ifdef USE_H1_ENC
+ "format = (string) { NV12, I420, YUY2, UYVY, RGBA, RGBx, RGB16, RGB15, BGRA, BGRx, BGR16 }, "
+#else
+ "format = (string) { NV12, I420, YV12 }, "
+#endif
"width = (int) [ 64, 1920, 8 ], "
"height = (int) [ 64, 1088, 8 ], "
"framerate = (fraction) [ 0, MAX ]"
@@ -156,6 +173,21 @@
)
);
+#ifdef USE_H1_ENC
+static GstStaticPadTemplate static_src_template_vp8 = GST_STATIC_PAD_TEMPLATE(
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS(
+ "video/x-vp8, "
+ "variant = (string) itu, "
+ "width = (int) [ 64, 1920, 8 ], "
+ "height = (int) [ 64, 1088, 8 ], "
+ "framerate = (fraction) [ 0, MAX ]; "
+ )
+);
+#endif
+
static GstStaticPadTemplate static_src_template_jpeg = GST_STATIC_PAD_TEMPLATE(
"src",
GST_PAD_SRC,
@@ -220,13 +252,18 @@
} else if (in_plugin->std == VPU_V_MPEG4) {
g_object_class_install_property (gobject_class, PROP_QUANT,
g_param_spec_int ("quant", "quant",
- "set quant value: Mpeg4(1-31) (-1 for automatic)",
+ "set quant value: Mpeg4(1-31) (-1 for automatic)",
-1, 31, DEFAULT_QUANT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
} else if (in_plugin->std == VPU_V_H263) {
g_object_class_install_property (gobject_class, PROP_QUANT,
g_param_spec_int ("quant", "quant",
"set quant value: H.263(1-31) (-1 for automatic)",
-1, 31, DEFAULT_QUANT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ } else if (in_plugin->std == VPU_V_VP8) {
+ g_object_class_install_property (gobject_class, PROP_QUANT,
+ g_param_spec_int ("quant", "quant",
+ "set quant value: VP8(1-31) (-1 for automatic)",
+ -1, 31, DEFAULT_QUANT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
if (in_plugin->std == VPU_V_AVC) {
@@ -250,6 +287,14 @@
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&static_src_template_jpeg));
}
+#ifdef USE_H1_ENC
+ else if (in_plugin->std == VPU_V_VP8) {
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&static_sink_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&static_src_template_vp8));
+ }
+#endif
gst_element_class_set_static_metadata (element_class,
in_plugin->description, "Codec/Encoder/Video",
@@ -419,6 +464,9 @@
return FALSE;
}
+ enc->total_frames = 0;
+ enc->total_time = 0;
+
return TRUE;
}
@@ -462,6 +510,9 @@
{
GstVpuEnc *enc = (GstVpuEnc *) benc;
+ GST_INFO_OBJECT(enc, "Video encoder frames: %lld time: %lld fps: (%.3f).\n",
+ enc->total_frames, enc->total_time, (gfloat)1000000 * enc->total_frames / enc->total_time);
+
if (!gst_vpu_enc_reset (enc)) {
GST_ERROR_OBJECT(enc, "gst_enc_free_output_buffer fail");
return FALSE;
@@ -582,6 +633,10 @@
if (!g_strcmp0(video_format_str, "avc"))
enc->open_param.nIsAvcc = 1;
+ // hantro vpu wrapper only output bytestream
+ if (IS_HANTRO())
+ enc->open_param.nIsAvcc = 0;
+
gst_caps_unref(caps);
return TRUE;
@@ -675,8 +730,28 @@
s = gst_caps_get_structure(state->caps, 0);
video_format_str = gst_structure_get_string(s, "format");
- if (video_format_str && !g_strcmp0(video_format_str, "NV12"))
- enc->open_param.nChromaInterleave = 1;
+ if (video_format_str) {
+ if (!g_strcmp0(video_format_str, "NV12")) {
+ enc->open_param.nChromaInterleave = 1;
+ enc->open_param.eColorFormat = VPU_COLOR_420;
+ } else if (!g_strcmp0(video_format_str, "YUY2")) {
+ enc->open_param.nChromaInterleave = 1;
+ enc->open_param.eColorFormat = VPU_COLOR_422YUYV;
+ } else if (!g_strcmp0(video_format_str, "UYVY")) {
+ enc->open_param.nChromaInterleave = 1;
+ enc->open_param.eColorFormat = VPU_COLOR_422UYVY;
+ } else if (!g_strcmp0(video_format_str, "RGBA") || !g_strcmp0(video_format_str, "RGBx")) {
+ enc->open_param.eColorFormat = VPU_COLOR_ARGB8888;
+ } else if (!g_strcmp0(video_format_str, "BGRA") || !g_strcmp0(video_format_str, "BGRx")) {
+ enc->open_param.eColorFormat = VPU_COLOR_BGRA8888;
+ }else if (!g_strcmp0(video_format_str, "RGB16")) {
+ enc->open_param.eColorFormat = VPU_COLOR_RGB565;
+ } else if (!g_strcmp0(video_format_str, "RGB15")) {
+ enc->open_param.eColorFormat = VPU_COLOR_RGB555;
+ } else if (!g_strcmp0(video_format_str, "BGR16")) {
+ enc->open_param.eColorFormat = VPU_COLOR_BGR565;
+ }
+ }
GST_INFO_OBJECT(enc, "setting bitrate to %u kbps and GOP size to %u", \
enc->open_param.nBitRate, enc->open_param.nGOPSize);
@@ -730,6 +805,7 @@
GstCaps *caps;
GstStructure *config;
guint i;
+ guint alignH, alignV;
enc->pool = gst_video_buffer_pool_new ();
if (!enc->pool) {
@@ -745,15 +821,21 @@
params.align = enc->init_info.nAddressAlignment;
memset(&(enc->video_align), 0, sizeof(GstVideoAlignment));
- if (enc->open_param.nPicWidth % DEFAULT_FRAME_BUFFER_ALIGNMENT_H)
- enc->video_align.padding_right = DEFAULT_FRAME_BUFFER_ALIGNMENT_H \
- - enc->open_param.nPicWidth % DEFAULT_FRAME_BUFFER_ALIGNMENT_H;
- if (enc->open_param.nPicHeight % DEFAULT_FRAME_BUFFER_ALIGNMENT_V)
- enc->video_align.padding_bottom = DEFAULT_FRAME_BUFFER_ALIGNMENT_V\
- - enc->open_param.nPicHeight % DEFAULT_FRAME_BUFFER_ALIGNMENT_V;
+
+ if (IS_HANTRO()) {
+ alignH = DEFAULT_FRAME_BUFFER_ALIGNMENT_H_HANTRO;
+ alignV = DEFAULT_FRAME_BUFFER_ALIGNMENT_V_HANTRO;
+ } else {
+ alignH = DEFAULT_FRAME_BUFFER_ALIGNMENT_H;
+ alignV = DEFAULT_FRAME_BUFFER_ALIGNMENT_V;
+ }
+ if (enc->open_param.nPicWidth % alignH)
+ enc->video_align.padding_right = alignH - enc->open_param.nPicWidth % alignH;
+ if (enc->open_param.nPicHeight % alignV)
+ enc->video_align.padding_bottom = alignV - enc->open_param.nPicHeight % alignV;
for (i = 0; i < GST_VIDEO_MAX_PLANES; i++)
- enc->video_align.stride_align[i] = DEFAULT_FRAME_BUFFER_ALIGNMENT_H - 1;
+ enc->video_align.stride_align[i] = alignH - 1;
config = gst_buffer_pool_get_config(enc->pool);
gst_buffer_pool_config_add_option(config, GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT);
@@ -867,7 +949,7 @@
}
}
- if (!gst_buffer_is_phymem (frame->input_buffer)) {
+ if (!(gst_buffer_is_phymem (frame->input_buffer) || gst_is_dmabuf_memory (gst_buffer_peek_memory(frame->input_buffer, 0)))) {
GstVideoInfo info = enc->state->info;
GstVideoFrame frame1, frame2;
@@ -894,10 +976,10 @@
gst_video_frame_unmap (&frame2);
input_buffer = pool_buffer;
- } else {
+ } else {
GST_DEBUG_OBJECT(enc, "is physical continues memory.");
input_buffer = frame->input_buffer;
- }
+ }
/* Set up physical addresses for the input framebuffer */
{
@@ -919,14 +1001,25 @@
plane_strides = enc->state->info.stride;
}
- input_phys_buffer = gst_buffer_query_phymem_block (input_buffer);
- if (input_phys_buffer == NULL) {
- GST_ERROR_OBJECT(enc, "could not get physical address from input buffer.");
- ret = GST_FLOW_ERROR;
- goto bail;
- }
-
- phys_ptr = (unsigned char*)(input_phys_buffer->paddr);
+ if (gst_is_dmabuf_memory (gst_buffer_peek_memory (frame->input_buffer, 0))) {
+ guint i, n_mem;
+ gint fd[4];
+ memset (fd, -1, sizeof(gint) * 4);
+ n_mem = gst_buffer_n_memory (frame->input_buffer);
+ for (i = 0; i < n_mem; i++) {
+ fd[i] = gst_dmabuf_memory_get_fd (gst_buffer_peek_memory (frame->input_buffer, i));
+ }
+ if (fd[0] >= 0)
+ phys_ptr = phy_addr_from_fd (fd[0]);
+ } else {
+ input_phys_buffer = gst_buffer_query_phymem_block (input_buffer);
+ if (input_phys_buffer == NULL) {
+ GST_ERROR_OBJECT(enc, "could not get physical address from input buffer.");
+ ret = GST_FLOW_ERROR;
+ goto bail;
+ }
+ phys_ptr = (unsigned char*)(input_phys_buffer->paddr);
+ }
input_framebuf.pbufY = phys_ptr;
input_framebuf.pbufCb = phys_ptr + plane_offsets[1];
@@ -942,7 +1035,7 @@
}
// Allocate needed physical buffer.
- if (!gst_vpu_enc_allocate_physical_mem (enc, src_stride)) {
+ if (enc->init_info.nMinFrameBufferCount > 0 && (!gst_vpu_enc_allocate_physical_mem (enc, src_stride))) {
GST_ERROR_OBJECT(enc, "gst_vpu_enc_allocate_physical_mem failed.");
ret = GST_FLOW_ERROR;
goto bail;
@@ -960,7 +1053,7 @@
gst_buffer_map (output_buffer, &minfo, GST_MAP_READ);
/* Set up encoding parameters */
- enc_enc_param.nInVirtOutput = (unsigned int)(minfo.data);
+ enc_enc_param.nInVirtOutput = (unsigned long)(minfo.data);
enc_enc_param.nInOutputBufLen = enc->state->info.size;
enc_enc_param.nPicWidth = enc->open_param.nPicWidth;
enc_enc_param.nPicHeight = enc->open_param.nPicHeight;
@@ -1016,6 +1109,7 @@
goto bail;
}
+ enc->total_time += g_get_monotonic_time () - start_time;
GST_DEBUG_OBJECT(enc, "encoder consume time: %lld\n", \
g_get_monotonic_time () - start_time);
@@ -1029,7 +1123,7 @@
if (!(enc->open_param.eFormat == VPU_V_AVC && enc->open_param.nIsAvcc == 1)) {
output_buffer_offset += enc_enc_param.nOutOutputSize;
- enc_enc_param.nInVirtOutput = (unsigned int)(minfo.data) + enc_enc_param.nOutOutputSize;
+ enc_enc_param.nInVirtOutput = (unsigned long)(minfo.data) + enc_enc_param.nOutOutputSize;
enc_enc_param.nInOutputBufLen = enc->state->info.size - enc_enc_param.nOutOutputSize;
}
@@ -1046,6 +1140,7 @@
GST_LOG_OBJECT(enc, "setting sync point");
GST_VIDEO_CODEC_FRAME_SET_SYNC_POINT(frame);
}
+ enc->total_frames ++;
enc->gop_count ++;
output_buffer_offset += enc_enc_param.nOutOutputSize;
@@ -1153,6 +1248,18 @@
const VpuEncInfo *in_plugin = gst_vpu_enc_get_info();
while (in_plugin->name) {
+#ifdef USE_H1_ENC
+ if (g_strcmp0 (in_plugin->name, "h264") && g_strcmp0 (in_plugin->name, "vp8")) {
+ in_plugin++;
+ continue;
+ }
+#else
+ if (!g_strcmp0 (in_plugin->name, "vp8")) {
+ in_plugin++;
+ continue;
+ }
+#endif
+
t_name = g_strdup_printf ("vpuenc_%s", in_plugin->name);
type = g_type_from_name (t_name);
diff --git a/plugins/vpu/gstvpuenc.h b/plugins/vpu/gstvpuenc.h
index 6268b89..16063fe 100755
--- a/plugins/vpu/gstvpuenc.h
+++ b/plugins/vpu/gstvpuenc.h
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2014, Freescale Semiconductor, Inc. All rights reserved.
+ * Copyright 2018 NXP
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -47,6 +48,8 @@
GstBuffer *internal_input_buffer;
guint gop_count;
gboolean bitrate_updated;
+ gint64 total_frames;
+ gint64 total_time;
};
struct _GstVpuEncClass {
diff --git a/plugins/vpu/gstvpuplugins.c b/plugins/vpu/gstvpuplugins.c
index 06985bd..98eae95 100755
--- a/plugins/vpu/gstvpuplugins.c
+++ b/plugins/vpu/gstvpuplugins.c
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2013, Freescale Semiconductor, Inc. All rights reserved.
+ * Copyright 2018 NXP
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -32,7 +33,7 @@
plugin_init (GstPlugin * plugin)
{
if (HAS_VPU()) {
- if (!IS_HANTRO())
+ if (!IS_HANTRO() || IS_IMX8MM())
if (!gst_vpu_enc_register (plugin))
return FALSE;
diff --git a/tools/gplay/playengine.c b/tools/gplay/playengine.c
index aa34556..e6e290c 100755
--- a/tools/gplay/playengine.c
+++ b/tools/gplay/playengine.c
@@ -1,11 +1,24 @@
/**
-* Copyright (c) 2014-2015, Freescale Semiconductor Inc.,
-* All Rights Reserved.
-*
-* The following programs are the sole property of Freescale Semiconductor Inc.,
-* and contain its proprietary and confidential information.
-*
-*/
+ * Copyright (c) 2014-2015, Freescale Semiconductor Inc.,
+ * Copyright 2019 NXP
+ */
+
+/*
+ * 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 pconfigion) 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
// for fullscreen setting
#include <fcntl.h>
diff --git a/tools/gplay/playengine.h b/tools/gplay/playengine.h
index d33bde7..b1fabfa 100755
--- a/tools/gplay/playengine.h
+++ b/tools/gplay/playengine.h
@@ -1,11 +1,24 @@
/**
-* Copyright (c) 2014-2015, Freescale Semiconductor Inc.,
-* All Rights Reserved.
-*
-* The following programs are the sole property of Freescale Semiconductor Inc.,
-* and contain its proprietary and confidential information.
-*
-*/
+ * Copyright (c) 2014-2015, Freescale Semiconductor Inc.,
+ * Copyright 2019 NXP
+ */
+
+/*
+ * 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 pconfigion) 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
#ifndef IMX_PLAY_ENGINE_H
#define IMX_PLAY_ENGINE_H
diff --git a/tools/gplay2/gplay2.c b/tools/gplay2/gplay2.c
index 5b5363c..55bbb06 100755
--- a/tools/gplay2/gplay2.c
+++ b/tools/gplay2/gplay2.c
@@ -1,6 +1,6 @@
/*
* Copyright 2014-2016 Freescale Semiconductor, Inc.
- * Copyright 2017 NXP
+ * Copyright 2017-2019 NXP
*
*/
@@ -35,11 +35,11 @@
#include <signal.h>
#include <unistd.h>
#include <errno.h>
+#include <gstimxcommon.h>
#include <gst/player/player.h>
#include "playlist.h"
-#include "../../libs/gstimxcommon.h"
#include <fcntl.h>
#include <linux/fb.h>
@@ -805,6 +805,8 @@
ret = FALSE;
break;
}
+
+ return ret;
}
@@ -863,6 +865,11 @@
gexit_input_thread = TRUE;
gexit_display_thread = TRUE;
}
+ if (gexit_input_thread == TRUE ) {
+ if (g_main_loop_is_running (gloop) == TRUE) {
+ g_main_loop_quit (gloop);
+ }
+ }
}
static void
@@ -892,6 +899,11 @@
gexit_input_thread = TRUE;
gexit_display_thread = TRUE;
}
+ if (gexit_input_thread == TRUE ) {
+ if (g_main_loop_is_running (gloop) == TRUE) {
+ g_main_loop_quit (gloop);
+ }
+ }
}
static void
@@ -1081,6 +1093,18 @@
case 'c': // playing direction and speed Control.
{
gdouble playback_rate;
+ gboolean seekable = FALSE;
+ GstPlayerMediaInfo *media_info = gst_player_get_media_info (player);
+
+ gDisable_display = TRUE;
+ seekable = gst_player_media_info_is_seekable (media_info);
+ g_object_unref (media_info);
+
+ if (!seekable) {
+ g_print ("file is not seekable!, rate can not be set! \n");
+ gDisable_display = FALSE;
+ break;
+ }
g_print ("Set playing speed[-8,-4,-2,0.125,0.25,0.5,1,2,4,8]:");
gDisable_display = TRUE;
if (scanf ("%lf", &playback_rate) != 1) {
@@ -1088,13 +1112,13 @@
break;
}
gDisable_display = FALSE;
+ gst_player_set_rate (player, playback_rate);
+ wait_for_seek_done (play, options->timeout);
if (playback_rate > 2.0 || playback_rate < 0){
gst_player_set_subtitle_track_enabled (player, FALSE);
} else {
gst_player_set_subtitle_track_enabled (player, TRUE);
}
- gst_player_set_rate (player, playback_rate);
- wait_for_seek_done (play, options->timeout);
if (playback_rate > 0 && playback_rate <= 2.0){
/* now do pending track select */
if (play->pending_audio_track >= 0) {
@@ -1512,26 +1536,25 @@
options.timeout = DEFAULT_TIME_OUT;
}
- if (!options.video_sink_name)
- if (gplay_checkfeature (G2D)) {
- options.video_sink_name = "overlaysink";
- if (gplay_checkfeature (DPU)) {
- if (gplay_checkfeature (VPU))
- options.video_sink_name = "kmssink";
- else
- options.video_sink_name = "glimagesink";
- }
- } else {
- options.video_sink_name = "imxv4l2sink";
- if (gplay_checkfeature (DCSS))
- options.video_sink_name = "kmssink";
- }
- g_print ("Set VideoSink %s \n", options.video_sink_name);
- video_sink =
+ if (!options.video_sink_name) {
+ if (gplay_checkfeature (VPU) && gplay_checkfeature (DPU)) {
+ options.video_sink_name = "imxvideoconvert_g2d ! queue ! waylandsink";
+ g_print ("Set VideoSink %s \n", options.video_sink_name);
+ video_sink =
+ gst_parse_bin_from_description (options.video_sink_name, TRUE, NULL);
+ VideoRender =
+ gst_player_video_overlay_video_renderer_new_with_sink (NULL, video_sink);
+ } else
+ VideoRender =
+ gst_player_video_overlay_video_renderer_new (NULL);
+ } else {
+ g_print ("Set VideoSink %s \n", options.video_sink_name);
+ video_sink =
gst_parse_bin_from_description (options.video_sink_name, TRUE, NULL);
-
- VideoRender =
+ VideoRender =
gst_player_video_overlay_video_renderer_new_with_sink (NULL, video_sink);
+ }
+
VideoOverlayVideoRenderer =
GST_PLAYER_VIDEO_OVERLAY_VIDEO_RENDERER (VideoRender);
diff --git a/tools/grecorder/Makefile.am b/tools/grecorder/Makefile.am
index 179da23..0523ab9 100755
--- a/tools/grecorder/Makefile.am
+++ b/tools/grecorder/Makefile.am
@@ -12,7 +12,8 @@
bin_PROGRAMS = grecorder-@GST_API_VERSION@
grecorder_@GST_API_VERSION@_SOURCES = grecorder.c
grecorder_@GST_API_VERSION@_CFLAGS = $(GST_CFLAGS)
-grecorder_@GST_API_VERSION@_LDADD = librecorder_engine-@GST_API_VERSION@.la
+grecorder_@GST_API_VERSION@_LDADD = librecorder_engine-@GST_API_VERSION@.la \
+ -lglib-2.0
opencv_haarcascadesdir = $(pkgdatadir)/$(GST_API_VERSION)/opencv_haarcascades
opencv_haarcascades_DATA = haarcascade_frontalface_old_format.xml
diff --git a/tools/grecorder/grecorder.c b/tools/grecorder/grecorder.c
index bb334ae..1fec19f 100644
--- a/tools/grecorder/grecorder.c
+++ b/tools/grecorder/grecorder.c
@@ -303,7 +303,9 @@
/* Video time stamp and video effect */
recorder->add_time_stamp ((RecorderEngineHandle)recorder, pOpt->add_time_stamp);
recorder->add_video_effect ((RecorderEngineHandle)recorder, pOpt->video_effect);
+#ifdef SUPPORT_VIDEO_DETECT
recorder->add_video_detect ((RecorderEngineHandle)recorder, pOpt->video_detect);
+#endif
/* Audio encoder interface */
{
@@ -601,7 +603,7 @@
{"audio input: 0->default(mic), 1->mic, 2->audiotestsrc"},
{"audio sample rate"},
{"audio channel"},
- {"video input: 0->default(camera), 1->camera, 2->screen, 3->videotestsrc"},
+ {"video input: 0->default(camera), 1->camera, 2->videotestsrc"},
{"camera id: 0->/dev/video0, 1->/dev/video1"},
{"camera output video format: 0->default(I420), 1->I420, 2->NV12, 3->YUYV, 4->UYVY"},
{"camera output video width"},
@@ -609,18 +611,20 @@
{"camera output video FPS"},
{"add date/time onto video"},
{"video effect: 0->default(no effect),1:cube,2:mirror,3:squeeze,4:fisheye,5:gray,6:tunnel,7:twirl"},
+#ifdef SUPPORT_VIDEO_DETECT
{"video detect: 0->default(no detect),1:face detect,2:faceblur"},
+#endif
{"preview video left"},
{"preview video top"},
{"preview video width"},
{"preview video height"},
{"disable view finder"},
{"need preview buffer"},
- {"audio encoder type: 0->default(MP3), 1->MP3"},
+ {"audio encoder type: 0->default(MP3), 1->MP3, 2->No Audio"},
{"audio encoder bitrate(kbps)"},
- {"video encoder type: 0->default(H264), 1->H264, 2->MPEG4, 3->H263, 4->MPEG"},
+ {"video encoder type: 0->default(H264), 1->H264, 2->MPEG4, 3->H263, 4->MPEG, 5->VP8"},
{"video encoder bitrate(kbps)"},
- {"media container format: 0->default(MOV), 1->MOV, 2->MKV, 3->AVI, 4->FLV, 5->TS"},
+ {"media container format: 0->default(MP4), 1->MP4, 2->MKV, 3->AVI, 4->FLV, 5->TS"},
{"output path"},
{"RTP streaming host IP address"},
{"RTP streaming port"},
@@ -645,7 +649,9 @@
{"fps", required_argument, 0, 'f'},
{"date_time", no_argument, &add_time_stamp, 1},
{"video_effect", required_argument, 0, 'q'},
+#ifdef SUPPORT_VIDEO_DETECT
{"video_detect", required_argument, 0, 'x'},
+#endif
{"preview_left", required_argument, 0, 'l'},
{"preview_top", required_argument, 0, 't'},
{"preview_width", required_argument, 0, 'b'},
@@ -667,7 +673,7 @@
{0, 0, 0, 0}
};
- c = getopt_long (argc, argv, "abcdefg",
+ c = getopt_long (argc, argv, "a:s:w:e:u:f:k:t:q:i:v:n:z:o:r:x:g:",
long_options, &option_index);
/* Detect the end of the options. */
@@ -749,6 +755,10 @@
if (optarg)
pOpt->video_detect = atoi (optarg);
break;
+ case 'g':
+ if (optarg)
+ pOpt->audio_encoder = atoi (optarg);
+ break;
case 'h':
printf ("Usage: grecorder-1.0 [OPTION]\n");
for (c = 0; long_options[c].name; ++c) {
@@ -806,6 +816,11 @@
act.sa_flags = 0;
sigaction(SIGINT, &act, NULL);
+ if (argc < 2) {
+ g_print ("Use -h to get usage help.\n");
+ return 0;
+ }
+
memset(&options, 0, sizeof(REOptions));
if (recorder_parse_options(argc,argv,&options)){
LOG_ERROR ("recorder_parse_options fail.\n");
diff --git a/tools/grecorder/recorder_engine.c b/tools/grecorder/recorder_engine.c
index 549b7f0..771c419 100644
--- a/tools/grecorder/recorder_engine.c
+++ b/tools/grecorder/recorder_engine.c
@@ -35,6 +35,7 @@
#include <gst/pbutils/encoding-profile.h>
#include <gst/pbutils/encoding-target.h>
#include "recorder_engine.h"
+#include "gstimxcommon.h"
/*
* debug logging
*/
@@ -46,6 +47,29 @@
#define TIME_FORMAT "02d.%09u"
#define TIMEDIFF_FORMAT "0.6lf"
+#define ADD_DATE_TIME
+#ifdef ADD_DATE_TIME
+#define DATE_TIME "clockoverlay halignment=left valignment=top time-format=\"%Y/%m/%d %H:%M:%S \" !"
+#else
+#define DATE_TIME ""
+#endif
+
+// this is only for test purpose to measure end to end latency, defaul not enabled
+//#define ADD_TIME_OVERLAY
+#ifdef ADD_TIME_OVERLAY
+#define TIME_OVERLAY "timeoverlay halignment=right valignment=top text=\"Stream time:\" !"
+#define DATE_TIME "" //we only have one watermark to save performance
+#else
+#define TIME_OVERLAY ""
+#endif
+
+#define USE_HW_COMPOSITOR
+#ifdef USE_HW_COMPOSITOR
+#define HW_COMPOSITOR "queue ! imxvideoconvert_g2d composition-meta-enable=true in-place=true !"
+#else
+#define HW_COMPOSITOR ""
+#endif
+
#define TIME_ARGS(t) \
(GST_CLOCK_TIME_IS_VALID (t) && (t) < 99 * GST_SECOND) ? \
(gint) ((((GstClockTime)(t)) / GST_SECOND) % 60) : 99, \
@@ -328,6 +352,16 @@
gst_encoding_container_profile_add_profile (container, sprof);
gst_caps_unref (caps);
break;
+ case RE_VIDEO_ENCODER_VP8:
+ caps = gst_caps_new_simple ("video/x-vp8", NULL);
+ sprof = (GstEncodingProfile *)
+ gst_encoding_video_profile_new (caps, NULL, NULL, 1);
+ //FIXME: videorate has issue.
+ gst_encoding_video_profile_set_variableframerate ((GstEncodingVideoProfile
+ *) sprof, TRUE);
+ gst_encoding_container_profile_add_profile (container, sprof);
+ gst_caps_unref (caps);
+ break;
default:
break;
}
@@ -336,7 +370,7 @@
case RE_AUDIO_ENCODER_DEFAULT:
case RE_AUDIO_ENCODER_MP3:
caps = gst_caps_new_simple ("audio/mpeg",
- "mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 3, NULL);
+ "mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 2, NULL);
gst_encoding_container_profile_add_profile (container, (GstEncodingProfile *)
gst_encoding_audio_profile_new (caps, NULL, NULL, 1));
gst_caps_unref (caps);
@@ -815,6 +849,7 @@
GstElement *video_effect;
GstElement *camerasrc;
GstElement *capsfilter;
+ GstElement *actual_video_source;
gchar *video_filter_str = NULL;
if (recorder->wrappersrc_name)
@@ -822,16 +857,23 @@
else
wrapper = gst_element_factory_make ("wrappercamerabinsrc", NULL);
- if (g_strcmp0(recorder->videosrc_name, "imxv4l2src") == 0
- || g_strcmp0(recorder->videosrc_name, "videotestsrc") == 0) {
- camerasrc = gst_element_factory_make (recorder->videosrc_name, NULL);
- } else {
- camerasrc = gst_parse_bin_from_description (recorder->videosrc_name, TRUE,
- NULL);
- }
+ camerasrc = gst_parse_bin_from_description (recorder->videosrc_name, TRUE, NULL);
+
if (g_strcmp0(recorder->videosrc_name, "videotestsrc") == 0) {
- g_object_set (camerasrc, "is-live", TRUE, NULL);
+ GValue item = G_VALUE_INIT;
+ GstIterator *it = gst_bin_iterate_sources ((GstBin*)camerasrc);
+ if (gst_iterator_next (it, &item) != GST_ITERATOR_OK)
+ {
+ g_warning("%s(): gst_iterator_next failed\n", __FUNCTION__);
+ gst_iterator_free (it);
+ return RE_RESULT_INTERNAL_ERROR;
+ }
+ actual_video_source = g_value_get_object (&item);
+ g_value_unset (&item);
+ gst_iterator_free (it);
+ g_object_set (actual_video_source, "is-live", TRUE, NULL);
}
+
g_object_set (wrapper, "video-source", camerasrc, NULL);
g_object_set (wrapper, "post-previews", FALSE, NULL);
g_object_unref (camerasrc);
@@ -892,8 +934,10 @@
else
if (recorder->video_detect_name)
recorder->vfsink_name = "imxv4l2sink";
- else
+ else if (IS_IMX6Q())
recorder->vfsink_name = "overlaysink";
+ else
+ recorder->vfsink_name = "autovideosink";
/* configure used elements */
res &=
@@ -1008,12 +1052,12 @@
recorder->mode == MODE_VIDEO ? MODE_IMAGE : MODE_VIDEO, NULL);
}
- //FIXME: shouldn't need those code. will check later.
+ /* handle imxcamera's preivewwidget window id */
if (GST_IS_VIDEO_OVERLAY (recorder->viewfinder_sink)) {
gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(recorder->viewfinder_sink),
recorder->window);
} else {
- g_warning ("view finder sink isn't video overlay.\n");
+ GST_WARNING ("view finder sink isn't video overlay");
}
if (GST_STATE_CHANGE_FAILURE ==
@@ -1436,12 +1480,13 @@
RecorderEngine *h = (RecorderEngine *)(handle);
gRecorderEngine *recorder = (gRecorderEngine *)(h->pData);
CHECK_PARAM (vs, RE_VIDEO_SOURCE_LIST_END);
+ gchar *videosrc = NULL;
static KeyMap kKeyMap[] = {
- { RE_VIDEO_SOURCE_DEFAULT, (REchar *)"imxv4l2src" },
- { RE_VIDEO_SOURCE_CAMERA, (REchar *)"imxv4l2src" },
- { RE_VIDEO_SOURCE_SCREEN, (REchar *)"ximagesrc ! queue ! imxcompositor_ipu" },
+ { RE_VIDEO_SOURCE_DEFAULT, (REchar *)"autovideosrc" },
+ { RE_VIDEO_SOURCE_CAMERA, (REchar *)"autovideosrc" },
{ RE_VIDEO_SOURCE_TEST, (REchar *)"videotestsrc" },
+ { RE_VIDEO_SOURCE_SCREEN, (REchar *)"ximagesrc ! queue ! imxcompositor_ipu" },
};
recorder->videosrc_name = key_value_pair (vs, kKeyMap, sizeof(kKeyMap));
@@ -1658,7 +1703,15 @@
gRecorderEngine *recorder = (gRecorderEngine *)(h->pData);
if (bAddTimeStamp) {
- recorder->date_time = "clockoverlay halignment=left valignment=top time-format=\"%Y/%m/%d %H:%M:%S \" ! queue ! imxvideoconvert_ipu composition-meta-enable=true in-place=true ! queue";
+ if (IS_IMX8MM()) {
+ recorder->date_time = DATE_TIME TIME_OVERLAY HW_COMPOSITOR "queue";
+ }
+ else if (IS_IMX8Q()) {
+ recorder->date_time = DATE_TIME TIME_OVERLAY "queue";
+ }
+ else {
+ recorder->date_time = DATE_TIME TIME_OVERLAY "queue ! imxvideoconvert_ipu composition-meta-enable=true in-place=true ! queue";
+ }
} else {
recorder->date_time = NULL;
}
@@ -1672,6 +1725,11 @@
gRecorderEngine *recorder = (gRecorderEngine *)(h->pData);
CHECK_PARAM (videoEffect, RE_VIDEO_EFFECT_LIST_END);
+ if (IS_IMX8MM()) {
+ g_print("***Video effect is not supported!\n");
+ return RE_RESULT_FEATURE_UNSUPPORTED;
+ }
+
/* check gstreamer version, pipeline is different in 1.4.5 and 1.6.0 */
/* gray shader effect has been removed in GST-1.8.0 */
#if GST_CHECK_VERSION(1, 8, 0)
@@ -1719,6 +1777,11 @@
gRecorderEngine *recorder = (gRecorderEngine *)(h->pData);
CHECK_PARAM (videoDetect, RE_VIDEO_DETECT_LIST_END);
+ if (IS_IMX8MM()) {
+ g_print("***Video detect is not supported!\n");
+ return RE_RESULT_FEATURE_UNSUPPORTED;
+ }
+
static KeyMap kKeyMap[] = {
{ RE_VIDEO_DETECT_DEFAULT, NULL },
{ RE_VIDEO_DETECT_FACEDETECT, (REchar *)"imxvideoconvert_ipu ! queue ! video/x-raw,width=176,height=144 ! queue ! facedetect profile=/usr/share/gst1.0-fsl-plugins/1.0/opencv_haarcascades/haarcascade_frontalface_old_format.xml display=true scale-factor=2 min-size-width=32 min-size-height=32 updates=2 min-neighbors=3 ! queue" },
@@ -1733,6 +1796,12 @@
static REresult set_audio_encoder_settings(RecorderEngineHandle handle, REAudioEncoderSettings *audioEncoderSettings)
{
RecorderEngine *h = (RecorderEngine *)(handle);
+ gRecorderEngine *recorder = (gRecorderEngine *)(h->pData);
+ CHECK_PARAM (audioEncoderSettings->encoderType, RE_AUDIO_ENCODER_LIST_END);
+
+ GST_DEBUG ("set audio encoder format: %d", audioEncoderSettings->encoderType);
+ recorder->audio_encoder_format = audioEncoderSettings->encoderType;
+
return RE_RESULT_SUCCESS;
}
diff --git a/tools/grecorder/recorder_engine.h b/tools/grecorder/recorder_engine.h
index 4766008..2d55853 100644
--- a/tools/grecorder/recorder_engine.h
+++ b/tools/grecorder/recorder_engine.h
@@ -68,8 +68,8 @@
#define RE_VIDEO_SOURCE_DEFAULT ((REuint32) 0x00000000)
#define RE_VIDEO_SOURCE_CAMERA ((REuint32) 0x00000001)
-#define RE_VIDEO_SOURCE_SCREEN ((REuint32) 0x00000002)
-#define RE_VIDEO_SOURCE_TEST ((REuint32) 0x00000003)
+#define RE_VIDEO_SOURCE_TEST ((REuint32) 0x00000002)
+#define RE_VIDEO_SOURCE_SCREEN ((REuint32) 0x00000003)
#define RE_VIDEO_SOURCE_LIST_END ((REuint32) 0x00000004)
#define RE_COLORFORMAT_DEFAULT ((REuint32) 0x00000000)
@@ -109,14 +109,16 @@
#define RE_AUDIO_ENCODER_DEFAULT ((REuint32) 0x00000000)
#define RE_AUDIO_ENCODER_MP3 ((REuint32) 0x00000001)
-#define RE_AUDIO_ENCODER_LIST_END ((REuint32) 0x00000002)
+#define RE_AUDIO_ENCODER_NO_AUDIO ((REuint32) 0x00000002)
+#define RE_AUDIO_ENCODER_LIST_END ((REuint32) 0x00000003)
#define RE_VIDEO_ENCODER_DEFAULT ((REuint32) 0x00000000)
#define RE_VIDEO_ENCODER_H264 ((REuint32) 0x00000001)
#define RE_VIDEO_ENCODER_MPEG4 ((REuint32) 0x00000002)
#define RE_VIDEO_ENCODER_H263 ((REuint32) 0x00000003)
#define RE_VIDEO_ENCODER_MJPEG ((REuint32) 0x00000004)
-#define RE_VIDEO_ENCODER_LIST_END ((REuint32) 0x00000005)
+#define RE_VIDEO_ENCODER_VP8 ((REuint32) 0x00000005)
+#define RE_VIDEO_ENCODER_LIST_END ((REuint32) 0x00000006)
#define RE_EVENT_NONE ((REuint32) 0x00000000)
#define RE_EVENT_ERROR_UNKNOWN ((REuint32) 0x00000001)