From 3affbef33590ea242fed4a24c8ed2c19fc9cee7c Mon Sep 17 00:00:00 2001 From: qijinquan Date: Thu, 28 Jul 2022 10:20:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=88=A0=E9=99=A4enum=E5=B9=B6=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=87=BD=E6=95=B0=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: qijinquan --- codec/hal/include/codec_adapter_interface.h | 16 +++++++-------- codec/hal/src/codec_adapter.cpp | 14 ++++++------- .../v2.0/hdi_impl/include/component_node.h | 14 ++++++------- .../hal/v2.0/hdi_impl/src/component_node.cpp | 14 ++++++------- .../test/demo/v2.0/include/codec_hdi_decode.h | 6 +++--- .../test/demo/v2.0/include/codec_hdi_encode.h | 8 ++++---- codec/test/demo/v2.0/src/codec_hdi_decode.cpp | 16 +++++++-------- codec/test/demo/v2.0/src/codec_hdi_encode.cpp | 20 +++++++++---------- 8 files changed, 54 insertions(+), 54 deletions(-) diff --git a/codec/hal/include/codec_adapter_interface.h b/codec/hal/include/codec_adapter_interface.h index 647a628a68..4702f69696 100644 --- a/codec/hal/include/codec_adapter_interface.h +++ b/codec/hal/include/codec_adapter_interface.h @@ -38,30 +38,30 @@ extern int32_t OmxAdapterComponentVersion(struct CodecComponentNode *codecNode, /** * @brief Send command to the component. */ -extern int32_t OmxAdapterSendCommand(struct CodecComponentNode *codecNode, enum OMX_COMMANDTYPE cmd, uint32_t param, +extern int32_t OmxAdapterSendCommand(struct CodecComponentNode *codecNode, OMX_COMMANDTYPE cmd, uint32_t param, int8_t *cmdData, uint32_t cmdDataLen); /** * @brief Get the parameter by index. */ -extern int32_t OmxAdapterGetParameter(struct CodecComponentNode *codecNode, enum OMX_INDEXTYPE paramIndex, - int8_t *param, uint32_t paramLen); +extern int32_t OmxAdapterGetParameter(struct CodecComponentNode *codecNode, OMX_INDEXTYPE paramIndex, int8_t *param, + uint32_t paramLen); /** * @brief Set the parameter by index. */ -extern int32_t OmxAdapterSetParameter(struct CodecComponentNode *codecNode, enum OMX_INDEXTYPE index, int8_t *param, +extern int32_t OmxAdapterSetParameter(struct CodecComponentNode *codecNode, OMX_INDEXTYPE index, int8_t *param, uint32_t paramLen); /** * @brief Get the config by index. * * This func can be invoked when the component is in any state except the OMX_StateInvalid state. */ -extern int32_t OmxAdapterGetConfig(struct CodecComponentNode *codecNode, enum OMX_INDEXTYPE index, int8_t *config, +extern int32_t OmxAdapterGetConfig(struct CodecComponentNode *codecNode, OMX_INDEXTYPE index, int8_t *config, uint32_t configLen); -extern int32_t OmxAdapterSetConfig(struct CodecComponentNode *codecNode, enum OMX_INDEXTYPE index, int8_t *config, +extern int32_t OmxAdapterSetConfig(struct CodecComponentNode *codecNode, OMX_INDEXTYPE index, int8_t *config, uint32_t configLen); extern int32_t OmxAdapterGetExtensionIndex(struct CodecComponentNode *codecNode, const char *parameterName, - enum OMX_INDEXTYPE *indexType); -extern int32_t OmxAdapterGetState(struct CodecComponentNode *codecNode, enum OMX_STATETYPE *state); + OMX_INDEXTYPE *indexType); +extern int32_t OmxAdapterGetState(struct CodecComponentNode *codecNode, OMX_STATETYPE *state); /** * @brief Set up tunneled communication between an output port and an input port. */ diff --git a/codec/hal/src/codec_adapter.cpp b/codec/hal/src/codec_adapter.cpp index b54e3ed830..c6e1b9df26 100644 --- a/codec/hal/src/codec_adapter.cpp +++ b/codec/hal/src/codec_adapter.cpp @@ -78,7 +78,7 @@ int32_t OmxAdapterComponentVersion(struct CodecComponentNode *codecNode, struct return codecNode->node->GetComponentVersion(*verInfo); } -int32_t OmxAdapterSendCommand(struct CodecComponentNode *codecNode, enum OMX_COMMANDTYPE cmd, uint32_t param, +int32_t OmxAdapterSendCommand(struct CodecComponentNode *codecNode, OMX_COMMANDTYPE cmd, uint32_t param, int8_t *cmdData, uint32_t cmdDataLen) { if (codecNode == nullptr || codecNode->node == nullptr) { @@ -88,7 +88,7 @@ int32_t OmxAdapterSendCommand(struct CodecComponentNode *codecNode, enum OMX_COM return codecNode->node->SendCommand(cmd, param, cmdData, cmdDataLen); } -int32_t OmxAdapterGetParameter(struct CodecComponentNode *codecNode, enum OMX_INDEXTYPE paramIndex, int8_t *param, +int32_t OmxAdapterGetParameter(struct CodecComponentNode *codecNode, OMX_INDEXTYPE paramIndex, int8_t *param, uint32_t paramLen) { if (codecNode == nullptr || codecNode->node == nullptr || param == nullptr) { @@ -99,7 +99,7 @@ int32_t OmxAdapterGetParameter(struct CodecComponentNode *codecNode, enum OMX_IN return codecNode->node->GetParameter(paramIndex, param, paramLen); } -int32_t OmxAdapterSetParameter(struct CodecComponentNode *codecNode, enum OMX_INDEXTYPE index, int8_t *param, +int32_t OmxAdapterSetParameter(struct CodecComponentNode *codecNode, OMX_INDEXTYPE index, int8_t *param, uint32_t paramLen) { if (codecNode == nullptr || codecNode->node == nullptr || param == nullptr) { @@ -109,7 +109,7 @@ int32_t OmxAdapterSetParameter(struct CodecComponentNode *codecNode, enum OMX_IN return codecNode->node->SetParameter(index, param, paramLen); } -int32_t OmxAdapterGetConfig(struct CodecComponentNode *codecNode, enum OMX_INDEXTYPE index, int8_t *config, +int32_t OmxAdapterGetConfig(struct CodecComponentNode *codecNode, OMX_INDEXTYPE index, int8_t *config, uint32_t configLen) { if (codecNode == nullptr || codecNode->node == nullptr || config == nullptr) { @@ -119,7 +119,7 @@ int32_t OmxAdapterGetConfig(struct CodecComponentNode *codecNode, enum OMX_INDEX return codecNode->node->GetConfig(index, config, configLen); } -int32_t OmxAdapterSetConfig(struct CodecComponentNode *codecNode, enum OMX_INDEXTYPE index, int8_t *config, +int32_t OmxAdapterSetConfig(struct CodecComponentNode *codecNode, OMX_INDEXTYPE index, int8_t *config, uint32_t configLen) { if (codecNode == nullptr || codecNode->node == nullptr || config == nullptr) { @@ -130,7 +130,7 @@ int32_t OmxAdapterSetConfig(struct CodecComponentNode *codecNode, enum OMX_INDEX } int32_t OmxAdapterGetExtensionIndex(struct CodecComponentNode *codecNode, const char *parameterName, - enum OMX_INDEXTYPE *indexType) + OMX_INDEXTYPE *indexType) { if (codecNode == nullptr || codecNode->node == nullptr || parameterName == nullptr || indexType == nullptr) { HDF_LOGE("%{public}s codecNode, node , parameterName or indexType is null", __func__); @@ -139,7 +139,7 @@ int32_t OmxAdapterGetExtensionIndex(struct CodecComponentNode *codecNode, const return codecNode->node->GetExtensionIndex(parameterName, indexType); } -int32_t OmxAdapterGetState(struct CodecComponentNode *codecNode, enum OMX_STATETYPE *state) +int32_t OmxAdapterGetState(struct CodecComponentNode *codecNode, OMX_STATETYPE *state) { if (codecNode == nullptr || codecNode->node == nullptr || state == nullptr) { HDF_LOGE("%{public}s codecNode, node or state is null", __func__); diff --git a/codec/hal/v2.0/hdi_impl/include/component_node.h b/codec/hal/v2.0/hdi_impl/include/component_node.h index 2c3dcfccb3..c8896ce6a0 100644 --- a/codec/hal/v2.0/hdi_impl/include/component_node.h +++ b/codec/hal/v2.0/hdi_impl/include/component_node.h @@ -37,19 +37,19 @@ public: int32_t GetComponentVersion(struct CompVerInfo &verInfo); - int32_t SendCommand(enum OMX_COMMANDTYPE cmd, uint32_t param, int8_t *cmdData, uint32_t cmdDataLen); + int32_t SendCommand(OMX_COMMANDTYPE cmd, uint32_t param, int8_t *cmdData, uint32_t cmdDataLen); - int32_t GetParameter(enum OMX_INDEXTYPE paramIndex, int8_t *param, uint32_t paramLen); + int32_t GetParameter(OMX_INDEXTYPE paramIndex, int8_t *param, uint32_t paramLen); - int32_t SetParameter(enum OMX_INDEXTYPE paramIndex, int8_t *param, uint32_t paramLen); + int32_t SetParameter(OMX_INDEXTYPE paramIndex, int8_t *param, uint32_t paramLen); - int32_t GetConfig(enum OMX_INDEXTYPE index, int8_t *config, uint32_t configLen); + int32_t GetConfig(OMX_INDEXTYPE index, int8_t *config, uint32_t configLen); - int32_t SetConfig(enum OMX_INDEXTYPE index, int8_t *config, uint32_t configLen); + int32_t SetConfig(OMX_INDEXTYPE index, int8_t *config, uint32_t configLen); - int32_t GetExtensionIndex(const char *parameterName, enum OMX_INDEXTYPE *indexType); + int32_t GetExtensionIndex(const char *parameterName, OMX_INDEXTYPE *indexType); - int32_t GetState(enum OMX_STATETYPE *state); + int32_t GetState(OMX_STATETYPE *state); int32_t ComponentTunnelRequest(uint32_t port, int32_t omxHandleTypeTunneledComp, uint32_t tunneledPort, struct OMX_TUNNELSETUPTYPE *tunnelSetup); diff --git a/codec/hal/v2.0/hdi_impl/src/component_node.cpp b/codec/hal/v2.0/hdi_impl/src/component_node.cpp index 52db824b55..a84ce94687 100644 --- a/codec/hal/v2.0/hdi_impl/src/component_node.cpp +++ b/codec/hal/v2.0/hdi_impl/src/component_node.cpp @@ -101,7 +101,7 @@ int32_t ComponentNode::GetComponentVersion(struct CompVerInfo &verInfo) return err; } -int32_t ComponentNode::SendCommand(enum OMX_COMMANDTYPE cmd, uint32_t param, int8_t *cmdData, uint32_t cmdDataLen) +int32_t ComponentNode::SendCommand(OMX_COMMANDTYPE cmd, uint32_t param, int8_t *cmdData, uint32_t cmdDataLen) { if (comp_ == nullptr) { HDF_LOGE("%{public}s error, comp_ is null ", __func__); @@ -111,7 +111,7 @@ int32_t ComponentNode::SendCommand(enum OMX_COMMANDTYPE cmd, uint32_t param, int return OMX_SendCommand(comp_, cmd, param, cmdData); } -int32_t ComponentNode::GetParameter(enum OMX_INDEXTYPE paramIndex, int8_t *param, uint32_t paramLen) +int32_t ComponentNode::GetParameter(OMX_INDEXTYPE paramIndex, int8_t *param, uint32_t paramLen) { if (comp_ == nullptr) { HDF_LOGE("%{public}s error, comp_ is null ", __func__); @@ -121,7 +121,7 @@ int32_t ComponentNode::GetParameter(enum OMX_INDEXTYPE paramIndex, int8_t *param return OMX_GetParameter(comp_, paramIndex, param); } -int32_t ComponentNode::SetParameter(enum OMX_INDEXTYPE paramIndex, int8_t *param, uint32_t paramLen) +int32_t ComponentNode::SetParameter(OMX_INDEXTYPE paramIndex, int8_t *param, uint32_t paramLen) { if (comp_ == nullptr || param == nullptr) { HDF_LOGE("%{public}s error, comp_ is null or param is null ", __func__); @@ -131,7 +131,7 @@ int32_t ComponentNode::SetParameter(enum OMX_INDEXTYPE paramIndex, int8_t *param return OMX_SetParameter(comp_, paramIndex, param); } -int32_t ComponentNode::GetConfig(enum OMX_INDEXTYPE index, int8_t *config, uint32_t configLen) +int32_t ComponentNode::GetConfig(OMX_INDEXTYPE index, int8_t *config, uint32_t configLen) { if (comp_ == nullptr) { HDF_LOGE("%{public}s error, comp_ is null ", __func__); @@ -141,7 +141,7 @@ int32_t ComponentNode::GetConfig(enum OMX_INDEXTYPE index, int8_t *config, uint3 return OMX_GetConfig(comp_, index, config); } -int32_t ComponentNode::SetConfig(enum OMX_INDEXTYPE index, int8_t *config, uint32_t configLen) +int32_t ComponentNode::SetConfig(OMX_INDEXTYPE index, int8_t *config, uint32_t configLen) { if (comp_ == nullptr) { HDF_LOGE("%{public}s error, comp_ is null ", __func__); @@ -151,7 +151,7 @@ int32_t ComponentNode::SetConfig(enum OMX_INDEXTYPE index, int8_t *config, uint3 return OMX_SetConfig(comp_, index, config); } -int32_t ComponentNode::GetExtensionIndex(const char *parameterName, enum OMX_INDEXTYPE *indexType) +int32_t ComponentNode::GetExtensionIndex(const char *parameterName, OMX_INDEXTYPE *indexType) { if (comp_ == nullptr) { HDF_LOGE("%{public}s error, comp_ is null ", __func__); @@ -161,7 +161,7 @@ int32_t ComponentNode::GetExtensionIndex(const char *parameterName, enum OMX_IND return OMX_GetExtensionIndex(comp_, const_cast(parameterName), indexType); } -int32_t ComponentNode::GetState(enum OMX_STATETYPE *state) +int32_t ComponentNode::GetState(OMX_STATETYPE *state) { if (comp_ == nullptr) { HDF_LOGE("%{public}s error, comp_ is null ", __func__); diff --git a/codec/test/demo/v2.0/include/codec_hdi_decode.h b/codec/test/demo/v2.0/include/codec_hdi_decode.h index faa0f616c6..3fe365ddbf 100644 --- a/codec/test/demo/v2.0/include/codec_hdi_decode.h +++ b/codec/test/demo/v2.0/include/codec_hdi_decode.h @@ -89,7 +89,7 @@ public: void FreeBuffers(); void Run(); void Release(); - static int32_t OnEvent(struct CodecCallbackType *self, enum OMX_EVENTTYPE event, struct EventInfo *info); + static int32_t OnEvent(struct CodecCallbackType *self, OMX_EVENTTYPE event, struct EventInfo *info); static int32_t OnEmptyBufferDone(struct CodecCallbackType *self, int64_t appData, const struct OmxCodecBuffer *buffer); static int32_t OnFillBufferDone(struct CodecCallbackType *self, int64_t appData, @@ -109,7 +109,7 @@ public: param.version.s.nVersionMajor = 1; // mVersion.s.nVersionMajor; } void WaitForStatusChanged(); - void onStatusChanged(); + void OnStatusChanged(); bool ReadOnePacket(FILE *fp, char *buf, uint32_t &filledCount); private: @@ -123,7 +123,7 @@ private: int32_t ConfigPortDefine(); bool FillAllTheBuffer(); int GetFreeBufferId(); - uint32_t inline align_up(uint32_t width) + uint32_t inline AlignUp(uint32_t width) { return (((width) + alignment_ - 1) & (~(alignment_ - 1))); } diff --git a/codec/test/demo/v2.0/include/codec_hdi_encode.h b/codec/test/demo/v2.0/include/codec_hdi_encode.h index b361247cf2..c0fb7a8cf1 100644 --- a/codec/test/demo/v2.0/include/codec_hdi_encode.h +++ b/codec/test/demo/v2.0/include/codec_hdi_encode.h @@ -79,7 +79,7 @@ public: void FreeBuffers(); void Run(); void Release(); - static int32_t OnEvent(struct CodecCallbackType *self, enum OMX_EVENTTYPE event, struct EventInfo *info); + static int32_t OnEvent(struct CodecCallbackType *self, OMX_EVENTTYPE event, struct EventInfo *info); static int32_t OnEmptyBufferDone(struct CodecCallbackType *self, int64_t appData, const struct OmxCodecBuffer *buffer); @@ -100,7 +100,7 @@ public: param.version.s.nVersionMajor = 1; // mVersion.s.nVersionMajor; } void WaitForStatusChanged(); - void onStatusChanged(); + void OnStatusChanged(); bool ReadOneFrame(FILE *fp, char *buf, uint32_t &filledCount); private: @@ -114,8 +114,8 @@ private: int32_t CheckAndUseBufferHandle(); int32_t UseDynaBuffer(int bufferCount, int bufferSize); bool FillCodecBuffer(std::shared_ptr bufferInfo, bool &endFlag); - int32_t createBufferHandle(); - uint32_t inline align_up(uint32_t width) + int32_t CreateBufferHandle(); + uint32_t inline AlignUp(uint32_t width) { return (((width) + alignment_ - 1) & (~(alignment_ - 1))); } diff --git a/codec/test/demo/v2.0/src/codec_hdi_decode.cpp b/codec/test/demo/v2.0/src/codec_hdi_decode.cpp index c09ab45350..a687cb7d6f 100644 --- a/codec/test/demo/v2.0/src/codec_hdi_decode.cpp +++ b/codec/test/demo/v2.0/src/codec_hdi_decode.cpp @@ -77,7 +77,7 @@ void CodecHdiDecode::WaitForStatusChanged() statusCondition_.wait(autoLock); } -void CodecHdiDecode::onStatusChanged() +void CodecHdiDecode::OnStatusChanged() { statusCondition_.notify_one(); } @@ -125,7 +125,7 @@ bool CodecHdiDecode::Init(CommandOpt &opt) this->width_ = opt.width; this->height_ = opt.height; this->codecMime_ = opt.codec; - this->stride_ = align_up(opt.width); + this->stride_ = AlignUp(opt.width); this->useBufferHandle_ = opt.useBuffer; HDF_LOGI("width[%{public}d], height[%{public}d],stride_[%{public}d],infile[%{public}s],outfile[%{public}s]", width_, height_, stride_, opt.fileInput.c_str(), opt.fileOutput.c_str()); @@ -326,7 +326,7 @@ bool CodecHdiDecode::UseBuffers() } HDF_LOGI("Wait for OMX_StateIdle status"); - enum OMX_STATETYPE status; + OMX_STATETYPE status; err = client_->GetState(client_, &status); if (err != HDF_SUCCESS) { HDF_LOGE("%{public}s GetState err [%{public}x]", __func__, err); @@ -511,7 +511,7 @@ void CodecHdiDecode::FreeBuffers() unUsedInBuffers_.clear(); unUsedOutBuffers_.clear(); - enum OMX_STATETYPE status; + OMX_STATETYPE status; auto err = client_->GetState(client_, &status); if (err != HDF_SUCCESS) { HDF_LOGE("%s GetState error [%{public}x]", __func__, err); @@ -593,7 +593,7 @@ void CodecHdiDecode::Run() break; } if (bufferID < 0) { - usleep(10000); + usleep(10000); // 10000: sleep time 10ms continue; } auto iter = omxBuffers_.find(bufferID); @@ -616,7 +616,7 @@ void CodecHdiDecode::Run() } // wait while (!this->exit_) { - usleep(10000); + usleep(10000); // 10000: sleep time 10ms continue; } auto t2 = std::chrono::system_clock::now(); @@ -626,7 +626,7 @@ void CodecHdiDecode::Run() (void)client_->SendCommand(client_, OMX_CommandStateSet, OMX_StateIdle, NULL, 0); return; } -int32_t CodecHdiDecode::OnEvent(struct CodecCallbackType *self, enum OMX_EVENTTYPE event, struct EventInfo *info) +int32_t CodecHdiDecode::OnEvent(struct CodecCallbackType *self, OMX_EVENTTYPE event, struct EventInfo *info) { HDF_LOGI("%{public}s: appData[%{public}" PRId64 "] eEvent [%{public}d], nData1[%{public}d]", __func__, info->appData, event, info->data1); @@ -635,7 +635,7 @@ int32_t CodecHdiDecode::OnEvent(struct CodecCallbackType *self, enum OMX_EVENTTY OMX_COMMANDTYPE cmd = (OMX_COMMANDTYPE)info->data1; if (OMX_CommandStateSet == cmd) { HDF_LOGI("OMX_CommandStateSet reached, status is %{public}d", info->data2); - g_core->onStatusChanged(); + g_core->OnStatusChanged(); } break; } diff --git a/codec/test/demo/v2.0/src/codec_hdi_encode.cpp b/codec/test/demo/v2.0/src/codec_hdi_encode.cpp index 6ea1ebe2c7..d733a24c5b 100644 --- a/codec/test/demo/v2.0/src/codec_hdi_encode.cpp +++ b/codec/test/demo/v2.0/src/codec_hdi_encode.cpp @@ -68,7 +68,7 @@ void CodecHdiEncode::WaitForStatusChanged() statusCondition_.wait(autoLock); } -void CodecHdiEncode::onStatusChanged() +void CodecHdiEncode::OnStatusChanged() { statusCondition_.notify_one(); } @@ -87,7 +87,7 @@ bool CodecHdiEncode::Init(CommandOpt &opt) { this->width_ = opt.width; this->height_ = opt.height; - this->stride_ = align_up(width_); + this->stride_ = AlignUp(width_); this->useBufferHandle_ = opt.useBuffer; HDF_LOGI("width[%{public}d], height[%{public}d]", width_, height_); // gralloc init @@ -221,13 +221,13 @@ bool CodecHdiEncode::UseBuffers() return false; } - if (useBufferHandle_ && createBufferHandle() != HDF_SUCCESS) { - HDF_LOGE("%{public}s createBufferHandle error", __func__); + if (useBufferHandle_ && CreateBufferHandle() != HDF_SUCCESS) { + HDF_LOGE("%{public}s CreateBufferHandle error", __func__); return false; } // wait executing state - enum OMX_STATETYPE status; + OMX_STATETYPE status; err = client_->GetState(client_, &status); if (err != HDF_SUCCESS) { HDF_LOGE("%{public}s GetState err [%{public}x]", __func__, err); @@ -407,7 +407,7 @@ void CodecHdiEncode::FreeBuffers() unUsedInBuffers_.clear(); unUsedOutBuffers_.clear(); - enum OMX_STATETYPE status; + OMX_STATETYPE status; auto err = client_->GetState(client_, &status); if (err != HDF_SUCCESS) { HDF_LOGE("%s GetState error [%{public}x]", __func__, err); @@ -478,7 +478,7 @@ void CodecHdiEncode::Run() break; } if (bufferID < 0) { - usleep(10000); + usleep(10000); // 10000: sleep time 10ms continue; } auto iter = omxBuffers_.find(bufferID); @@ -496,7 +496,7 @@ void CodecHdiEncode::Run() } } while (!this->exit_) { - usleep(10000); + usleep(10000); // 10000: sleep time 10ms continue; } (void)client_->SendCommand(client_, OMX_CommandStateSet, OMX_StateIdle, NULL, 0); @@ -540,7 +540,7 @@ bool CodecHdiEncode::FillCodecBuffer(std::shared_ptr bufferInfo, boo return true; } -int32_t CodecHdiEncode::createBufferHandle() +int32_t CodecHdiEncode::CreateBufferHandle() { if (gralloc_ == nullptr) { HDF_LOGE("%{public}s gralloc_ is null", __func__); @@ -575,7 +575,7 @@ int32_t CodecHdiEncode::OnEvent(struct CodecCallbackType *self, enum OMX_EVENTTY OMX_COMMANDTYPE cmd = (OMX_COMMANDTYPE)info->data1; if (OMX_CommandStateSet == cmd) { HDF_LOGI("OMX_CommandStateSet reached"); - g_core->onStatusChanged(); + g_core->OnStatusChanged(); } break; }