summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/omx/OMXNodeInstance.cpp
diff options
context:
space:
mode:
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;