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

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

Merge "Fix the presentation video resolution when it is different from the...

Merge "Fix the presentation video resolution when it is different from the actual image resolution of the video." into honeycomb
parents 2597aedb 08adfd29
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -30,8 +30,10 @@ namespace android {
// The following keys map to int32_t data unless indicated otherwise.
enum {
    kKeyMIMEType          = 'mime',  // cstring
    kKeyWidth             = 'widt',  // int32_t
    kKeyHeight            = 'heig',  // int32_t
    kKeyWidth             = 'widt',  // int32_t, image pixel
    kKeyHeight            = 'heig',  // int32_t, image pixel
    kKeyDisplayWidth      = 'dWid',  // int32_t, display/presentation
    kKeyDisplayHeight     = 'dHgt',  // int32_t, display/presentation

    // a rectangle, if absent assumed to be (0, 0, width - 1, height - 1)
    kKeyCropRect          = 'crop',
+22 −0
Original line number Diff line number Diff line
@@ -165,6 +165,8 @@ AwesomePlayer::AwesomePlayer()
      mTimeSource(NULL),
      mVideoRendererIsPreview(false),
      mAudioPlayer(NULL),
      mDisplayWidth(0),
      mDisplayHeight(0),
      mFlags(0),
      mExtractorFlags(0),
      mVideoBuffer(NULL),
@@ -329,6 +331,18 @@ status_t AwesomePlayer::setDataSource_l(const sp<MediaExtractor> &extractor) {
        if (!haveVideo && !strncasecmp(mime, "video/", 6)) {
            setVideoSource(extractor->getTrack(i));
            haveVideo = true;

            // Set the presentation/display size
            int32_t displayWidth, displayHeight;
            bool success = meta->findInt32(kKeyDisplayWidth, &displayWidth);
            if (success) {
                success = meta->findInt32(kKeyDisplayHeight, &displayHeight);
            }
            if (success) {
                mDisplayWidth = displayWidth;
                mDisplayHeight = displayHeight;
            }

        } else if (!haveAudio && !strncasecmp(mime, "audio/", 6)) {
            setAudioSource(extractor->getTrack(i));
            haveAudio = true;
@@ -370,6 +384,8 @@ void AwesomePlayer::reset() {

void AwesomePlayer::reset_l() {
    LOGI("reset_l");
    mDisplayWidth = 0;
    mDisplayHeight = 0;

    if (mDecryptHandle != NULL) {
            mDrmManagerClient->setPlaybackStatus(mDecryptHandle,
@@ -862,6 +878,12 @@ void AwesomePlayer::notifyVideoSize_l() {

    int32_t usableWidth = cropRight - cropLeft + 1;
    int32_t usableHeight = cropBottom - cropTop + 1;
    if (mDisplayWidth != 0) {
        usableWidth = mDisplayWidth;
    }
    if (mDisplayHeight != 0) {
        usableHeight = mDisplayHeight;
    }

    int32_t rotationDegrees;
    if (!mVideoTrack->getFormat()->findInt32(
+4 −2
Original line number Diff line number Diff line
@@ -1321,10 +1321,12 @@ status_t MPEG4Extractor::parseTrackHeader(
        mLastTrack->meta->setInt32(kKeyRotation, rotationDegrees);
    }

#if 0
    // Handle presentation display size, which could be different
    // from the image size indicated by kKeyWidth and kKeyHeight.
    uint32_t width = U32_AT(&buffer[dynSize + 52]);
    uint32_t height = U32_AT(&buffer[dynSize + 56]);
#endif
    mLastTrack->meta->setInt32(kKeyDisplayWidth, width >> 16);
    mLastTrack->meta->setInt32(kKeyDisplayHeight, height >> 16);

    return OK;
}
+3 −0
Original line number Diff line number Diff line
@@ -150,6 +150,9 @@ private:
    AudioPlayer *mAudioPlayer;
    int64_t mDurationUs;

    int32_t mDisplayWidth;
    int32_t mDisplayHeight;

    uint32_t mFlags;
    uint32_t mExtractorFlags;
    uint32_t mSinceLastDropped;