Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 30ff5aec authored by James Dong's avatar James Dong Committed by Android (Google) Code Review
Browse files

Merge "Fix thumbnail generation failure"

parents f4409871 0041b5c5
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -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
+0 −9
Original line number Diff line number Diff line
@@ -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",