summaryrefslogtreecommitdiffstats
path: root/media/jni/android_media_MediaScanner.cpp
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2010-01-08 10:57:34 -0800
committerAndreas Huber <andih@google.com>2010-01-08 11:54:36 -0800
commite4a838051de5e56f44c71117073a035b804b5d04 (patch)
tree6e388540202e3386ff80a3b25da69d3e4b085701 /media/jni/android_media_MediaScanner.cpp
parent660cc3461afbf0631cc8d4ab628628d68d840014 (diff)
downloadframeworks_base-e4a838051de5e56f44c71117073a035b804b5d04.zip
frameworks_base-e4a838051de5e56f44c71117073a035b804b5d04.tar.gz
frameworks_base-e4a838051de5e56f44c71117073a035b804b5d04.tar.bz2
Reorganize some of the stagefright implementation related to metadata.
Diffstat (limited to 'media/jni/android_media_MediaScanner.cpp')
-rw-r--r--media/jni/android_media_MediaScanner.cpp28
1 files changed, 21 insertions, 7 deletions
diff --git a/media/jni/android_media_MediaScanner.cpp b/media/jni/android_media_MediaScanner.cpp
index 144fba2..2ab2445 100644
--- a/media/jni/android_media_MediaScanner.cpp
+++ b/media/jni/android_media_MediaScanner.cpp
@@ -24,6 +24,7 @@
#include <limits.h>
#include <unistd.h>
#include <fcntl.h>
+#include <cutils/properties.h>
#include <utils/threads.h>
#include "jni.h"
@@ -32,8 +33,10 @@
#ifndef NO_OPENCORE
#include "pvmediascanner.h"
-#else
-#include "StagefrightMediaScanner.h"
+#endif
+
+#if BUILD_WITH_FULL_STAGEFRIGHT
+#include <media/stagefright/StagefrightMediaScanner.h>
#endif
// ----------------------------------------------------------------------------
@@ -283,14 +286,25 @@ android_media_MediaScanner_native_init(JNIEnv *env)
}
}
+static MediaScanner *createMediaScanner() {
+#if BUILD_WITH_FULL_STAGEFRIGHT
+ char value[PROPERTY_VALUE_MAX];
+ if (property_get("media.stagefright.enable-scan", value, NULL)
+ && (!strcmp(value, "1") || !strcasecmp(value, "true"))) {
+ return new StagefrightMediaScanner;
+ }
+#endif
+#ifndef NO_OPENCORE
+ return new PVMediaScanner();
+#endif
+
+ return NULL;
+}
+
static void
android_media_MediaScanner_native_setup(JNIEnv *env, jobject thiz)
{
-#ifndef NO_OPENCORE
- MediaScanner *mp = new PVMediaScanner();
-#else
- MediaScanner *mp = new StagefrightMediaScanner();
-#endif
+ MediaScanner *mp = createMediaScanner();
if (mp == NULL) {
jniThrowException(env, "java/lang/RuntimeException", "Out of memory");