From 1ab12519ec3d4922d1980f975fc884908879e0f0 Mon Sep 17 00:00:00 2001 From: James Dong Date: Wed, 25 Apr 2012 18:14:36 -0700 Subject: Add profile/level dump for encoders in cmd stagefright o related-to-bug: 6401068 Change-Id: I51e3eeb026aa75c4492d421f5f239dc9072a9c8b --- cmds/stagefright/stagefright.cpp | 89 ++++++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 40 deletions(-) (limited to 'cmds') diff --git a/cmds/stagefright/stagefright.cpp b/cmds/stagefright/stagefright.cpp index 6a5b45f..3656fe3 100644 --- a/cmds/stagefright/stagefright.cpp +++ b/cmds/stagefright/stagefright.cpp @@ -610,6 +610,53 @@ static void usage(const char *me) { fprintf(stderr, " -d(ump) filename (raw stream data to a file)\n"); } +static void dumpCodecProfiles(const sp& omx, bool queryDecoders) { + const char *kMimeTypes[] = { + MEDIA_MIMETYPE_VIDEO_AVC, MEDIA_MIMETYPE_VIDEO_MPEG4, + MEDIA_MIMETYPE_VIDEO_H263, MEDIA_MIMETYPE_AUDIO_AAC, + MEDIA_MIMETYPE_AUDIO_AMR_NB, MEDIA_MIMETYPE_AUDIO_AMR_WB, + MEDIA_MIMETYPE_AUDIO_MPEG, MEDIA_MIMETYPE_AUDIO_G711_MLAW, + MEDIA_MIMETYPE_AUDIO_G711_ALAW, MEDIA_MIMETYPE_AUDIO_VORBIS, + MEDIA_MIMETYPE_VIDEO_VPX + }; + + if (queryDecoders) { + printf("decoder profiles:\n"); + } else { + printf("encoder profiles:\n"); + } + + for (size_t k = 0; k < sizeof(kMimeTypes) / sizeof(kMimeTypes[0]); ++k) { + printf("type '%s':\n", kMimeTypes[k]); + + Vector results; + // will retrieve hardware and software codecs + CHECK_EQ(QueryCodecs(omx, kMimeTypes[k], + queryDecoders, + &results), (status_t)OK); + + for (size_t i = 0; i < results.size(); ++i) { + printf(" decoder '%s' supports ", + results[i].mComponentName.string()); + + if (results[i].mProfileLevels.size() == 0) { + printf("NOTHING.\n"); + continue; + } + + for (size_t j = 0; j < results[i].mProfileLevels.size(); ++j) { + const CodecProfileLevel &profileLevel = + results[i].mProfileLevels[j]; + + printf("%s%ld/%ld", j > 0 ? ", " : "", + profileLevel.mProfile, profileLevel.mLevel); + } + + printf("\n"); + } + } +} + int main(int argc, char **argv) { android::ProcessState::self()->startThreadPool(); @@ -830,46 +877,8 @@ int main(int argc, char **argv) { sp omx = service->getOMX(); CHECK(omx.get() != NULL); - - const char *kMimeTypes[] = { - MEDIA_MIMETYPE_VIDEO_AVC, MEDIA_MIMETYPE_VIDEO_MPEG4, - MEDIA_MIMETYPE_VIDEO_H263, MEDIA_MIMETYPE_AUDIO_AAC, - MEDIA_MIMETYPE_AUDIO_AMR_NB, MEDIA_MIMETYPE_AUDIO_AMR_WB, - MEDIA_MIMETYPE_AUDIO_MPEG, MEDIA_MIMETYPE_AUDIO_G711_MLAW, - MEDIA_MIMETYPE_AUDIO_G711_ALAW, MEDIA_MIMETYPE_AUDIO_VORBIS, - MEDIA_MIMETYPE_VIDEO_VPX - }; - - for (size_t k = 0; k < sizeof(kMimeTypes) / sizeof(kMimeTypes[0]); - ++k) { - printf("type '%s':\n", kMimeTypes[k]); - - Vector results; - // will retrieve hardware and software codecs - CHECK_EQ(QueryCodecs(omx, kMimeTypes[k], - true, // queryDecoders - &results), (status_t)OK); - - for (size_t i = 0; i < results.size(); ++i) { - printf(" decoder '%s' supports ", - results[i].mComponentName.string()); - - if (results[i].mProfileLevels.size() == 0) { - printf("NOTHING.\n"); - continue; - } - - for (size_t j = 0; j < results[i].mProfileLevels.size(); ++j) { - const CodecProfileLevel &profileLevel = - results[i].mProfileLevels[j]; - - printf("%s%ld/%ld", j > 0 ? ", " : "", - profileLevel.mProfile, profileLevel.mLevel); - } - - printf("\n"); - } - } + dumpCodecProfiles(omx, true /* queryDecoders */); + dumpCodecProfiles(omx, false /* queryDecoders */); } if (listComponents) { -- cgit v1.1