diff options
author | Lajos Molnar <lajos@google.com> | 2013-06-12 09:32:30 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-06-12 09:32:30 -0700 |
commit | 63e9f73c2db01fec30246adbcfea2880671e2108 (patch) | |
tree | e77ece5239d9503fed78872ecbaa216649a22a78 | |
parent | fe9a901a445633e70073b1b91fca3af34d8e8132 (diff) | |
parent | f8af99b7c10f1441d9a52676724b168f20752270 (diff) | |
download | frameworks_av-63e9f73c2db01fec30246adbcfea2880671e2108.zip frameworks_av-63e9f73c2db01fec30246adbcfea2880671e2108.tar.gz frameworks_av-63e9f73c2db01fec30246adbcfea2880671e2108.tar.bz2 |
am f8af99b7: am 0662f7b6: Merge "stagefright: synchronously change nativewindow crop" into jb-mr2-dev
* commit 'f8af99b7c10f1441d9a52676724b168f20752270':
stagefright: synchronously change nativewindow crop
-rw-r--r-- | include/media/stagefright/ACodec.h | 2 | ||||
-rw-r--r-- | media/libstagefright/ACodec.cpp | 31 |
2 files changed, 19 insertions, 14 deletions
diff --git a/include/media/stagefright/ACodec.h b/include/media/stagefright/ACodec.h index 391c089..8876c9b 100644 --- a/include/media/stagefright/ACodec.h +++ b/include/media/stagefright/ACodec.h @@ -278,7 +278,7 @@ private: void deferMessage(const sp<AMessage> &msg); void processDeferredMessages(); - void sendFormatChange(); + void sendFormatChange(const sp<AMessage> &reply); void signalError( OMX_ERRORTYPE error = OMX_ErrorUndefined, diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp index a60c320..bf650b4 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp @@ -2254,7 +2254,7 @@ void ACodec::processDeferredMessages() { } } -void ACodec::sendFormatChange() { +void ACodec::sendFormatChange(const sp<AMessage> &reply) { sp<AMessage> notify = mNotify->dup(); notify->setInt32("what", kWhatOutputFormatChanged); @@ -2319,14 +2319,12 @@ void ACodec::sendFormatChange() { rect.nTop + rect.nHeight - 1); if (mNativeWindow != NULL) { - android_native_rect_t crop; - crop.left = rect.nLeft; - crop.top = rect.nTop; - crop.right = rect.nLeft + rect.nWidth; - crop.bottom = rect.nTop + rect.nHeight; - - CHECK_EQ(0, native_window_set_crop( - mNativeWindow.get(), &crop)); + reply->setRect( + "crop", + rect.nLeft, + rect.nTop, + rect.nLeft + rect.nWidth, + rect.nTop + rect.nHeight); } } break; @@ -3090,8 +3088,11 @@ bool ACodec::BaseState::onOMXFillBufferDone( break; } + sp<AMessage> reply = + new AMessage(kWhatOutputBufferDrained, mCodec->id()); + if (!mCodec->mSentFormat) { - mCodec->sendFormatChange(); + mCodec->sendFormatChange(reply); } if (mCodec->mUseMetadataOnEncoderOutput) { @@ -3122,9 +3123,6 @@ bool ACodec::BaseState::onOMXFillBufferDone( notify->setBuffer("buffer", info->mData); notify->setInt32("flags", flags); - sp<AMessage> reply = - new AMessage(kWhatOutputBufferDrained, mCodec->id()); - reply->setPointer("buffer-id", info->mBufferID); notify->setMessage("reply", reply); @@ -3168,6 +3166,13 @@ void ACodec::BaseState::onOutputBufferDrained(const sp<AMessage> &msg) { mCodec->findBufferByID(kPortIndexOutput, bufferID, &index); CHECK_EQ((int)info->mStatus, (int)BufferInfo::OWNED_BY_DOWNSTREAM); + android_native_rect_t crop; + if (msg->findRect("crop", + &crop.left, &crop.top, &crop.right, &crop.bottom)) { + CHECK_EQ(0, native_window_set_crop( + mCodec->mNativeWindow.get(), &crop)); + } + int32_t render; if (mCodec->mNativeWindow != NULL && msg->findInt32("render", &render) && render != 0 |