From 5145d67e7738681af6971748fa77b5eb32ab2302 Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Mon, 1 Nov 2010 16:01:05 -0700 Subject: [PATCH] Notify surfaceflinger about (changes to) the crop rectangle output by the decoder. Change-Id: I9c33618dd3351be1ecadcc7d0329654ea50bad3f related-to-bug: 3153626 --- media/libstagefright/OMXCodec.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp index 0d8abe2f0c5fd..ce48d1c99dd14 100644 --- a/media/libstagefright/OMXCodec.cpp +++ b/media/libstagefright/OMXCodec.cpp @@ -2109,6 +2109,17 @@ void OMXCodec::onEvent(OMX_EVENTTYPE event, OMX_U32 data1, OMX_U32 data2) { CODEC_LOGV( "output crop (%ld, %ld, %ld, %ld)", rect.nLeft, rect.nTop, rect.nWidth, rect.nHeight); + + if (mNativeWindow != NULL) { + android_native_rect_t crop; + crop.left = rect.nLeft; + crop.top = rect.nTop; + crop.right = crop.left + rect.nWidth - 1; + crop.bottom = crop.top + rect.nHeight - 1; + + CHECK_EQ(0, native_window_set_crop( + mNativeWindow.get(), &crop)); + } } else { CODEC_LOGE("getConfig(OMX_IndexConfigCommonOutputCrop) " "returned error 0x%08x", err);