diff options
| -rwxr-xr-x | videocodec/OMXVideoEncoderBase.cpp | 17 | ||||
| -rw-r--r-- | videocodec/OMXVideoEncoderVP8.cpp | 30 | ||||
| -rw-r--r-- | videocodec/OMXVideoEncoderVP8.h | 2 |
3 files changed, 42 insertions, 7 deletions
diff --git a/videocodec/OMXVideoEncoderBase.cpp b/videocodec/OMXVideoEncoderBase.cpp index 628da22..0960e0c 100755 --- a/videocodec/OMXVideoEncoderBase.cpp +++ b/videocodec/OMXVideoEncoderBase.cpp @@ -418,7 +418,6 @@ OMX_ERRORTYPE OMXVideoEncoderBase::BuildHandlerList(void) { AddHandler((OMX_INDEXTYPE)OMX_IndexStoreMetaDataInBuffers, GetStoreMetaDataInBuffers, SetStoreMetaDataInBuffers); AddHandler((OMX_INDEXTYPE)OMX_IndexExtSyncEncoding, GetSyncEncoding, SetSyncEncoding); AddHandler((OMX_INDEXTYPE)OMX_IndexExtPrependSPSPPS, GetPrependSPSPPS, SetPrependSPSPPS); - return OMX_ErrorNone; } @@ -568,7 +567,8 @@ OMX_ERRORTYPE OMXVideoEncoderBase::GetConfigIntelBitrate(OMX_PTR pStructure) { OMX_ERRORTYPE OMXVideoEncoderBase::SetConfigIntelBitrate(OMX_PTR pStructure) { OMX_ERRORTYPE ret; Encode_Status retStatus = ENCODE_SUCCESS; - if (mParamIntelBitrate.eControlRate == OMX_Video_Intel_ControlRateMax) { + if ((mParamIntelBitrate.eControlRate == OMX_Video_Intel_ControlRateMax)&& + (mEncoderParams->profile != VAProfileVP8Version0_3)) { LOGE("SetConfigIntelBitrate failed. Feature is disabled."); return OMX_ErrorUnsupportedIndex; } @@ -583,8 +583,9 @@ OMX_ERRORTYPE OMXVideoEncoderBase::SetConfigIntelBitrate(OMX_PTR pStructure) { // TODO: return OMX_ErrorIncorrectStateOperation? CHECK_SET_CONFIG_STATE(); - if (mParamIntelBitrate.eControlRate != OMX_Video_Intel_ControlRateVideoConferencingMode) { - LOGE("SetConfigIntelBitrate failed. Feature is supported only in VCM."); + if ((mParamIntelBitrate.eControlRate != OMX_Video_Intel_ControlRateVideoConferencingMode)&& + (mEncoderParams->profile != VAProfileVP8Version0_3)){ + LOGE("SetConfigIntelBitrate failed. Feature is supported only in VCM for AVC/H264/MPEG4."); return OMX_ErrorUnsupportedSetting; } VideoConfigBitRate configBitRate; @@ -723,7 +724,8 @@ OMX_ERRORTYPE OMXVideoEncoderBase::GetConfigVideoFramerate(OMX_PTR pStructure) { OMX_ERRORTYPE OMXVideoEncoderBase::SetConfigVideoFramerate(OMX_PTR pStructure) { OMX_ERRORTYPE ret; Encode_Status retStatus = ENCODE_SUCCESS; - if (mParamIntelBitrate.eControlRate == OMX_Video_Intel_ControlRateMax) { + if ((mParamIntelBitrate.eControlRate == OMX_Video_Intel_ControlRateMax)&& + (mEncoderParams->profile != VAProfileVP8Version0_3)){ LOGE("SetConfigVideoFramerate failed. Feature is disabled."); return OMX_ErrorUnsupportedIndex; } @@ -738,8 +740,9 @@ OMX_ERRORTYPE OMXVideoEncoderBase::SetConfigVideoFramerate(OMX_PTR pStructure) { // TODO, return OMX_ErrorIncorrectStateOperation? CHECK_SET_CONFIG_STATE(); - if (mParamIntelBitrate.eControlRate != OMX_Video_Intel_ControlRateVideoConferencingMode) { - LOGE("SetConfigIntelAIR failed. Feature is supported only in VCM."); + if ((mParamIntelBitrate.eControlRate != OMX_Video_Intel_ControlRateVideoConferencingMode)&& + (mEncoderParams->profile != VAProfileVP8Version0_3)){ + LOGE("SetConfigIntelAIR failed. Feature is supported only in VCM for AVC/H264/MPEG4."); return OMX_ErrorUnsupportedSetting; } VideoConfigFrameRate framerate; diff --git a/videocodec/OMXVideoEncoderVP8.cpp b/videocodec/OMXVideoEncoderVP8.cpp index 8df2b3d..c5630f9 100644 --- a/videocodec/OMXVideoEncoderVP8.cpp +++ b/videocodec/OMXVideoEncoderVP8.cpp @@ -194,6 +194,7 @@ OMX_ERRORTYPE OMXVideoEncoderVP8::BuildHandlerList(void) { OMXVideoEncoderBase::BuildHandlerList(); AddHandler((OMX_INDEXTYPE)OMX_IndexParamVideoVp8, GetParamVideoVp8, SetParamVideoVp8); AddHandler((OMX_INDEXTYPE)OMX_IndexConfigVideoVp8ReferenceFrame, GetConfigVideoVp8ReferenceFrame, SetConfigVideoVp8ReferenceFrame); + AddHandler((OMX_INDEXTYPE)OMX_IndexExtVP8ForceKFrame, GetConfigVp8ForceKFrame, SetConfigVp8ForceKFrame); return OMX_ErrorNone; } @@ -253,4 +254,33 @@ OMX_ERRORTYPE OMXVideoEncoderVP8::SetConfigVideoVp8ReferenceFrame(OMX_PTR pStruc return OMX_ErrorNone; } +OMX_ERRORTYPE OMXVideoEncoderVP8::GetConfigVp8ForceKFrame(OMX_PTR pStructure) { + + return OMX_ErrorNone; +} + +OMX_ERRORTYPE OMXVideoEncoderVP8::SetConfigVp8ForceKFrame(OMX_PTR pStructure) { + OMX_ERRORTYPE ret; + Encode_Status retStatus = ENCODE_SUCCESS; + OMX_VIDEO_CONFIG_INTEL_VP8_FORCE_KFRAME *p = (OMX_VIDEO_CONFIG_INTEL_VP8_FORCE_KFRAME*) pStructure; + CHECK_TYPE_HEADER(p); + CHECK_PORT_INDEX(p, OUTPORT_INDEX); + + CHECK_SET_CONFIG_STATE(); + + VideoConfigVP8 configVP8; + configVP8.force_kf = p->bForceKFrame; + configVP8.refresh_entropy_probs = 0; + configVP8.value = 0; + configVP8.sharpness_level = 2; + + retStatus = mVideoEncoder->setConfig(&configVP8); + if(retStatus != ENCODE_SUCCESS) { + LOGW("Failed to set refresh config"); + } + return OMX_ErrorNone; +} + + + DECLARE_OMX_COMPONENT("OMX.Intel.VideoEncoder.VP8", "video_encoder.vpx", OMXVideoEncoderVP8); diff --git a/videocodec/OMXVideoEncoderVP8.h b/videocodec/OMXVideoEncoderVP8.h index 54aae79..fb578c8 100644 --- a/videocodec/OMXVideoEncoderVP8.h +++ b/videocodec/OMXVideoEncoderVP8.h @@ -17,6 +17,7 @@ class OMXVideoEncoderVP8 : public OMXVideoEncoderBase { virtual OMX_ERRORTYPE SetVideoEncoderParam(); DECLARE_HANDLER(OMXVideoEncoderVP8, ParamVideoVp8); DECLARE_HANDLER(OMXVideoEncoderVP8, ConfigVideoVp8ReferenceFrame); + DECLARE_HANDLER(OMXVideoEncoderVP8, ConfigVp8ForceKFrame); private: enum { OUTPORT_MIN_BUFFER_COUNT = 1, @@ -26,6 +27,7 @@ class OMXVideoEncoderVP8 : public OMXVideoEncoderBase { OMX_VIDEO_PARAM_VP8TYPE mParamVp8; OMX_VIDEO_VP8REFERENCEFRAMETYPE mConfigVideoVp8ReferenceFrame; + OMX_VIDEO_CONFIG_INTEL_VP8_FORCE_KFRAME mVideoConfigVP8ForceKFrame; }; #endif /* OMX_VIDEO_ENCODER_VP8_H */ |
