summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/ACodec.cpp
diff options
context:
space:
mode:
authorAndy Hung <hunga@google.com>2014-05-02 11:05:04 -0700
committerGlenn Kasten <gkasten@android.com>2014-06-12 13:26:03 -0700
commit8b1be2ca7cee71a4920d5d31fdcbad2b1d4ca49d (patch)
tree6a22d7fcaacca08ef7b79c20bd0e6b3e72d9e7f0 /media/libstagefright/ACodec.cpp
parentc323737dd46d724b4c1ec230b283f26ae2a22b4f (diff)
downloadframeworks_av-8b1be2ca7cee71a4920d5d31fdcbad2b1d4ca49d.zip
frameworks_av-8b1be2ca7cee71a4920d5d31fdcbad2b1d4ca49d.tar.gz
frameworks_av-8b1be2ca7cee71a4920d5d31fdcbad2b1d4ca49d.tar.bz2
Update OMX messages for 64 bit
Change node_id and buffer_id to uint32_t. Ensure IOMX messages are fixed size. Remove 64 bit compile warnings in associated files. Change-Id: Icdbef00aca575e5dc502ebb52e3ce7d0d7883203 Signed-off-by: Andy Hung <hunga@google.com>
Diffstat (limited to 'media/libstagefright/ACodec.cpp')
-rw-r--r--media/libstagefright/ACodec.cpp57
1 files changed, 28 insertions, 29 deletions
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index f5fb622..ed1de58 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -17,6 +17,7 @@
//#define LOG_NDEBUG 0
#define LOG_TAG "ACodec"
+#include <inttypes.h>
#include <utils/Trace.h>
#include <media/stagefright/ACodec.h>
@@ -64,7 +65,7 @@ struct CodecObserver : public BnOMXObserver {
sp<AMessage> msg = mNotify->dup();
msg->setInt32("type", omx_msg.type);
- msg->setPointer("node", omx_msg.node);
+ msg->setInt32("node", omx_msg.node);
switch (omx_msg.type) {
case omx_message::EVENT:
@@ -77,13 +78,13 @@ struct CodecObserver : public BnOMXObserver {
case omx_message::EMPTY_BUFFER_DONE:
{
- msg->setPointer("buffer", omx_msg.u.buffer_data.buffer);
+ msg->setInt32("buffer", omx_msg.u.buffer_data.buffer);
break;
}
case omx_message::FILL_BUFFER_DONE:
{
- msg->setPointer(
+ msg->setInt32(
"buffer", omx_msg.u.extended_buffer_data.buffer);
msg->setInt32(
"range_offset",
@@ -360,7 +361,7 @@ private:
ACodec::ACodec()
: mQuirks(0),
- mNode(NULL),
+ mNode(0),
mSentFormat(false),
mIsEncoder(false),
mUseMetadataOnEncoderOutput(false),
@@ -374,7 +375,7 @@ ACodec::ACodec()
mStoreMetaDataInOutputBuffers(false),
mMetaDataBuffersToSubmit(0),
mRepeatFrameDelayUs(-1ll),
- mMaxPtsGapUs(-1l) {
+ mMaxPtsGapUs(-1ll) {
mUninitializedState = new UninitializedState(this);
mLoadedState = new LoadedState(this);
mLoadedToIdleState = new LoadedToIdleState(this);
@@ -490,7 +491,7 @@ status_t ACodec::allocateBuffersOnPort(OMX_U32 portIndex) {
mNode, OMX_IndexParamPortDefinition, &def, sizeof(def));
if (err == OK) {
- ALOGV("[%s] Allocating %lu buffers of size %lu on %s port",
+ ALOGV("[%s] Allocating %u buffers of size %u on %s port",
mComponentName.c_str(),
def.nBufferCountActual, def.nBufferSize,
portIndex == kPortIndexInput ? "input" : "output");
@@ -664,7 +665,7 @@ status_t ACodec::configureOutputBuffersFromNativeWindow(
break;
}
- ALOGW("[%s] setting nBufferCountActual to %lu failed: %d",
+ ALOGW("[%s] setting nBufferCountActual to %u failed: %d",
mComponentName.c_str(), newBufferCount, err);
/* exit condition */
if (extraBuffers == 0) {
@@ -694,7 +695,7 @@ status_t ACodec::allocateOutputBuffersFromNativeWindow() {
return err;
mNumUndequeuedBuffers = minUndequeuedBuffers;
- ALOGV("[%s] Allocating %lu buffers from a native window of size %lu on "
+ ALOGV("[%s] Allocating %u buffers from a native window of size %u on "
"output port",
mComponentName.c_str(), bufferCount, bufferSize);
@@ -718,14 +719,14 @@ status_t ACodec::allocateOutputBuffersFromNativeWindow() {
err = mOMX->useGraphicBuffer(mNode, kPortIndexOutput, graphicBuffer,
&bufferId);
if (err != 0) {
- ALOGE("registering GraphicBuffer %lu with OMX IL component failed: "
+ ALOGE("registering GraphicBuffer %u with OMX IL component failed: "
"%d", i, err);
break;
}
mBuffers[kPortIndexOutput].editItemAt(i).mBufferID = bufferId;
- ALOGV("[%s] Registered graphic buffer with ID %p (pointer = %p)",
+ ALOGV("[%s] Registered graphic buffer with ID %u (pointer = %p)",
mComponentName.c_str(),
bufferId, graphicBuffer.get());
}
@@ -760,7 +761,7 @@ status_t ACodec::allocateOutputMetaDataBuffers() {
return err;
mNumUndequeuedBuffers = minUndequeuedBuffers;
- ALOGV("[%s] Allocating %lu meta buffers on output port",
+ ALOGV("[%s] Allocating %u meta buffers on output port",
mComponentName.c_str(), bufferCount);
size_t totalSize = bufferCount * 8;
@@ -784,7 +785,7 @@ status_t ACodec::allocateOutputMetaDataBuffers() {
mBuffers[kPortIndexOutput].push(info);
- ALOGV("[%s] allocated meta buffer with ID %p (pointer = %p)",
+ ALOGV("[%s] allocated meta buffer with ID %u (pointer = %p)",
mComponentName.c_str(), info.mBufferID, mem->pointer());
}
@@ -801,7 +802,7 @@ status_t ACodec::submitOutputMetaDataBuffer() {
if (info == NULL)
return ERROR_IO;
- ALOGV("[%s] submitting output meta buffer ID %p for graphic buffer %p",
+ ALOGV("[%s] submitting output meta buffer ID %u for graphic buffer %p",
mComponentName.c_str(), info->mBufferID, info->mGraphicBuffer.get());
--mMetaDataBuffersToSubmit;
@@ -815,7 +816,7 @@ status_t ACodec::submitOutputMetaDataBuffer() {
status_t ACodec::cancelBufferToNativeWindow(BufferInfo *info) {
CHECK_EQ((int)info->mStatus, (int)BufferInfo::OWNED_BY_US);
- ALOGV("[%s] Calling cancelBuffer on buffer %p",
+ ALOGV("[%s] Calling cancelBuffer on buffer %u",
mComponentName.c_str(), info->mBufferID);
int err = mNativeWindow->cancelBuffer(
@@ -2465,7 +2466,7 @@ bool ACodec::allYourBuffersAreBelongToUs(
if (info->mStatus != BufferInfo::OWNED_BY_US
&& info->mStatus != BufferInfo::OWNED_BY_NATIVE_WINDOW) {
- ALOGV("[%s] Buffer %p on port %ld still has status %d",
+ ALOGV("[%s] Buffer %u on port %u still has status %d",
mComponentName.c_str(),
info->mBufferID, portIndex, info->mStatus);
return false;
@@ -2947,7 +2948,7 @@ bool ACodec::BaseState::onOMXMessage(const sp<AMessage> &msg) {
CHECK(msg->findInt32("type", &type));
IOMX::node_id nodeID;
- CHECK(msg->findPointer("node", &nodeID));
+ CHECK(msg->findInt32("node", (int32_t*)&nodeID));
CHECK_EQ(nodeID, mCodec->mNode);
switch (type) {
@@ -2978,7 +2979,7 @@ bool ACodec::BaseState::onOMXMessage(const sp<AMessage> &msg) {
case omx_message::EMPTY_BUFFER_DONE:
{
IOMX::buffer_id bufferID;
- CHECK(msg->findPointer("buffer", &bufferID));
+ CHECK(msg->findInt32("buffer", (int32_t*)&bufferID));
return onOMXEmptyBufferDone(bufferID);
}
@@ -2986,7 +2987,7 @@ bool ACodec::BaseState::onOMXMessage(const sp<AMessage> &msg) {
case omx_message::FILL_BUFFER_DONE:
{
IOMX::buffer_id bufferID;
- CHECK(msg->findPointer("buffer", &bufferID));
+ CHECK(msg->findInt32("buffer", (int32_t*)&bufferID));
int32_t rangeOffset, rangeLength, flags;
int64_t timeUs;
@@ -3089,13 +3090,13 @@ void ACodec::BaseState::postFillThisBuffer(BufferInfo *info) {
sp<AMessage> notify = mCodec->mNotify->dup();
notify->setInt32("what", ACodec::kWhatFillThisBuffer);
- notify->setPointer("buffer-id", info->mBufferID);
+ notify->setInt32("buffer-id", info->mBufferID);
info->mData->meta()->clear();
notify->setBuffer("buffer", info->mData);
sp<AMessage> reply = new AMessage(kWhatInputBufferFilled, mCodec->id());
- reply->setPointer("buffer-id", info->mBufferID);
+ reply->setInt32("buffer-id", info->mBufferID);
notify->setMessage("reply", reply);
@@ -3106,8 +3107,7 @@ void ACodec::BaseState::postFillThisBuffer(BufferInfo *info) {
void ACodec::BaseState::onInputBufferFilled(const sp<AMessage> &msg) {
IOMX::buffer_id bufferID;
- CHECK(msg->findPointer("buffer-id", &bufferID));
-
+ CHECK(msg->findInt32("buffer-id", (int32_t*)&bufferID));
sp<ABuffer> buffer;
int32_t err = OK;
bool eos = false;
@@ -3345,7 +3345,7 @@ bool ACodec::BaseState::onOMXFillBufferDone(
case RESUBMIT_BUFFERS:
{
if (rangeLength == 0 && !(flags & OMX_BUFFERFLAG_EOS)) {
- ALOGV("[%s] calling fillBuffer %p",
+ ALOGV("[%s] calling fillBuffer %u",
mCodec->mComponentName.c_str(), info->mBufferID);
CHECK_EQ(mCodec->mOMX->fillBuffer(
@@ -3387,11 +3387,11 @@ bool ACodec::BaseState::onOMXFillBufferDone(
sp<AMessage> notify = mCodec->mNotify->dup();
notify->setInt32("what", ACodec::kWhatDrainThisBuffer);
- notify->setPointer("buffer-id", info->mBufferID);
+ notify->setInt32("buffer-id", info->mBufferID);
notify->setBuffer("buffer", info->mData);
notify->setInt32("flags", flags);
- reply->setPointer("buffer-id", info->mBufferID);
+ reply->setInt32("buffer-id", info->mBufferID);
notify->setMessage("reply", reply);
@@ -3427,8 +3427,7 @@ bool ACodec::BaseState::onOMXFillBufferDone(
void ACodec::BaseState::onOutputBufferDrained(const sp<AMessage> &msg) {
IOMX::buffer_id bufferID;
- CHECK(msg->findPointer("buffer-id", &bufferID));
-
+ CHECK(msg->findInt32("buffer-id", (int32_t*)&bufferID));
ssize_t index;
BufferInfo *info =
mCodec->findBufferByID(kPortIndexOutput, bufferID, &index);
@@ -3492,7 +3491,7 @@ void ACodec::BaseState::onOutputBufferDrained(const sp<AMessage> &msg) {
}
if (info != NULL) {
- ALOGV("[%s] calling fillBuffer %p",
+ ALOGV("[%s] calling fillBuffer %u",
mCodec->mComponentName.c_str(), info->mBufferID);
CHECK_EQ(mCodec->mOMX->fillBuffer(mCodec->mNode, info->mBufferID),
@@ -4702,7 +4701,7 @@ bool ACodec::FlushingState::onOMXEvent(
{
sp<AMessage> msg = new AMessage(kWhatOMXMessage, mCodec->id());
msg->setInt32("type", omx_message::EVENT);
- msg->setPointer("node", mCodec->mNode);
+ msg->setInt32("node", mCodec->mNode);
msg->setInt32("event", event);
msg->setInt32("data1", data1);
msg->setInt32("data2", data2);