summaryrefslogtreecommitdiff
path: root/media/libstagefright/ACodec.cpp
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2012-02-29 15:47:17 -0800
committerAndreas Huber <andih@google.com>2012-03-01 11:30:10 -0800
commitafc16d667afa23f5aa00154ccad62f8c45cf5419 (patch)
treee7a7573397177303112c1809f0087b25c8a30397 /media/libstagefright/ACodec.cpp
parentdf94a547d8036619d15975873a1ff5736b0f14fe (diff)
Instead of hardcoding OMX component names in our code, support
a config file instead. Change-Id: I5835903ab9f1c4a22ccc605ca99ed966767adf57
Diffstat (limited to 'media/libstagefright/ACodec.cpp')
-rw-r--r--media/libstagefright/ACodec.cpp31
1 files changed, 20 insertions, 11 deletions
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index 9a9d094a..09e4e451 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -26,6 +26,7 @@
#include <media/stagefright/foundation/ADebug.h>
#include <media/stagefright/foundation/AMessage.h>
+#include <media/stagefright/MediaCodecList.h>
#include <media/stagefright/MediaDefs.h>
#include <media/stagefright/NativeWindowWrapper.h>
#include <media/stagefright/OMXClient.h>
@@ -328,7 +329,8 @@ private:
////////////////////////////////////////////////////////////////////////////////
ACodec::ACodec()
- : mNode(NULL),
+ : mQuirks(0),
+ mNode(NULL),
mSentFormat(false),
mIsEncoder(false),
mShutdownInProgress(false) {
@@ -427,16 +429,12 @@ status_t ACodec::allocateBuffersOnPort(OMX_U32 portIndex) {
IOMX::buffer_id buffer;
- if (!strncasecmp(
- mComponentName.c_str(), "OMX.TI.DUCATI1.VIDEO.", 21)) {
- if (portIndex == kPortIndexInput && i == 0) {
- // Only log this warning once per allocation round.
-
- ALOGW("OMX.TI.DUCATI1.VIDEO.* require the use of "
- "OMX_AllocateBuffer instead of the preferred "
- "OMX_UseBuffer. Vendor must fix this.");
- }
+ uint32_t requiresAllocateBufferBit =
+ (portIndex == kPortIndexInput)
+ ? OMXCodec::kRequiresAllocateBufferOnInputPorts
+ : OMXCodec::kRequiresAllocateBufferOnOutputPorts;
+ if (mQuirks & requiresAllocateBufferBit) {
err = mOMX->allocateBufferWithBackup(
mNode, portIndex, mem, &buffer);
} else {
@@ -2588,12 +2586,19 @@ bool ACodec::UninitializedState::onAllocateComponent(const sp<AMessage> &msg) {
sp<IOMX> omx = client.interface();
Vector<String8> matchingCodecs;
+ Vector<uint32_t> matchingCodecQuirks;
AString mime;
AString componentName;
+ uint32_t quirks;
if (msg->findString("componentName", &componentName)) {
matchingCodecs.push_back(String8(componentName.c_str()));
+
+ if (!OMXCodec::findCodecQuirks(componentName.c_str(), &quirks)) {
+ quirks = 0;
+ }
+ matchingCodecQuirks.push_back(quirks);
} else {
CHECK(msg->findString("mime", &mime));
@@ -2607,7 +2612,8 @@ bool ACodec::UninitializedState::onAllocateComponent(const sp<AMessage> &msg) {
encoder, // createEncoder
NULL, // matchComponentName
0, // flags
- &matchingCodecs);
+ &matchingCodecs,
+ &matchingCodecQuirks);
}
sp<CodecObserver> observer = new CodecObserver;
@@ -2616,6 +2622,7 @@ bool ACodec::UninitializedState::onAllocateComponent(const sp<AMessage> &msg) {
for (size_t matchIndex = 0; matchIndex < matchingCodecs.size();
++matchIndex) {
componentName = matchingCodecs.itemAt(matchIndex).string();
+ quirks = matchingCodecQuirks.itemAt(matchIndex);
pid_t tid = androidGetTid();
int prevPriority = androidGetThreadPriority(tid);
@@ -2646,6 +2653,7 @@ bool ACodec::UninitializedState::onAllocateComponent(const sp<AMessage> &msg) {
observer->setNotificationMessage(notify);
mCodec->mComponentName = componentName;
+ mCodec->mQuirks = quirks;
mCodec->mOMX = omx;
mCodec->mNode = node;
@@ -2692,6 +2700,7 @@ void ACodec::LoadedState::onShutdown(bool keepComponentAllocated) {
mCodec->mNativeWindow.clear();
mCodec->mNode = NULL;
mCodec->mOMX.clear();
+ mCodec->mQuirks = 0;
mCodec->mComponentName.clear();
mCodec->changeState(mCodec->mUninitializedState);