diff options
author | Andreas Huber <andih@google.com> | 2011-06-28 12:48:01 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-06-28 12:48:01 -0700 |
commit | d11eccf3a861fdaa754907a28cc0da554b9aa7b7 (patch) | |
tree | 0dd3beebe6413af2b3b8e2c624a49eeff2a6390b /cmds/stagefright | |
parent | a1d9ae69fff95e0b74061cc41f808b7f5c25bbf2 (diff) | |
parent | e366f52b1520f13306d5fef1c3c8a2b2c653d935 (diff) | |
download | frameworks_base-d11eccf3a861fdaa754907a28cc0da554b9aa7b7.zip frameworks_base-d11eccf3a861fdaa754907a28cc0da554b9aa7b7.tar.gz frameworks_base-d11eccf3a861fdaa754907a28cc0da554b9aa7b7.tar.bz2 |
Merge "Multiple changes to ACodec/codec tools:"
Diffstat (limited to 'cmds/stagefright')
-rw-r--r-- | cmds/stagefright/sf2.cpp | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/cmds/stagefright/sf2.cpp b/cmds/stagefright/sf2.cpp index 289665f..ddd64ec 100644 --- a/cmds/stagefright/sf2.cpp +++ b/cmds/stagefright/sf2.cpp @@ -29,6 +29,7 @@ #include <media/stagefright/MediaExtractor.h> #include <media/stagefright/MediaSource.h> #include <media/stagefright/MetaData.h> +#include <media/stagefright/NativeWindowWrapper.h> #include <media/stagefright/Utils.h> #include <surfaceflinger/ISurfaceComposer.h> @@ -39,10 +40,12 @@ using namespace android; struct Controller : public AHandler { - Controller(const char *uri, bool decodeAudio, const sp<Surface> &surface) + Controller(const char *uri, bool decodeAudio, + const sp<Surface> &surface, bool renderToSurface) : mURI(uri), mDecodeAudio(decodeAudio), mSurface(surface), + mRenderToSurface(renderToSurface), mCodec(new ACodec) { CHECK(!mDecodeAudio || mSurface == NULL); } @@ -97,7 +100,8 @@ protected: sp<AMessage> format = makeFormat(mSource->getFormat()); if (mSurface != NULL) { - format->setObject("surface", mSurface); + format->setObject( + "native-window", new NativeWindowWrapper(mSurface)); } mCodec->initiateSetup(format); @@ -220,6 +224,7 @@ private: AString mURI; bool mDecodeAudio; sp<Surface> mSurface; + bool mRenderToSurface; sp<ACodec> mCodec; sp<MediaSource> mSource; @@ -451,7 +456,7 @@ private: inBuffer->release(); inBuffer = NULL; - // break; // Don't coalesce + break; // Don't coalesce } LOGV("coalesced %d input buffers", n); @@ -479,6 +484,10 @@ private: sp<AMessage> reply; CHECK(msg->findMessage("reply", &reply)); + if (mRenderToSurface) { + reply->setInt32("render", 1); + } + reply->post(); } @@ -491,7 +500,8 @@ static void usage(const char *me) { fprintf(stderr, " -a(udio)\n"); fprintf(stderr, - " -s(surface) Allocate output buffers on a surface.\n"); + " -S(urface) Allocate output buffers on a surface.\n" + " -R(ender) Render surface-allocated buffers.\n"); } int main(int argc, char **argv) { @@ -499,18 +509,23 @@ int main(int argc, char **argv) { bool decodeAudio = false; bool useSurface = false; + bool renderToSurface = false; int res; - while ((res = getopt(argc, argv, "has")) >= 0) { + while ((res = getopt(argc, argv, "haSR")) >= 0) { switch (res) { case 'a': decodeAudio = true; break; - case 's': + case 'S': useSurface = true; break; + case 'R': + renderToSurface = true; + break; + case '?': case 'h': default: @@ -562,7 +577,9 @@ int main(int argc, char **argv) { CHECK(surface != NULL); } - sp<Controller> controller = new Controller(argv[0], decodeAudio, surface); + sp<Controller> controller = + new Controller(argv[0], decodeAudio, surface, renderToSurface); + looper->registerHandler(controller); controller->startAsync(); |