diff options
author | Andreas Huber <andih@google.com> | 2012-06-26 10:56:14 -0700 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2012-08-07 13:08:15 -0700 |
commit | e671207115fac3914134c61b336d5fa0242c68ca (patch) | |
tree | 466cda101e1528b81bf72c228d7060c33788dedf /media/libstagefright/OMXCodec.cpp | |
parent | 28620ee3e9926ef07f0b4cb3e22b156b812e2d7e (diff) | |
download | frameworks_av-e671207115fac3914134c61b336d5fa0242c68ca.zip frameworks_av-e671207115fac3914134c61b336d5fa0242c68ca.tar.gz frameworks_av-e671207115fac3914134c61b336d5fa0242c68ca.tar.bz2 |
Make sure codec names and corresponding quirks are returned together.
Previously they were returned in separate vectors and only one of them was sorted if
software codecs were preferred, leaving the quirks no longer matching the codec name
at the same index.
Change-Id: Id3f1e6f9f7f8c9cc4b6ebfb86a203b4d59de8604
related-to-bug: 6737884
Diffstat (limited to 'media/libstagefright/OMXCodec.cpp')
-rwxr-xr-x | media/libstagefright/OMXCodec.cpp | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp index e8cb9d5..5615d0f 100755 --- a/media/libstagefright/OMXCodec.cpp +++ b/media/libstagefright/OMXCodec.cpp @@ -147,12 +147,13 @@ static bool IsSoftwareCodec(const char *componentName) { // A sort order in which OMX software codecs are first, followed // by other (non-OMX) software codecs, followed by everything else. static int CompareSoftwareCodecsFirst( - const String8 *elem1, const String8 *elem2) { - bool isOMX1 = !strncmp(elem1->string(), "OMX.", 4); - bool isOMX2 = !strncmp(elem2->string(), "OMX.", 4); + const OMXCodec::CodecNameAndQuirks *elem1, + const OMXCodec::CodecNameAndQuirks *elem2) { + bool isOMX1 = !strncmp(elem1->mName.string(), "OMX.", 4); + bool isOMX2 = !strncmp(elem2->mName.string(), "OMX.", 4); - bool isSoftwareCodec1 = IsSoftwareCodec(elem1->string()); - bool isSoftwareCodec2 = IsSoftwareCodec(elem2->string()); + bool isSoftwareCodec1 = IsSoftwareCodec(elem1->mName.string()); + bool isSoftwareCodec2 = IsSoftwareCodec(elem2->mName.string()); if (isSoftwareCodec1) { if (!isSoftwareCodec2) { return -1; } @@ -182,14 +183,9 @@ void OMXCodec::findMatchingCodecs( const char *mime, bool createEncoder, const char *matchComponentName, uint32_t flags, - Vector<String8> *matchingCodecs, - Vector<uint32_t> *matchingCodecQuirks) { + Vector<CodecNameAndQuirks> *matchingCodecs) { matchingCodecs->clear(); - if (matchingCodecQuirks) { - matchingCodecQuirks->clear(); - } - const MediaCodecList *list = MediaCodecList::getInstance(); if (list == NULL) { return; @@ -221,11 +217,13 @@ void OMXCodec::findMatchingCodecs( ((flags & kHardwareCodecsOnly) && !IsSoftwareCodec(componentName)) || (!(flags & (kSoftwareCodecsOnly | kHardwareCodecsOnly)))) { - matchingCodecs->push(String8(componentName)); + ssize_t index = matchingCodecs->add(); + CodecNameAndQuirks *entry = &matchingCodecs->editItemAt(index); + entry->mName = String8(componentName); + entry->mQuirks = getComponentQuirks(list, matchIndex); - if (matchingCodecQuirks) { - matchingCodecQuirks->push(getComponentQuirks(list, matchIndex)); - } + ALOGV("matching '%s' quirks 0x%08x", + entry->mName.string(), entry->mQuirks); } } @@ -294,11 +292,9 @@ sp<MediaSource> OMXCodec::Create( bool success = meta->findCString(kKeyMIMEType, &mime); CHECK(success); - Vector<String8> matchingCodecs; - Vector<uint32_t> matchingCodecQuirks; + Vector<CodecNameAndQuirks> matchingCodecs; findMatchingCodecs( - mime, createEncoder, matchComponentName, flags, - &matchingCodecs, &matchingCodecQuirks); + mime, createEncoder, matchComponentName, flags, &matchingCodecs); if (matchingCodecs.isEmpty()) { ALOGV("No matching codecs! (mime: %s, createEncoder: %s, " @@ -311,8 +307,8 @@ sp<MediaSource> OMXCodec::Create( IOMX::node_id node = 0; for (size_t i = 0; i < matchingCodecs.size(); ++i) { - const char *componentNameBase = matchingCodecs[i].string(); - uint32_t quirks = matchingCodecQuirks[i]; + const char *componentNameBase = matchingCodecs[i].mName.string(); + uint32_t quirks = matchingCodecs[i].mQuirks; const char *componentName = componentNameBase; AString tmp; @@ -572,6 +568,8 @@ status_t OMXCodec::configureCodec(const sp<MetaData> &meta) { if ((mFlags & kClientNeedsFramebuffer) && !strncmp(mComponentName, "OMX.SEC.", 8)) { + // This appears to no longer be needed??? + OMX_INDEXTYPE index; status_t err = @@ -4489,7 +4487,7 @@ status_t QueryCodecs( const sp<IOMX> &omx, const char *mime, bool queryDecoders, bool hwCodecOnly, Vector<CodecCapabilities> *results) { - Vector<String8> matchingCodecs; + Vector<OMXCodec::CodecNameAndQuirks> matchingCodecs; results->clear(); OMXCodec::findMatchingCodecs(mime, @@ -4499,7 +4497,7 @@ status_t QueryCodecs( &matchingCodecs); for (size_t c = 0; c < matchingCodecs.size(); c++) { - const char *componentName = matchingCodecs.itemAt(c).string(); + const char *componentName = matchingCodecs.itemAt(c).mName.string(); results->push(); CodecCapabilities *caps = &results->editItemAt(results->size() - 1); |