summaryrefslogtreecommitdiffstats
path: root/media/libmediaplayerservice/nuplayer
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2012-08-31 12:18:27 -0700
committerJames Dong <jdong@google.com>2012-09-04 19:00:50 -0700
commit0d268a3cae145afb2720c88ae38fb81550be5584 (patch)
treef9867ade7070263e6a521531d1ff4e6624618966 /media/libmediaplayerservice/nuplayer
parentfbe9d81ff5fbdc5aecdcdd13e4a5d7f019824f96 (diff)
downloadframeworks_av-0d268a3cae145afb2720c88ae38fb81550be5584.zip
frameworks_av-0d268a3cae145afb2720c88ae38fb81550be5584.tar.gz
frameworks_av-0d268a3cae145afb2720c88ae38fb81550be5584.tar.bz2
Add setVideoScalingMode support to NuPlayer
o related-to-bug: 7089195 Change-Id: Ic30d9312673f2d5837c779e023ac64468ecd4951
Diffstat (limited to 'media/libmediaplayerservice/nuplayer')
-rw-r--r--media/libmediaplayerservice/nuplayer/NuPlayer.cpp20
-rw-r--r--media/libmediaplayerservice/nuplayer/NuPlayer.h4
-rw-r--r--media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp24
3 files changed, 46 insertions, 2 deletions
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
index 91aaafe..dc1e351 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
@@ -68,7 +68,8 @@ NuPlayer::NuPlayer()
mSkipRenderingVideoUntilMediaTimeUs(-1ll),
mVideoLateByUs(0ll),
mNumFramesTotal(0ll),
- mNumFramesDropped(0ll) {
+ mNumFramesDropped(0ll),
+ mVideoScalingMode(NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW) {
}
NuPlayer::~NuPlayer() {
@@ -217,6 +218,9 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) {
CHECK(msg->findObject("native-window", &obj));
mNativeWindow = static_cast<NativeWindowWrapper *>(obj.get());
+
+ // XXX - ignore error from setVideoScalingMode for now
+ setVideoScalingMode(mVideoScalingMode);
break;
}
@@ -957,4 +961,18 @@ sp<AMessage> NuPlayer::Source::getFormat(bool audio) {
return NULL;
}
+status_t NuPlayer::setVideoScalingMode(int32_t mode) {
+ mVideoScalingMode = mode;
+ if (mNativeWindow != NULL) {
+ status_t ret = native_window_set_scaling_mode(
+ mNativeWindow->getNativeWindow().get(), mVideoScalingMode);
+ if (ret != OK) {
+ ALOGE("Failed to set scaling mode (%d): %s",
+ -ret, strerror(-ret));
+ return ret;
+ }
+ }
+ return OK;
+}
+
} // namespace android
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.h b/media/libmediaplayerservice/nuplayer/NuPlayer.h
index 996806e..36d3a9c 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayer.h
+++ b/media/libmediaplayerservice/nuplayer/NuPlayer.h
@@ -55,6 +55,8 @@ struct NuPlayer : public AHandler {
// Will notify the driver through "notifySeekComplete" once finished.
void seekToAsync(int64_t seekTimeUs);
+ status_t setVideoScalingMode(int32_t mode);
+
protected:
virtual ~NuPlayer();
@@ -130,6 +132,8 @@ private:
int64_t mVideoLateByUs;
int64_t mNumFramesTotal, mNumFramesDropped;
+ int32_t mVideoScalingMode;
+
status_t instantiateDecoder(bool audio, sp<Decoder> *decoder);
status_t feedDecoderInputData(bool audio, const sp<AMessage> &msg);
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
index 441cbf3..d03601f 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
@@ -259,7 +259,29 @@ player_type NuPlayerDriver::playerType() {
}
status_t NuPlayerDriver::invoke(const Parcel &request, Parcel *reply) {
- return INVALID_OPERATION;
+ if (reply == NULL) {
+ ALOGE("reply is a NULL pointer");
+ return BAD_VALUE;
+ }
+
+ int32_t methodId;
+ status_t ret = request.readInt32(&methodId);
+ if (ret != OK) {
+ ALOGE("Failed to retrieve the requested method to invoke");
+ return ret;
+ }
+
+ switch (methodId) {
+ case INVOKE_ID_SET_VIDEO_SCALING_MODE:
+ {
+ int mode = request.readInt32();
+ return mPlayer->setVideoScalingMode(mode);
+ }
+ default:
+ {
+ return INVALID_OPERATION;
+ }
+ }
}
void NuPlayerDriver::setAudioSink(const sp<AudioSink> &audioSink) {