summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--media/java/android/media/MediaMetadataRetriever.java20
-rw-r--r--media/jni/android_media_MediaMetadataRetriever.cpp9
2 files changed, 19 insertions, 10 deletions
diff --git a/media/java/android/media/MediaMetadataRetriever.java b/media/java/android/media/MediaMetadataRetriever.java
index 11ecd1f..aef631f 100644
--- a/media/java/android/media/MediaMetadataRetriever.java
+++ b/media/java/android/media/MediaMetadataRetriever.java
@@ -23,6 +23,7 @@ import android.graphics.Bitmap;
import android.net.Uri;
import java.io.FileDescriptor;
+import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -57,7 +58,24 @@ public class MediaMetadataRetriever
* @param path The path of the input media file.
* @throws IllegalArgumentException If the path is invalid.
*/
- public native void setDataSource(String path) throws IllegalArgumentException;
+ public void setDataSource(String path) throws IllegalArgumentException {
+ FileInputStream is = null;
+ try {
+ is = new FileInputStream(path);
+ FileDescriptor fd = is.getFD();
+ setDataSource(fd, 0, 0x7ffffffffffffffL);
+ } catch (FileNotFoundException fileEx) {
+ throw new IllegalArgumentException();
+ } catch (IOException ioEx) {
+ throw new IllegalArgumentException();
+ }
+
+ try {
+ if (is != null) {
+ is.close();
+ }
+ } catch (Exception e) {}
+ }
/**
* Sets the data source (URI) to use. Call this
diff --git a/media/jni/android_media_MediaMetadataRetriever.cpp b/media/jni/android_media_MediaMetadataRetriever.cpp
index 0dc3b65..297dadf 100644
--- a/media/jni/android_media_MediaMetadataRetriever.cpp
+++ b/media/jni/android_media_MediaMetadataRetriever.cpp
@@ -131,13 +131,6 @@ android_media_MediaMetadataRetriever_setDataSourceAndHeaders(
"setDataSource failed");
}
-
-static void android_media_MediaMetadataRetriever_setDataSource(
- JNIEnv *env, jobject thiz, jstring path) {
- android_media_MediaMetadataRetriever_setDataSourceAndHeaders(
- env, thiz, path, NULL, NULL);
-}
-
static void android_media_MediaMetadataRetriever_setDataSourceFD(JNIEnv *env, jobject thiz, jobject fileDescriptor, jlong offset, jlong length)
{
ALOGV("setDataSource");
@@ -447,8 +440,6 @@ static void android_media_MediaMetadataRetriever_native_setup(JNIEnv *env, jobje
// JNI mapping between Java methods and native methods
static JNINativeMethod nativeMethods[] = {
- {"setDataSource", "(Ljava/lang/String;)V", (void *)android_media_MediaMetadataRetriever_setDataSource},
-
{
"_setDataSource",
"(Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/String;)V",