diff options
author | Kenny Root <kroot@google.com> | 2010-10-14 23:58:41 -0700 |
---|---|---|
committer | Kenny Root <kroot@google.com> | 2010-10-14 23:58:41 -0700 |
commit | f9f083e2853740c97588f4db82c24645ae5880e4 (patch) | |
tree | 5d045dddcf9e85e4826286c28662050b9d4a935d /media/libmediaplayerservice | |
parent | d6119356f45c9c57cac812357d969ecc3001087e (diff) | |
parent | e4edd632d48720b44f7878273f46d192d5703150 (diff) | |
download | frameworks_av-f9f083e2853740c97588f4db82c24645ae5880e4.zip frameworks_av-f9f083e2853740c97588f4db82c24645ae5880e4.tar.gz frameworks_av-f9f083e2853740c97588f4db82c24645ae5880e4.tar.bz2 |
resolved conflicts for merge of a127c07c to master
Change-Id: Ifdfc6681cba00f36456eaf7a97f34a75b9d0c086
Diffstat (limited to 'media/libmediaplayerservice')
-rw-r--r-- | media/libmediaplayerservice/StagefrightRecorder.cpp | 56 | ||||
-rw-r--r-- | media/libmediaplayerservice/StagefrightRecorder.h | 1 |
2 files changed, 57 insertions, 0 deletions
diff --git a/media/libmediaplayerservice/StagefrightRecorder.cpp b/media/libmediaplayerservice/StagefrightRecorder.cpp index 06d5cd5..ec2449d 100644 --- a/media/libmediaplayerservice/StagefrightRecorder.cpp +++ b/media/libmediaplayerservice/StagefrightRecorder.cpp @@ -26,6 +26,7 @@ #include <media/stagefright/VideoSourceDownSampler.h> #include <media/stagefright/CameraSourceTimeLapse.h> #include <media/stagefright/MediaSourceSplitter.h> +#include <media/stagefright/MPEG2TSWriter.h> #include <media/stagefright/MPEG4Writer.h> #include <media/stagefright/MediaDebug.h> #include <media/stagefright/MediaDefs.h> @@ -724,6 +725,9 @@ status_t StagefrightRecorder::start() { case OUTPUT_FORMAT_RTP_AVP: return startRTPRecording(); + case OUTPUT_FORMAT_MPEG2TS: + return startMPEG2TSRecording(); + default: LOGE("Unsupported output file format: %d", mOutputFormat); return UNKNOWN_ERROR; @@ -898,6 +902,58 @@ status_t StagefrightRecorder::startRTPRecording() { return mWriter->start(); } +status_t StagefrightRecorder::startMPEG2TSRecording() { + CHECK_EQ(mOutputFormat, OUTPUT_FORMAT_MPEG2TS); + + sp<MediaWriter> writer = new MPEG2TSWriter(dup(mOutputFd)); + + if (mAudioSource != AUDIO_SOURCE_LIST_END) { + if (mAudioEncoder != AUDIO_ENCODER_AAC) { + return ERROR_UNSUPPORTED; + } + + status_t err = setupAudioEncoder(writer); + + if (err != OK) { + return err; + } + } + + if (mVideoSource == VIDEO_SOURCE_DEFAULT + || mVideoSource == VIDEO_SOURCE_CAMERA) { + if (mVideoEncoder != VIDEO_ENCODER_H264) { + return ERROR_UNSUPPORTED; + } + + sp<CameraSource> cameraSource; + status_t err = setupCameraSource(&cameraSource); + if (err != OK) { + return err; + } + + sp<MediaSource> encoder; + err = setupVideoEncoder(cameraSource, mVideoBitRate, &encoder); + + if (err != OK) { + return err; + } + + writer->addSource(encoder); + } + + if (mMaxFileDurationUs != 0) { + writer->setMaxFileDuration(mMaxFileDurationUs); + } + + if (mMaxFileSizeBytes != 0) { + writer->setMaxFileSize(mMaxFileSizeBytes); + } + + mWriter = writer; + + return mWriter->start(); +} + void StagefrightRecorder::clipVideoFrameRate() { LOGV("clipVideoFrameRate: encoder %d", mVideoEncoder); int minFrameRate = mEncoderProfiles->getVideoEncoderParamByName( diff --git a/media/libmediaplayerservice/StagefrightRecorder.h b/media/libmediaplayerservice/StagefrightRecorder.h index 039bc16..7d2549f 100644 --- a/media/libmediaplayerservice/StagefrightRecorder.h +++ b/media/libmediaplayerservice/StagefrightRecorder.h @@ -118,6 +118,7 @@ private: status_t startAMRRecording(); status_t startAACRecording(); status_t startRTPRecording(); + status_t startMPEG2TSRecording(); sp<MediaSource> createAudioSource(); status_t checkVideoEncoderCapabilities(); status_t setupCameraSource(sp<CameraSource> *cameraSource); |