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

Commit 2cef2eff authored by James Dong's avatar James Dong Committed by Android Git Automerger
Browse files

am c4a2ead2: am d2d62d04: Merge "Support extracting thumbnail from rotated...

am c4a2ead2: am d2d62d04: Merge "Support extracting thumbnail from rotated video tracks" into gingerbread

* commit 'c4a2ead2aa5ab4403553e4956ba71b44782f0c84':
  Support extracting thumbnail from rotated video tracks
parents 858154e4 beda607a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -120,6 +120,7 @@ public:
    uint32_t mDisplayHeight;
    uint32_t mSize;            // Number of bytes in mData
    uint8_t* mData;            // Actual binary data
    int32_t  mRotationAngle;   // rotation angle, clockwise
};

}; // namespace android
+2 −0
Original line number Diff line number Diff line
@@ -253,6 +253,8 @@ sp<IMemory> MetadataRetrieverClient::captureFrame()
    frameCopy->mDisplayWidth = frame->mDisplayWidth;
    frameCopy->mDisplayHeight = frame->mDisplayHeight;
    frameCopy->mSize = frame->mSize;
    frameCopy->mRotationAngle = frame->mRotationAngle;
    LOGV("rotation: %d", frameCopy->mRotationAngle);
    frameCopy->mData = (uint8_t *)frameCopy + sizeof(VideoFrame);
    memcpy(frameCopy->mData, frame->mData, frame->mSize);
    delete frame;  // Fix memory leakage
+6 −0
Original line number Diff line number Diff line
@@ -191,6 +191,11 @@ static VideoFrame *extractVideoFrameWithCodecFlags(
    CHECK(meta->findInt32(kKeyWidth, &width));
    CHECK(meta->findInt32(kKeyHeight, &height));

    int32_t rotationAngle;
    if (!trackMeta->findInt32(kKeyRotation, &rotationAngle)) {
        rotationAngle = 0;  // By default, no rotation
    }

    VideoFrame *frame = new VideoFrame;
    frame->mWidth = width;
    frame->mHeight = height;
@@ -198,6 +203,7 @@ static VideoFrame *extractVideoFrameWithCodecFlags(
    frame->mDisplayHeight = height;
    frame->mSize = width * height * 2;
    frame->mData = new uint8_t[frame->mSize];
    frame->mRotationAngle = rotationAngle;

    int32_t srcFormat;
    CHECK(meta->findInt32(kKeyColorFormat, &srcFormat));