aboutsummaryrefslogtreecommitdiffstats
path: root/videocodec/OMXVideoDecoderVP9Hybrid.cpp
diff options
context:
space:
mode:
authorYuanjun Huang <yuanjun.huang@intel.com>2015-05-14 01:54:06 +0800
committerRonghua Wu <ronghuawu@google.com>2015-06-01 10:20:07 -0700
commitf832fbe64172f3dcde2bf8d7f960375efd8a30d9 (patch)
treeacf9c2bcf34120665655b7a68ca7fa36d3104ab0 /videocodec/OMXVideoDecoderVP9Hybrid.cpp
parent7579ae2fa6c1b95605f651892a1adfd6eed7c946 (diff)
downloadandroid_hardware_intel_common_omx-components-f832fbe64172f3dcde2bf8d7f960375efd8a30d9.tar.gz
android_hardware_intel_common_omx-components-f832fbe64172f3dcde2bf8d7f960375efd8a30d9.tar.bz2
android_hardware_intel_common_omx-components-f832fbe64172f3dcde2bf8d7f960375efd8a30d9.zip
omx-component: Adding media resource management support
for each codec. Initial implementation. Implement returning OMX_ErrorInsufficientResources case. Bug: 20165724 Change-Id: I88a7229f6342bbfb8cb36b7dc9629b81e2debf93 Signed-off-by: Yuanjun Huang <yuanjun.huang@intel.com>
Diffstat (limited to 'videocodec/OMXVideoDecoderVP9Hybrid.cpp')
-rw-r--r--videocodec/OMXVideoDecoderVP9Hybrid.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/videocodec/OMXVideoDecoderVP9Hybrid.cpp b/videocodec/OMXVideoDecoderVP9Hybrid.cpp
index 55d481a..db400ca 100644
--- a/videocodec/OMXVideoDecoderVP9Hybrid.cpp
+++ b/videocodec/OMXVideoDecoderVP9Hybrid.cpp
@@ -25,6 +25,10 @@
#include <hardware/gralloc.h>
#include <system/graphics.h>
+// codec number limitation
+#define INSTANCE_LIMITATION 4
+static int gInstanceNumber = 0;
+
static const char* VP9_MIME_TYPE = "video/x-vnd.on2.vp9";
OMXVideoDecoderVP9Hybrid::OMXVideoDecoderVP9Hybrid() {
@@ -51,6 +55,7 @@ OMXVideoDecoderVP9Hybrid::OMXVideoDecoderVP9Hybrid() {
}
OMXVideoDecoderVP9Hybrid::~OMXVideoDecoderVP9Hybrid() {
+ gInstanceNumber --;
LOGV("OMXVideoDecoderVP9Hybrid is destructed.");
}
@@ -566,4 +571,24 @@ bool OMXVideoDecoderVP9Hybrid::IsAllBufferAvailable(void) {
return mCheckBufferAvailable(mHybridCtx);
}
-DECLARE_OMX_COMPONENT("OMX.Intel.VideoDecoder.VP9.hybrid", "video_decoder.vp9", OMXVideoDecoderVP9Hybrid);
+#define DECLARE_OMX_COMPONENT_VP9(NAME, ROLE, CLASS) \
+ static const char *gName = (const char *)(NAME);\
+ static const char *gRole = (const char *)(ROLE);\
+ OMX_ERRORTYPE CreateInstance(OMX_PTR *instance) {\
+ *instance = NULL;\
+ if (gInstanceNumber + 1 > INSTANCE_LIMITATION) {\
+ return OMX_ErrorInsufficientResources;\
+ } else {\
+ gInstanceNumber ++;\
+ }\
+ ComponentBase *inst = new CLASS;\
+ if (!inst) {\
+ return OMX_ErrorInsufficientResources;\
+ }\
+ *instance = inst;\
+ return OMX_ErrorNone;\
+ }\
+ struct wrs_omxil_cmodule_ops_s gOps = {CreateInstance};\
+ struct wrs_omxil_cmodule_s WRS_OMXIL_CMODULE_SYMBOL = {gName, &gRole, 1, &gOps};
+
+DECLARE_OMX_COMPONENT_VP9("OMX.Intel.VideoDecoder.VP9.hybrid", "video_decoder.vp9", OMXVideoDecoderVP9Hybrid);