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 | 457116d3a01618acf9a875020ca5860551ba03a6 (patch) | |
tree | 16ea85295b56ef3cc8885c7507841505a9a744e7 /media/libstagefright/codecs/on2/h264dec | |
parent | 9b186a44051d0ef7f4ca67150f204299b15a448e (diff) | |
download | frameworks_av-457116d3a01618acf9a875020ca5860551ba03a6.zip frameworks_av-457116d3a01618acf9a875020ca5860551ba03a6.tar.gz frameworks_av-457116d3a01618acf9a875020ca5860551ba03a6.tar.bz2 |
Support profile and level query for SW video decoders
Change-Id: I9c20db128be96cd36cf2083e08e8c21f5e6d1fdf
Diffstat (limited to 'media/libstagefright/codecs/on2/h264dec')
-rw-r--r-- | media/libstagefright/codecs/on2/h264dec/SoftAVC.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/media/libstagefright/codecs/on2/h264dec/SoftAVC.cpp b/media/libstagefright/codecs/on2/h264dec/SoftAVC.cpp index ec7bd1c..740c957 100644 --- a/media/libstagefright/codecs/on2/h264dec/SoftAVC.cpp +++ b/media/libstagefright/codecs/on2/h264dec/SoftAVC.cpp @@ -23,10 +23,30 @@ #include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/MediaDefs.h> #include <media/stagefright/MediaErrors.h> +#include <media/IOMX.h> namespace android { +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 }, + { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel13 }, + { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel2 }, + { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel21 }, + { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel22 }, + { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel3 }, + { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel31 }, + { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel32 }, + { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel4 }, + { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel41 }, + { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel42 }, + { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel5 }, + { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel51 }, +}; + template<class T> static void InitOMXParams(T *params) { params->nSize = sizeof(T); @@ -177,6 +197,28 @@ OMX_ERRORTYPE SoftAVC::internalGetParameter( return OMX_ErrorNone; } + case OMX_IndexParamVideoProfileLevelQuerySupported: + { + OMX_VIDEO_PARAM_PROFILELEVELTYPE *profileLevel = + (OMX_VIDEO_PARAM_PROFILELEVELTYPE *) params; + + if (profileLevel->nPortIndex != kInputPortIndex) { + 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); } |