From 25f4395b932fa9859a6e91ba77c5d20d009da64a Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Wed, 28 Jul 2010 05:40:18 -0700 Subject: Audio effects: modified command() parameter types. The type of the cmd, cmdSize and *pReplySize parameters of the effect control interface command() function have been modified from int to uint32_t. This is more consistent with their role. Change-Id: I84d289fc262d6753747910f06f485597dfee6591 --- media/libmedia/AudioEffect.cpp | 20 ++++++++++++++------ media/libmedia/IEffect.cpp | 14 +++++++++----- media/libmedia/IEffectClient.cpp | 12 ++++++++---- media/libmedia/Visualizer.cpp | 2 +- 4 files changed, 32 insertions(+), 16 deletions(-) (limited to 'media/libmedia') diff --git a/media/libmedia/AudioEffect.cpp b/media/libmedia/AudioEffect.cpp index df0f73b..3cdf48a 100644 --- a/media/libmedia/AudioEffect.cpp +++ b/media/libmedia/AudioEffect.cpp @@ -221,7 +221,11 @@ status_t AudioEffect::setEnabled(bool enabled) return INVALID_OPERATION; } -status_t AudioEffect::command(int32_t cmdCode, int32_t cmdSize, void *cmdData, int32_t *replySize, void *replyData) +status_t AudioEffect::command(uint32_t cmdCode, + uint32_t cmdSize, + void *cmdData, + uint32_t *replySize, + void *replyData) { if (mStatus != NO_ERROR && mStatus != ALREADY_EXISTS) { return INVALID_OPERATION; @@ -241,8 +245,8 @@ status_t AudioEffect::setParameter(effect_param_t *param) return BAD_VALUE; } - int size = sizeof(int); - int psize = ((param->psize - 1) / sizeof(int) + 1) * sizeof(int) + param->vsize; + uint32_t size = sizeof(int); + uint32_t psize = ((param->psize - 1) / sizeof(int) + 1) * sizeof(int) + param->vsize; LOGV("setParameter: param: %d, param2: %d", *(int *)param->data, (param->psize == 8) ? *((int *)param->data + 1): -1); @@ -285,7 +289,7 @@ status_t AudioEffect::setParameterCommit() if (mCblk->clientIndex == 0) { return INVALID_OPERATION; } - int size = 0; + uint32_t size = 0; return mIEffect->command(EFFECT_CMD_SET_PARAM_COMMIT, 0, NULL, &size, NULL); } @@ -301,7 +305,7 @@ status_t AudioEffect::getParameter(effect_param_t *param) LOGV("getParameter: param: %d, param2: %d", *(int *)param->data, (param->psize == 8) ? *((int *)param->data + 1): -1); - int psize = sizeof(effect_param_t) + ((param->psize - 1) / sizeof(int) + 1) * sizeof(int) + param->vsize; + uint32_t psize = sizeof(effect_param_t) + ((param->psize - 1) / sizeof(int) + 1) * sizeof(int) + param->vsize; return mIEffect->command(EFFECT_CMD_GET_PARAM, sizeof(effect_param_t) + param->psize, param, &psize, param); } @@ -350,7 +354,11 @@ void AudioEffect::enableStatusChanged(bool enabled) } } -void AudioEffect::commandExecuted(int cmdCode, int cmdSize, void *cmdData, int replySize, void *replyData) +void AudioEffect::commandExecuted(uint32_t cmdCode, + uint32_t cmdSize, + void *cmdData, + uint32_t replySize, + void *replyData) { if (cmdData == NULL || replyData == NULL) { return; diff --git a/media/libmedia/IEffect.cpp b/media/libmedia/IEffect.cpp index 8e3ac71..a945b97 100644 --- a/media/libmedia/IEffect.cpp +++ b/media/libmedia/IEffect.cpp @@ -59,7 +59,11 @@ public: return reply.readInt32(); } - status_t command(int cmdCode, int cmdSize, void *pCmdData, int *pReplySize, void *pReplyData) + status_t command(uint32_t cmdCode, + uint32_t cmdSize, + void *pCmdData, + uint32_t *pReplySize, + void *pReplyData) { LOGV("command"); Parcel data, reply; @@ -136,15 +140,15 @@ status_t BnEffect::onTransact( case COMMAND: { LOGV("COMMAND"); CHECK_INTERFACE(IEffect, data, reply); - int cmdCode = data.readInt32(); - int cmdSize = data.readInt32(); + uint32_t cmdCode = data.readInt32(); + uint32_t cmdSize = data.readInt32(); char *cmd = NULL; if (cmdSize) { cmd = (char *)malloc(cmdSize); data.read(cmd, cmdSize); } - int replySize = data.readInt32(); - int replySz = replySize; + uint32_t replySize = data.readInt32(); + uint32_t replySz = replySize; char *resp = NULL; if (replySize) { resp = (char *)malloc(replySize); diff --git a/media/libmedia/IEffectClient.cpp b/media/libmedia/IEffectClient.cpp index e7659ae..1fa9cbe 100644 --- a/media/libmedia/IEffectClient.cpp +++ b/media/libmedia/IEffectClient.cpp @@ -56,7 +56,11 @@ public: remote()->transact(ENABLE_STATUS_CHANGED, data, &reply, IBinder::FLAG_ONEWAY); } - void commandExecuted(int cmdCode, int cmdSize, void *pCmdData, int replySize, void *pReplyData) + void commandExecuted(uint32_t cmdCode, + uint32_t cmdSize, + void *pCmdData, + uint32_t replySize, + void *pReplyData) { LOGV("commandExecuted"); Parcel data, reply; @@ -108,14 +112,14 @@ status_t BnEffectClient::onTransact( case COMMAND_EXECUTED: { LOGV("COMMAND_EXECUTED"); CHECK_INTERFACE(IEffectClient, data, reply); - int cmdCode = data.readInt32(); - int cmdSize = data.readInt32(); + uint32_t cmdCode = data.readInt32(); + uint32_t cmdSize = data.readInt32(); char *cmd = NULL; if (cmdSize) { cmd = (char *)malloc(cmdSize); data.read(cmd, cmdSize); } - int replySize = data.readInt32(); + uint32_t replySize = data.readInt32(); char *resp = NULL; if (replySize) { resp = (char *)malloc(replySize); diff --git a/media/libmedia/Visualizer.cpp b/media/libmedia/Visualizer.cpp index 47e96e5..32cdb49 100644 --- a/media/libmedia/Visualizer.cpp +++ b/media/libmedia/Visualizer.cpp @@ -184,7 +184,7 @@ status_t Visualizer::getWaveForm(uint8_t *waveform) status_t status = NO_ERROR; if (mEnabled) { - int32_t replySize = mCaptureSize; + uint32_t replySize = mCaptureSize; status_t status = command(VISU_CMD_CAPTURE, 0, NULL, &replySize, waveform); if (replySize == 0) { status = NOT_ENOUGH_DATA; -- cgit v1.1