diff --git a/codec/hal/src/codec_callback_type_proxy.c b/codec/hal/src/codec_callback_type_proxy.c
index 01d0c9a5a8bbd943148a7280540c12b4c472446f..4330155271bb4bd02d9c58b366c68f727f3e4bcb 100644
--- a/codec/hal/src/codec_callback_type_proxy.c
+++ b/codec/hal/src/codec_callback_type_proxy.c
@@ -65,29 +65,33 @@ static int32_t WriteArray(struct HdfSBuf *data, int8_t *array, uint32_t arrayLen
return HDF_SUCCESS;
}
-static int32_t WriteEventData(struct HdfSBuf *data, enum OMX_EVENTTYPE eEvent, uint32_t data1, uint32_t data2)
+static int32_t WriteEventInfo(struct HdfSBuf *data, struct EventInfo* info)
{
- if (!HdfSbufWriteUint32(data, (uint32_t)eEvent)) {
- HDF_LOGE("%{public}s: write eEvent failed!", __func__);
- return HDF_ERR_INVALID_PARAM;
+ int32_t ret = WriteArray(data, info->appData, info->appDataLen);
+ if (ret != HDF_SUCCESS) {
+ HDF_LOGE("%{public}s: write appData failed!", __func__);
+ return ret;
}
- if (!HdfSbufWriteUint32(data, data1)) {
+ if (!HdfSbufWriteUint32(data, info->data1)) {
HDF_LOGE("%{public}s: write data1 failed!", __func__);
return HDF_ERR_INVALID_PARAM;
}
- if (!HdfSbufWriteUint32(data, data2)) {
+ if (!HdfSbufWriteUint32(data, info->data2)) {
HDF_LOGE("%{public}s: write data2 failed!", __func__);
return HDF_ERR_INVALID_PARAM;
}
- return HDF_SUCCESS;
+ ret = WriteArray(data, info->eventData, info->eventDataLen);
+ if (ret != HDF_SUCCESS) {
+ HDF_LOGE("%{public}s: write eventData failed!", __func__);
+ }
+ return ret;
}
static int32_t CodecCallbackTypeProxyEventHandler(struct CodecCallbackType *self,
- int8_t *appData, uint32_t appDataLen, enum OMX_EVENTTYPE eEvent, uint32_t data1,
- uint32_t data2, int8_t *eventData, uint32_t eventDataLen)
+ enum OMX_EVENTTYPE event, struct EventInfo* info)
{
int32_t ret;
@@ -105,32 +109,17 @@ static int32_t CodecCallbackTypeProxyEventHandler(struct CodecCallbackType *self
return HDF_FAILURE;
}
- ret = WriteArray(data, appData, appDataLen);
- if (ret != HDF_SUCCESS) {
- HDF_LOGE("%{public}s: write appData failed!", __func__);
- ReleaseSbuf(data, reply);
- return ret;
- }
-
- ret = WriteEventData(data, eEvent, data1, data2);
- if (ret != HDF_SUCCESS) {
+ if (!HdfSbufWriteUint32(data, (uint32_t)event)) {
+ HDF_LOGE("%{public}s: write event failed!", __func__);
ReleaseSbuf(data, reply);
- return ret;
+ return HDF_ERR_INVALID_PARAM;
}
- ret = WriteArray(data, eventData, eventDataLen);
+ ret = WriteEventInfo(data, info);
if (ret != HDF_SUCCESS) {
- HDF_LOGE("%{public}s: write eventData failed!", __func__);
+ HDF_LOGE("%{public}s: write event info failed", __func__);
ReleaseSbuf(data, reply);
- return ret;
- }
-
- for (uint32_t i = 0; i < eventDataLen; i++) {
- if (!HdfSbufWriteInt8(data, eventData[i])) {
- HDF_LOGE("%{public}s: write eventData[i] failed!", __func__);
- ReleaseSbuf(data, reply);
- return HDF_ERR_INVALID_PARAM;
- }
+ return HDF_ERR_INVALID_PARAM;
}
ret = CodecCallbackTypeProxyCall(self, CMD_EVENT_HANDLER, data, reply);
diff --git a/codec/hal/src/codec_callback_type_service.c b/codec/hal/src/codec_callback_type_service.c
index 4efa283f309c9d5d89853d9871b285ec80f9200e..5f7faf8df886c82ebd7f284bc848ebf1bf45c427 100644
--- a/codec/hal/src/codec_callback_type_service.c
+++ b/codec/hal/src/codec_callback_type_service.c
@@ -19,8 +19,8 @@
#define HDF_LOG_TAG codec_hdi_cb_server
-int32_t CodecCallbackTypeEventHandler(struct CodecCallbackType *self, int8_t *appData, uint32_t appDataLen,
- enum OMX_EVENTTYPE eEvent, uint32_t data1, uint32_t data2, int8_t *eventData, uint32_t eventDataLen)
+int32_t CodecCallbackTypeEventHandler(struct CodecCallbackType *self, enum OMX_EVENTTYPE eEvent,
+ struct EventInfo *info)
{
HDF_LOGI("%{public}s, callback service impl", __func__);
return HDF_SUCCESS;
diff --git a/codec/hal/src/codec_callback_type_stub.c b/codec/hal/src/codec_callback_type_stub.c
index ede874f7d3fb40b5bf2c6014eef9dcfb51986d36..2dc9311f1c8ffe3d2ad395a12f20fe470c644d1d 100644
--- a/codec/hal/src/codec_callback_type_stub.c
+++ b/codec/hal/src/codec_callback_type_stub.c
@@ -58,80 +58,87 @@ static int32_t ReadArray(struct HdfSBuf *data, int8_t **array, uint32_t *arrayLe
return HDF_ERR_INVALID_PARAM;
}
- if (bufferLen > 0) {
- buffer = (int8_t*)OsalMemCalloc(sizeof(int8_t) * bufferLen);
- if (buffer == NULL) {
- return HDF_ERR_MALLOC_FAIL;
- }
+ if (bufferLen <= 0) {
+ *arrayLen = bufferLen;
+ return HDF_SUCCESS;
+ }
+
+ buffer = (int8_t*)OsalMemCalloc(sizeof(int8_t) * bufferLen);
+ if (buffer == NULL) {
+ return HDF_ERR_MALLOC_FAIL;
+ }
- for (uint32_t i = 0; i < bufferLen; i++) {
- if (!HdfSbufReadInt8(data, &buffer[i])) {
- HDF_LOGE("%{public}s: read &buffer[i] failed!", __func__);
- return HDF_ERR_INVALID_PARAM;
- }
+ for (uint32_t i = 0; i < bufferLen; i++) {
+ if (!HdfSbufReadInt8(data, &buffer[i])) {
+ HDF_LOGE("%{public}s: read &buffer[i] failed!", __func__);
+ OsalMemFree(buffer);
+ return HDF_ERR_INVALID_PARAM;
}
}
-
+
*array = buffer;
*arrayLen = bufferLen;
return HDF_SUCCESS;
}
-static int32_t SerStubEventHandler(struct CodecCallbackType *serviceImpl,
- struct HdfSBuf *data, struct HdfSBuf *reply)
+static int32_t ReadEventInfo(struct HdfSBuf *data, struct EventInfo *info)
{
int32_t ret;
- int8_t *appData = NULL;
- uint32_t appDataLen = 0;
- enum OMX_EVENTTYPE eEvent;
- uint32_t data1 = 0;
- uint32_t data2 = 0;
- int8_t *eventData = NULL;
- uint32_t eventDataLen = 0;
-
- ret = ReadArray(data, &appData, &appDataLen);
+ ret = ReadArray(data, &info->appData, &info->appDataLen);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%{public}s: read appData failed!", __func__);
- FreeMem(appData, appDataLen);
return ret;
}
- if (!HdfSbufReadUint32(data, (uint32_t*)&eEvent)) {
- HDF_LOGE("%{public}s: read &eEvent failed!", __func__);
- FreeMem(appData, appDataLen);
- return HDF_ERR_INVALID_PARAM;
- }
-
- if (!HdfSbufReadUint32(data, &data1)) {
+ if (!HdfSbufReadUint32(data, &info->data1)) {
HDF_LOGE("%{public}s: read &data1 failed!", __func__);
- FreeMem(appData, appDataLen);
+ FreeMem(info->appData, info->appDataLen);
return HDF_ERR_INVALID_PARAM;
}
- if (!HdfSbufReadUint32(data, &data2)) {
+ if (!HdfSbufReadUint32(data, &info->data2)) {
HDF_LOGE("%{public}s: read &data2 failed!", __func__);
- FreeMem(appData, appDataLen);
+ FreeMem(info->appData, info->appDataLen);
return HDF_ERR_INVALID_PARAM;
}
- ret = ReadArray(data, &eventData, &eventDataLen);
+ ret = ReadArray(data, &info->eventData, &info->eventDataLen);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%{public}s: read eventData failed!", __func__);
- FreeMem(appData, appDataLen);
- FreeMem(eventData, eventDataLen);
- return ret;
+ FreeMem(info->appData, info->appDataLen);
+ }
+ return ret;
+}
+
+static void ReleaseEventInfo(struct EventInfo *info)
+{
+ FreeMem(info->appData, info->appDataLen);
+ FreeMem(info->eventData, info->eventDataLen);
+}
+
+static int32_t SerStubEventHandler(struct CodecCallbackType *serviceImpl,
+ struct HdfSBuf *data, struct HdfSBuf *reply)
+{
+ int32_t ret;
+ enum OMX_EVENTTYPE event;
+ struct EventInfo info = {0};
+
+ if (!HdfSbufReadUint32(data, (uint32_t*)&event)) {
+ HDF_LOGE("%{public}s: read &event failed!", __func__);
+ return HDF_ERR_INVALID_PARAM;
}
- ret = serviceImpl->EventHandler(serviceImpl, appData, appDataLen, eEvent, data1, data2, eventData, eventDataLen);
+ ret = ReadEventInfo(data, &info);
+ if (ret != HDF_SUCCESS) {
+ HDF_LOGE("%{public}s: read &info failed!", __func__);
+ return HDF_ERR_INVALID_PARAM;
+ }
+
+ ret = serviceImpl->EventHandler(serviceImpl, event, &info);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%{public}s: call EventHandler function failed!", __func__);
- FreeMem(appData, appDataLen);
- FreeMem(eventData, eventDataLen);
- return ret;
}
-
- FreeMem(appData, appDataLen);
- FreeMem(eventData, eventDataLen);
+ ReleaseEventInfo(&info);
return ret;
}
diff --git a/codec/hal/src/codec_component_type_proxy.c b/codec/hal/src/codec_component_type_proxy.c
index a08b91863e887653817db973ca3ca5ffcc6175dd..13ed1054ef87b473367e8c669b747b72a665fc35 100644
--- a/codec/hal/src/codec_component_type_proxy.c
+++ b/codec/hal/src/codec_component_type_proxy.c
@@ -66,59 +66,23 @@ static int32_t CodecComponentTypeProxyCall(struct CodecComponentType *self, int3
return proxy->remote->dispatcher->Dispatch(proxy->remote, id, data, reply);
}
-static int32_t ReadValuesForGetComponentVersion(struct HdfSBuf *reply, char *compName,
- union OMX_VERSIONTYPE *compVersion, union OMX_VERSIONTYPE *specVersion, uint8_t *compUUID)
+static int32_t ReadValuesForGetComponentVersion(struct HdfSBuf *reply, struct CompVerInfo *verInfo)
{
int32_t ret;
-
- const char *componentNameCopy = HdfSbufReadString(reply);
- if (componentNameCopy == NULL) {
- HDF_LOGE("%{public}s: read componentNameCopy failed!", __func__);
- return HDF_ERR_INVALID_PARAM;
- }
- ret = strcpy_s(compName, OMX_MAX_STRINGNAME_SIZE, componentNameCopy);
- if (ret != EOK) {
- HDF_LOGE("%{public}s: strcpy_s compName failed, error code: %{public}d", __func__, ret);
- return HDF_FAILURE;
- }
-
- const union OMX_VERSIONTYPE *componentVersionCp
- = (union OMX_VERSIONTYPE *)HdfSbufReadUnpadBuffer(reply, sizeof(union OMX_VERSIONTYPE));
- if (componentVersionCp == NULL) {
- HDF_LOGE("%{public}s: read componentVersionCp failed!", __func__);
+ struct CompVerInfo *verInfoCp = (struct CompVerInfo *)HdfSbufReadUnpadBuffer(reply, sizeof(struct CompVerInfo));
+ if (verInfoCp == NULL) {
+ HDF_LOGE("%{public}s: read compVerInfo failed!", __func__);
return HDF_ERR_INVALID_PARAM;
}
- ret = memcpy_s(compVersion, sizeof(union OMX_VERSIONTYPE), componentVersionCp, sizeof(union OMX_VERSIONTYPE));
+ ret = memcpy_s(verInfo, sizeof(struct CompVerInfo), verInfoCp, sizeof(struct CompVerInfo));
if (ret != EOK) {
HDF_LOGE("%{public}s: memcpy_s compVersion failed, error code: %{public}d", __func__, ret);
return HDF_FAILURE;
}
-
- const union OMX_VERSIONTYPE *specVersionCp
- = (union OMX_VERSIONTYPE *)HdfSbufReadUnpadBuffer(reply, sizeof(union OMX_VERSIONTYPE));
- if (specVersionCp == NULL) {
- HDF_LOGE("%{public}s: read specVersionCp failed!", __func__);
- return HDF_ERR_INVALID_PARAM;
- }
- ret = memcpy_s(specVersion, sizeof(union OMX_VERSIONTYPE), specVersionCp, sizeof(union OMX_VERSIONTYPE));
- if (ret != EOK) {
- HDF_LOGE("%{public}s: memcpy_s specVersion failed, error code: %{public}d", __func__, ret);
- return HDF_FAILURE;
- }
-
- uint32_t compUUIDLen = sizeof(OMX_UUIDTYPE);
- for (uint32_t i = 0; i < compUUIDLen; i++) {
- if (!HdfSbufReadUint8(reply, &compUUID[i])) {
- HDF_LOGE("%{public}s: read compUUID[i] failed!", __func__);
- return HDF_ERR_INVALID_PARAM;
- }
- }
-
return HDF_SUCCESS;
}
-static int32_t CodecComponentTypeProxyGetComponentVersion(struct CodecComponentType *self, char *compName,
- union OMX_VERSIONTYPE *compVersion, union OMX_VERSIONTYPE *specVersion, uint8_t *compUUID, uint32_t compUUIDLen)
+static int32_t CodecComponentTypeProxyGetComponentVersion(struct CodecComponentType *self, struct CompVerInfo *verInfo)
{
int32_t ret;
@@ -136,12 +100,6 @@ static int32_t CodecComponentTypeProxyGetComponentVersion(struct CodecComponentT
return HDF_FAILURE;
}
- if (!HdfSbufWriteUint32(data, compUUIDLen)) {
- HDF_LOGE("%{public}s: write compUUIDLen failed!", __func__);
- ReleaseSbuf(data, reply);
- return HDF_ERR_INVALID_PARAM;
- }
-
ret = CodecComponentTypeProxyCall(self, CMD_GET_COMPONENT_VERSION, data, reply);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%{public}s: call failed! error code is %{public}d", __func__, ret);
@@ -149,7 +107,7 @@ static int32_t CodecComponentTypeProxyGetComponentVersion(struct CodecComponentT
return ret;
}
- ret = ReadValuesForGetComponentVersion(reply, compName, compVersion, specVersion, compUUID);
+ ret = ReadValuesForGetComponentVersion(reply, verInfo);
ReleaseSbuf(data, reply);
return ret;
}
@@ -610,7 +568,7 @@ static int32_t CodecComponentTypeProxyUseBuffer(struct CodecComponentType *self,
}
static int32_t CodecComponentTypeProxyAllocateBuffer(struct CodecComponentType *self,
- struct OmxCodecBuffer *buffer, uint32_t portIndex)
+ uint32_t portIndex, struct OmxCodecBuffer *buffer)
{
int32_t ret;
@@ -628,14 +586,14 @@ static int32_t CodecComponentTypeProxyAllocateBuffer(struct CodecComponentType *
return HDF_FAILURE;
}
- if (!OmxCodecBufferBlockMarshalling(data, buffer)) {
- HDF_LOGE("%{public}s: write buffer failed!", __func__);
+ if (!HdfSbufWriteUint32(data, portIndex)) {
+ HDF_LOGE("%{public}s: write portIndex failed!", __func__);
ReleaseSbuf(data, reply);
return HDF_ERR_INVALID_PARAM;
}
- if (!HdfSbufWriteUint32(data, portIndex)) {
- HDF_LOGE("%{public}s: write portIndex failed!", __func__);
+ if (!OmxCodecBufferBlockMarshalling(data, buffer)) {
+ HDF_LOGE("%{public}s: write buffer failed!", __func__);
ReleaseSbuf(data, reply);
return HDF_ERR_INVALID_PARAM;
}
diff --git a/codec/hal/src/codec_component_type_service.c b/codec/hal/src/codec_component_type_service.c
index 894968e2eb43644971ec17bc4c4ee2b7df0fd912..7738edc4f265aeaebef58d6fd5e263d8078a0171 100644
--- a/codec/hal/src/codec_component_type_service.c
+++ b/codec/hal/src/codec_component_type_service.c
@@ -32,9 +32,7 @@ int32_t OmxManagerDestroyComponent(OMX_HANDLETYPE compHandle)
return HDF_SUCCESS;
}
-int32_t CodecComponentTypeGetComponentVersion(struct CodecComponentType *self,
- char* compName, union OMX_VERSIONTYPE *compVersion, union OMX_VERSIONTYPE *specVersion,
- uint8_t *compUUID, uint32_t compUUIDLen)
+int32_t CodecComponentTypeGetComponentVersion(struct CodecComponentType *self, struct CompVerInfo *verInfo)
{
HDF_LOGI("%{public}s, service impl!", __func__);
return HDF_SUCCESS;
@@ -105,7 +103,7 @@ int32_t CodecComponentTypeUseBuffer(struct CodecComponentType *self,
}
int32_t CodecComponentTypeAllocateBuffer(struct CodecComponentType *self,
- struct OmxCodecBuffer *buffer, uint32_t portIndex)
+ uint32_t portIndex, struct OmxCodecBuffer *buffer)
{
HDF_LOGI("%{public}s, service impl!", __func__);
return HDF_SUCCESS;
diff --git a/codec/hal/src/codec_component_type_stub.c b/codec/hal/src/codec_component_type_stub.c
index e4664d45572f1ef4eccb48890ed02d09110aca1a..ed8ac226aa83a82d2c744e510f61535966fc7c96 100644
--- a/codec/hal/src/codec_component_type_stub.c
+++ b/codec/hal/src/codec_component_type_stub.c
@@ -34,8 +34,6 @@
typedef void (*SERVICE_CONSTRUCT_FUNC)(struct OmxComponentManager *, struct CodecComponentType *);
-static const int COMPONENT_NAME_LENGTH = 128;
-
static void FreeMem(int8_t *mem, uint32_t memLen)
{
if (memLen > 0 && mem != NULL) {
@@ -151,56 +149,18 @@ static int32_t SerStubGetComponentVersion(struct CodecComponentTypeStub *stub,
struct HdfSBuf *data, struct HdfSBuf *reply)
{
int32_t ret;
- char compName[COMPONENT_NAME_LENGTH] = {0};
- union OMX_VERSIONTYPE compVersion;
- union OMX_VERSIONTYPE specVersion;
- uint8_t *compUUID = NULL;
- uint32_t compUUIDLen = 0;
+ struct CompVerInfo verInfo = {0};
- if (!HdfSbufReadUint32(data, &compUUIDLen)) {
- HDF_LOGE("%{public}s: read compUUIDLen failed!", __func__);
- return HDF_ERR_INVALID_PARAM;
- }
- compUUID = (uint8_t*)OsalMemCalloc(sizeof(uint8_t) * (compUUIDLen));
- if (compUUID == NULL) {
- HDF_LOGE("%{public}s: HDF_ERR_MALLOC_FAIL!", __func__);
- return HDF_ERR_MALLOC_FAIL;
- }
- ret = stub->service.GetComponentVersion(&stub->service, compName,
- &compVersion, &specVersion, compUUID, compUUIDLen);
+ ret = stub->service.GetComponentVersion(&stub->service, &verInfo);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%{public}s: call GetComponentVersion function failed!", __func__);
- FreeMem((int8_t*)compUUID, compUUIDLen);
return ret;
}
-
- if (!HdfSbufWriteString(reply, compName)) {
- HDF_LOGE("%{public}s: write compName failed!", __func__);
- FreeMem((int8_t*)compUUID, compUUIDLen);
- return HDF_ERR_INVALID_PARAM;
- }
-
- if (!HdfSbufWriteUnpadBuffer(reply, (const uint8_t *)&compVersion, sizeof(union OMX_VERSIONTYPE))) {
- HDF_LOGE("%{public}s: write compVersion failed!", __func__);
- FreeMem((int8_t*)compUUID, compUUIDLen);
+ if (!HdfSbufWriteUnpadBuffer(reply, (const uint8_t *)&verInfo, sizeof(struct CompVerInfo))) {
+ HDF_LOGE("%{public}s: write verInfo failed!", __func__);
return HDF_ERR_INVALID_PARAM;
}
- if (!HdfSbufWriteUnpadBuffer(reply, (const uint8_t *)&specVersion, sizeof(union OMX_VERSIONTYPE))) {
- HDF_LOGE("%{public}s: write specVersion failed!", __func__);
- FreeMem((int8_t*)compUUID, compUUIDLen);
- return HDF_ERR_INVALID_PARAM;
- }
-
- for (uint32_t i = 0; i < compUUIDLen; i++) {
- if (!HdfSbufWriteUint8(reply, compUUID[i])) {
- HDF_LOGE("%{public}s: write compUUID[i] failed!", __func__);
- FreeMem((int8_t*)compUUID, compUUIDLen);
- return HDF_ERR_INVALID_PARAM;
- }
- }
-
- FreeMem((int8_t*)compUUID, compUUIDLen);
return HDF_SUCCESS;
}
@@ -571,17 +531,17 @@ static int32_t SerStubAllocateBuffer(struct CodecComponentTypeStub *stub,
struct OmxCodecBuffer buffer;
uint32_t portIndex = 0;
- if (!OmxCodecBufferBlockUnmarshalling(data, &buffer)) {
- HDF_LOGE("%{public}s: read buffer failed!", __func__);
- return HDF_ERR_INVALID_PARAM;
- }
-
if (!HdfSbufReadUint32(data, &portIndex)) {
HDF_LOGE("%{public}s: read &portIndex failed!", __func__);
return HDF_ERR_INVALID_PARAM;
}
- ret = stub->service.AllocateBuffer(&stub->service, &buffer, portIndex);
+ if (!OmxCodecBufferBlockUnmarshalling(data, &buffer)) {
+ HDF_LOGE("%{public}s: read buffer failed!", __func__);
+ return HDF_ERR_INVALID_PARAM;
+ }
+
+ ret = stub->service.AllocateBuffer(&stub->service, portIndex, &buffer);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%{public}s: call AllocateBuffer function failed!", __func__);
return ret;
diff --git a/codec/hal/src/codec_types.c b/codec/hal/src/codec_types.c
index e78d4d3a1f82e8b9c7731edc20e54a13616e86cb..907e3772e456dc22fbe16565cae6409460ba53f8 100644
--- a/codec/hal/src/codec_types.c
+++ b/codec/hal/src/codec_types.c
@@ -73,6 +73,9 @@ static bool CodecBufferMarshalling(struct HdfSBuf *data, const struct OmxCodecBu
HDF_LOGE("%{public}s: write dataBlock->bufferLen failed!", __func__);
return false;
}
+ if (dataBlock->bufferLen <= 0) {
+ return true;
+ }
if (dataBlock->bufferType == BUFFER_TYPE_AVSHARE_MEM_FD) {
int32_t fd = (int32_t)dataBlock->buffer;
@@ -163,7 +166,10 @@ static bool CodecBufferUnmarshalling(struct HdfSBuf *data, struct OmxCodecBuffer
return false;
}
dataBlock->bufferLen = bufferCpLen;
-
+ if (dataBlock->bufferLen <= 0) {
+ dataBlock->buffer = NULL;
+ return true;
+ }
if (dataBlock->bufferType == BUFFER_TYPE_AVSHARE_MEM_FD) {
int32_t fd = HdfSbufReadFileDescriptor(data);
if (fd < 0) {
diff --git a/codec/interfaces/include/codec_callback_if.h b/codec/interfaces/include/codec_callback_if.h
index 6953f68658a1b4cbac9a9e20756670b23d5af960..ef331229ca7597c46e7dc4e80c89b16d04834f09 100644
--- a/codec/interfaces/include/codec_callback_if.h
+++ b/codec/interfaces/include/codec_callback_if.h
@@ -79,21 +79,15 @@ struct CodecCallbackType {
* the values of data1, data2, and eventData are 0.
*
* @param self Indicates the pointer to the callback to be invoked.
- * @param appData Indicates the pointer to the upper-layer instance passed to the callback.
- * @param appDataLen Indicates the length of appData, in bytes.
- * @param eEvent Indicates the type of events to report. For details, see {@link OMX_EVENTTYPE}.
- * @param data1 Indicates data 1 carried in the event.
- * @param data2 Indicates data 2 carried in the event.
- * @param eventData Indicates the pointer to the data carried in the event.
- * @param eventDataLen Indicates the length of eventData, in bytes.
+ * @param event Indicates the type of events to report. For details, see {@link OMX_EVENTTYPE}.
+ * @param info Indicates the pointer to event info. For detials see{@link EventInfo}.
*
* @return Returns HDF_SUCCESS if the operation is successful.
* @return Returns HDF_ERR_INVALID_PARAM if the operation failed due to invalid parameters.
* @return Returns HDF_ERR_INVALID_OBJECT if the operation failed due to invalid objects.
* @return Returns HDF_ERR_MALLOC_FAIL if the operation failed due to insufficient memory.
*/
- int32_t (*EventHandler)(struct CodecCallbackType *self, int8_t *appData, uint32_t appDataLen,
- enum OMX_EVENTTYPE eEvent, uint32_t data1, uint32_t data2, int8_t *eventData, uint32_t eventDataLen);
+ int32_t (*EventHandler)(struct CodecCallbackType *self, enum OMX_EVENTTYPE event, struct EventInfo *info);
/**
* @brief Reports an event indicating that the encoding or decoding in the input buffer is complete.
diff --git a/codec/interfaces/include/codec_component_if.h b/codec/interfaces/include/codec_component_if.h
index 2adb7aaaa00b3001951cae3ee19a945f2cc608f5..502210e143871a730225e574d29de1facf811fc2 100644
--- a/codec/interfaces/include/codec_component_if.h
+++ b/codec/interfaces/include/codec_component_if.h
@@ -64,21 +64,14 @@ struct CodecComponentType {
* @brief Obtains the version of a codec component.
*
* @param self Indicates the pointer to the target codec component.
- * @param compName Indicates the pointer to the component name.
- * @param compVersion Indicates the pointer to the OMX component version. For details, see {@link OMX_VERSIONTYPE}.
- * @param specVersion Indicates the pointer to the version information of the specifications based on which the
- * component is built. For details, see {@link OMX_VERSIONTYPE}.
- * @param compUUID Indicates the pointer to the UUID that uniquely identifies the component.
- * @param compUUIDLen Indicates the length of compUUID, in bytes.
+ * @param verInfo Indicates info of the component. For details, see {@link CompVerInfo}
*
* @return Returns HDF_SUCCESS if the operation is successful.
* @return Returns HDF_ERR_INVALID_PARAM if the operation failed due to invalid parameters.
* @return Returns HDF_ERR_INVALID_OBJECT if the operation failed due to invalid objects.
* @return Returns HDF_ERR_MALLOC_FAIL if the operation failed due to insufficient memory.
*/
- int32_t (*GetComponentVersion)(struct CodecComponentType *self, char *compName,
- union OMX_VERSIONTYPE *compVersion, union OMX_VERSIONTYPE *specVersion,
- uint8_t *compUUID, uint32_t compUUIDLen);
+ int32_t (*GetComponentVersion)(struct CodecComponentType *self, struct CompVerInfo *verInfo);
/**
* @brief Sends a command to a component.
@@ -261,15 +254,15 @@ struct CodecComponentType {
* The component is in the OMX_StateExecuting, OMX_StatePause, or OMX_StateIdle state on a disabled port.
*
* @param self Indicates the pointer to the target codec component.
- * @param buffer Indicates the pointer to the buffer requested. For details, see {@link OmxCodecBuffer}.
* @param portIndex Indicates the port of the component.
+ * @param buffer Indicates the pointer to the buffer requested. For details, see {@link OmxCodecBuffer}.
*
* @return Returns HDF_SUCCESS if the operation is successful.
* @return Returns HDF_ERR_INVALID_PARAM if the operation failed due to invalid parameters.
* @return Returns HDF_ERR_INVALID_OBJECT if the operation failed due to invalid objects.
* @return Returns HDF_ERR_MALLOC_FAIL if the operation failed due to insufficient memory.
*/
- int32_t (*AllocateBuffer)(struct CodecComponentType *self, struct OmxCodecBuffer *buffer, uint32_t portIndex);
+ int32_t (*AllocateBuffer)(struct CodecComponentType *self, uint32_t portIndex, struct OmxCodecBuffer *buffer);
/**
* @brief Releases a buffer.
diff --git a/codec/interfaces/include/codec_component_type.h b/codec/interfaces/include/codec_component_type.h
index fa7d4e2afb4d1425d1a5c409ff7373bb2fc4d700..404fde205d9d07782acdd108823d5e69ada100bc 100644
--- a/codec/interfaces/include/codec_component_type.h
+++ b/codec/interfaces/include/codec_component_type.h
@@ -52,7 +52,7 @@ extern "C" {
* @brief Defines the maximum value of the sampling format.
*/
#define SAMPLE_FMT_NUM 32
-
+#define UUID_LENGTH 128
/**
* @brief Enumerates the codec types.
*/
@@ -362,6 +362,35 @@ enum OmxIndexCodecExType {
OMX_IndexParamGetBufferHandleUsage,
};
+/**
+ * @brief Enumerates the extended codec codingtyps.
+ */
+enum OmxVideoExType {
+ OMX_VIDEO_CodingHEVC = 11, /** HEVC Index in Codec HDI */
+};
+
+/**
+ * @brief Defines the CompVerInfo.
+ */
+struct CompVerInfo {
+ char compName[NAME_LENGTH]; /** The name of the component */
+ uint8_t compUUID[UUID_LENGTH]; /** The UUID of the component */
+ union OMX_VERSIONTYPE compVersion; /** The version of the component. For details, see {@link OMX_VERSIONTYPE}. */
+ union OMX_VERSIONTYPE specVersion; /** The spec version of the component. */
+};
+
+/**
+ * @brief Defines the EventInfo.
+ */
+struct EventInfo {
+ int8_t *appData; /** The pointer to the upper-layer instance passed to the callback */
+ uint32_t appDataLen; /** The length of appData, in bytes. */
+ uint32_t data1; /** Data 1 carried in the event. */
+ uint32_t data2; /** Data 2 carried in the event. */
+ int8_t *eventData; /** The pointer of data carried in the event. */
+ uint32_t eventDataLen; /** The length of eventData, in bytes. */
+};
+
/**
* @brief Defines the SupportBuffer.
*/
diff --git a/codec/test/unittest/hdi_omx/codec_hdi_omx_test.cpp b/codec/test/unittest/hdi_omx/codec_hdi_omx_test.cpp
index 534c951127aae186f42671a633df68ee09417a73..3e1548f698812e2f1b6abb906c655dcaf62b079e 100644
--- a/codec/test/unittest/hdi_omx/codec_hdi_omx_test.cpp
+++ b/codec/test/unittest/hdi_omx/codec_hdi_omx_test.cpp
@@ -179,21 +179,15 @@ HWTEST_F(CodecHdiOmxTest, HdfCodecHdiOmxTest_003, TestSize.Level1)
HWTEST_F(CodecHdiOmxTest, HdfCodecHdiOmxTest_004, TestSize.Level1)
{
- const int32_t componentNameLength = 128;
- const int32_t componentUuidLength = 128;
const uint32_t compVersionNum = 10;
const uint32_t specVersionNum = 1;
const uint8_t uuidValue = 127;
- char compName[componentNameLength];
- OMX_VERSIONTYPE compVersion;
- OMX_VERSIONTYPE specVersion;
- unsigned char compUuid[componentUuidLength];
- int32_t ret = g_component->GetComponentVersion(g_component, compName, &compVersion, &specVersion,
- compUuid, componentUuidLength);
+ struct CompVerInfo verInfo;
+ int32_t ret = g_component->GetComponentVersion(g_component, &verInfo);
ASSERT_EQ(ret, HDF_SUCCESS);
- ASSERT_EQ(compVersion.nVersion, compVersionNum);
- ASSERT_EQ(specVersion.nVersion, specVersionNum);
- ASSERT_EQ(compUuid[0], uuidValue);
+ ASSERT_EQ(verInfo.compVersion.nVersion, compVersionNum);
+ ASSERT_EQ(verInfo.specVersion.nVersion, specVersionNum);
+ ASSERT_EQ(verInfo.compUUID[0], uuidValue);
}
HWTEST_F(CodecHdiOmxTest, HdfCodecHdiOmxTest_005, TestSize.Level1)
@@ -296,7 +290,7 @@ HWTEST_F(CodecHdiOmxTest, HdfCodecHdiOmxTest_014, TestSize.Level1)
const uint32_t bufferId = 11;
struct OmxCodecBuffer buffer;
FillDataOmxCodecBuffer(&buffer);
- int32_t ret = g_component->AllocateBuffer(g_component, &buffer, portIndex);
+ int32_t ret = g_component->AllocateBuffer(g_component, portIndex, &buffer);
ASSERT_EQ(buffer.bufferId, bufferId);
ASSERT_EQ(ret, HDF_SUCCESS);
}