diff options
author | Jamie Gennis <jgennis@google.com> | 2011-02-23 19:01:28 -0800 |
---|---|---|
committer | Jamie Gennis <jgennis@google.com> | 2011-02-28 12:12:20 -0800 |
commit | e2ce6458659c6e1bad420357b61dc10cd8bbe2ab (patch) | |
tree | 89a59a1cef847dc359dbf013f0c76d94f6363918 /media/libstagefright/omx/OMXNodeInstance.cpp | |
parent | 3911a720270fc0326accfa4a3df427a649a45487 (diff) | |
download | frameworks_av-e2ce6458659c6e1bad420357b61dc10cd8bbe2ab.zip frameworks_av-e2ce6458659c6e1bad420357b61dc10cd8bbe2ab.tar.gz frameworks_av-e2ce6458659c6e1bad420357b61dc10cd8bbe2ab.tar.bz2 |
Add an OMX IL API for querying buffer usage flags.
This change defines an OpenMAX IL API for querying from the IL component
the gralloc buffer usage flags that should be used to allocate the
buffers. It also adds the Stagefright plumbing for using the new OMX IL
API.
Change-Id: I046b5e7be70ce61e2a921dcdc6e3aa9324d19ea6
Related-Bug: 3479027
Diffstat (limited to 'media/libstagefright/omx/OMXNodeInstance.cpp')
-rw-r--r-- | media/libstagefright/omx/OMXNodeInstance.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/media/libstagefright/omx/OMXNodeInstance.cpp b/media/libstagefright/omx/OMXNodeInstance.cpp index c7c1409..6cbd599 100644 --- a/media/libstagefright/omx/OMXNodeInstance.cpp +++ b/media/libstagefright/omx/OMXNodeInstance.cpp @@ -302,6 +302,45 @@ status_t OMXNodeInstance::enableGraphicBuffers( return OK; } +status_t OMXNodeInstance::getGraphicBufferUsage( + OMX_U32 portIndex, OMX_U32* usage) { + Mutex::Autolock autoLock(mLock); + + OMX_INDEXTYPE index; + OMX_ERRORTYPE err = OMX_GetExtensionIndex( + mHandle, + const_cast<OMX_STRING>( + "OMX.google.android.index.getAndroidNativeBufferUsage"), + &index); + + if (err != OMX_ErrorNone) { + LOGE("OMX_GetExtensionIndex failed"); + + return StatusFromOMXError(err); + } + + OMX_VERSIONTYPE ver; + ver.s.nVersionMajor = 1; + ver.s.nVersionMinor = 0; + ver.s.nRevision = 0; + ver.s.nStep = 0; + GetAndroidNativeBufferUsageParams params = { + sizeof(GetAndroidNativeBufferUsageParams), ver, portIndex, 0, + }; + + err = OMX_GetParameter(mHandle, index, ¶ms); + + if (err != OMX_ErrorNone) { + LOGE("OMX_GetAndroidNativeBufferUsage failed with error %d (0x%08x)", + err, err); + return UNKNOWN_ERROR; + } + + *usage = params.nUsage; + + return OK; +} + status_t OMXNodeInstance::storeMetaDataInBuffers( OMX_U32 portIndex, OMX_BOOL enable) { |