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

Commit 5b7ced6a authored by Andreas Huber's avatar Andreas Huber
Browse files

Support passing headers to MediaMetadataRetriever's setDataSource API

Change-Id: Ib1a5c08fc5034cac05034db27007a35c9b660b26
related-to-bug: 3506316
parent affb58e7
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -105715,6 +105715,23 @@
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="uri" type="java.lang.String">
</parameter>
<parameter name="headers" type="java.util.Map&lt;java.lang.String, java.lang.String&gt;">
</parameter>
<exception name="IllegalArgumentException" type="java.lang.IllegalArgumentException">
</exception>
</method>
<method name="setDataSource"
 return="void"
 abstract="false"
 native="true"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="fd" type="java.io.FileDescriptor">
</parameter>
<parameter name="offset" type="long">
+7 −2
Original line number Diff line number Diff line
@@ -18,10 +18,11 @@
#ifndef ANDROID_IMEDIAMETADATARETRIEVER_H
#define ANDROID_IMEDIAMETADATARETRIEVER_H

#include <utils/RefBase.h>
#include <binder/IInterface.h>
#include <binder/Parcel.h>
#include <binder/IMemory.h>
#include <utils/KeyedVector.h>
#include <utils/RefBase.h>

namespace android {

@@ -30,7 +31,11 @@ class IMediaMetadataRetriever: public IInterface
public:
    DECLARE_META_INTERFACE(MediaMetadataRetriever);
    virtual void            disconnect() = 0;
    virtual status_t        setDataSource(const char* srcUrl) = 0;

    virtual status_t        setDataSource(
            const char *srcUrl,
            const KeyedVector<String8, String8> *headers = NULL) = 0;

    virtual status_t        setDataSource(int fd, int64_t offset, int64_t length) = 0;
    virtual sp<IMemory>     getFrameAtTime(int64_t timeUs, int option) = 0;
    virtual sp<IMemory>     extractAlbumArt() = 0;
+5 −1
Original line number Diff line number Diff line
@@ -30,7 +30,11 @@ class MediaMetadataRetrieverBase : public RefBase
public:
                        MediaMetadataRetrieverBase() {}
    virtual             ~MediaMetadataRetrieverBase() {}
    virtual status_t    setDataSource(const char *url) = 0;

    virtual status_t    setDataSource(
            const char *url,
            const KeyedVector<String8, String8> *headers = NULL) = 0;

    virtual status_t    setDataSource(int fd, int64_t offset, int64_t length) = 0;
    virtual VideoFrame* getFrameAtTime(int64_t timeUs, int option) = 0;
    virtual MediaAlbumArt* extractAlbumArt() = 0;
+5 −1
Original line number Diff line number Diff line
@@ -62,7 +62,11 @@ public:
    MediaMetadataRetriever();
    ~MediaMetadataRetriever();
    void disconnect();
    status_t setDataSource(const char* dataSourceUrl);

    status_t setDataSource(
            const char *dataSourceUrl,
            const KeyedVector<String8, String8> *headers = NULL);

    status_t setDataSource(int fd, int64_t offset, int64_t length);
    sp<IMemory> getFrameAtTime(int64_t timeUs, int option);
    sp<IMemory> extractAlbumArt();
+15 −1
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@ import java.io.FileDescriptor;
import java.io.FileNotFoundException;
import java.io.IOException;

import java.util.Map;

/**
 * MediaMetadataRetriever class provides a unified interface for retrieving
 * frame and meta data from an input media file.
@@ -57,6 +59,18 @@ public class MediaMetadataRetriever
     */
    public native void setDataSource(String path) throws IllegalArgumentException;

    /**
     * Sets the data source (URI) to use. Call this
     * method before the rest of the methods in this class. This method may be
     * time-consuming.
     *
     * @param uri The URI of the input media.
     * @param headers the headers to be sent together with the request for the data
     * @throws IllegalArgumentException If the URI is invalid.
     */
    public native void setDataSource(String uri, Map<String, String> headers)
        throws IllegalArgumentException;

    /**
     * Sets the data source (FileDescriptor) to use.  It is the caller's
     * responsibility to close the file descriptor. It is safe to do so as soon
Loading