summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2009-11-04 10:42:45 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2009-11-04 10:42:45 -0800
commit66c2557334d6c8116c874aa65e84b280d325009e (patch)
treef459f0cebe66651098cc7a11d1403953c4d7146e /cmds
parent5a58de8b3bb1b6cc5304f83c8a3d527f952b91de (diff)
parent12bc3af0fb4ce17065d0f17982e0a9da52fc093d (diff)
downloadframeworks_base-66c2557334d6c8116c874aa65e84b280d325009e.zip
frameworks_base-66c2557334d6c8116c874aa65e84b280d325009e.tar.gz
frameworks_base-66c2557334d6c8116c874aa65e84b280d325009e.tar.bz2
am 12bc3af0: Merge change I6f6bf3d8 into eclair-mr2
Merge commit '12bc3af0fb4ce17065d0f17982e0a9da52fc093d' into eclair-mr2-plus-aosp * commit '12bc3af0fb4ce17065d0f17982e0a9da52fc093d': Support raw audio sources in stagefright commandline tool.
Diffstat (limited to 'cmds')
-rw-r--r--cmds/stagefright/stagefright.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/cmds/stagefright/stagefright.cpp b/cmds/stagefright/stagefright.cpp
index 3b7cece..d26e558 100644
--- a/cmds/stagefright/stagefright.cpp
+++ b/cmds/stagefright/stagefright.cpp
@@ -55,14 +55,23 @@ static void playSource(OMXClient *client, const sp<MediaSource> &source) {
int64_t durationUs;
CHECK(meta->findInt64(kKeyDuration, &durationUs));
- sp<OMXCodec> decoder = OMXCodec::Create(
+ const char *mime;
+ CHECK(meta->findCString(kKeyMIMEType, &mime));
+
+ sp<MediaSource> rawSource;
+ if (!strcasecmp(MEDIA_MIMETYPE_AUDIO_RAW, mime)) {
+ rawSource = source;
+ } else {
+ rawSource = OMXCodec::Create(
client->interface(), meta, false /* createEncoder */, source);
- if (decoder == NULL) {
- return;
+ if (rawSource == NULL) {
+ fprintf(stderr, "Failed to instantiate decoder for '%s'.\n", mime);
+ return;
+ }
}
- decoder->start();
+ rawSource->start();
if (gReproduceBug >= 3 && gReproduceBug <= 5) {
status_t err;
@@ -70,7 +79,7 @@ static void playSource(OMXClient *client, const sp<MediaSource> &source) {
MediaSource::ReadOptions options;
int64_t seekTimeUs = -1;
for (;;) {
- err = decoder->read(&buffer, &options);
+ err = rawSource->read(&buffer, &options);
options.clearSeekTo();
bool shouldSeek = false;
@@ -134,7 +143,7 @@ static void playSource(OMXClient *client, const sp<MediaSource> &source) {
}
}
- decoder->stop();
+ rawSource->stop();
return;
}
@@ -151,7 +160,7 @@ static void playSource(OMXClient *client, const sp<MediaSource> &source) {
MediaBuffer *buffer;
for (;;) {
- status_t err = decoder->read(&buffer, &options);
+ status_t err = rawSource->read(&buffer, &options);
options.clearSeekTo();
if (err != OK) {
@@ -193,7 +202,7 @@ static void playSource(OMXClient *client, const sp<MediaSource> &source) {
options.setSeekTo(0);
}
- decoder->stop();
+ rawSource->stop();
printf("\n");
int64_t delay = getNowUs() - startTime;