aboutsummaryrefslogtreecommitdiffstats
path: root/videocodec
diff options
context:
space:
mode:
authorwfeng6 <wei.feng@intel.com>2012-02-03 20:03:55 +0800
committerPatrick Tjin <pattjin@google.com>2014-07-21 22:02:45 -0700
commit6bc8d027bb46c0638d26b3f755350b84f6325de3 (patch)
treeaedecdc48206518c3076d5e0828140bb77a9f48e /videocodec
parent09780b7386587d6116b9bdf7e627f3c5037a9008 (diff)
downloadandroid_hardware_intel_common_omx-components-6bc8d027bb46c0638d26b3f755350b84f6325de3.tar.gz
android_hardware_intel_common_omx-components-6bc8d027bb46c0638d26b3f755350b84f6325de3.tar.bz2
android_hardware_intel_common_omx-components-6bc8d027bb46c0638d26b3f755350b84f6325de3.zip
Video editor enabling (Part 4)
BZ: 21677 22177 Add handlers to query the video decoder and encoder profiles and levels to support video editor. Change-Id: I39a7482cdd4327ed75464e14604399b999199119 Signed-off-by: wfeng6 <wei.feng@intel.com> Reviewed-on: http://android.intel.com:8080/33365 Reviewed-by: Ding, Haitao <haitao.ding@intel.com> Tested-by: Ding, Haitao <haitao.ding@intel.com> Reviewed-by: buildbot <buildbot@intel.com> Tested-by: buildbot <buildbot@intel.com>
Diffstat (limited to 'videocodec')
-rw-r--r--videocodec/OMXVideoDecoderAVC.cpp18
-rw-r--r--videocodec/OMXVideoDecoderAVC.h1
-rw-r--r--videocodec/OMXVideoDecoderBase.cpp2
-rw-r--r--videocodec/OMXVideoDecoderH263.cpp17
-rw-r--r--videocodec/OMXVideoDecoderH263.h1
-rw-r--r--videocodec/OMXVideoDecoderMPEG4.cpp17
-rw-r--r--videocodec/OMXVideoDecoderMPEG4.h1
-rw-r--r--videocodec/OMXVideoEncoderAVC.cpp12
-rw-r--r--videocodec/OMXVideoEncoderBase.cpp16
9 files changed, 79 insertions, 6 deletions
diff --git a/videocodec/OMXVideoDecoderAVC.cpp b/videocodec/OMXVideoDecoderAVC.cpp
index 7f22974..02d0c78 100644
--- a/videocodec/OMXVideoDecoderAVC.cpp
+++ b/videocodec/OMXVideoDecoderAVC.cpp
@@ -224,6 +224,7 @@ OMX_ERRORTYPE OMXVideoDecoderAVC::BuildHandlerList(void) {
AddHandler(OMX_IndexParamVideoAvc, GetParamVideoAvc, SetParamVideoAvc);
AddHandler((OMX_INDEXTYPE)OMX_IndexParamIntelAVCDecodeSettings, GetParamIntelAVCDecodeSettings, SetParamIntelAVCDecodeSettings);
AddHandler(static_cast<OMX_INDEXTYPE>(OMX_IndexExtEnableNativeBuffer),GetNativeBufferMode,SetNativeBufferMode);
+ AddHandler(OMX_IndexParamVideoProfileLevelQuerySupported, GetParamVideoAVCProfileLevel, SetParamVideoAVCProfileLevel);
return OMX_ErrorNone;
}
@@ -300,5 +301,22 @@ OMX_ERRORTYPE OMXVideoDecoderAVC::SetNativeBufferMode(OMX_PTR pStructure) {
return OMX_ErrorNone;
}
+OMX_ERRORTYPE OMXVideoDecoderAVC::GetParamVideoAVCProfileLevel(OMX_PTR pStructure) {
+ OMX_ERRORTYPE ret;
+ OMX_VIDEO_PARAM_PROFILELEVELTYPE *p = (OMX_VIDEO_PARAM_PROFILELEVELTYPE *)pStructure;
+ CHECK_TYPE_HEADER(p);
+ CHECK_PORT_INDEX(p, INPORT_INDEX);
+ CHECK_ENUMERATION_RANGE(p->nProfileIndex,1);
+
+ p->eProfile = mParamAvc.eProfile;
+ p->eLevel = mParamAvc.eLevel;
+
+ return OMX_ErrorNone;
+}
+
+OMX_ERRORTYPE OMXVideoDecoderAVC::SetParamVideoAVCProfileLevel(OMX_PTR pStructure) {
+ LOGW("SetParamVideoAVCProfileLevel is not supported.");
+ return OMX_ErrorUnsupportedSetting;
+}
DECLARE_OMX_COMPONENT("OMX.Intel.VideoDecoder.AVC", "video_decoder.avc", OMXVideoDecoderAVC);
diff --git a/videocodec/OMXVideoDecoderAVC.h b/videocodec/OMXVideoDecoderAVC.h
index 90d5f93..4bd98c8 100644
--- a/videocodec/OMXVideoDecoderAVC.h
+++ b/videocodec/OMXVideoDecoderAVC.h
@@ -42,6 +42,7 @@ protected:
DECLARE_HANDLER(OMXVideoDecoderAVC, ParamVideoAvc);
DECLARE_HANDLER(OMXVideoDecoderAVC, ParamIntelAVCDecodeSettings);
DECLARE_HANDLER(OMXVideoDecoderAVC,NativeBufferMode);
+ DECLARE_HANDLER(OMXVideoDecoderAVC, ParamVideoAVCProfileLevel);
private:
inline OMX_ERRORTYPE AccumulateBuffer(OMX_BUFFERHEADERTYPE *buffer);
diff --git a/videocodec/OMXVideoDecoderBase.cpp b/videocodec/OMXVideoDecoderBase.cpp
index c58d0c0..5d06df8 100644
--- a/videocodec/OMXVideoDecoderBase.cpp
+++ b/videocodec/OMXVideoDecoderBase.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-//#define LOG_NDEBUG 0
+#define LOG_NDEBUG 0
#define LOG_TAG "OMXVideoDecoderBase"
#include <utils/Log.h>
#include "OMXVideoDecoderBase.h"
diff --git a/videocodec/OMXVideoDecoderH263.cpp b/videocodec/OMXVideoDecoderH263.cpp
index 5cf1d45..bf4f394 100644
--- a/videocodec/OMXVideoDecoderH263.cpp
+++ b/videocodec/OMXVideoDecoderH263.cpp
@@ -83,6 +83,7 @@ OMX_ERRORTYPE OMXVideoDecoderH263::BuildHandlerList(void) {
OMXVideoDecoderBase::BuildHandlerList();
AddHandler(OMX_IndexParamVideoH263, GetParamVideoH263, SetParamVideoH263);
AddHandler(static_cast<OMX_INDEXTYPE>(OMX_IndexExtEnableNativeBuffer),GetNativeBufferMode,SetNativeBufferMode);
+ AddHandler(OMX_IndexParamVideoProfileLevelQuerySupported, GetParamVideoH263ProfileLevel, SetParamVideoH263ProfileLevel);
return OMX_ErrorNone;
}
@@ -134,6 +135,22 @@ OMX_ERRORTYPE OMXVideoDecoderH263::SetNativeBufferMode(OMX_PTR pStructure) {
return OMX_ErrorNone;
}
+OMX_ERRORTYPE OMXVideoDecoderH263::GetParamVideoH263ProfileLevel(OMX_PTR pStructure) {
+ OMX_ERRORTYPE ret;
+ OMX_VIDEO_PARAM_PROFILELEVELTYPE *p = (OMX_VIDEO_PARAM_PROFILELEVELTYPE *)pStructure;
+ CHECK_TYPE_HEADER(p);
+ CHECK_ENUMERATION_RANGE(p->nProfileIndex,1);
+
+ p->eProfile = mParamH263.eProfile;
+ p->eLevel = mParamH263.eLevel;
+
+ return OMX_ErrorNone;
+}
+
+OMX_ERRORTYPE OMXVideoDecoderH263::SetParamVideoH263ProfileLevel(OMX_PTR pStructure) {
+ LOGW("SetParamVideoH263ProfileLevel is not supported.");
+ return OMX_ErrorUnsupportedSetting;
+}
DECLARE_OMX_COMPONENT("OMX.Intel.VideoDecoder.H263", "video_decoder.h263", OMXVideoDecoderH263);
diff --git a/videocodec/OMXVideoDecoderH263.h b/videocodec/OMXVideoDecoderH263.h
index 2cf80af..8b27d36 100644
--- a/videocodec/OMXVideoDecoderH263.h
+++ b/videocodec/OMXVideoDecoderH263.h
@@ -41,6 +41,7 @@ protected:
virtual OMX_ERRORTYPE BuildHandlerList(void);
DECLARE_HANDLER(OMXVideoDecoderH263, ParamVideoH263);
DECLARE_HANDLER(OMXVideoDecoderH263,NativeBufferMode);
+ DECLARE_HANDLER(OMXVideoDecoderH263, ParamVideoH263ProfileLevel);
private:
enum {
diff --git a/videocodec/OMXVideoDecoderMPEG4.cpp b/videocodec/OMXVideoDecoderMPEG4.cpp
index be19d13..9d24161 100644
--- a/videocodec/OMXVideoDecoderMPEG4.cpp
+++ b/videocodec/OMXVideoDecoderMPEG4.cpp
@@ -83,6 +83,7 @@ OMX_ERRORTYPE OMXVideoDecoderMPEG4::BuildHandlerList(void) {
OMXVideoDecoderBase::BuildHandlerList();
AddHandler(OMX_IndexParamVideoMpeg4, GetParamVideoMpeg4, SetParamVideoMpeg4);
AddHandler(static_cast<OMX_INDEXTYPE>(OMX_IndexExtEnableNativeBuffer),GetNativeBufferMode,SetNativeBufferMode);
+ AddHandler(OMX_IndexParamVideoProfileLevelQuerySupported, GetParamVideoMpeg4ProfileLevel, SetParamVideoMpeg4ProfileLevel);
return OMX_ErrorNone;
}
@@ -133,6 +134,22 @@ OMX_ERRORTYPE OMXVideoDecoderMPEG4::SetNativeBufferMode(OMX_PTR pStructure) {
return OMX_ErrorNone;
}
+OMX_ERRORTYPE OMXVideoDecoderMPEG4::GetParamVideoMpeg4ProfileLevel(OMX_PTR pStructure) {
+ OMX_ERRORTYPE ret;
+ OMX_VIDEO_PARAM_PROFILELEVELTYPE *p = (OMX_VIDEO_PARAM_PROFILELEVELTYPE *)pStructure;
+ CHECK_TYPE_HEADER(p);
+ CHECK_ENUMERATION_RANGE(p->nProfileIndex,1);
+
+ p->eProfile = mParamMpeg4.eProfile;
+ p->eLevel = mParamMpeg4.eLevel;
+
+ return OMX_ErrorNone;
+}
+
+OMX_ERRORTYPE OMXVideoDecoderMPEG4::SetParamVideoMpeg4ProfileLevel(OMX_PTR pStructure) {
+ LOGW("SetParamVideoMpeg4ProfileLevel is not supported.");
+ return OMX_ErrorUnsupportedSetting;
+}
DECLARE_OMX_COMPONENT("OMX.Intel.VideoDecoder.MPEG4", "video_decoder.mpeg4", OMXVideoDecoderMPEG4);
diff --git a/videocodec/OMXVideoDecoderMPEG4.h b/videocodec/OMXVideoDecoderMPEG4.h
index c3e5773..43d35f8 100644
--- a/videocodec/OMXVideoDecoderMPEG4.h
+++ b/videocodec/OMXVideoDecoderMPEG4.h
@@ -42,6 +42,7 @@ protected:
virtual OMX_ERRORTYPE BuildHandlerList(void);
DECLARE_HANDLER(OMXVideoDecoderMPEG4, ParamVideoMpeg4);
DECLARE_HANDLER(OMXVideoDecoderMPEG4,NativeBufferMode);
+ DECLARE_HANDLER(OMXVideoDecoderMPEG4, ParamVideoMpeg4ProfileLevel);
private:
enum {
diff --git a/videocodec/OMXVideoEncoderAVC.cpp b/videocodec/OMXVideoEncoderAVC.cpp
index 2981d1f..b17bb58 100644
--- a/videocodec/OMXVideoEncoderAVC.cpp
+++ b/videocodec/OMXVideoEncoderAVC.cpp
@@ -23,6 +23,7 @@
static const char *AVC_MIME_TYPE = "video/h264";
OMXVideoEncoderAVC::OMXVideoEncoderAVC() {
+ LOGV("OMXVideoEncoderAVC::OMXVideoEncoderAVC");
BuildHandlerList();
mVideoEncoder = createVideoEncoder(AVC_MIME_TYPE);
if (!mVideoEncoder) LOGE("OMX_ErrorInsufficientResources");
@@ -32,6 +33,7 @@ OMXVideoEncoderAVC::OMXVideoEncoderAVC() {
}
OMXVideoEncoderAVC::~OMXVideoEncoderAVC() {
+ LOGV("OMXVideoEncoderAVC::~OMXVideoEncoderAVC");
if(mAVCParams) {
delete mAVCParams;
mAVCParams = NULL;
@@ -44,14 +46,14 @@ OMX_ERRORTYPE OMXVideoEncoderAVC::InitOutputPortFormatSpecific(OMX_PARAM_PORTDEF
SetTypeHeader(&mParamAvc, sizeof(mParamAvc));
mParamAvc.nPortIndex = OUTPORT_INDEX;
mParamAvc.eProfile = OMX_VIDEO_AVCProfileBaseline;
- mParamAvc.eLevel = OMX_VIDEO_AVCLevel1;
+ mParamAvc.eLevel = OMX_VIDEO_AVCLevel41;
// OMX_NALSTREAMFORMATTYPE
memset(&mNalStreamFormat, 0, sizeof(mNalStreamFormat));
SetTypeHeader(&mNalStreamFormat, sizeof(mNalStreamFormat));
mNalStreamFormat.nPortIndex = OUTPORT_INDEX;
// TODO: check if this is desired Nalu Format
- // mNalStreamFormat.eNaluFormat = OMX_NaluFormatStartCodesSeparateFirstHeader;
+ //mNalStreamFormat.eNaluFormat = OMX_NaluFormatStartCodesSeparateFirstHeader;
mNalStreamFormat.eNaluFormat = OMX_NaluFormatLengthPrefixedSeparateFirstHeader;
// OMX_VIDEO_CONFIG_AVCINTRAPERIOD
memset(&mConfigAvcIntraPeriod, 0, sizeof(mConfigAvcIntraPeriod));
@@ -461,12 +463,14 @@ OMX_ERRORTYPE OMXVideoEncoderAVC::GetParamNalStreamFormat(OMX_PTR pStructure) {
}
OMX_ERRORTYPE OMXVideoEncoderAVC::SetParamNalStreamFormat(OMX_PTR pStructure) {
+
+ LOGV("SetParamNalStreamFormat start");
OMX_ERRORTYPE ret;
OMX_NALSTREAMFORMATTYPE *p = (OMX_NALSTREAMFORMATTYPE *)pStructure;
CHECK_TYPE_HEADER(p);
CHECK_PORT_INDEX(p, OUTPORT_INDEX);
-
+ LOGV("Current eNaluFormat is %d\n", mNalStreamFormat.eNaluFormat);
LOGV("p->eNaluFormat =%d\n",p->eNaluFormat);
if(p->eNaluFormat != OMX_NaluFormatStartCodes &&
p->eNaluFormat != OMX_NaluFormatStartCodesSeparateFirstHeader &&
@@ -476,6 +480,8 @@ OMX_ERRORTYPE OMXVideoEncoderAVC::SetParamNalStreamFormat(OMX_PTR pStructure) {
return OMX_ErrorUnsupportedSetting;
}
mNalStreamFormat.eNaluFormat = p->eNaluFormat;
+ LOGV("Set eNaluFormat to %d\n", mNalStreamFormat.eNaluFormat);
+ LOGV("SetParamNalStreamFormat end");
return OMX_ErrorNone;
}
diff --git a/videocodec/OMXVideoEncoderBase.cpp b/videocodec/OMXVideoEncoderBase.cpp
index a13cd58..5600334 100644
--- a/videocodec/OMXVideoEncoderBase.cpp
+++ b/videocodec/OMXVideoEncoderBase.cpp
@@ -31,7 +31,7 @@ OMXVideoEncoderBase::OMXVideoEncoderBase()
,mFrameRetrieved(OMX_TRUE)
,mFirstFrame(OMX_TRUE)
,mForceBufferSharing(OMX_FALSE) {
-
+ LOGV("OMXVideoEncoderBase::OMXVideoEncoderBase begin");
mEncoderParams = new VideoParamsCommon();
if (!mEncoderParams) LOGE("OMX_ErrorInsufficientResources");
@@ -41,10 +41,13 @@ OMXVideoEncoderBase::OMXVideoEncoderBase()
LOGE("InitBSMode failed in Constructor ");
DeinitBSMode();
}
+ LOGV("OMXVideoEncoderBase::OMXVideoEncoderBase end");
}
OMXVideoEncoderBase::~OMXVideoEncoderBase() {
+ LOGV("OMXVideoEncoderBase::~OMXVideoEncoderBase begin");
+
// destroy ports
if (this->ports) {
if (this->ports[INPORT_INDEX]) {
@@ -73,6 +76,8 @@ OMXVideoEncoderBase::~OMXVideoEncoderBase() {
if (oret != OMX_ErrorNone) {
LOGE("DeinitBSMode in destructor");
}
+
+ LOGV("OMXVideoEncoderBase::~OMXVideoEncoderBase end");
}
OMX_ERRORTYPE OMXVideoEncoderBase::InitInputPort(void) {
@@ -523,7 +528,7 @@ OMX_ERRORTYPE OMXVideoEncoderBase::TriggerBSMode() {
OMX_ERRORTYPE OMXVideoEncoderBase::CheckAndEnableBSMode() {
BufferShareStatus bsret;
- if (mBsState != BS_STATE_INVALID) {
+ if ((mBsState != BS_STATE_INVALID) && (mBsState != BS_STATE_FAILD)) {
LOGE("failed (incorrect state).");
return OMX_ErrorUndefined;
}
@@ -553,16 +558,20 @@ OMX_ERRORTYPE OMXVideoEncoderBase::InitBSMode(void) {
mBsInstance = BufferShareRegistry::getInstance();
ret = mBsInstance->encoderRequestToEnableSharingMode();
+
if (ret != BS_SUCCESS) {
mBsState = BS_STATE_FAILD;
return OMX_ErrorInsufficientResources;
}
+
return OMX_ErrorNone;
}
OMX_ERRORTYPE OMXVideoEncoderBase::DeinitBSMode(void) {
BufferShareStatus ret;
+ LOGV("OMXVideoEncoderBase::DeinitBSMode begin");
+
CHECK_BS_STATE();
if (mBsState == BS_STATE_INVALID || mBsState == BS_STATE_FAILD) {
@@ -579,6 +588,9 @@ OMX_ERRORTYPE OMXVideoEncoderBase::DeinitBSMode(void) {
mBsState = BS_STATE_INVALID;
+
+ LOGV("OMXVideoEncoderBase::DeinitBSMode end");
+
return OMX_ErrorNone;
}