From df57a0d6d3b0609e69ff79afa63fe44dfa91f6f5 Mon Sep 17 00:00:00 2001 From: Jean-Michel Trivi Date: Sun, 17 Jul 2011 16:35:11 -0700 Subject: 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 --- media/libstagefright/OMXCodec.cpp | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'media/libstagefright/OMXCodec.cpp') diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp index 3b05752..0f816ae 100755 --- a/media/libstagefright/OMXCodec.cpp +++ b/media/libstagefright/OMXCodec.cpp @@ -4406,26 +4406,19 @@ status_t OMXCodec::pause() { status_t QueryCodecs( const sp &omx, - const char *mime, bool queryDecoders, + const char *mime, bool queryDecoders, bool hwCodecOnly, Vector *results) { + Vector 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) { -- cgit v1.1