diff options
| author | Chong Zhang <chz@google.com> | 2015-07-17 16:25:03 -0700 | 
|---|---|---|
| committer | Chong Zhang <chz@google.com> | 2015-07-17 17:14:29 -0700 | 
| commit | 505aab41c0e8e79a49d4506344fcd9d220d5965b (patch) | |
| tree | 4f1389e7281cbd3973f6c4af7c15dd4ff164d849 | |
| parent | a8dc93efc9be8d5e37c7473601fb8654804188c1 (diff) | |
| download | frameworks_av-505aab41c0e8e79a49d4506344fcd9d220d5965b.zip frameworks_av-505aab41c0e8e79a49d4506344fcd9d220d5965b.tar.gz frameworks_av-505aab41c0e8e79a49d4506344fcd9d220d5965b.tar.bz2  | |
fix soft renderer rotation
bug: 13222807
Change-Id: I6f6f417422d3a18117b594670bb23e3019d449bb
| -rw-r--r-- | include/media/stagefright/MediaCodec.h | 1 | ||||
| -rw-r--r-- | media/libstagefright/MediaCodec.cpp | 6 | ||||
| -rw-r--r-- | media/libstagefright/colorconversion/SoftwareRenderer.cpp | 8 | ||||
| -rw-r--r-- | media/libstagefright/include/SoftwareRenderer.h | 4 | 
4 files changed, 14 insertions, 5 deletions
diff --git a/include/media/stagefright/MediaCodec.h b/include/media/stagefright/MediaCodec.h index 09cbe8f..720778b 100644 --- a/include/media/stagefright/MediaCodec.h +++ b/include/media/stagefright/MediaCodec.h @@ -299,6 +299,7 @@ private:      bool mIsVideo;      int32_t mVideoWidth;      int32_t mVideoHeight; +    int32_t mRotationDegrees;      // initial create parameters      AString mInitName; diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp index fb32d3a..c9bd20b 100644 --- a/media/libstagefright/MediaCodec.cpp +++ b/media/libstagefright/MediaCodec.cpp @@ -251,6 +251,7 @@ MediaCodec::MediaCodec(const sp<ALooper> &looper)        mIsVideo(false),        mVideoWidth(0),        mVideoHeight(0), +      mRotationDegrees(0),        mDequeueInputTimeoutGeneration(0),        mDequeueInputReplyID(0),        mDequeueOutputTimeoutGeneration(0), @@ -413,6 +414,9 @@ status_t MediaCodec::configure(      if (mIsVideo) {          format->findInt32("width", &mVideoWidth);          format->findInt32("height", &mVideoHeight); +        if (!format->findInt32("rotation-degrees", &mRotationDegrees)) { +            mRotationDegrees = 0; +        }      }      msg->setMessage("format", format); @@ -1313,7 +1317,7 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {                          CHECK(msg->findString("mime", &mime));                          if (mime.startsWithIgnoreCase("video/")) { -                            mSoftRenderer = new SoftwareRenderer(mSurface); +                            mSoftRenderer = new SoftwareRenderer(mSurface, mRotationDegrees);                          }                      } diff --git a/media/libstagefright/colorconversion/SoftwareRenderer.cpp b/media/libstagefright/colorconversion/SoftwareRenderer.cpp index d22451b..e92c192 100644 --- a/media/libstagefright/colorconversion/SoftwareRenderer.cpp +++ b/media/libstagefright/colorconversion/SoftwareRenderer.cpp @@ -38,7 +38,8 @@ static int ALIGN(int x, int y) {      return (x + y - 1) & ~(y - 1);  } -SoftwareRenderer::SoftwareRenderer(const sp<ANativeWindow> &nativeWindow) +SoftwareRenderer::SoftwareRenderer( +        const sp<ANativeWindow> &nativeWindow, int32_t rotation)      : mColorFormat(OMX_COLOR_FormatUnused),        mConverter(NULL),        mYUVMode(None), @@ -50,7 +51,8 @@ SoftwareRenderer::SoftwareRenderer(const sp<ANativeWindow> &nativeWindow)        mCropRight(0),        mCropBottom(0),        mCropWidth(0), -      mCropHeight(0) { +      mCropHeight(0), +      mRotationDegrees(rotation) {  }  SoftwareRenderer::~SoftwareRenderer() { @@ -181,7 +183,7 @@ void SoftwareRenderer::resetFormatIfChanged(const sp<AMessage> &format) {      int32_t rotationDegrees;      if (!format->findInt32("rotation-degrees", &rotationDegrees)) { -        rotationDegrees = 0; +        rotationDegrees = mRotationDegrees;      }      uint32_t transform;      switch (rotationDegrees) { diff --git a/media/libstagefright/include/SoftwareRenderer.h b/media/libstagefright/include/SoftwareRenderer.h index 9e652d5..757b308 100644 --- a/media/libstagefright/include/SoftwareRenderer.h +++ b/media/libstagefright/include/SoftwareRenderer.h @@ -31,7 +31,8 @@ struct AMessage;  class SoftwareRenderer {  public: -    explicit SoftwareRenderer(const sp<ANativeWindow> &nativeWindow); +    explicit SoftwareRenderer( +            const sp<ANativeWindow> &nativeWindow, int32_t rotation = 0);      ~SoftwareRenderer(); @@ -52,6 +53,7 @@ private:      int32_t mWidth, mHeight;      int32_t mCropLeft, mCropTop, mCropRight, mCropBottom;      int32_t mCropWidth, mCropHeight; +    int32_t mRotationDegrees;      FrameRenderTracker mRenderTracker;      SoftwareRenderer(const SoftwareRenderer &);  | 
