summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2011-06-28 10:11:09 -0700
committerAndreas Huber <andih@google.com>2011-06-28 10:11:09 -0700
commit16f7863149b400ca52e2e3cb83e50534fee6b58b (patch)
treec014c8206d3f69b77eeee1bc2ede86e332bb9ac9 /cmds
parent1e06f435434681f8750cc21763868fd025e8480e (diff)
downloadframeworks_av-16f7863149b400ca52e2e3cb83e50534fee6b58b.zip
frameworks_av-16f7863149b400ca52e2e3cb83e50534fee6b58b.tar.gz
frameworks_av-16f7863149b400ca52e2e3cb83e50534fee6b58b.tar.bz2
New option in the stagefright commandline tool.
Use '-S' to allocate decoder buffers from a surface Use '-T' to allocate decoder buffers from a surface texture Change-Id: Ib71ea53d0fd1b2def08bfeac2fd8bcbdc1938161
Diffstat (limited to 'cmds')
-rw-r--r--cmds/stagefright/stagefright.cpp77
1 files changed, 42 insertions, 35 deletions
diff --git a/cmds/stagefright/stagefright.cpp b/cmds/stagefright/stagefright.cpp
index d7b1e71..656f5fd 100644
--- a/cmds/stagefright/stagefright.cpp
+++ b/cmds/stagefright/stagefright.cpp
@@ -74,8 +74,6 @@ static String8 gWriteMP4Filename;
static sp<ANativeWindow> gSurface;
-#define USE_SURFACE_COMPOSER 0
-
static int64_t getNowUs() {
struct timeval tv;
gettimeofday(&tv, NULL);
@@ -579,6 +577,7 @@ static void usage(const char *me) {
fprintf(stderr, " -x display a histogram of decoding times/fps "
"(video only)\n");
fprintf(stderr, " -S allocate buffers from a surface\n");
+ fprintf(stderr, " -T allocate buffers from a surface texture\n");
}
int main(int argc, char **argv) {
@@ -590,6 +589,7 @@ int main(int argc, char **argv) {
bool extractThumbnail = false;
bool seekTest = false;
bool useSurfaceAlloc = false;
+ bool useSurfaceTexAlloc = false;
gNumRepetitions = 1;
gMaxNumFrames = 0;
gReproduceBug = -1;
@@ -604,7 +604,7 @@ int main(int argc, char **argv) {
sp<LiveSession> liveSession;
int res;
- while ((res = getopt(argc, argv, "han:lm:b:ptsrow:kxS")) >= 0) {
+ while ((res = getopt(argc, argv, "han:lm:b:ptsrow:kxST")) >= 0) {
switch (res) {
case 'a':
{
@@ -695,6 +695,12 @@ int main(int argc, char **argv) {
break;
}
+ case 'T':
+ {
+ useSurfaceTexAlloc = true;
+ break;
+ }
+
case '?':
case 'h':
default:
@@ -843,34 +849,35 @@ int main(int argc, char **argv) {
sp<SurfaceComposerClient> composerClient;
sp<SurfaceControl> control;
- if (useSurfaceAlloc && !audioOnly) {
-#if USE_SURFACE_COMPOSER
- composerClient = new SurfaceComposerClient;
- CHECK_EQ(composerClient->initCheck(), (status_t)OK);
-
- control = composerClient->createSurface(
- getpid(),
- String8("A Surface"),
- 0,
- 1280,
- 800,
- PIXEL_FORMAT_RGB_565,
- 0);
-
- CHECK(control != NULL);
- CHECK(control->isValid());
-
- CHECK_EQ(composerClient->openTransaction(), (status_t)OK);
- CHECK_EQ(control->setLayer(30000), (status_t)OK);
- CHECK_EQ(control->show(), (status_t)OK);
- CHECK_EQ(composerClient->closeTransaction(), (status_t)OK);
-
- gSurface = control->getSurface();
- CHECK(gSurface != NULL);
-#else
- sp<SurfaceTexture> texture = new SurfaceTexture(0 /* tex */);
- gSurface = new SurfaceTextureClient(texture);
-#endif
+ if ((useSurfaceAlloc || useSurfaceTexAlloc) && !audioOnly) {
+ if (useSurfaceAlloc) {
+ composerClient = new SurfaceComposerClient;
+ CHECK_EQ(composerClient->initCheck(), (status_t)OK);
+
+ control = composerClient->createSurface(
+ String8("A Surface"),
+ 0,
+ 1280,
+ 800,
+ PIXEL_FORMAT_RGB_565,
+ 0);
+
+ CHECK(control != NULL);
+ CHECK(control->isValid());
+
+ CHECK_EQ(composerClient->openTransaction(), (status_t)OK);
+ CHECK_EQ(control->setLayer(30000), (status_t)OK);
+ CHECK_EQ(control->show(), (status_t)OK);
+ CHECK_EQ(composerClient->closeTransaction(), (status_t)OK);
+
+ gSurface = control->getSurface();
+ CHECK(gSurface != NULL);
+ } else {
+ CHECK(useSurfaceTexAlloc);
+
+ sp<SurfaceTexture> texture = new SurfaceTexture(0 /* tex */);
+ gSurface = new SurfaceTextureClient(texture);
+ }
}
DataSource::RegisterDefaultSniffers();
@@ -1061,12 +1068,12 @@ int main(int argc, char **argv) {
}
}
- if (useSurfaceAlloc && !audioOnly) {
+ if ((useSurfaceAlloc || useSurfaceTexAlloc) && !audioOnly) {
gSurface.clear();
-#if USE_SURFACE_COMPOSER
- composerClient->dispose();
-#endif
+ if (useSurfaceAlloc) {
+ composerClient->dispose();
+ }
}
client.disconnect();