diff options
author | James Dong <jdong@google.com> | 2010-11-09 11:15:47 -0800 |
---|---|---|
committer | James Dong <jdong@google.com> | 2010-11-09 11:48:29 -0800 |
commit | 13f6284305e4b27395a23db7882d670bdb1bcae1 (patch) | |
tree | d1d52048987dfa98e53e151a6820ae332e59d59a /media/libmediaplayerservice/StagefrightRecorder.cpp | |
parent | 30db2709395c73fb3b4ee334119ceba68c95ab13 (diff) | |
download | frameworks_av-13f6284305e4b27395a23db7882d670bdb1bcae1.zip frameworks_av-13f6284305e4b27395a23db7882d670bdb1bcae1.tar.gz frameworks_av-13f6284305e4b27395a23db7882d670bdb1bcae1.tar.bz2 |
Rotation support
- We only support 0, 90, 180, and 270 degree clockwise rotation
- Some players are known to ignore composition matrix in the MP4 file,
although this is part of the MP4 file standard.
Both QT and YT are supporting the rotation
The original patch (65a73f4e8c79d05c0d9001b660325748d4ecf37b) was not merged.
The only change I made is to reuse the same kKeyRotation in MetaData.h;
and thus do not neeed to use kKeyRotationDegree.
Change-Id: Ib328716d4842201c4adf57e4ddfe1f1ac1ae4d8a
Diffstat (limited to 'media/libmediaplayerservice/StagefrightRecorder.cpp')
-rw-r--r-- | media/libmediaplayerservice/StagefrightRecorder.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/media/libmediaplayerservice/StagefrightRecorder.cpp b/media/libmediaplayerservice/StagefrightRecorder.cpp index 6a25dc5..9da5f01 100644 --- a/media/libmediaplayerservice/StagefrightRecorder.cpp +++ b/media/libmediaplayerservice/StagefrightRecorder.cpp @@ -345,6 +345,17 @@ status_t StagefrightRecorder::setParamVideoEncodingBitRate(int32_t bitRate) { return OK; } +// Always rotate clockwise, and only support 0, 90, 180 and 270 for now. +status_t StagefrightRecorder::setParamVideoRotation(int32_t degrees) { + LOGV("setParamVideoRotation: %d", degrees); + if (degrees < 0 || degrees % 90 != 0) { + LOGE("Unsupported video rotation angle: %d", degrees); + return BAD_VALUE; + } + mRotationDegrees = degrees % 360; + return OK; +} + status_t StagefrightRecorder::setParamMaxFileDurationUs(int64_t timeUs) { LOGV("setParamMaxFileDurationUs: %lld us", timeUs); if (timeUs <= 0) { @@ -599,6 +610,11 @@ status_t StagefrightRecorder::setParameter( if (safe_strtoi32(value.string(), &video_bitrate)) { return setParamVideoEncodingBitRate(video_bitrate); } + } else if (key == "video-param-rotation-angle-degrees") { + int32_t degrees; + if (safe_strtoi32(value.string(), °rees)) { + return setParamVideoRotation(degrees); + } } else if (key == "video-param-i-frames-interval") { int32_t seconds; if (safe_strtoi32(value.string(), &seconds)) { @@ -1255,6 +1271,9 @@ void StagefrightRecorder::setupMPEG4MetaData(int64_t startTimeUs, int32_t totalB if (mTrackEveryTimeDurationUs > 0) { (*meta)->setInt64(kKeyTrackTimeStatus, mTrackEveryTimeDurationUs); } + if (mRotationDegrees != 0) { + (*meta)->setInt32(kKeyRotation, mRotationDegrees); + } } status_t StagefrightRecorder::startMPEG4Recording() { |