diff options
author | Andreas Huber <andih@google.com> | 2010-01-25 14:27:12 -0800 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2010-01-25 16:17:40 -0800 |
commit | 07bf09da4a365282fc35f800b62a83e0fa5533e2 (patch) | |
tree | 378e1ba0004146ae514c29c2e0ed60ac1cef6af0 /cmds | |
parent | f1c934f2726a09f11a7126e2a889c97162a2a1e2 (diff) | |
download | frameworks_base-07bf09da4a365282fc35f800b62a83e0fa5533e2.zip frameworks_base-07bf09da4a365282fc35f800b62a83e0fa5533e2.tar.gz frameworks_base-07bf09da4a365282fc35f800b62a83e0fa5533e2.tar.bz2 |
Initial checkin of AudioSource and AMRWriter, a pair of classes supporting pure-audio recording in stagefright.
related-to-bug: 2295449
Diffstat (limited to 'cmds')
-rw-r--r-- | cmds/stagefright/audioloop.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/cmds/stagefright/audioloop.cpp b/cmds/stagefright/audioloop.cpp index 3788e73..8733662 100644 --- a/cmds/stagefright/audioloop.cpp +++ b/cmds/stagefright/audioloop.cpp @@ -1,7 +1,10 @@ #include "SineSource.h" #include <binder/ProcessState.h> +#include <media/mediarecorder.h> +#include <media/stagefright/AMRWriter.h> #include <media/stagefright/AudioPlayer.h> +#include <media/stagefright/AudioSource.h> #include <media/stagefright/MediaDebug.h> #include <media/stagefright/MediaDefs.h> #include <media/stagefright/MetaData.h> @@ -21,7 +24,16 @@ int main() { OMXClient client; CHECK_EQ(client.connect(), OK); +#if 0 sp<MediaSource> source = new SineSource(kSampleRate, kNumChannels); +#else + sp<MediaSource> source = new AudioSource( + AUDIO_SOURCE_DEFAULT, + kSampleRate, + kNumChannels == 1 + ? AudioSystem::CHANNEL_IN_MONO + : AudioSystem::CHANNEL_IN_STEREO); +#endif sp<MetaData> meta = new MetaData; @@ -43,12 +55,19 @@ int main() { meta, true /* createEncoder */, source); +#if 1 + sp<AMRWriter> writer = new AMRWriter("/sdcard/out.amr"); + writer->addSource(encoder); + writer->start(); + sleep(10); + writer->stop(); +#else sp<MediaSource> decoder = OMXCodec::Create( client.interface(), meta, false /* createEncoder */, encoder); -#if 1 +#if 0 AudioPlayer *player = new AudioPlayer(NULL); player->setSource(decoder); @@ -60,7 +79,7 @@ int main() { delete player; player = NULL; -#else +#elif 0 CHECK_EQ(decoder->start(), OK); MediaBuffer *buffer; @@ -76,6 +95,7 @@ int main() { CHECK_EQ(decoder->stop(), OK); #endif +#endif return 0; } |