summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2010-01-25 14:27:12 -0800
committerAndreas Huber <andih@google.com>2010-01-25 16:17:40 -0800
commite7c9cb48fec02697227bd847cd2e69432659adfd (patch)
treeab833cb8951fc46fa4dcef5569d818378ca14b8c /cmds
parent213addfaf4b359c69da4e9b4490c511d116845bb (diff)
downloadframeworks_av-e7c9cb48fec02697227bd847cd2e69432659adfd.zip
frameworks_av-e7c9cb48fec02697227bd847cd2e69432659adfd.tar.gz
frameworks_av-e7c9cb48fec02697227bd847cd2e69432659adfd.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.cpp24
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;
}