gecko-dev/dom/camera/update2.patch
Inder Kumar ext:(%20and%20Mike%20Habicher%20%3Cmhabicher%40mozilla.com%3E) 6d9d08d1fd Bug 776062: Add support for recording video on gonk. r=cjones,double,ikumar,mikeh sr=sicking
2012-09-28 22:30:52 -07:00

164 lines
5.6 KiB
Diff

diff --git a/dom/camera/GonkCameraSource.cpp b/dom/camera/GonkCameraSource.cpp
--- a/dom/camera/GonkCameraSource.cpp
+++ b/dom/camera/GonkCameraSource.cpp
@@ -492,21 +492,17 @@ status_t GonkCameraSource::init(
mMeta = new MetaData;
mMeta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_VIDEO_RAW);
mMeta->setInt32(kKeyColorFormat, mColorFormat);
mMeta->setInt32(kKeyWidth, mVideoSize.width);
mMeta->setInt32(kKeyHeight, mVideoSize.height);
mMeta->setInt32(kKeyStride, mVideoSize.width);
mMeta->setInt32(kKeySliceHeight, mVideoSize.height);
mMeta->setInt32(kKeyFrameRate, mVideoFrameRate);
- mMeta->setInt32(kKeyHFR, hfr);
- if (want3D) {
- mMeta->setInt32(kKey3D, !0);
- }
return OK;
}
GonkCameraSource::~GonkCameraSource() {
if (mStarted) {
stop();
} else if (mInitCheck == OK) {
// Camera is initialized but because start() is never called,
diff --git a/dom/camera/GonkRecorder.cpp b/dom/camera/GonkRecorder.cpp
--- a/dom/camera/GonkRecorder.cpp
+++ b/dom/camera/GonkRecorder.cpp
@@ -716,56 +716,16 @@ status_t GonkRecorder::start() {
mStarted = true;
}
return status;
}
sp<MediaSource> GonkRecorder::createAudioSource() {
- bool tunneledSource = false;
- const char *tunnelMime;
- {
- AudioParameter param;
- String8 key("tunneled-input-formats");
- param.add( key, String8("get") );
- String8 valueStr = AudioSystem::getParameters( 0, param.toString());
- AudioParameter result(valueStr);
- int value;
- if ( mAudioEncoder == AUDIO_ENCODER_AMR_NB &&
- result.getInt(String8("AMR"),value) == NO_ERROR ) {
- tunneledSource = true;
- tunnelMime = MEDIA_MIMETYPE_AUDIO_AMR_NB;
- }
- else if ( mAudioEncoder == AUDIO_ENCODER_QCELP &&
- result.getInt(String8("QCELP"),value) == NO_ERROR ) {
- tunneledSource = true;
- tunnelMime = MEDIA_MIMETYPE_AUDIO_QCELP;
- }
- else if ( mAudioEncoder == AUDIO_ENCODER_EVRC &&
- result.getInt(String8("EVRC"),value) == NO_ERROR ) {
- tunneledSource = true;
- tunnelMime = MEDIA_MIMETYPE_AUDIO_EVRC;
- }
- }
-
- if ( tunneledSource ) {
- sp<AudioSource> audioSource = NULL;
- sp<MetaData> meta = new MetaData;
- meta->setInt32(kKeyChannelCount, mAudioChannels);
- meta->setInt32(kKeySampleRate, mSampleRate);
- meta->setInt32(kKeyBitRate, mAudioBitRate);
- if (mAudioTimeScale > 0) {
- meta->setInt32(kKeyTimeScale, mAudioTimeScale);
- }
- meta->setCString( kKeyMIMEType, tunnelMime );
- audioSource = new AudioSource( mAudioSource, meta);
- return audioSource->initCheck( ) == OK ? audioSource : NULL;
- }
-
sp<AudioSource> audioSource =
new AudioSource(
mAudioSource,
mSampleRate,
mAudioChannels);
status_t err = audioSource->initCheck();
@@ -1226,56 +1186,33 @@ status_t GonkRecorder::setupVideoEncoder
default:
CHECK(!"Should not be here, unsupported video encoding.");
break;
}
sp<MetaData> meta = cameraSource->getFormat();
- int32_t width, height, stride, sliceHeight, colorFormat, hfr, is3D;
+ int32_t width, height, stride, sliceHeight, colorFormat;
CHECK(meta->findInt32(kKeyWidth, &width));
CHECK(meta->findInt32(kKeyHeight, &height));
CHECK(meta->findInt32(kKeyStride, &stride));
CHECK(meta->findInt32(kKeySliceHeight, &sliceHeight));
CHECK(meta->findInt32(kKeyColorFormat, &colorFormat));
- CHECK(meta->findInt32(kKeyHFR, &hfr));
-
- if(hfr) {
- mMaxFileDurationUs = mMaxFileDurationUs * (hfr/mFrameRate);
- }
-
enc_meta->setInt32(kKeyWidth, width);
enc_meta->setInt32(kKeyHeight, height);
enc_meta->setInt32(kKeyIFramesInterval, mIFramesIntervalSec);
enc_meta->setInt32(kKeyStride, stride);
enc_meta->setInt32(kKeySliceHeight, sliceHeight);
enc_meta->setInt32(kKeyColorFormat, colorFormat);
- enc_meta->setInt32(kKeyHFR, hfr);
if (mVideoTimeScale > 0) {
enc_meta->setInt32(kKeyTimeScale, mVideoTimeScale);
}
- char mDeviceName[100];
- property_get("ro.board.platform",mDeviceName,"0");
- if(!strncmp(mDeviceName, "msm7627a", 8)) {
- if(hfr && (width * height > 432*240)) {
- LOGE("HFR mode is supported only upto WQVGA resolution");
- return INVALID_OPERATION;
- }
- }
- else {
- if(hfr && ((mVideoEncoder != VIDEO_ENCODER_H264) || (width * height > 800*480))) {
- LOGE("HFR mode is supported only upto WVGA and H264 codec.");
- return INVALID_OPERATION;
- }
- }
-
-
/*
* can set profile from the app as a parameter.
* For the mean time, set from shell
*/
char value[PROPERTY_VALUE_MAX];
bool customProfile = false;
@@ -1322,19 +1259,16 @@ status_t GonkRecorder::setupVideoEncoder
}
if (mVideoEncoderProfile != -1) {
enc_meta->setInt32(kKeyVideoProfile, mVideoEncoderProfile);
}
if (mVideoEncoderLevel != -1) {
enc_meta->setInt32(kKeyVideoLevel, mVideoEncoderLevel);
}
- if (meta->findInt32(kKey3D, &is3D)) {
- enc_meta->setInt32(kKey3D, is3D);
- }
uint32_t encoder_flags = 0;
if (mIsMetaDataStoredInVideoBuffers) {
LOGW("Camera source supports metadata mode, create OMXCodec for metadata");
encoder_flags |= OMXCodec::kHardwareCodecsOnly;
encoder_flags |= OMXCodec::kStoreMetaDataInVideoBuffers;
encoder_flags |= OMXCodec::kOnlySubmitOneInputBufferAtOneTime;
}