diff options
author | James Dong <jdong@google.com> | 2012-05-01 13:33:52 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-05-01 13:33:52 -0700 |
commit | daaf7b119649674cfc414a8761585fed6b0296df (patch) | |
tree | 0ca015369803b98500731e6c37fefe218e436f57 /media | |
parent | 31dfd1db7a4d2228d9642008af6f3dd744368eb6 (diff) | |
parent | 4f6eed0d1c7972a983c075bdcf03089569e13fe1 (diff) | |
download | frameworks_av-daaf7b119649674cfc414a8761585fed6b0296df.zip frameworks_av-daaf7b119649674cfc414a8761585fed6b0296df.tar.gz frameworks_av-daaf7b119649674cfc414a8761585fed6b0296df.tar.bz2 |
Merge "Impl for supporting two video scaling modes" into jb-dev
Diffstat (limited to 'media')
-rw-r--r-- | media/libstagefright/AwesomePlayer.cpp | 26 | ||||
-rwxr-xr-x | media/libstagefright/OMXCodec.cpp | 15 | ||||
-rw-r--r-- | media/libstagefright/include/AwesomePlayer.h | 3 |
3 files changed, 29 insertions, 15 deletions
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp index 1387e74..cc3fae6 100644 --- a/media/libstagefright/AwesomePlayer.cpp +++ b/media/libstagefright/AwesomePlayer.cpp @@ -184,6 +184,7 @@ AwesomePlayer::AwesomePlayer() mAudioPlayer(NULL), mDisplayWidth(0), mDisplayHeight(0), + mVideoScalingMode(NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW), mFlags(0), mExtractorFlags(0), mVideoBuffer(NULL), @@ -1081,6 +1082,8 @@ void AwesomePlayer::initRenderer_l() { // before creating a new one. IPCThreadState::self()->flushCommands(); + // Even if set scaling mode fails, we will continue anyway + setVideoScalingMode_l(mVideoScalingMode); if (USE_SURFACE_ALLOC && !strncmp(component, "OMX.", 4) && strncmp(component, "OMX.google.", 11) @@ -2362,6 +2365,23 @@ size_t AwesomePlayer::countTracks() const { return mExtractor->countTracks() + mTextDriver->countExternalTracks(); } +status_t AwesomePlayer::setVideoScalingMode(int32_t mode) { + Mutex::Autolock lock(mLock); + return setVideoScalingMode_l(mode); +} + +status_t AwesomePlayer::setVideoScalingMode_l(int32_t mode) { + mVideoScalingMode = mode; + if (mNativeWindow != NULL) { + status_t err = native_window_set_scaling_mode( + mNativeWindow.get(), mVideoScalingMode); + if (err != OK) { + ALOGW("Failed to set scaling mode: %d", err); + } + } + return OK; +} + status_t AwesomePlayer::invoke(const Parcel &request, Parcel *reply) { if (NULL == reply) { return android::BAD_VALUE; @@ -2372,6 +2392,12 @@ status_t AwesomePlayer::invoke(const Parcel &request, Parcel *reply) { return ret; } switch(methodId) { + case INVOKE_ID_SET_VIDEO_SCALING_MODE: + { + int mode = request.readInt32(); + return setVideoScalingMode(mode); + } + case INVOKE_ID_GET_TRACK_INFO: { return getTrackInfo(reply); diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp index 791e044..56016a8 100755 --- a/media/libstagefright/OMXCodec.cpp +++ b/media/libstagefright/OMXCodec.cpp @@ -1683,13 +1683,6 @@ status_t OMXCodec::allocateOutputBuffersFromNativeWindow() { return err; } - err = native_window_set_scaling_mode(mNativeWindow.get(), - NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW); - - if (err != OK) { - return err; - } - err = native_window_set_buffers_geometry( mNativeWindow.get(), def.format.video.nFrameWidth, @@ -1913,14 +1906,6 @@ status_t OMXCodec::pushBlankBuffersToNativeWindow() { return err; } - err = native_window_set_scaling_mode(mNativeWindow.get(), - NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW); - if (err != NO_ERROR) { - ALOGE("error pushing blank frames: set_buffers_geometry failed: %s (%d)", - strerror(-err), -err); - goto error; - } - err = native_window_set_buffers_geometry(mNativeWindow.get(), 1, 1, HAL_PIXEL_FORMAT_RGBX_8888); if (err != NO_ERROR) { diff --git a/media/libstagefright/include/AwesomePlayer.h b/media/libstagefright/include/AwesomePlayer.h index a2e2e85..1409dc7 100644 --- a/media/libstagefright/include/AwesomePlayer.h +++ b/media/libstagefright/include/AwesomePlayer.h @@ -175,6 +175,7 @@ private: int32_t mDisplayWidth; int32_t mDisplayHeight; + int32_t mVideoScalingMode; uint32_t mFlags; uint32_t mExtractorFlags; @@ -318,6 +319,8 @@ private: Vector<TrackStat> mTracks; } mStats; + status_t setVideoScalingMode(int32_t mode); + status_t setVideoScalingMode_l(int32_t mode); status_t getTrackInfo(Parcel* reply) const; // when select is true, the given track is selected. |