diff options
author | Lajos Molnar <lajos@google.com> | 2015-05-02 00:40:52 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-05-02 00:40:52 +0000 |
commit | 64da6f045b1a1d1b8f01391b6e37287f77f85d1e (patch) | |
tree | f0ff2afd1653e1f1705c1267389f4028118fb714 /media | |
parent | 0247f0db93a828f0754a6d2d278cb08c6609cf26 (diff) | |
parent | f06cc24ce7aeb5ff6f45b770a15286c95f8cc9ff (diff) | |
download | frameworks_av-64da6f045b1a1d1b8f01391b6e37287f77f85d1e.zip frameworks_av-64da6f045b1a1d1b8f01391b6e37287f77f85d1e.tar.gz frameworks_av-64da6f045b1a1d1b8f01391b6e37287f77f85d1e.tar.bz2 |
Merge "stagefright: MediaCodec: rename mNativeWindow to mSurface" into mnc-dev
Diffstat (limited to 'media')
-rw-r--r-- | media/libstagefright/MediaCodec.cpp | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp index 25887ef..9906a10 100644 --- a/media/libstagefright/MediaCodec.cpp +++ b/media/libstagefright/MediaCodec.cpp @@ -466,7 +466,7 @@ status_t MediaCodec::setCallback(const sp<AMessage> &callback) { status_t MediaCodec::configure( const sp<AMessage> &format, - const sp<Surface> &nativeWindow, + const sp<Surface> &surface, const sp<ICrypto> &crypto, uint32_t flags) { sp<AMessage> msg = new AMessage(kWhatConfigure, this); @@ -478,10 +478,7 @@ status_t MediaCodec::configure( msg->setMessage("format", format); msg->setInt32("flags", flags); - - if (nativeWindow != NULL) { - msg->setObject("native-window", nativeWindow); - } + msg->setObject("surface", surface); if (crypto != NULL) { msg->setPointer("crypto", crypto.get()); @@ -1324,13 +1321,13 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { ALOGV("codec output format changed"); if (mSoftRenderer == NULL && - mNativeWindow != NULL && + mSurface != NULL && (mFlags & kFlagUsesSoftwareRenderer)) { AString mime; CHECK(msg->findString("mime", &mime)); if (mime.startsWithIgnoreCase("video/")) { - mSoftRenderer = new SoftwareRenderer(mNativeWindow); + mSoftRenderer = new SoftwareRenderer(mSurface); } } @@ -1602,22 +1599,20 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { } sp<RefBase> obj; - if (!msg->findObject("native-window", &obj)) { - obj.clear(); - } + CHECK(msg->findObject("surface", &obj)); sp<AMessage> format; CHECK(msg->findMessage("format", &format)); if (obj != NULL) { format->setObject("native-window", obj); - status_t err = setNativeWindow(static_cast<Surface *>(obj.get())); + status_t err = handleSetSurface(static_cast<Surface *>(obj.get())); if (err != OK) { PostReplyWithError(replyID, err); break; } } else { - setNativeWindow(NULL); + handleSetSurface(NULL); } mReplyID = replyID; @@ -2100,7 +2095,7 @@ void MediaCodec::setState(State newState) { mSoftRenderer = NULL; mCrypto.clear(); - setNativeWindow(NULL); + handleSetSurface(NULL); mInputFormat.clear(); mOutputFormat.clear(); @@ -2406,25 +2401,24 @@ ssize_t MediaCodec::dequeuePortBuffer(int32_t portIndex) { return index; } -status_t MediaCodec::setNativeWindow( - const sp<Surface> &surfaceTextureClient) { +status_t MediaCodec::handleSetSurface(const sp<Surface> &surface) { status_t err; - if (mNativeWindow != NULL) { + if (mSurface != NULL) { err = native_window_api_disconnect( - mNativeWindow.get(), NATIVE_WINDOW_API_MEDIA); + mSurface.get(), NATIVE_WINDOW_API_MEDIA); if (err != OK) { ALOGW("native_window_api_disconnect returned an error: %s (%d)", strerror(-err), err); } - mNativeWindow.clear(); + mSurface.clear(); } - if (surfaceTextureClient != NULL) { + if (surface != NULL) { err = native_window_api_connect( - surfaceTextureClient.get(), NATIVE_WINDOW_API_MEDIA); + surface.get(), NATIVE_WINDOW_API_MEDIA); if (err != OK) { ALOGE("native_window_api_connect returned an error: %s (%d)", @@ -2433,7 +2427,7 @@ status_t MediaCodec::setNativeWindow( return err; } - mNativeWindow = surfaceTextureClient; + mSurface = surface; } return OK; |