diff options
author | Andreas Huber <andih@google.com> | 2011-08-25 16:09:06 -0700 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2011-08-25 16:28:18 -0700 |
commit | 5df775d2f509c76e76a46615fca83dba95299f6e (patch) | |
tree | 1062b747ad85433dec6dca2093fafb8d2a6d89a7 /media/libstagefright/foundation/AMessage.cpp | |
parent | 24245683b9285b0b53c8900f088cf146000501c4 (diff) | |
download | frameworks_av-5df775d2f509c76e76a46615fca83dba95299f6e.zip frameworks_av-5df775d2f509c76e76a46615fca83dba95299f6e.tar.gz frameworks_av-5df775d2f509c76e76a46615fca83dba95299f6e.tar.bz2 |
Support for posting messages and synchronously waiting for a response.
Change-Id: Id6c7a08c34fd5cb6c4632f78ece9e7898b29e52c
Diffstat (limited to 'media/libstagefright/foundation/AMessage.cpp')
-rw-r--r-- | media/libstagefright/foundation/AMessage.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/media/libstagefright/foundation/AMessage.cpp b/media/libstagefright/foundation/AMessage.cpp index b592c3f..582bdba 100644 --- a/media/libstagefright/foundation/AMessage.cpp +++ b/media/libstagefright/foundation/AMessage.cpp @@ -27,6 +27,8 @@ namespace android { +extern ALooperRoster gLooperRoster; + AMessage::AMessage(uint32_t what, ALooper::handler_id target) : mWhat(what), mTarget(target), @@ -227,11 +229,30 @@ bool AMessage::findRect( } void AMessage::post(int64_t delayUs) { - extern ALooperRoster gLooperRoster; - gLooperRoster.postMessage(this, delayUs); } +status_t AMessage::postAndAwaitResponse(sp<AMessage> *response) { + return gLooperRoster.postAndAwaitResponse(this, response); +} + +void AMessage::postReply(uint32_t replyID) { + gLooperRoster.postReply(replyID, this); +} + +bool AMessage::senderAwaitsResponse(uint32_t *replyID) const { + int32_t tmp; + bool found = findInt32("replyID", &tmp); + + if (!found) { + return false; + } + + *replyID = static_cast<uint32_t>(tmp); + + return true; +} + sp<AMessage> AMessage::dup() const { sp<AMessage> msg = new AMessage(mWhat, mTarget); msg->mNumItems = mNumItems; |