diff options
-rw-r--r-- | mm-core/Android.mk | 1 | ||||
-rw-r--r-- | mm-core/inc/OMX_IndexExt.h | 3 | ||||
-rw-r--r-- | mm-core/inc/OMX_VideoExt.h | 124 | ||||
-rw-r--r-- | mm-video-v4l2/vidc/venc/inc/omx_video_base.h | 3 | ||||
-rw-r--r-- | mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h | 1 | ||||
-rw-r--r-- | mm-video-v4l2/vidc/venc/src/omx_video_base.cpp | 19 | ||||
-rw-r--r-- | mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp | 51 | ||||
-rw-r--r-- | mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp | 108 |
8 files changed, 292 insertions, 18 deletions
diff --git a/mm-core/Android.mk b/mm-core/Android.mk index 6998cdd3..e01df2e2 100644 --- a/mm-core/Android.mk +++ b/mm-core/Android.mk @@ -60,6 +60,7 @@ LOCAL_COPY_HEADERS += inc/QOMX_IVCommonExtensions.h LOCAL_COPY_HEADERS += inc/QOMX_SourceExtensions.h LOCAL_COPY_HEADERS += inc/QOMX_VideoExtensions.h LOCAL_COPY_HEADERS += inc/OMX_IndexExt.h +LOCAL_COPY_HEADERS += inc/OMX_VideoExt.h LOCAL_COPY_HEADERS += inc/QOMX_StreamingExtensions.h LOCAL_COPY_HEADERS += inc/QCMediaDefs.h LOCAL_COPY_HEADERS += inc/QCMetaData.h diff --git a/mm-core/inc/OMX_IndexExt.h b/mm-core/inc/OMX_IndexExt.h index 56235e59..100a33c8 100644 --- a/mm-core/inc/OMX_IndexExt.h +++ b/mm-core/inc/OMX_IndexExt.h @@ -64,6 +64,9 @@ typedef enum OMX_INDEXEXTTYPE { OMX_IndexKhronosExtParamNALStreamFormatSupported, /**< reference: OMX_NALSTREAMFORMATTYPE */ OMX_IndexKhronosExtParamNALStreamFormat, /**< reference: OMX_NALSTREAMFORMATTYPE */ OMX_IndexKhronosExtParamNALStreamFormatSelect, /**< reference: OMX_NALSTREAMFORMATTYPE */ + OMX_IndexParamVideoVp8, /**< reference: OMX_VIDEO_PARAM_VP8TYPE */ + OMX_IndexConfigVideoVp8ReferenceFrame, /**< reference: OMX_VIDEO_VP8REFERENCEFRAMETYPE */ + OMX_IndexConfigVideoVp8ReferenceFrameType, /**< reference: OMX_VIDEO_VP8REFERENCEFRAMEINFOTYPE */ /* Image & Video common configurations */ OMX_IndexExtCommonStartUnused = OMX_IndexKhronosExtensions + 0x00700000, diff --git a/mm-core/inc/OMX_VideoExt.h b/mm-core/inc/OMX_VideoExt.h new file mode 100644 index 00000000..d2c52026 --- /dev/null +++ b/mm-core/inc/OMX_VideoExt.h @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2010 The Khronos Group Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +/** OMX_VideoExt.h - OpenMax IL version 1.1.2 + * The OMX_VideoExt header file contains extensions to the + * definitions used by both the application and the component to + * access video items. + */ + +#ifndef OMX_VideoExt_h +#define OMX_VideoExt_h + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* Each OMX header shall include all required header files to allow the + * header to compile without errors. The includes below are required + * for this header file to compile successfully + */ +#include <OMX_Core.h> +#include <OMX_Video.h> + +/** NALU Formats */ +typedef enum OMX_NALUFORMATSTYPE { + OMX_NaluFormatStartCodes = 1, + OMX_NaluFormatOneNaluPerBuffer = 2, + OMX_NaluFormatOneByteInterleaveLength = 4, + OMX_NaluFormatTwoByteInterleaveLength = 8, + OMX_NaluFormatFourByteInterleaveLength = 16, + OMX_NaluFormatCodingMax = 0x7FFFFFFF +} OMX_NALUFORMATSTYPE; + +/** NAL Stream Format */ +typedef struct OMX_NALSTREAMFORMATTYPE{ + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_NALUFORMATSTYPE eNaluFormat; +} OMX_NALSTREAMFORMATTYPE; + +/** Enum for standard video codingtype extensions */ +typedef enum OMX_VIDEO_CODINGEXTTYPE { + OMX_VIDEO_ExtCodingUnused = OMX_VIDEO_CodingKhronosExtensions, + OMX_VIDEO_CodingVP8, /**< VP8/WebM */ +} OMX_VIDEO_CODINGEXTTYPE; + +/** VP8 profiles */ +typedef enum OMX_VIDEO_VP8PROFILETYPE { + OMX_VIDEO_VP8ProfileMain = 0x01, + OMX_VIDEO_VP8ProfileUnknown = 0x6EFFFFFF, + OMX_VIDEO_VP8ProfileMax = 0x7FFFFFFF +} OMX_VIDEO_VP8PROFILETYPE; + +/** VP8 levels */ +typedef enum OMX_VIDEO_VP8LEVELTYPE { + OMX_VIDEO_VP8Level_Version0 = 0x01, + OMX_VIDEO_VP8Level_Version1 = 0x02, + OMX_VIDEO_VP8Level_Version2 = 0x04, + OMX_VIDEO_VP8Level_Version3 = 0x08, + OMX_VIDEO_VP8LevelUnknown = 0x6EFFFFFF, + OMX_VIDEO_VP8LevelMax = 0x7FFFFFFF +} OMX_VIDEO_VP8LEVELTYPE; + +/** VP8 Param */ +typedef struct OMX_VIDEO_PARAM_VP8TYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_VIDEO_VP8PROFILETYPE eProfile; + OMX_VIDEO_VP8LEVELTYPE eLevel; + OMX_U32 nDCTPartitions; + OMX_BOOL bErrorResilientMode; +} OMX_VIDEO_PARAM_VP8TYPE; + +/** Structure for configuring VP8 reference frames */ +typedef struct OMX_VIDEO_VP8REFERENCEFRAMETYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bPreviousFrameRefresh; + OMX_BOOL bGoldenFrameRefresh; + OMX_BOOL bAlternateFrameRefresh; + OMX_BOOL bUsePreviousFrame; + OMX_BOOL bUseGoldenFrame; + OMX_BOOL bUseAlternateFrame; +} OMX_VIDEO_VP8REFERENCEFRAMETYPE; + +/** Structure for querying VP8 reference frame type */ +typedef struct OMX_VIDEO_VP8REFERENCEFRAMEINFOTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bIsIntraFrame; + OMX_BOOL bIsGoldenOrAlternateFrame; +} OMX_VIDEO_VP8REFERENCEFRAMEINFOTYPE; + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* OMX_VideoExt_h */ +/* File EOF */ diff --git a/mm-video-v4l2/vidc/venc/inc/omx_video_base.h b/mm-video-v4l2/vidc/venc/inc/omx_video_base.h index aa15d0cd..435e3e1b 100644 --- a/mm-video-v4l2/vidc/venc/inc/omx_video_base.h +++ b/mm-video-v4l2/vidc/venc/inc/omx_video_base.h @@ -57,6 +57,8 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <linux/msm_vidc_enc.h> #include "OMX_Core.h" #include "OMX_QCOMExtns.h" +#include "OMX_VideoExt.h" +#include "OMX_IndexExt.h" #include "qc_omx_component.h" #include "omx_video_common.h" #include "extra_data_handler.h" @@ -552,6 +554,7 @@ class omx_video: public qc_omx_component OMX_VIDEO_PARAM_MPEG4TYPE m_sParamMPEG4; OMX_VIDEO_PARAM_H263TYPE m_sParamH263; OMX_VIDEO_PARAM_AVCTYPE m_sParamAVC; + OMX_VIDEO_PARAM_VP8TYPE m_sParamVP8; OMX_PORT_PARAM_TYPE m_sPortParam_img; OMX_PORT_PARAM_TYPE m_sPortParam_audio; OMX_VIDEO_CONFIG_BITRATETYPE m_sConfigBitrate; diff --git a/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h b/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h index 19890264..7b4b250f 100644 --- a/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h +++ b/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h @@ -31,6 +31,7 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "OMX_Types.h" #include "OMX_Core.h" +#include "OMX_VideoExt.h" #include "OMX_QCOMExtns.h" #include "qc_omx_component.h" #include "omx_video_common.h" diff --git a/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp b/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp index 5e591455..c4d03e26 100644 --- a/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp +++ b/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp @@ -1532,6 +1532,13 @@ OMX_ERRORTYPE omx_video::get_parameter(OMX_IN OMX_HANDLETYPE hComp, memcpy(pParam, &m_sParamAVC, sizeof(m_sParamAVC)); break; } + case (OMX_INDEXTYPE)OMX_IndexParamVideoVp8: + { + OMX_VIDEO_PARAM_VP8TYPE* pParam = (OMX_VIDEO_PARAM_VP8TYPE*)paramData; + DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamVideoVp8\n"); + memcpy(pParam, &m_sParamVP8, sizeof(m_sParamVP8)); + break; + } case OMX_IndexParamVideoProfileLevelQuerySupported: { OMX_VIDEO_PARAM_PROFILELEVELTYPE* pParam = (OMX_VIDEO_PARAM_PROFILELEVELTYPE*)paramData; @@ -3990,6 +3997,18 @@ OMX_ERRORTYPE omx_video::get_supported_profile_level(OMX_VIDEO_PARAM_PROFILELEVE DEBUG_PRINT_ERROR("get_parameter: OMX_IndexParamVideoProfileLevelQuerySupported nProfileIndex ret NoMore %lu\n", profileLevelType->nProfileIndex); eRet = OMX_ErrorNoMore; } + } else if (m_sOutPortDef.format.video.eCompressionFormat == OMX_VIDEO_CodingVPX) { + if (profileLevelType->nProfileIndex == 0) { + profileLevelType->eProfile = OMX_VIDEO_VP8ProfileMain; + profileLevelType->eLevel = OMX_VIDEO_VP8Level_Version0; + } else if (profileLevelType->nProfileIndex == 1) { + profileLevelType->eProfile = OMX_VIDEO_VP8ProfileMain; + profileLevelType->eLevel = OMX_VIDEO_VP8Level_Version1; + } else { + DEBUG_PRINT_LOW("VP8: get_parameter: OMX_IndexParamVideoProfileLevelQuerySupported nProfileIndex ret NoMore %d\n", + profileLevelType->nProfileIndex); + eRet = OMX_ErrorNoMore; + } } else { DEBUG_PRINT_ERROR("get_parameter: OMX_IndexParamVideoProfileLevelQuerySupported ret NoMore\n"); eRet = OMX_ErrorNoMore; diff --git a/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp b/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp index d9e5c84b..a07e81e1 100644 --- a/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp +++ b/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp @@ -244,6 +244,9 @@ OMX_ERRORTYPE omx_venc::component_init(OMX_STRING role) } else if (codec_type == OMX_VIDEO_CodingAVC) { m_sParamProfileLevel.eProfile = (OMX_U32) OMX_VIDEO_AVCProfileBaseline; m_sParamProfileLevel.eLevel = (OMX_U32) OMX_VIDEO_AVCLevel1; + } else if (codec_type == OMX_VIDEO_CodingVPX) { + m_sParamProfileLevel.eProfile = (OMX_U32) OMX_VIDEO_VP8ProfileMain; + m_sParamProfileLevel.eLevel = (OMX_U32) OMX_VIDEO_VP8Level_Version0; } // Initialize the video parameters for input port @@ -288,9 +291,12 @@ OMX_ERRORTYPE omx_venc::component_init(OMX_STRING role) m_sOutPortDef.format.video.eCompressionFormat = OMX_VIDEO_CodingMPEG4; } else if (codec_type == OMX_VIDEO_CodingH263) { m_sOutPortDef.format.video.eCompressionFormat = OMX_VIDEO_CodingH263; - } else { + } else if (codec_type == OMX_VIDEO_CodingAVC) { m_sOutPortDef.format.video.eCompressionFormat = OMX_VIDEO_CodingAVC; + } else if (codec_type == OMX_VIDEO_CodingVPX) { + m_sOutPortDef.format.video.eCompressionFormat = OMX_VIDEO_CodingVPX; } + if (dev_get_buf_req(&m_sOutPortDef.nBufferCountMin, &m_sOutPortDef.nBufferCountActual, &m_sOutPortDef.nBufferSize, @@ -316,10 +322,13 @@ OMX_ERRORTYPE omx_venc::component_init(OMX_STRING role) m_sOutPortFormat.eCompressionFormat = OMX_VIDEO_CodingMPEG4; } else if (codec_type == OMX_VIDEO_CodingH263) { m_sOutPortFormat.eCompressionFormat = OMX_VIDEO_CodingH263; - } else { + } else if (codec_type == OMX_VIDEO_CodingAVC) { m_sOutPortFormat.eCompressionFormat = OMX_VIDEO_CodingAVC; + } else if (codec_type == OMX_VIDEO_CodingVPX) { + m_sOutPortFormat.eCompressionFormat = OMX_VIDEO_CodingVPX; } + // mandatory Indices for kronos test suite OMX_INIT_STRUCT(&m_sPriorityMgmt, OMX_PRIORITYMGMTTYPE); @@ -386,6 +395,14 @@ OMX_ERRORTYPE omx_venc::component_init(OMX_STRING role) m_sParamAVC.nCabacInitIdc = 0; m_sParamAVC.eLoopFilterMode = OMX_VIDEO_AVCLoopFilterEnable; + // VP8 specific init + OMX_INIT_STRUCT(&m_sParamVP8, OMX_VIDEO_PARAM_VP8TYPE); + m_sParamVP8.nPortIndex = (OMX_U32) PORT_INDEX_OUT; + m_sParamVP8.eProfile = OMX_VIDEO_VP8ProfileMain; + m_sParamVP8.eLevel = OMX_VIDEO_VP8Level_Version0; + m_sParamVP8.nDCTPartitions = 0; + m_sParamVP8.bErrorResilientMode = OMX_FALSE; + OMX_INIT_STRUCT(&m_sParamLTRMode, QOMX_VIDEO_PARAM_LTRMODE_TYPE); m_sParamLTRMode.nPortIndex = (OMX_U32) PORT_INDEX_OUT; m_sParamLTRMode.eLTRMode = QOMX_VIDEO_LTRMode_Disable; @@ -725,6 +742,22 @@ OMX_ERRORTYPE omx_venc::set_parameter(OMX_IN OMX_HANDLETYPE hComp, m_sIntraperiod.nBFrames = m_sParamAVC.nBFrames; break; } + case (OMX_INDEXTYPE)OMX_IndexParamVideoVp8: + { + OMX_VIDEO_PARAM_VP8TYPE* pParam = (OMX_VIDEO_PARAM_VP8TYPE*)paramData; + OMX_VIDEO_PARAM_VP8TYPE vp8_param; + DEBUG_PRINT_LOW("set_parameter: OMX_IndexParamVideoVp8"); + if (pParam->nDCTPartitions != m_sParamVP8.nDCTPartitions || + pParam->bErrorResilientMode != m_sParamVP8.bErrorResilientMode) { + DEBUG_PRINT_ERROR("VP8 doesn't support nDCTPartitions or bErrorResilientMode"); + } + memcpy(&vp8_param, pParam, sizeof( struct OMX_VIDEO_PARAM_VP8TYPE)); + if (handle->venc_set_param(&vp8_param, (OMX_INDEXTYPE)OMX_IndexParamVideoVp8) != true) { + return OMX_ErrorUnsupportedSetting; + } + memcpy(&m_sParamVP8,pParam, sizeof(struct OMX_VIDEO_PARAM_VP8TYPE)); + break; + } case OMX_IndexParamVideoProfileLevelCurrent: { OMX_VIDEO_PARAM_PROFILELEVELTYPE* pParam = (OMX_VIDEO_PARAM_PROFILELEVELTYPE*)paramData; @@ -756,6 +789,13 @@ OMX_ERRORTYPE omx_venc::set_parameter(OMX_IN OMX_HANDLETYPE hComp, DEBUG_PRINT_LOW("\n AVC profile = %d, level = %d", m_sParamAVC.eProfile, m_sParamAVC.eLevel); } + else if (!strncmp((char*)m_nkind, "OMX.qcom.video.encoder.vp8",\ + OMX_MAX_STRINGNAME_SIZE)) { + m_sParamVP8.eProfile = (OMX_VIDEO_VP8PROFILETYPE)m_sParamProfileLevel.eProfile; + m_sParamVP8.eLevel = (OMX_VIDEO_VP8LEVELTYPE)m_sParamProfileLevel.eLevel; + DEBUG_PRINT_LOW("\n VP8 profile = %d, level = %d", m_sParamVP8.eProfile, + m_sParamVP8.eLevel); + } break; } case OMX_IndexParamStandardComponentRole: @@ -1160,6 +1200,13 @@ bool omx_venc::update_profile_level() DEBUG_PRINT_LOW("\n AVC profile = %d, level = %d", m_sParamAVC.eProfile, m_sParamAVC.eLevel); } + else if (!strncmp((char *)m_nkind, "OMX.qcom.video.encoder.vp8",\ + OMX_MAX_STRINGNAME_SIZE)) { + m_sParamVP8.eProfile = (OMX_VIDEO_VP8PROFILETYPE)eProfile; + m_sParamVP8.eLevel = (OMX_VIDEO_VP8LEVELTYPE)eLevel; + DEBUG_PRINT_LOW("\n VP8 profile = %d, level = %d", m_sParamVP8.eProfile, + m_sParamVP8.eLevel); + } return true; } /* ====================================================================== diff --git a/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp b/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp index da7e8231..90063f4c 100644 --- a/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp +++ b/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp @@ -568,21 +568,17 @@ bool venc_dev::venc_open(OMX_U32 codec) #ifdef OUTPUT_BUFFER_LOG strcat(outputfilename, "263"); #endif - } - - if (codec == OMX_VIDEO_CodingAVC) { + } else if (codec == OMX_VIDEO_CodingAVC) { m_sVenc_cfg.codectype = V4L2_PIX_FMT_H264; codec_profile.profile = V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE; profile_level.level = V4L2_MPEG_VIDEO_H264_LEVEL_1_0; #ifdef OUTPUT_BUFFER_LOG strcat(outputfilename, "264"); #endif - } - - if (codec == OMX_VIDEO_CodingVPX) { + } else if (codec == OMX_VIDEO_CodingVPX) { m_sVenc_cfg.codectype = V4L2_PIX_FMT_VP8; - codec_profile.profile = V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE; - profile_level.level = V4L2_MPEG_VIDEO_H264_LEVEL_1_0; + codec_profile.profile = V4L2_MPEG_VIDC_VIDEO_VP8_UNUSED; + profile_level.level = V4L2_MPEG_VIDC_VIDEO_VP8_VERSION_0; #ifdef OUTPUT_BUFFER_LOG strcat(outputfilename, "ivf"); #endif @@ -1199,6 +1195,17 @@ bool venc_dev::venc_set_param(void *paramData,OMX_INDEXTYPE index ) //TBD, lot of other variables to be updated, yet to decide break; } + case (OMX_INDEXTYPE)OMX_IndexParamVideoVp8: + { + DEBUG_PRINT_LOW("venc_set_param:OMX_IndexParamVideoVp8\n"); + OMX_VIDEO_PARAM_VP8TYPE* pParam = (OMX_VIDEO_PARAM_VP8TYPE*)paramData; + if (!venc_set_profile_level (pParam->eProfile, pParam->eLevel)) { + DEBUG_PRINT_ERROR("\nERROR: Unsuccessful in updating Profile and level %d, %d", + pParam->eProfile, pParam->eLevel); + return false; + } + break; + } case OMX_IndexParamVideoIntraRefresh: { DEBUG_PRINT_LOW("venc_set_param:OMX_IndexParamVideoIntraRefresh\n"); @@ -2290,6 +2297,27 @@ bool venc_dev::venc_set_profile_level(OMX_U32 eProfile,OMX_U32 eLevel) return false; break; } + } else if (m_sVenc_cfg.codectype == V4L2_PIX_FMT_VP8) { + if (!(eProfile == OMX_VIDEO_VP8ProfileMain)) { + DEBUG_PRINT_ERROR("\nERROR: Unsupported VP8 profile = %u", + eProfile); + return false; + } + requested_profile.profile = V4L2_MPEG_VIDC_VIDEO_VP8_UNUSED; + m_profile_set = true; + switch(eLevel) { + case OMX_VIDEO_VP8Level_Version0: + requested_level.level = V4L2_MPEG_VIDC_VIDEO_VP8_VERSION_0; + break; + case OMX_VIDEO_VP8Level_Version1: + requested_level.level = V4L2_MPEG_VIDC_VIDEO_VP8_VERSION_1; + break; + default: + DEBUG_PRINT_ERROR("\nERROR: Unsupported VP8 level= %lu", + eLevel); + return false; + break; + } } if (!m_profile_set) { @@ -2302,11 +2330,6 @@ bool venc_dev::venc_set_profile_level(OMX_U32 eProfile,OMX_U32 eLevel) control.id = V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE; } else if (m_sVenc_cfg.codectype == V4L2_PIX_FMT_H263) { control.id = V4L2_CID_MPEG_VIDC_VIDEO_H263_PROFILE; - } else if (m_sVenc_cfg.codectype == V4L2_PIX_FMT_VP8) { - DEBUG_PRINT_ERROR("\n No Profile and LEVEL Setting for VP8 \n"); - m_profile_set = true; - m_level_set = true; - return true; } else { DEBUG_PRINT_ERROR("\n Wrong CODEC \n"); return false; @@ -2338,6 +2361,8 @@ bool venc_dev::venc_set_profile_level(OMX_U32 eProfile,OMX_U32 eLevel) control.id = V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL; } else if (m_sVenc_cfg.codectype == V4L2_PIX_FMT_H263) { control.id = V4L2_CID_MPEG_VIDC_VIDEO_H263_LEVEL; + } else if (m_sVenc_cfg.codectype == V4L2_PIX_FMT_VP8) { + control.id = V4L2_CID_MPEG_VIDC_VIDEO_VP8_PROFILE_LEVEL; } else { DEBUG_PRINT_ERROR("\n Wrong CODEC \n"); return false; @@ -3108,6 +3133,33 @@ bool venc_dev::venc_get_profile_level(OMX_U32 *eProfile,OMX_U32 *eLevel) break; } } + else if (m_sVenc_cfg.codectype == V4L2_PIX_FMT_VP8) { + switch (codec_profile.profile) { + case V4L2_MPEG_VIDC_VIDEO_VP8_UNUSED: + *eProfile = OMX_VIDEO_VP8ProfileMain; + break; + default: + *eProfile = OMX_VIDEO_VP8ProfileMax; + status = false; + break; + } + if (!status) { + return status; + } + + switch (profile_level.level) { + case V4L2_MPEG_VIDC_VIDEO_VP8_VERSION_0: + *eLevel = OMX_VIDEO_VP8Level_Version0; + break; + case V4L2_MPEG_VIDC_VIDEO_VP8_VERSION_1: + *eLevel = OMX_VIDEO_VP8Level_Version1; + break; + default: + *eLevel = OMX_VIDEO_VP8LevelMax; + status = false; + break; + } + } return status; } @@ -3231,7 +3283,31 @@ bool venc_dev::venc_validate_profile_level(OMX_U32 *eProfile, OMX_U32 *eLevel) return false; } } else if (m_sVenc_cfg.codectype == V4L2_PIX_FMT_VP8) { - DEBUG_PRINT_HIGH("Disregarding profile/level setting for VP8\n"); + if (*eProfile == 0) { + *eProfile = OMX_VIDEO_VP8ProfileMain; + } else { + switch (codec_profile.profile) { + case V4L2_MPEG_VIDC_VIDEO_VP8_UNUSED: + *eProfile = OMX_VIDEO_VP8ProfileMain; + break; + default: + DEBUG_PRINT_ERROR("\n %s(): Unknown VP8 profile", __func__); + return false; + } + } + if (*eLevel == 0) { + switch (profile_level.level) { + case V4L2_MPEG_VIDC_VIDEO_VP8_VERSION_0: + *eLevel = OMX_VIDEO_VP8Level_Version0; + break; + case V4L2_MPEG_VIDC_VIDEO_VP8_VERSION_1: + *eLevel = OMX_VIDEO_VP8Level_Version1; + break; + default: + DEBUG_PRINT_ERROR("\n %s(): Unknown VP8 level", __func__); + return false; + } + } return true; } else { DEBUG_PRINT_LOW("\n Invalid codec type"); @@ -3279,11 +3355,11 @@ bool venc_dev::venc_validate_profile_level(OMX_U32 *eProfile, OMX_U32 *eLevel) } if ((*eLevel == OMX_VIDEO_MPEG4LevelMax) || (*eLevel == OMX_VIDEO_AVCLevelMax) - || (*eLevel == OMX_VIDEO_H263LevelMax)) { + || (*eLevel == OMX_VIDEO_H263LevelMax || (*eLevel == OMX_VIDEO_VP8ProfileMax))) { *eLevel = new_level; } - DEBUG_PRINT_HIGH("%s: Returning with eProfile = %lu" + DEBUG_PRINT_LOW("%s: Returning with eProfile = %lu\n" "Level = %lu", __func__, *eProfile, *eLevel); return true; |