diff options
| author | 2011-07-17 16:35:11 -0700 | |
|---|---|---|
| committer | 2011-07-18 10:57:50 -0700 | |
| commit | 56a37b052912d09c310f43ab1215ccc93f2dbda5 (patch) | |
| tree | ce525d6fa573cdda87019003e72d8326d05ef464 | |
| parent | a6c53c79390e719ae425d38d6d80587e0d017ef3 (diff) | |
Add option to query hardware decoders only
Add an option to OMXCodec::QueryCodecs() to filter out
software codecs.
Update stagefright command line tool to list the roles of codecs.
Change-Id: Icddb79118c30fe13cc3aea20f340174cc082c4e0
| -rw-r--r-- | cmds/stagefright/stagefright.cpp | 8 | ||||
| -rw-r--r-- | include/media/stagefright/OMXCodec.h | 2 | ||||
| -rwxr-xr-x | media/libstagefright/OMXCodec.cpp | 27 |
3 files changed, 19 insertions, 18 deletions
diff --git a/cmds/stagefright/stagefright.cpp b/cmds/stagefright/stagefright.cpp index 1a5b7f3ab8b1..e2d40d59bd8b 100644 --- a/cmds/stagefright/stagefright.cpp +++ b/cmds/stagefright/stagefright.cpp @@ -803,6 +803,7 @@ int main(int argc, char **argv) { Vector<CodecCapabilities> results; CHECK_EQ(QueryCodecs(omx, kMimeTypes[k], true, // queryDecoders + false, // hwCodecOnly &results), (status_t)OK); for (size_t i = 0; i < results.size(); ++i) { @@ -842,7 +843,12 @@ int main(int argc, char **argv) { for (List<IOMX::ComponentInfo>::iterator it = list.begin(); it != list.end(); ++it) { - printf("%s\n", (*it).mName.string()); + printf("%s\t Roles: ", (*it).mName.string()); + for (List<String8>::iterator itRoles = (*it).mRoles.begin() ; + itRoles != (*it).mRoles.end() ; ++itRoles) { + printf("%s\t", (*itRoles).string()); + } + printf("\n"); } } diff --git a/include/media/stagefright/OMXCodec.h b/include/media/stagefright/OMXCodec.h index 7f3c497ecb32..0c07429f32e8 100644 --- a/include/media/stagefright/OMXCodec.h +++ b/include/media/stagefright/OMXCodec.h @@ -360,7 +360,7 @@ struct CodecCapabilities { status_t QueryCodecs( const sp<IOMX> &omx, - const char *mimeType, bool queryDecoders, + const char *mimeType, bool queryDecoders, bool hwCodecOnly, Vector<CodecCapabilities> *results); } // namespace android diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp index 3b0575248efc..0f816ae752c6 100755 --- a/media/libstagefright/OMXCodec.cpp +++ b/media/libstagefright/OMXCodec.cpp @@ -4406,26 +4406,19 @@ status_t OMXCodec::pause() { status_t QueryCodecs( const sp<IOMX> &omx, - const char *mime, bool queryDecoders, + const char *mime, bool queryDecoders, bool hwCodecOnly, Vector<CodecCapabilities> *results) { + Vector<String8> matchingCodecs; results->clear(); - for (int index = 0;; ++index) { - const char *componentName; + OMXCodec::findMatchingCodecs(mime, + !queryDecoders /*createEncoder*/, + NULL /*matchComponentName*/, + hwCodecOnly ? OMXCodec::kHardwareCodecsOnly : 0 /*flags*/, + &matchingCodecs); - if (!queryDecoders) { - componentName = GetCodec( - kEncoderInfo, sizeof(kEncoderInfo) / sizeof(kEncoderInfo[0]), - mime, index); - } else { - componentName = GetCodec( - kDecoderInfo, sizeof(kDecoderInfo) / sizeof(kDecoderInfo[0]), - mime, index); - } - - if (!componentName) { - return OK; - } + for (size_t c = 0; c < matchingCodecs.size(); c++) { + const char *componentName = matchingCodecs.itemAt(c).string(); if (strncmp(componentName, "OMX.", 4)) { // Not an OpenMax component but a software codec. @@ -4490,6 +4483,8 @@ status_t QueryCodecs( CHECK_EQ(omx->freeNode(node), (status_t)OK); } + + return OK; } void OMXCodec::restorePatchedDataPointer(BufferInfo *info) { |