diff options
author | Andreas Huber <andih@google.com> | 2011-01-10 10:38:31 -0800 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2011-01-10 10:38:31 -0800 |
commit | 7caa130a98baa64768dcd409bc110ce9acb0cbff (patch) | |
tree | 251f888c616e61c6a59101ea15165dcc3b4a5294 /media/libmediaplayerservice/nuplayer | |
parent | aa6b9f55d60702211dd2d08403c7296347f0bd7d (diff) | |
download | frameworks_base-7caa130a98baa64768dcd409bc110ce9acb0cbff.zip frameworks_base-7caa130a98baa64768dcd409bc110ce9acb0cbff.tar.gz frameworks_base-7caa130a98baa64768dcd409bc110ce9acb0cbff.tar.bz2 |
NuPlayer now properly sends MEDIA_SET_VIDEOSIZE notifications.
Change-Id: I99b4223ad6ecfd8839a3c0e737fef3165565d76d
related-to-bug: 3336496
Diffstat (limited to 'media/libmediaplayerservice/nuplayer')
-rw-r--r-- | media/libmediaplayerservice/nuplayer/DecoderWrapper.cpp | 12 | ||||
-rw-r--r-- | media/libmediaplayerservice/nuplayer/NuPlayer.cpp | 45 |
2 files changed, 45 insertions, 12 deletions
diff --git a/media/libmediaplayerservice/nuplayer/DecoderWrapper.cpp b/media/libmediaplayerservice/nuplayer/DecoderWrapper.cpp index 4d4cd8d..802d1fb 100644 --- a/media/libmediaplayerservice/nuplayer/DecoderWrapper.cpp +++ b/media/libmediaplayerservice/nuplayer/DecoderWrapper.cpp @@ -309,6 +309,18 @@ void DecoderWrapper::WrapperReader::sendFormatChange() { realNotify->setInt32("width", width); realNotify->setInt32("height", height); + + int32_t cropLeft, cropTop, cropRight, cropBottom; + if (!meta->findRect( + kKeyCropRect, + &cropLeft, &cropTop, &cropRight, &cropBottom)) { + cropLeft = 0; + cropTop = 0; + cropRight = width - 1; + cropBottom = height - 1; + } + + realNotify->setRect("crop", cropLeft, cropTop, cropRight, cropBottom); } notify->post(); diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp index e1b371e..7f534c0 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp @@ -271,22 +271,43 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) { finishFlushIfPossible(); } else if (what == ACodec::kWhatOutputFormatChanged) { - CHECK(audio); - - int32_t numChannels; - CHECK(codecRequest->findInt32("channel-count", &numChannels)); + if (audio) { + int32_t numChannels; + CHECK(codecRequest->findInt32("channel-count", &numChannels)); - int32_t sampleRate; - CHECK(codecRequest->findInt32("sample-rate", &sampleRate)); + int32_t sampleRate; + CHECK(codecRequest->findInt32("sample-rate", &sampleRate)); - LOGV("Audio output format changed to %d Hz, %d channels", - sampleRate, numChannels); + LOGV("Audio output format changed to %d Hz, %d channels", + sampleRate, numChannels); - mAudioSink->close(); - CHECK_EQ(mAudioSink->open(sampleRate, numChannels), (status_t)OK); - mAudioSink->start(); + mAudioSink->close(); + CHECK_EQ(mAudioSink->open(sampleRate, numChannels), (status_t)OK); + mAudioSink->start(); - mRenderer->signalAudioSinkChanged(); + mRenderer->signalAudioSinkChanged(); + } else { + // video + + int32_t width, height; + CHECK(codecRequest->findInt32("width", &width)); + CHECK(codecRequest->findInt32("height", &height)); + + int32_t cropLeft, cropTop, cropRight, cropBottom; + CHECK(codecRequest->findRect( + "crop", + &cropLeft, &cropTop, &cropRight, &cropBottom)); + + LOGV("Video output format changed to %d x %d " + "(crop: %d, %d, %d, %d)", + width, height, + cropLeft, cropTop, cropRight, cropBottom); + + notifyListener( + MEDIA_SET_VIDEO_SIZE, + cropRight - cropLeft + 1, + cropBottom - cropTop + 1); + } } else if (what == ACodec::kWhatShutdownCompleted) { LOGV("%s shutdown completed", audio ? "audio" : "video"); if (audio) { |