summaryrefslogtreecommitdiff
path: root/media/libstagefright
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2012-11-26 14:37:22 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2012-11-26 14:37:22 -0800
commit5bc5bf39120ae27ef46a8b13f85bf44ea19c7d5e (patch)
tree45bdaceb377aab7fc1957f59ed5cbccd254fdd37 /media/libstagefright
parent21006fa5fa180d1eb1513a5ae297211a24312021 (diff)
parent79fd685323e34e0fde22d17fd6848d33f171f4ae (diff)
am 79fd6853: Merge "MediaCodec: Add a method for getting the component name"
* commit '79fd685323e34e0fde22d17fd6848d33f171f4ae': MediaCodec: Add a method for getting the component name
Diffstat (limited to 'media/libstagefright')
-rw-r--r--media/libstagefright/MediaCodec.cpp44
1 files changed, 40 insertions, 4 deletions
diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp
index 56e6df02..cb8a6518 100644
--- a/media/libstagefright/MediaCodec.cpp
+++ b/media/libstagefright/MediaCodec.cpp
@@ -302,6 +302,20 @@ status_t MediaCodec::getOutputFormat(sp<AMessage> *format) const {
return OK;
}
+status_t MediaCodec::getName(AString *name) const {
+ sp<AMessage> msg = new AMessage(kWhatGetName, id());
+
+ sp<AMessage> response;
+ status_t err;
+ if ((err = PostAndAwaitResponse(msg, &response)) != OK) {
+ return err;
+ }
+
+ CHECK(response->findString("name", name));
+
+ return OK;
+}
+
status_t MediaCodec::getInputBuffers(Vector<sp<ABuffer> > *buffers) const {
sp<AMessage> msg = new AMessage(kWhatGetBuffers, id());
msg->setInt32("portIndex", kPortIndexInput);
@@ -534,16 +548,15 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
CHECK_EQ(mState, INITIALIZING);
setState(INITIALIZED);
- AString componentName;
- CHECK(msg->findString("componentName", &componentName));
+ CHECK(msg->findString("componentName", &mComponentName));
- if (componentName.startsWith("OMX.google.")) {
+ if (mComponentName.startsWith("OMX.google.")) {
mFlags |= kFlagIsSoftwareCodec;
} else {
mFlags &= ~kFlagIsSoftwareCodec;
}
- if (componentName.endsWith(".secure")) {
+ if (mComponentName.endsWith(".secure")) {
mFlags |= kFlagIsSecure;
} else {
mFlags &= ~kFlagIsSecure;
@@ -1171,6 +1184,25 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
break;
}
+ case kWhatGetName:
+ {
+ uint32_t replyID;
+ CHECK(msg->senderAwaitsResponse(&replyID));
+
+ if (mComponentName.empty()) {
+ sp<AMessage> response = new AMessage;
+ response->setInt32("err", INVALID_OPERATION);
+
+ response->postReply(replyID);
+ break;
+ }
+
+ sp<AMessage> response = new AMessage;
+ response->setString("name", mComponentName.c_str());
+ response->postReply(replyID);
+ break;
+ }
+
default:
TRESPASS();
}
@@ -1240,6 +1272,10 @@ void MediaCodec::setState(State newState) {
mActivityNotify.clear();
}
+ if (newState == UNINITIALIZED) {
+ mComponentName.clear();
+ }
+
mState = newState;
cancelPendingDequeueOperations();