summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/omx/OMX.cpp
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2009-11-11 16:33:17 -0800
committerAndreas Huber <andih@google.com>2009-11-12 09:36:10 -0800
commit1dfc99f22fb9d8c798065938c24eeb4eb9691747 (patch)
tree51fa5da2f34649321196925e4a3441158193d7e2 /media/libstagefright/omx/OMX.cpp
parenta75e9fb4876139fff4bb836fb0ebd5f80c8b20b3 (diff)
downloadframeworks_av-1dfc99f22fb9d8c798065938c24eeb4eb9691747.zip
frameworks_av-1dfc99f22fb9d8c798065938c24eeb4eb9691747.tar.gz
frameworks_av-1dfc99f22fb9d8c798065938c24eeb4eb9691747.tar.bz2
Delegate the platform dependent hardware renderer implementation to a shared library provided by the vendor.
Diffstat (limited to 'media/libstagefright/omx/OMX.cpp')
-rw-r--r--media/libstagefright/omx/OMX.cpp50
1 files changed, 29 insertions, 21 deletions
diff --git a/media/libstagefright/omx/OMX.cpp b/media/libstagefright/omx/OMX.cpp
index 9ac0d44..4ccd4bd 100644
--- a/media/libstagefright/omx/OMX.cpp
+++ b/media/libstagefright/omx/OMX.cpp
@@ -27,9 +27,7 @@
#include <binder/IMemory.h>
#include <media/stagefright/MediaDebug.h>
-#include <media/stagefright/QComHardwareRenderer.h>
#include <media/stagefright/SoftwareRenderer.h>
-#include <media/stagefright/TIHardwareRenderer.h>
#include <media/stagefright/VideoRenderer.h>
#include <OMX_Component.h>
@@ -431,27 +429,37 @@ sp<IOMXRenderer> OMX::createRenderer(
OMX_COLOR_FORMATTYPE colorFormat,
size_t encodedWidth, size_t encodedHeight,
size_t displayWidth, size_t displayHeight) {
+ Mutex::Autolock autoLock(mLock);
+
VideoRenderer *impl = NULL;
- static const int OMX_QCOM_COLOR_FormatYVU420SemiPlanar = 0x7FA30C00;
-
- if (colorFormat == OMX_QCOM_COLOR_FormatYVU420SemiPlanar
- && !strncmp(componentName, "OMX.qcom.video.decoder.", 23)) {
- LOGW("Using QComHardwareRenderer.");
- impl =
- new QComHardwareRenderer(
- surface,
- displayWidth, displayHeight,
- encodedWidth, encodedHeight);
- } else if (colorFormat == OMX_COLOR_FormatCbYCrY
- && !strcmp(componentName, "OMX.TI.Video.Decoder")) {
- LOGW("Using TIHardwareRenderer.");
- impl =
- new TIHardwareRenderer(
- surface,
- displayWidth, displayHeight,
- encodedWidth, encodedHeight);
- } else {
+ static void *libHandle = NULL;
+
+ if (!libHandle) {
+ libHandle = dlopen("libstagefrighthw.so", RTLD_NOW);
+ }
+
+ if (libHandle) {
+ typedef VideoRenderer *(*CreateRendererFunc)(
+ const sp<ISurface> &surface,
+ const char *componentName,
+ OMX_COLOR_FORMATTYPE colorFormat,
+ size_t displayWidth, size_t displayHeight,
+ size_t decodedWidth, size_t decodedHeight);
+
+ CreateRendererFunc func =
+ (CreateRendererFunc)dlsym(
+ libHandle,
+ "_Z14createRendererRKN7android2spINS_8ISurfaceEEEPKc20"
+ "OMX_COLOR_FORMATTYPEjjjj");
+
+ if (func) {
+ impl = (*func)(surface, componentName, colorFormat,
+ displayWidth, displayHeight, encodedWidth, encodedHeight);
+ }
+ }
+
+ if (!impl) {
LOGW("Using software renderer.");
impl = new SoftwareRenderer(
colorFormat,