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

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

Merge "Squash commits of the following patches, cherry-picked from other...

Merge "Squash commits of the following patches, cherry-picked from other branch - do not merge." into gingerbread
parents a788a943 9efe4737
Loading
Loading
Loading
Loading
+379 −0
Original line number Diff line number Diff line
@@ -86147,6 +86147,385 @@
</parameter>
</method>
</interface>
<class name="MediaMetadataRetriever"
 extends="java.lang.Object"
 abstract="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<constructor name="MediaMetadataRetriever"
 type="android.media.MediaMetadataRetriever"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</constructor>
<method name="extractMetadata"
 return="java.lang.String"
 abstract="false"
 native="true"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="keyCode" type="int">
</parameter>
</method>
<method name="getEmbeddedPicture"
 return="byte[]"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getFrameAtTime"
 return="android.graphics.Bitmap"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="timeUs" type="long">
</parameter>
<parameter name="option" type="int">
</parameter>
</method>
<method name="getFrameAtTime"
 return="android.graphics.Bitmap"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="timeUs" type="long">
</parameter>
</method>
<method name="getFrameAtTime"
 return="android.graphics.Bitmap"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="release"
 return="void"
 abstract="false"
 native="true"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="setDataSource"
 return="void"
 abstract="false"
 native="true"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="path" type="java.lang.String">
</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">
</parameter>
<parameter name="length" type="long">
</parameter>
<exception name="IllegalArgumentException" type="java.lang.IllegalArgumentException">
</exception>
</method>
<method name="setDataSource"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="fd" type="java.io.FileDescriptor">
</parameter>
<exception name="IllegalArgumentException" type="java.lang.IllegalArgumentException">
</exception>
</method>
<method name="setDataSource"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="context" type="android.content.Context">
</parameter>
<parameter name="uri" type="android.net.Uri">
</parameter>
<exception name="IllegalArgumentException" type="java.lang.IllegalArgumentException">
</exception>
<exception name="SecurityException" type="java.lang.SecurityException">
</exception>
</method>
<field name="METADATA_KEY_ALBUM"
 type="int"
 transient="false"
 volatile="false"
 value="1"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="METADATA_KEY_ALBUMARTIST"
 type="int"
 transient="false"
 volatile="false"
 value="13"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="METADATA_KEY_ARTIST"
 type="int"
 transient="false"
 volatile="false"
 value="2"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="METADATA_KEY_AUTHOR"
 type="int"
 transient="false"
 volatile="false"
 value="3"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="METADATA_KEY_CD_TRACK_NUMBER"
 type="int"
 transient="false"
 volatile="false"
 value="0"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="METADATA_KEY_COMPILATION"
 type="int"
 transient="false"
 volatile="false"
 value="15"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="METADATA_KEY_COMPOSER"
 type="int"
 transient="false"
 volatile="false"
 value="4"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="METADATA_KEY_DATE"
 type="int"
 transient="false"
 volatile="false"
 value="5"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="METADATA_KEY_DISC_NUMBER"
 type="int"
 transient="false"
 volatile="false"
 value="14"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="METADATA_KEY_DURATION"
 type="int"
 transient="false"
 volatile="false"
 value="9"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="METADATA_KEY_GENRE"
 type="int"
 transient="false"
 volatile="false"
 value="6"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="METADATA_KEY_MIMETYPE"
 type="int"
 transient="false"
 volatile="false"
 value="12"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="METADATA_KEY_NUM_TRACKS"
 type="int"
 transient="false"
 volatile="false"
 value="10"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="METADATA_KEY_TITLE"
 type="int"
 transient="false"
 volatile="false"
 value="7"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="METADATA_KEY_WRITER"
 type="int"
 transient="false"
 volatile="false"
 value="11"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="METADATA_KEY_YEAR"
 type="int"
 transient="false"
 volatile="false"
 value="8"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="OPTION_CLOSEST"
 type="int"
 transient="false"
 volatile="false"
 value="3"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="OPTION_CLOSEST_SYNC"
 type="int"
 transient="false"
 volatile="false"
 value="2"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="OPTION_NEXT_SYNC"
 type="int"
 transient="false"
 volatile="false"
 value="1"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="OPTION_PREVIOUS_SYNC"
 type="int"
 transient="false"
 volatile="false"
 value="0"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
</class>
<class name="MediaPlayer"
 extends="java.lang.Object"
 abstract="false"
+5 −7
Original line number Diff line number Diff line
@@ -596,21 +596,19 @@ int main(int argc, char **argv) {
            const char *filename = argv[k];

            CHECK_EQ(retriever->setDataSource(filename), (status_t)OK);
            CHECK_EQ(retriever->setMode(
                        METADATA_MODE_FRAME_CAPTURE_AND_METADATA_RETRIEVAL),
                     (status_t)OK);

            sp<IMemory> mem = retriever->captureFrame();
            sp<IMemory> mem =
                    retriever->getFrameAtTime(-1,
                                    MediaSource::ReadOptions::SEEK_PREVIOUS_SYNC);

            if (mem != NULL) {
                printf("captureFrame(%s) => OK\n", filename);
                printf("getFrameAtTime(%s) => OK\n", filename);
            } else {
                mem = retriever->extractAlbumArt();

                if (mem != NULL) {
                    printf("extractAlbumArt(%s) => OK\n", filename);
                } else {
                    printf("both captureFrame and extractAlbumArt "
                    printf("both getFrameAtTime and extractAlbumArt "
                           "failed on file '%s'.\n", filename);
                }
            }
+1 −3
Original line number Diff line number Diff line
@@ -32,9 +32,7 @@ public:
    virtual void            disconnect() = 0;
    virtual status_t        setDataSource(const char* srcUrl) = 0;
    virtual status_t        setDataSource(int fd, int64_t offset, int64_t length) = 0;
    virtual status_t        setMode(int mode) = 0;
    virtual status_t        getMode(int* mode) const = 0;
    virtual sp<IMemory>     captureFrame() = 0;
    virtual sp<IMemory>     getFrameAtTime(int64_t timeUs, int option) = 0;
    virtual sp<IMemory>     extractAlbumArt() = 0;
    virtual const char*     extractMetadata(int keyCode) = 0;
};
+3 −28
Original line number Diff line number Diff line
@@ -32,9 +32,7 @@ public:
    virtual             ~MediaMetadataRetrieverBase() {}
    virtual status_t    setDataSource(const char *url) = 0;
    virtual status_t    setDataSource(int fd, int64_t offset, int64_t length) = 0;
    virtual status_t    setMode(int mode) = 0;
    virtual status_t    getMode(int* mode) const = 0;
    virtual VideoFrame* captureFrame() = 0;
    virtual VideoFrame* getFrameAtTime(int64_t timeUs, int option) = 0;
    virtual MediaAlbumArt* extractAlbumArt() = 0;
    virtual const char* extractMetadata(int keyCode) = 0;
};
@@ -43,35 +41,12 @@ public:
class MediaMetadataRetrieverInterface : public MediaMetadataRetrieverBase
{
public:
    MediaMetadataRetrieverInterface()
        : mMode(0) {
    }
    MediaMetadataRetrieverInterface() {}

    virtual             ~MediaMetadataRetrieverInterface() {}

    // @param mode The intended mode of operations:
    // can be any of the following:
    // METADATA_MODE_NOOP: Experimental - just add and remove data source.
    // METADATA_MODE_FRAME_CAPTURE_ONLY: For capture frame/thumbnail only.
    // METADATA_MODE_METADATA_RETRIEVAL_ONLY: For meta data retrieval only.
    // METADATA_MODE_FRAME_CAPTURE_AND_METADATA_RETRIEVAL: For both frame
    //     capture and meta data retrieval.
    virtual status_t    setMode(int mode) {
                            if (mode < METADATA_MODE_NOOP ||
                                mode > METADATA_MODE_FRAME_CAPTURE_AND_METADATA_RETRIEVAL) {
                                return BAD_VALUE;
                            }

                            mMode = mode;
                            return NO_ERROR;
                        }

    virtual status_t    getMode(int* mode) const { *mode = mMode; return NO_ERROR; }
    virtual VideoFrame* captureFrame() { return NULL; }
    virtual VideoFrame* getFrameAtTime(int64_t timeUs, int option) { return NULL; }
    virtual MediaAlbumArt* extractAlbumArt() { return NULL; }
    virtual const char* extractMetadata(int keyCode) { return NULL; }

    uint32_t mMode;
};

}; // namespace android
+6 −31
Original line number Diff line number Diff line
@@ -42,37 +42,14 @@ enum {
    METADATA_KEY_YEAR            = 8,
    METADATA_KEY_DURATION        = 9,
    METADATA_KEY_NUM_TRACKS      = 10,
    METADATA_KEY_IS_DRM_CRIPPLED = 11,
    METADATA_KEY_CODEC           = 12,
    METADATA_KEY_RATING          = 13,
    METADATA_KEY_COMMENT         = 14,
    METADATA_KEY_COPYRIGHT       = 15,
    METADATA_KEY_BIT_RATE        = 16,
    METADATA_KEY_FRAME_RATE      = 17,
    METADATA_KEY_VIDEO_FORMAT    = 18,
    METADATA_KEY_VIDEO_HEIGHT    = 19,
    METADATA_KEY_VIDEO_WIDTH     = 20,
    METADATA_KEY_WRITER          = 21,
    METADATA_KEY_MIMETYPE        = 22,
    METADATA_KEY_DISC_NUMBER     = 23,
    METADATA_KEY_ALBUMARTIST     = 24,
    METADATA_KEY_COMPILATION     = 25,
    METADATA_KEY_WRITER          = 11,
    METADATA_KEY_MIMETYPE        = 12,
    METADATA_KEY_ALBUMARTIST     = 13,
    METADATA_KEY_DISC_NUMBER     = 14,
    METADATA_KEY_COMPILATION     = 15,
    // Add more here...
};

// The intended mode of operations:$
// METADATA_MODE_NOOP: Experimental - just add and remove data source.$
// METADATA_MODE_FRAME_CAPTURE_ONLY: For capture frame/thumbnail only.$
// METADATA_MODE_METADATA_RETRIEVAL_ONLY: For meta data retrieval only.$
// METADATA_MODE_FRAME_CAPTURE_AND_METADATA_RETRIEVAL: For both frame capture
//   and meta data retrieval.$
enum {
    METADATA_MODE_NOOP                                 = 0x00,
    METADATA_MODE_METADATA_RETRIEVAL_ONLY              = 0x01,
    METADATA_MODE_FRAME_CAPTURE_ONLY                   = 0x02,
    METADATA_MODE_FRAME_CAPTURE_AND_METADATA_RETRIEVAL = 0x03
};

class MediaMetadataRetriever: public RefBase
{
public:
@@ -81,9 +58,7 @@ public:
    void disconnect();
    status_t setDataSource(const char* dataSourceUrl);
    status_t setDataSource(int fd, int64_t offset, int64_t length);
    status_t setMode(int mode);
    status_t getMode(int* mode);
    sp<IMemory> captureFrame();
    sp<IMemory> getFrameAtTime(int64_t timeUs, int option);
    sp<IMemory> extractAlbumArt();
    const char* extractMetadata(int keyCode);

Loading