summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/omx/OMXNodeInstance.cpp
diff options
context:
space:
mode:
authorLajos Molnar <lajos@google.com>2014-10-10 17:14:17 -0700
committerLajos Molnar <lajos@google.com>2014-10-13 21:27:49 -0700
commit512e979284de984427e5b2f73b9054ae1b5e2b0a (patch)
tree34e93922113abbd179cba3363439ff285e9c2e27 /media/libstagefright/omx/OMXNodeInstance.cpp
parente760de61d9a662b1fbfda96ac34aaa246c2711bb (diff)
downloadframeworks_av-512e979284de984427e5b2f73b9054ae1b5e2b0a.zip
frameworks_av-512e979284de984427e5b2f73b9054ae1b5e2b0a.tar.gz
frameworks_av-512e979284de984427e5b2f73b9054ae1b5e2b0a.tar.bz2
stagefright: support passing GraphicBuffer in metadata buffer
Bug: 17935149 Change-Id: I6bb5dd654e498a7153410afc052c2c8f7f35e44d
Diffstat (limited to 'media/libstagefright/omx/OMXNodeInstance.cpp')
-rw-r--r--media/libstagefright/omx/OMXNodeInstance.cpp35
1 files changed, 29 insertions, 6 deletions
diff --git a/media/libstagefright/omx/OMXNodeInstance.cpp b/media/libstagefright/omx/OMXNodeInstance.cpp
index efb27f5..d07ec14 100644
--- a/media/libstagefright/omx/OMXNodeInstance.cpp
+++ b/media/libstagefright/omx/OMXNodeInstance.cpp
@@ -393,20 +393,39 @@ status_t OMXNodeInstance::storeMetaDataInBuffers(
OMX_U32 portIndex,
OMX_BOOL enable) {
Mutex::Autolock autolock(mLock);
- return storeMetaDataInBuffers_l(portIndex, enable);
+ return storeMetaDataInBuffers_l(
+ portIndex, enable,
+ OMX_FALSE /* useGraphicBuffer */, NULL /* usingGraphicBufferInMetadata */);
}
status_t OMXNodeInstance::storeMetaDataInBuffers_l(
OMX_U32 portIndex,
- OMX_BOOL enable) {
+ OMX_BOOL enable,
+ OMX_BOOL useGraphicBuffer,
+ OMX_BOOL *usingGraphicBufferInMetadata) {
OMX_INDEXTYPE index;
OMX_STRING name = const_cast<OMX_STRING>(
"OMX.google.android.index.storeMetaDataInBuffers");
- OMX_ERRORTYPE err = OMX_GetExtensionIndex(mHandle, name, &index);
+ OMX_STRING graphicBufferName = const_cast<OMX_STRING>(
+ "OMX.google.android.index.storeGraphicBufferInMetaData");
+ if (usingGraphicBufferInMetadata == NULL) {
+ usingGraphicBufferInMetadata = &useGraphicBuffer;
+ }
+
+ OMX_ERRORTYPE err =
+ (useGraphicBuffer && portIndex == kPortIndexInput)
+ ? OMX_GetExtensionIndex(mHandle, graphicBufferName, &index)
+ : OMX_ErrorBadParameter;
+ if (err == OMX_ErrorNone) {
+ *usingGraphicBufferInMetadata = OMX_TRUE;
+ } else {
+ *usingGraphicBufferInMetadata = OMX_FALSE;
+ err = OMX_GetExtensionIndex(mHandle, name, &index);
+ }
+
if (err != OMX_ErrorNone) {
ALOGE("OMX_GetExtensionIndex %s failed", name);
-
return StatusFromOMXError(err);
}
@@ -421,6 +440,7 @@ status_t OMXNodeInstance::storeMetaDataInBuffers_l(
params.bStoreMetaData = enable;
if ((err = OMX_SetParameter(mHandle, index, &params)) != OMX_ErrorNone) {
ALOGE("OMX_SetParameter() failed for StoreMetaDataInBuffers: 0x%08x", err);
+ *usingGraphicBufferInMetadata = OMX_FALSE;
return UNKNOWN_ERROR;
}
return err;
@@ -683,7 +703,10 @@ status_t OMXNodeInstance::createInputSurface(
}
// Input buffers will hold meta-data (gralloc references).
- err = storeMetaDataInBuffers_l(portIndex, OMX_TRUE);
+ OMX_BOOL usingGraphicBuffer = OMX_FALSE;
+ err = storeMetaDataInBuffers_l(
+ portIndex, OMX_TRUE,
+ OMX_TRUE /* useGraphicBuffer */, &usingGraphicBuffer);
if (err != OK) {
return err;
}
@@ -709,7 +732,7 @@ status_t OMXNodeInstance::createInputSurface(
GraphicBufferSource* bufferSource = new GraphicBufferSource(
this, def.format.video.nFrameWidth, def.format.video.nFrameHeight,
- def.nBufferCountActual);
+ def.nBufferCountActual, usingGraphicBuffer);
if ((err = bufferSource->initCheck()) != OK) {
delete bufferSource;
return err;