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

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

Merge "Allows MediaMetadataRetriever to retrieve video rotation angle" into jb-mr1-dev

parents 5665fde6 5a81ad89
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -55,6 +55,7 @@ enum {
    METADATA_KEY_TIMED_TEXT_LANGUAGES      = 21,
    METADATA_KEY_TIMED_TEXT_LANGUAGES      = 21,
    METADATA_KEY_IS_DRM          = 22,
    METADATA_KEY_IS_DRM          = 22,
    METADATA_KEY_LOCATION        = 23,
    METADATA_KEY_LOCATION        = 23,
    METADATA_KEY_VIDEO_ROTATION  = 24,


    // Add more here...
    // Add more here...
};
};
+7 −0
Original line number Original line Diff line number Diff line
@@ -462,6 +462,7 @@ void StagefrightMetadataRetriever::parseMetaData() {
    int32_t videoWidth = -1;
    int32_t videoWidth = -1;
    int32_t videoHeight = -1;
    int32_t videoHeight = -1;
    int32_t audioBitrate = -1;
    int32_t audioBitrate = -1;
    int32_t rotationAngle = -1;


    // The overall duration is the duration of the longest track.
    // The overall duration is the duration of the longest track.
    int64_t maxDurationUs = 0;
    int64_t maxDurationUs = 0;
@@ -489,6 +490,9 @@ void StagefrightMetadataRetriever::parseMetaData() {


                CHECK(trackMeta->findInt32(kKeyWidth, &videoWidth));
                CHECK(trackMeta->findInt32(kKeyWidth, &videoWidth));
                CHECK(trackMeta->findInt32(kKeyHeight, &videoHeight));
                CHECK(trackMeta->findInt32(kKeyHeight, &videoHeight));
                if (!trackMeta->findInt32(kKeyRotation, &rotationAngle)) {
                    rotationAngle = 0;
                }
            } else if (!strcasecmp(mime, MEDIA_MIMETYPE_TEXT_3GPP)) {
            } else if (!strcasecmp(mime, MEDIA_MIMETYPE_TEXT_3GPP)) {
                const char *lang;
                const char *lang;
                trackMeta->findCString(kKeyMediaLanguage, &lang);
                trackMeta->findCString(kKeyMediaLanguage, &lang);
@@ -521,6 +525,9 @@ void StagefrightMetadataRetriever::parseMetaData() {


        sprintf(tmp, "%d", videoHeight);
        sprintf(tmp, "%d", videoHeight);
        mMetaData.add(METADATA_KEY_VIDEO_HEIGHT, String8(tmp));
        mMetaData.add(METADATA_KEY_VIDEO_HEIGHT, String8(tmp));

        sprintf(tmp, "%d", rotationAngle);
        mMetaData.add(METADATA_KEY_VIDEO_ROTATION, String8(tmp));
    }
    }


    if (numTracks == 1 && hasAudio && audioBitrate >= 0) {
    if (numTracks == 1 && hasAudio && audioBitrate >= 0) {