diff options
author | Jamie Gennis <jgennis@google.com> | 2011-03-01 10:25:38 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-03-01 10:25:38 -0800 |
commit | e13e24b6e8a7c2d0244ba575e309fb1254119a82 (patch) | |
tree | 6cdccfa869301126e7f8f88db4453bcb81ea8aad /media/libstagefright | |
parent | d2d38d5c937c552555aec8aa2eb9822a19b2476b (diff) | |
parent | e2ce6458659c6e1bad420357b61dc10cd8bbe2ab (diff) | |
download | frameworks_av-e13e24b6e8a7c2d0244ba575e309fb1254119a82.zip frameworks_av-e13e24b6e8a7c2d0244ba575e309fb1254119a82.tar.gz frameworks_av-e13e24b6e8a7c2d0244ba575e309fb1254119a82.tar.bz2 |
Merge "Add an OMX IL API for querying buffer usage flags."
Diffstat (limited to 'media/libstagefright')
-rw-r--r-- | media/libstagefright/include/OMX.h | 3 | ||||
-rw-r--r-- | media/libstagefright/include/OMXNodeInstance.h | 3 | ||||
-rw-r--r-- | media/libstagefright/omx/OMX.cpp | 5 | ||||
-rw-r--r-- | media/libstagefright/omx/OMXNodeInstance.cpp | 39 |
4 files changed, 50 insertions, 0 deletions
diff --git a/media/libstagefright/include/OMX.h b/media/libstagefright/include/OMX.h index 5fed98a..ec3e5fa 100644 --- a/media/libstagefright/include/OMX.h +++ b/media/libstagefright/include/OMX.h @@ -62,6 +62,9 @@ public: virtual status_t enableGraphicBuffers( node_id node, OMX_U32 port_index, OMX_BOOL enable); + virtual status_t getGraphicBufferUsage( + node_id node, OMX_U32 port_index, OMX_U32* usage); + virtual status_t storeMetaDataInBuffers( node_id node, OMX_U32 port_index, OMX_BOOL enable); diff --git a/media/libstagefright/include/OMXNodeInstance.h b/media/libstagefright/include/OMXNodeInstance.h index 86c102c..ca2578f 100644 --- a/media/libstagefright/include/OMXNodeInstance.h +++ b/media/libstagefright/include/OMXNodeInstance.h @@ -50,6 +50,9 @@ struct OMXNodeInstance { status_t setConfig(OMX_INDEXTYPE index, const void *params, size_t size); status_t enableGraphicBuffers(OMX_U32 portIndex, OMX_BOOL enable); + + status_t getGraphicBufferUsage(OMX_U32 portIndex, OMX_U32* usage); + status_t storeMetaDataInBuffers(OMX_U32 portIndex, OMX_BOOL enable); status_t useBuffer( diff --git a/media/libstagefright/omx/OMX.cpp b/media/libstagefright/omx/OMX.cpp index 3638f41..4b1c3a7 100644 --- a/media/libstagefright/omx/OMX.cpp +++ b/media/libstagefright/omx/OMX.cpp @@ -297,6 +297,11 @@ status_t OMX::enableGraphicBuffers( return findInstance(node)->enableGraphicBuffers(port_index, enable); } +status_t OMX::getGraphicBufferUsage( + node_id node, OMX_U32 port_index, OMX_U32* usage) { + return findInstance(node)->getGraphicBufferUsage(port_index, usage); +} + status_t OMX::storeMetaDataInBuffers( node_id node, OMX_U32 port_index, OMX_BOOL enable) { return findInstance(node)->storeMetaDataInBuffers(port_index, enable); 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) { |