summaryrefslogtreecommitdiff
path: root/mm-video-v4l2
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@quicinc.com>2017-09-01 09:05:47 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2017-09-01 09:05:47 -0700
commit960da5b71d6aad3639f7fac0aafd0dfbedfe2b98 (patch)
treeadc7141920e0143ced896318ded947661c938890 /mm-video-v4l2
parent10b603357fd98478cf1e11cd7dc9432252d32ece (diff)
parent6c80ebe5cfcb4ffd84b8dab65aaaebfcb5152149 (diff)
downloadmedia-960da5b71d6aad3639f7fac0aafd0dfbedfe2b98.tar.gz
Merge "mm-video-v4l2: Add support for TME encoding mode"
Diffstat (limited to 'mm-video-v4l2')
-rw-r--r--mm-video-v4l2/vidc/common/inc/vidc_common.h4
-rw-r--r--mm-video-v4l2/vidc/common/src/vidc_common.cpp25
-rw-r--r--mm-video-v4l2/vidc/venc/inc/omx_video_base.h6
-rw-r--r--mm-video-v4l2/vidc/venc/src/omx_video_base.cpp88
-rw-r--r--mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp49
-rw-r--r--[-rwxr-xr-x]mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp64
6 files changed, 226 insertions, 10 deletions
diff --git a/mm-video-v4l2/vidc/common/inc/vidc_common.h b/mm-video-v4l2/vidc/common/inc/vidc_common.h
index 78c8d8fa..66ef4618 100644
--- a/mm-video-v4l2/vidc/common/inc/vidc_common.h
+++ b/mm-video-v4l2/vidc/common/inc/vidc_common.h
@@ -36,20 +36,24 @@ class profile_level_converter {
static pl_map profile_hevc_omx_to_v4l2;
static pl_map profile_mpeg2_omx_to_v4l2;
static pl_map profile_vp9_omx_to_v4l2;
+ static pl_map profile_tme_omx_to_v4l2;
static pl_map level_avc_omx_to_v4l2;
static pl_map level_hevc_omx_to_v4l2;
static pl_map level_vp8_omx_to_v4l2;
static pl_map level_mpeg2_omx_to_v4l2;
static pl_map level_vp9_omx_to_v4l2;
+ static pl_map level_tme_omx_to_v4l2;
static pl_map profile_avc_v4l2_to_omx;
static pl_map profile_hevc_v4l2_to_omx;
static pl_map profile_mpeg2_v4l2_to_omx;
static pl_map profile_vp9_v4l2_to_omx;
+ static pl_map profile_tme_v4l2_to_omx;
static pl_map level_avc_v4l2_to_omx;
static pl_map level_hevc_v4l2_to_omx;
static pl_map level_vp8_v4l2_to_omx;
static pl_map level_mpeg2_v4l2_to_omx;
static pl_map level_vp9_v4l2_to_omx;
+ static pl_map level_tme_v4l2_to_omx;
static codec_map profile_omx_to_v4l2_map;
static codec_map profile_v4l2_to_omx_map;
diff --git a/mm-video-v4l2/vidc/common/src/vidc_common.cpp b/mm-video-v4l2/vidc/common/src/vidc_common.cpp
index cbc89200..de46cac5 100644
--- a/mm-video-v4l2/vidc/common/src/vidc_common.cpp
+++ b/mm-video-v4l2/vidc/common/src/vidc_common.cpp
@@ -80,6 +80,19 @@ pl_map profile_level_converter::profile_vp9_omx_to_v4l2 ({
pl_map profile_level_converter::profile_vp9_v4l2_to_omx ({});
+pl_map profile_level_converter::profile_tme_omx_to_v4l2 ({
+ {QOMX_VIDEO_TMEProfile0,
+ V4L2_MPEG_VIDC_VIDEO_TME_PROFILE_0},
+ {QOMX_VIDEO_TMEProfile1,
+ V4L2_MPEG_VIDC_VIDEO_TME_PROFILE_1},
+ {QOMX_VIDEO_TMEProfile2,
+ V4L2_MPEG_VIDC_VIDEO_TME_PROFILE_2},
+ {QOMX_VIDEO_TMEProfile3,
+ V4L2_MPEG_VIDC_VIDEO_TME_PROFILE_3},
+ });
+
+pl_map profile_level_converter::profile_tme_v4l2_to_omx ({});
+
pl_map profile_level_converter::level_avc_omx_to_v4l2 ({
{OMX_VIDEO_AVCLevel1, V4L2_MPEG_VIDEO_H264_LEVEL_1_0},
{OMX_VIDEO_AVCLevel11, V4L2_MPEG_VIDEO_H264_LEVEL_1_1},
@@ -165,11 +178,18 @@ pl_map profile_level_converter::level_vp9_omx_to_v4l2 ({
pl_map profile_level_converter::level_vp9_v4l2_to_omx ({});
+pl_map profile_level_converter::level_tme_omx_to_v4l2 ({
+ {QOMX_VIDEO_TMELevelInteger, V4L2_MPEG_VIDC_VIDEO_TME_LEVEL_INTEGER},
+ });
+
+pl_map profile_level_converter::level_tme_v4l2_to_omx ({});
+
codec_map profile_level_converter::profile_omx_to_v4l2_map ({
{V4L2_PIX_FMT_H264, &profile_avc_omx_to_v4l2},
{V4L2_PIX_FMT_HEVC, &profile_hevc_omx_to_v4l2},
{V4L2_PIX_FMT_MPEG2, &profile_mpeg2_omx_to_v4l2},
{V4L2_PIX_FMT_VP9, &profile_vp9_omx_to_v4l2},
+ {V4L2_PIX_FMT_TME, &profile_tme_omx_to_v4l2},
});
codec_map profile_level_converter::profile_v4l2_to_omx_map ({
@@ -177,6 +197,7 @@ codec_map profile_level_converter::profile_v4l2_to_omx_map ({
{V4L2_PIX_FMT_HEVC, &profile_hevc_v4l2_to_omx},
{V4L2_PIX_FMT_MPEG2, &profile_mpeg2_v4l2_to_omx},
{V4L2_PIX_FMT_VP9, &profile_vp9_v4l2_to_omx},
+ {V4L2_PIX_FMT_TME, &profile_tme_v4l2_to_omx},
});
codec_map profile_level_converter::level_omx_to_v4l2_map ({
@@ -185,6 +206,7 @@ codec_map profile_level_converter::level_omx_to_v4l2_map ({
{V4L2_PIX_FMT_MPEG2, &level_mpeg2_omx_to_v4l2},
{V4L2_PIX_FMT_VP8, &level_vp8_omx_to_v4l2},
{V4L2_PIX_FMT_VP9, &level_vp9_omx_to_v4l2},
+ {V4L2_PIX_FMT_TME, &level_tme_omx_to_v4l2},
});
codec_map profile_level_converter::level_v4l2_to_omx_map ({
@@ -193,6 +215,7 @@ codec_map profile_level_converter::level_v4l2_to_omx_map ({
{V4L2_PIX_FMT_MPEG2, &level_mpeg2_v4l2_to_omx},
{V4L2_PIX_FMT_VP8, &level_vp8_v4l2_to_omx},
{V4L2_PIX_FMT_VP9, &level_vp9_v4l2_to_omx},
+ {V4L2_PIX_FMT_TME, &level_tme_v4l2_to_omx},
});
void reverse_map(pl_map source_map, pl_map &dest_map)
@@ -211,11 +234,13 @@ void profile_level_converter::init()
reverse_map(profile_hevc_omx_to_v4l2, profile_hevc_v4l2_to_omx);
reverse_map(profile_mpeg2_omx_to_v4l2, profile_mpeg2_v4l2_to_omx);
reverse_map(profile_vp9_omx_to_v4l2, profile_vp9_v4l2_to_omx);
+ reverse_map(profile_tme_omx_to_v4l2, profile_tme_v4l2_to_omx);
reverse_map(level_avc_omx_to_v4l2, level_avc_v4l2_to_omx);
reverse_map(level_hevc_omx_to_v4l2, level_hevc_v4l2_to_omx);
reverse_map(level_vp8_omx_to_v4l2, level_vp8_v4l2_to_omx);
reverse_map(level_mpeg2_omx_to_v4l2, level_mpeg2_v4l2_to_omx);
reverse_map(level_vp9_omx_to_v4l2, level_vp9_v4l2_to_omx);
+ reverse_map(level_tme_omx_to_v4l2, level_tme_v4l2_to_omx);
}
bool profile_level_converter::find_map(codec_map map, int key, pl_map **value_map)
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 7a844aae..858db6d8 100644
--- a/mm-video-v4l2/vidc/venc/inc/omx_video_base.h
+++ b/mm-video-v4l2/vidc/venc/inc/omx_video_base.h
@@ -400,6 +400,10 @@ class omx_video: public qc_omx_component
void * eglImage);
Signal signal;
+
+ bool reject_param_for_TME_mode(int index);
+ bool reject_config_for_TME_mode(int index);
+
pthread_t msg_thread_id;
pthread_t async_thread_id;
bool async_thread_created;
@@ -670,6 +674,8 @@ class omx_video: public qc_omx_component
OMX_VIDEO_PARAM_AVCTYPE m_sParamAVC;
OMX_VIDEO_PARAM_VP8TYPE m_sParamVP8;
OMX_VIDEO_PARAM_HEVCTYPE m_sParamHEVC;
+ QOMX_VIDEO_PARAM_TMETYPE m_sParamTME;
+ OMX_U32 tme_payload_version;
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/src/omx_video_base.cpp b/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp
index ef40e291..50ff11d6 100644
--- a/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp
+++ b/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp
@@ -1445,6 +1445,61 @@ bool omx_video::post_event(unsigned long p1,
return bRet;
}
+bool omx_video::reject_param_for_TME_mode(int index) {
+ int allowed_params[] = {
+ OMX_IndexParamPortDefinition,
+ OMX_IndexParamVideoPortFormat,
+ OMX_IndexParamVideoInit,
+ OMX_IndexParamAudioInit,
+ OMX_IndexParamImageInit,
+ OMX_IndexParamOtherInit,
+ OMX_IndexParamStandardComponentRole,
+ OMX_IndexParamPriorityMgmt,
+ OMX_IndexParamCompBufferSupplier,
+ OMX_GoogleAndroidIndexAllocateNativeHandle,
+ OMX_QcomIndexPortDefn,
+ OMX_QcomIndexParamVideoMetaBufferMode,
+ OMX_QTIIndexParamLowLatencyMode,
+ OMX_IndexParamVideoTme,
+ OMX_IndexParamVideoProfileLevelQuerySupported,
+ OMX_IndexParamConsumerUsageBits
+ };
+
+ if (m_sOutPortFormat.eCompressionFormat != (OMX_VIDEO_CODINGTYPE)QOMX_VIDEO_CodingTME) {
+ return false;
+ }
+
+ for (unsigned i = 0; i < (sizeof(allowed_params) / sizeof(int)); i++) {
+ if (index == allowed_params[i]) {
+ return false;
+ }
+ }
+ return true;
+}
+
+bool omx_video::reject_config_for_TME_mode(int index) {
+ int allowed_configs[] = {
+ OMX_IndexConfigVideoFramerate,
+ OMX_IndexConfigPriority,
+ OMX_IndexConfigOperatingRate,
+ OMX_IndexConfigTimePosition,
+ OMX_QcomIndexConfigPerfLevel,
+ OMX_QTIIndexConfigDescribeColorAspects,
+ OMX_IndexConfigAndroidVendorExtension
+ };
+
+ if (m_sOutPortFormat.eCompressionFormat != (OMX_VIDEO_CODINGTYPE)QOMX_VIDEO_CodingTME) {
+ return false;
+ }
+
+ for (unsigned i = 0; i < (sizeof(allowed_configs) / sizeof(int)); i++) {
+ if (index == allowed_configs[i]) {
+ return false;
+ }
+ }
+ return true;
+}
+
/* ======================================================================
FUNCTION
omx_venc::GetParameter
@@ -1475,6 +1530,12 @@ OMX_ERRORTYPE omx_video::get_parameter(OMX_IN OMX_HANDLETYPE hComp,
DEBUG_PRINT_ERROR("ERROR: Get Param in Invalid paramData");
return OMX_ErrorBadParameter;
}
+
+ if (reject_param_for_TME_mode(paramIndex)) {
+ DEBUG_PRINT_ERROR("ERROR: Set Parameter 0x%x rejected in TME mode", (int)paramIndex);
+ return OMX_ErrorNone;
+ }
+
switch ((int)paramIndex) {
case OMX_IndexParamPortDefinition:
{
@@ -1654,6 +1715,14 @@ OMX_ERRORTYPE omx_video::get_parameter(OMX_IN OMX_HANDLETYPE hComp,
memcpy(pParam, &m_sParamHEVC, sizeof(m_sParamHEVC));
break;
}
+ case (OMX_INDEXTYPE)OMX_IndexParamVideoTme:
+ {
+ VALIDATE_OMX_PARAM_DATA(paramData, QOMX_VIDEO_PARAM_TMETYPE);
+ QOMX_VIDEO_PARAM_TMETYPE* pParam = (QOMX_VIDEO_PARAM_TMETYPE*)paramData;
+ DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamVideoTme");
+ memcpy(pParam, &m_sParamTME, sizeof(m_sParamTME));
+ break;
+ }
case OMX_IndexParamVideoProfileLevelQuerySupported:
{
VALIDATE_OMX_PARAM_DATA(paramData, OMX_VIDEO_PARAM_PROFILELEVELTYPE);
@@ -2104,6 +2173,11 @@ OMX_ERRORTYPE omx_video::get_config(OMX_IN OMX_HANDLETYPE hComp,
return OMX_ErrorIncorrectStateOperation;
}
+ if (reject_config_for_TME_mode(configIndex)) {
+ DEBUG_PRINT_ERROR("ERROR: config 0x%x rejected in TME mode", configIndex);
+ return OMX_ErrorNone;
+ }
+
//@todo need to validate params
switch ((int)configIndex) {
case OMX_IndexConfigVideoBitrate:
@@ -2390,6 +2464,12 @@ OMX_ERRORTYPE omx_video::get_extension_index(OMX_IN OMX_HANDLETYPE hComp,
*indexType = (OMX_INDEXTYPE)OMX_QTIIndexParamVideoClientExtradata;
return OMX_ErrorNone;
}
+
+ if (extn_equals(paramName, OMX_QTI_INDEX_PARAM_TME)) {
+ *indexType = (OMX_INDEXTYPE)OMX_IndexParamVideoTme;
+ return OMX_ErrorNone;
+ }
+
return OMX_ErrorNotImplemented;
}
@@ -4217,6 +4297,14 @@ OMX_ERRORTYPE omx_video::component_role_enum(OMX_IN OMX_HANDLETYPE hComp,
DEBUG_PRINT_ERROR("ERROR: No more roles");
eRet = OMX_ErrorNoMore;
}
+ } else if (!strncmp((char*)m_nkind, "OMX.qcom.video.encoder.tme", OMX_MAX_STRINGNAME_SIZE)) {
+ if ((0 == index) && role) {
+ strlcpy((char *)role, "video_encoder.tme", OMX_MAX_STRINGNAME_SIZE);
+ DEBUG_PRINT_LOW("component_role_enum: role %s", role);
+ } else {
+ DEBUG_PRINT_ERROR("ERROR: No more roles");
+ eRet = OMX_ErrorNoMore;
+ }
}
else {
DEBUG_PRINT_ERROR("ERROR: Querying Role on Unknown Component");
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 249ef200..3980e153 100644
--- a/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp
+++ b/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp
@@ -129,6 +129,10 @@ OMX_ERRORTYPE omx_venc::component_init(OMX_STRING role)
strlcpy((char *)m_cRole, "video_encoder.hevc", OMX_MAX_STRINGNAME_SIZE);
codec_type = OMX_VIDEO_CodingHEVC;
secure_session = true;
+ } else if (!strncmp((char *)m_nkind, "OMX.qcom.video.encoder.tme", \
+ OMX_MAX_STRINGNAME_SIZE)) {
+ strlcpy((char *)m_cRole, "video_encoder.tme", OMX_MAX_STRINGNAME_SIZE);
+ codec_type = (OMX_VIDEO_CODINGTYPE)QOMX_VIDEO_CodingTME;
} else {
DEBUG_PRINT_ERROR("ERROR: Unknown Component");
eRet = OMX_ErrorInvalidComponentName;
@@ -305,6 +309,8 @@ OMX_ERRORTYPE omx_venc::component_init(OMX_STRING role)
m_sOutPortDef.format.video.eCompressionFormat = OMX_VIDEO_CodingVP8;
} else if (codec_type == OMX_VIDEO_CodingHEVC) {
m_sOutPortDef.format.video.eCompressionFormat = OMX_VIDEO_CodingHEVC;
+ } else if (codec_type == (OMX_VIDEO_CODINGTYPE)QOMX_VIDEO_CodingTME) {
+ m_sOutPortDef.format.video.eCompressionFormat = (OMX_VIDEO_CODINGTYPE)QOMX_VIDEO_CodingTME;
}
if (dev_get_buf_req(&m_sOutPortDef.nBufferCountMin,
@@ -334,6 +340,8 @@ OMX_ERRORTYPE omx_venc::component_init(OMX_STRING role)
m_sOutPortFormat.eCompressionFormat = OMX_VIDEO_CodingVP8;
} else if (codec_type == OMX_VIDEO_CodingHEVC) {
m_sOutPortFormat.eCompressionFormat = OMX_VIDEO_CodingHEVC;
+ } else if (codec_type == (OMX_VIDEO_CODINGTYPE)QOMX_VIDEO_CodingTME) {
+ m_sOutPortFormat.eCompressionFormat = (OMX_VIDEO_CODINGTYPE)QOMX_VIDEO_CodingTME;
}
// mandatory Indices for kronos test suite
@@ -386,6 +394,13 @@ OMX_ERRORTYPE omx_venc::component_init(OMX_STRING role)
m_sParamHEVC.eProfile = OMX_VIDEO_HEVCProfileMain;
m_sParamHEVC.eLevel = OMX_VIDEO_HEVCMainTierLevel1;
+ // TME specific init
+ OMX_INIT_STRUCT(&m_sParamTME, QOMX_VIDEO_PARAM_TMETYPE);
+ m_sParamTME.nPortIndex = (OMX_U32) PORT_INDEX_OUT;
+ m_sParamTME.eProfile = QOMX_VIDEO_TMEProfile0;
+ m_sParamTME.eLevel = QOMX_VIDEO_TMELevelInteger;
+ m_sParamTME.ePayloadVersion = tme_payload_version;
+
OMX_INIT_STRUCT(&m_sParamLTRCount, QOMX_VIDEO_PARAM_LTRCOUNT_TYPE);
m_sParamLTRCount.nPortIndex = (OMX_U32) PORT_INDEX_OUT;
m_sParamLTRCount.nCount = 0;
@@ -513,6 +528,11 @@ OMX_ERRORTYPE omx_venc::set_parameter(OMX_IN OMX_HANDLETYPE hComp,
return OMX_ErrorIncorrectStateOperation;
}
+ if (reject_param_for_TME_mode(paramIndex)) {
+ DEBUG_PRINT_ERROR("ERROR: Set Parameter 0x%x rejected in TME mode", (int)paramIndex);
+ return OMX_ErrorNone;
+ }
+
switch ((int)paramIndex) {
case OMX_IndexParamPortDefinition:
{
@@ -774,6 +794,21 @@ OMX_ERRORTYPE omx_venc::set_parameter(OMX_IN OMX_HANDLETYPE hComp,
memcpy(&m_sParamHEVC, pParam, sizeof(struct OMX_VIDEO_PARAM_HEVCTYPE));
break;
}
+ case (OMX_INDEXTYPE)OMX_IndexParamVideoTme:
+ {
+ VALIDATE_OMX_PARAM_DATA(paramData, QOMX_VIDEO_PARAM_TMETYPE);
+ QOMX_VIDEO_PARAM_TMETYPE* pParam = (QOMX_VIDEO_PARAM_TMETYPE*)paramData;
+ QOMX_VIDEO_PARAM_TMETYPE tme_param;
+ DEBUG_PRINT_LOW("set_parameter: OMX_IndexParamVideoTME");
+ memcpy(&tme_param, pParam, sizeof( struct QOMX_VIDEO_PARAM_TMETYPE));
+ if (handle->venc_set_param(&tme_param, (OMX_INDEXTYPE)OMX_IndexParamVideoTme) != true) {
+ DEBUG_PRINT_ERROR("Failed : set_parameter: OMX_IndexParamVideoTme");
+ return OMX_ErrorUnsupportedSetting;
+ }
+ memcpy(&m_sParamTME, pParam, sizeof(struct QOMX_VIDEO_PARAM_TMETYPE));
+ m_sParamTME.ePayloadVersion = tme_payload_version;
+ break;
+ }
case OMX_IndexParamVideoProfileLevelCurrent:
{
VALIDATE_OMX_PARAM_DATA(paramData, OMX_VIDEO_PARAM_PROFILELEVELTYPE);
@@ -863,7 +898,14 @@ OMX_ERRORTYPE omx_venc::set_parameter(OMX_IN OMX_HANDLETYPE hComp,
eRet = OMX_ErrorUnsupportedSetting;
}
}
-
+ else if (!strncmp((char*)m_nkind, "OMX.qcom.video.encoder.tme", OMX_MAX_STRINGNAME_SIZE)) {
+ if (!strncmp((const char*)comp_role->cRole,"video_encoder.tme",OMX_MAX_STRINGNAME_SIZE)) {
+ strlcpy((char*)m_cRole,"video_encoder.tme",OMX_MAX_STRINGNAME_SIZE);
+ } else {
+ DEBUG_PRINT_ERROR("ERROR: Setparameter: unknown Index %s", comp_role->cRole);
+ eRet = OMX_ErrorUnsupportedSetting;
+ }
+ }
else {
DEBUG_PRINT_ERROR("ERROR: Setparameter: unknown param %s", m_nkind);
eRet = OMX_ErrorInvalidComponentName;
@@ -1577,6 +1619,11 @@ OMX_ERRORTYPE omx_venc::set_config(OMX_IN OMX_HANDLETYPE hComp,
return OMX_ErrorIncorrectStateOperation;
}
+ if (reject_config_for_TME_mode(configIndex)) {
+ DEBUG_PRINT_ERROR("ERROR: config 0x%x rejected in TME mode", configIndex);
+ return OMX_ErrorNone;
+ }
+
// params will be validated prior to venc_init
switch ((int)configIndex) {
case OMX_IndexConfigVideoBitrate:
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 c91dec05..057a851c 100755..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
@@ -1353,6 +1353,8 @@ bool venc_dev::venc_open(OMX_U32 codec)
maxqp = 51;
codec_profile.profile = V4L2_MPEG_VIDC_VIDEO_HEVC_PROFILE_MAIN;
profile_level.level = V4L2_MPEG_VIDC_VIDEO_HEVC_LEVEL_MAIN_TIER_LEVEL_1;
+ } else if (codec == QOMX_VIDEO_CodingTME) {
+ m_sVenc_cfg.codectype = V4L2_PIX_FMT_TME;
}
session_ipb_qp_values.min_i_qp = minqp;
session_ipb_qp_values.max_i_qp = maxqp;
@@ -1464,13 +1466,15 @@ bool venc_dev::venc_open(OMX_U32 codec)
resume_in_stopped = 0;
metadatamode = 0;
- control.id = V4L2_CID_MPEG_VIDEO_HEADER_MODE;
- control.value = V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE;
+ if (m_sVenc_cfg.codectype != V4L2_PIX_FMT_TME) {
+ control.id = V4L2_CID_MPEG_VIDEO_HEADER_MODE;
+ control.value = V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE;
- DEBUG_PRINT_LOW("Calling IOCTL to disable seq_hdr in sync_frame id=%d, val=%d", control.id, control.value);
+ DEBUG_PRINT_LOW("Calling IOCTL to disable seq_hdr in sync_frame id=%d, val=%d", control.id, control.value);
- if (ioctl(m_nDriver_fd, VIDIOC_S_CTRL, &control))
- DEBUG_PRINT_ERROR("Failed to set control");
+ if (ioctl(m_nDriver_fd, VIDIOC_S_CTRL, &control))
+ DEBUG_PRINT_ERROR("Failed to set control");
+ }
struct v4l2_frmsizeenum frmsize;
@@ -1506,6 +1510,17 @@ bool venc_dev::venc_open(OMX_U32 codec)
input_extradata_info.port_index = OUTPUT_PORT;
output_extradata_info.port_index = CAPTURE_PORT;
+ if (m_sVenc_cfg.codectype == V4L2_PIX_FMT_TME) {
+ control.id = V4L2_CID_MPEG_VIDC_VIDEO_TME_PAYLOAD_VERSION;
+ ret = ioctl(m_nDriver_fd, VIDIOC_G_CTRL,&control);
+
+ if (ret) {
+ DEBUG_PRINT_ERROR("Failed to read TME version");
+ return false;
+ }
+ venc_handle->tme_payload_version = control.value;
+ DEBUG_PRINT_HIGH("TME version is 0x%x", control.value);
+ }
return true;
}
@@ -1950,8 +1965,10 @@ bool venc_dev::venc_set_param(void *paramData, OMX_INDEXTYPE index)
}
m_sOutput_buff_property.datasize = fmt.fmt.pix_mp.plane_fmt[0].sizeimage;
- if (!venc_set_target_bitrate(portDefn->format.video.nBitrate)) {
- return false;
+ if (m_sVenc_cfg.codectype != V4L2_PIX_FMT_TME) {
+ if (!venc_set_target_bitrate(portDefn->format.video.nBitrate)) {
+ return false;
+ }
}
bufreq.memory = V4L2_MEMORY_USERPTR;
@@ -2123,6 +2140,23 @@ bool venc_dev::venc_set_param(void *paramData, OMX_INDEXTYPE index)
}
break;
}
+ case (OMX_INDEXTYPE)OMX_IndexParamVideoTme:
+ {
+ DEBUG_PRINT_LOW("venc_set_param:OMX_IndexParamVideoTme");
+ QOMX_VIDEO_PARAM_TMETYPE * pParam = (QOMX_VIDEO_PARAM_TMETYPE*)paramData;
+
+ if (!venc_set_profile(pParam->eProfile)) {
+ DEBUG_PRINT_ERROR("ERROR: Unsuccessful in updating Profile %d",
+ pParam->eProfile);
+ return false;
+ }
+ if (!venc_set_level(pParam->eLevel)) {
+ DEBUG_PRINT_ERROR("ERROR: Unsuccessful in updating level %d",
+ pParam->eLevel);
+ return false;
+ }
+ break;
+ }
case OMX_IndexParamVideoIntraRefresh:
{
DEBUG_PRINT_LOW("venc_set_param:OMX_IndexParamVideoIntraRefresh");
@@ -4224,6 +4258,10 @@ bool venc_dev::venc_set_inband_video_header(OMX_BOOL enable)
{
struct v4l2_control control;
+ if (m_sVenc_cfg.codectype == V4L2_PIX_FMT_TME) {
+ return false;
+ }
+
control.id = V4L2_CID_MPEG_VIDEO_HEADER_MODE;
if(enable) {
control.value = V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME;
@@ -4579,8 +4617,10 @@ bool venc_dev::venc_set_profile(OMX_U32 eProfile)
} else if (m_sVenc_cfg.codectype == V4L2_PIX_FMT_VP8) {
//In driver VP8 profile is hardcoded. No need to set anything from here
return true;
- } else if (m_sVenc_cfg.codectype == V4L2_PIX_FMT_HEVC) {
+ } else if (m_sVenc_cfg.codectype == V4L2_PIX_FMT_HEVC) {
control.id = V4L2_CID_MPEG_VIDC_VIDEO_HEVC_PROFILE;
+ } else if (m_sVenc_cfg.codectype == V4L2_PIX_FMT_TME) {
+ control.id = V4L2_CID_MPEG_VIDC_VIDEO_TME_PROFILE;
} else {
DEBUG_PRINT_ERROR("Wrong CODEC");
return false;
@@ -4622,7 +4662,10 @@ bool venc_dev::venc_set_level(OMX_U32 eLevel)
} else if (m_sVenc_cfg.codectype == V4L2_PIX_FMT_HEVC) {
control.id = V4L2_CID_MPEG_VIDC_VIDEO_HEVC_TIER_LEVEL;
control.value = V4L2_MPEG_VIDC_VIDEO_HEVC_LEVEL_UNKNOWN;
- } else {
+ } else if (m_sVenc_cfg.codectype == V4L2_PIX_FMT_TME) {
+ control.id = V4L2_CID_MPEG_VIDC_VIDEO_TME_LEVEL;
+ control.value = V4L2_MPEG_VIDC_VIDEO_TME_LEVEL_INTEGER;
+ } else {
DEBUG_PRINT_ERROR("Wrong CODEC");
return false;
}
@@ -5290,6 +5333,9 @@ unsigned long venc_dev::venc_get_codectype(OMX_VIDEO_CODINGTYPE eCompressionForm
case OMX_VIDEO_CodingHEVC:
codectype = V4L2_PIX_FMT_HEVC;
break;
+ case QOMX_VIDEO_CodingTME:
+ codectype = V4L2_PIX_FMT_TME;
+ break;
default:
DEBUG_PRINT_ERROR("Unsupported eCompressionFormat %#x", eCompressionFormat);
codectype = V4L2_PIX_FMT_H264;