diff options
author | James Dong <jdong@google.com> | 2011-07-11 12:29:10 -0700 |
---|---|---|
committer | James Dong <jdong@google.com> | 2011-07-11 12:29:10 -0700 |
commit | fbb170ca9cbbd0c87c71ac39ecbb36086bca5ee2 (patch) | |
tree | 9d7e4209206fea3dad6814ea9ef6e785a782bbe7 /media/libstagefright/codecs/avc | |
parent | 6dabb63307a0b63f9386d61e8444aed29db2081e (diff) | |
download | frameworks_base-fbb170ca9cbbd0c87c71ac39ecbb36086bca5ee2.zip frameworks_base-fbb170ca9cbbd0c87c71ac39ecbb36086bca5ee2.tar.gz frameworks_base-fbb170ca9cbbd0c87c71ac39ecbb36086bca5ee2.tar.bz2 |
Support profile and level query for SW video decoders
Change-Id: I9c20db128be96cd36cf2083e08e8c21f5e6d1fdf
Diffstat (limited to 'media/libstagefright/codecs/avc')
-rw-r--r-- | media/libstagefright/codecs/avc/dec/SoftAVC.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/media/libstagefright/codecs/avc/dec/SoftAVC.cpp b/media/libstagefright/codecs/avc/dec/SoftAVC.cpp index 9f141ac..6a476f6 100644 --- a/media/libstagefright/codecs/avc/dec/SoftAVC.cpp +++ b/media/libstagefright/codecs/avc/dec/SoftAVC.cpp @@ -23,6 +23,7 @@ #include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/MediaDefs.h> #include <media/stagefright/MediaErrors.h> +#include <media/IOMX.h> #include "avcdec_api.h" #include "avcdec_int.h" @@ -31,6 +32,13 @@ namespace android { static const char kStartCode[4] = { 0x00, 0x00, 0x00, 0x01 }; +static const CodecProfileLevel kProfileLevels[] = { + { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel1 }, + { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel1b }, + { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel11 }, + { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel12 }, +}; + template<class T> static void InitOMXParams(T *params) { params->nSize = sizeof(T); @@ -181,6 +189,28 @@ OMX_ERRORTYPE SoftAVC::internalGetParameter( return OMX_ErrorNone; } + case OMX_IndexParamVideoProfileLevelQuerySupported: + { + OMX_VIDEO_PARAM_PROFILELEVELTYPE *profileLevel = + (OMX_VIDEO_PARAM_PROFILELEVELTYPE *) params; + + if (profileLevel->nPortIndex != 0) { // Input port only + LOGE("Invalid port index: %ld", profileLevel->nPortIndex); + return OMX_ErrorUnsupportedIndex; + } + + size_t index = profileLevel->nProfileIndex; + size_t nProfileLevels = + sizeof(kProfileLevels) / sizeof(kProfileLevels[0]); + if (index >= nProfileLevels) { + return OMX_ErrorNoMore; + } + + profileLevel->eProfile = kProfileLevels[index].mProfile; + profileLevel->eLevel = kProfileLevels[index].mLevel; + return OMX_ErrorNone; + } + default: return SimpleSoftOMXComponent::internalGetParameter(index, params); } |