diff options
author | James Dong <jdong@google.com> | 2011-03-21 14:29:38 -0700 |
---|---|---|
committer | James Dong <jdong@google.com> | 2011-05-04 13:38:31 -0700 |
commit | 760943b5e7a09b602aba04ec451e97662f48b0a4 (patch) | |
tree | d73d7dd74e4063b6d6494fdd9f8f71be3c05d89e /media/libmediaplayerservice | |
parent | 89dc0dffdcbf0999a854a9b1bbea8f56395cc209 (diff) | |
download | frameworks_av-760943b5e7a09b602aba04ec451e97662f48b0a4.zip frameworks_av-760943b5e7a09b602aba04ec451e97662f48b0a4.tar.gz frameworks_av-760943b5e7a09b602aba04ec451e97662f48b0a4.tar.bz2 |
Initial check-in for AACWriter
Change-Id: Ia21ca39a404484b2dda25c6101780d2ff11c4623
related-to-bug: 4211046
Diffstat (limited to 'media/libmediaplayerservice')
-rw-r--r-- | media/libmediaplayerservice/StagefrightRecorder.cpp | 27 | ||||
-rw-r--r-- | media/libmediaplayerservice/StagefrightRecorder.h | 3 |
2 files changed, 24 insertions, 6 deletions
diff --git a/media/libmediaplayerservice/StagefrightRecorder.cpp b/media/libmediaplayerservice/StagefrightRecorder.cpp index 01fbea1..c1687c4 100644 --- a/media/libmediaplayerservice/StagefrightRecorder.cpp +++ b/media/libmediaplayerservice/StagefrightRecorder.cpp @@ -26,6 +26,7 @@ #include <media/IMediaPlayerService.h> #include <media/stagefright/AudioSource.h> #include <media/stagefright/AMRWriter.h> +#include <media/stagefright/AACWriter.h> #include <media/stagefright/CameraSource.h> #include <media/stagefright/VideoSourceDownSampler.h> #include <media/stagefright/CameraSourceTimeLapse.h> @@ -872,15 +873,21 @@ sp<MediaSource> StagefrightRecorder::createAudioSource() { } status_t StagefrightRecorder::startAACRecording() { - CHECK(mOutputFormat == OUTPUT_FORMAT_AAC_ADIF || - mOutputFormat == OUTPUT_FORMAT_AAC_ADTS); + // FIXME: + // Add support for OUTPUT_FORMAT_AAC_ADIF + CHECK(mOutputFormat == OUTPUT_FORMAT_AAC_ADTS); CHECK(mAudioEncoder == AUDIO_ENCODER_AAC); CHECK(mAudioSource != AUDIO_SOURCE_CNT); - CHECK(0 == "AACWriter is not implemented yet"); + mWriter = new AACWriter(mOutputFd); + status_t status = startRawAudioRecording(); + if (status != OK) { + mWriter.clear(); + mWriter = NULL; + } - return OK; + return status; } status_t StagefrightRecorder::startAMRRecording() { @@ -902,6 +909,16 @@ status_t StagefrightRecorder::startAMRRecording() { } } + mWriter = new AMRWriter(mOutputFd); + status_t status = startRawAudioRecording(); + if (status != OK) { + mWriter.clear(); + mWriter = NULL; + } + return status; +} + +status_t StagefrightRecorder::startRawAudioRecording() { if (mAudioSource >= AUDIO_SOURCE_CNT) { LOGE("Invalid audio source: %d", mAudioSource); return BAD_VALUE; @@ -917,7 +934,7 @@ status_t StagefrightRecorder::startAMRRecording() { return UNKNOWN_ERROR; } - mWriter = new AMRWriter(mOutputFd); + CHECK(mWriter != 0); mWriter->addSource(audioEncoder); if (mMaxFileDurationUs != 0) { diff --git a/media/libmediaplayerservice/StagefrightRecorder.h b/media/libmediaplayerservice/StagefrightRecorder.h index 3d463ea..c3e6d65 100644 --- a/media/libmediaplayerservice/StagefrightRecorder.h +++ b/media/libmediaplayerservice/StagefrightRecorder.h @@ -69,6 +69,7 @@ private: sp<Surface> mPreviewSurface; sp<IMediaRecorderClient> mListener; sp<MediaWriter> mWriter, mWriterAux; + int mOutputFd, mOutputFdAux; sp<AudioSource> mAudioSourceNode; audio_source_t mAudioSource; @@ -104,7 +105,6 @@ private: sp<CameraSourceTimeLapse> mCameraSourceTimeLapse; String8 mParams; - int mOutputFd, mOutputFdAux; bool mIsMetaDataStoredInVideoBuffers; MediaProfiles *mEncoderProfiles; @@ -123,6 +123,7 @@ private: status_t startMPEG4Recording(); status_t startAMRRecording(); status_t startAACRecording(); + status_t startRawAudioRecording(); status_t startRTPRecording(); status_t startMPEG2TSRecording(); sp<MediaSource> createAudioSource(); |