summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2011-06-28 10:51:41 -0700
committerAndreas Huber <andih@google.com>2011-06-28 10:51:41 -0700
commit1065b3f17d3048948e7d522049d1980b90df3dc1 (patch)
treedbe2c8d5a540ec07e7ef74929808401b71004cd5 /cmds
parent1e06f435434681f8750cc21763868fd025e8480e (diff)
downloadframeworks_av-1065b3f17d3048948e7d522049d1980b90df3dc1.zip
frameworks_av-1065b3f17d3048948e7d522049d1980b90df3dc1.tar.gz
frameworks_av-1065b3f17d3048948e7d522049d1980b90df3dc1.tar.bz2
Multiple changes to ACodec/codec tools:
Make sure sf2 does not coalesce input buffers, generalize ACodec's codec instantiation based on OMXCodec's list of eligible component names. Some changes/additions to the "sf2" commandline tool Make surface options consistent with stagefright tool, i.e. use '-S' instead of '-s' New option '-R' renders surface-allocated buffers. Also fixes a longstanding bug introduced when generalizing from surfaces to native windows that never used surface-allocated buffers in sf2 even when the option was specified. Change-Id: I59fd533f0f6ef0337ebe2806ddc81a46878eb3ae
Diffstat (limited to 'cmds')
-rw-r--r--cmds/stagefright/sf2.cpp31
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();