summaryrefslogtreecommitdiffstats
path: root/media/libmediaplayerservice/StagefrightRecorder.cpp
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2010-08-16 18:39:28 -0700
committerJames Dong <jdong@google.com>2010-11-05 15:47:52 -0700
commitaca1fe35480ae76dd6bae167ade40adc955e2d0d (patch)
treeed1cb95800d38e5937ae59d01dc60cbdf3803a3a /media/libmediaplayerservice/StagefrightRecorder.cpp
parentff5bfcf19da45e6bb0136ef818b7c4bf8fd8db3d (diff)
downloadframeworks_av-aca1fe35480ae76dd6bae167ade40adc955e2d0d.zip
frameworks_av-aca1fe35480ae76dd6bae167ade40adc955e2d0d.tar.gz
frameworks_av-aca1fe35480ae76dd6bae167ade40adc955e2d0d.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 Change-Id: I1b7f66a801e9d9c49d889c9b06dd6173fa7e76c4
Diffstat (limited to 'media/libmediaplayerservice/StagefrightRecorder.cpp')
-rw-r--r--media/libmediaplayerservice/StagefrightRecorder.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/media/libmediaplayerservice/StagefrightRecorder.cpp b/media/libmediaplayerservice/StagefrightRecorder.cpp
index d37d83d..553648d 100644
--- a/media/libmediaplayerservice/StagefrightRecorder.cpp
+++ b/media/libmediaplayerservice/StagefrightRecorder.cpp
@@ -340,6 +340,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) {
@@ -532,6 +543,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(), &degrees)) {
+ return setParamVideoRotation(degrees);
+ }
} else if (key == "video-param-i-frames-interval") {
int32_t seconds;
if (safe_strtoi32(value.string(), &seconds)) {
@@ -1105,6 +1121,9 @@ status_t StagefrightRecorder::startMPEG4Recording() {
if (mTrackEveryTimeDurationUs > 0) {
meta->setInt64(kKeyTrackTimeStatus, mTrackEveryTimeDurationUs);
}
+ if (mRotationDegrees != 0) {
+ meta->setInt32(kKeyRotationDegree, mRotationDegrees);
+ }
writer->setListener(mListener);
mWriter = writer;
return mWriter->start(meta.get());
@@ -1187,6 +1206,7 @@ status_t StagefrightRecorder::reset() {
mMaxFileDurationUs = 0;
mMaxFileSizeBytes = 0;
mTrackEveryTimeDurationUs = 0;
+ mRotationDegrees = 0;
mEncoderProfiles = MediaProfiles::getInstance();
mOutputFd = -1;