Loading cmds/stagefright/Android.mk +1 −1 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ LOCAL_SRC_FILES:= \ LOCAL_SHARED_LIBRARIES := \ libstagefright libmedia libutils libbinder libstagefright_foundation \ libskia libskia libsurfaceflinger_client libgui LOCAL_C_INCLUDES:= \ $(JNI_H_INCLUDE) \ Loading cmds/stagefright/stagefright.cpp +61 −2 Original line number Diff line number Diff line Loading @@ -55,6 +55,11 @@ #include <fcntl.h> #include <gui/SurfaceTextureClient.h> #include <surfaceflinger/ISurfaceComposer.h> #include <surfaceflinger/SurfaceComposerClient.h> using namespace android; static long gNumRepetitions; Loading @@ -66,6 +71,10 @@ static bool gWriteMP4; static bool gDisplayHistogram; static String8 gWriteMP4Filename; static sp<ANativeWindow> gSurface; #define USE_SURFACE_COMPOSER 0 static int64_t getNowUs() { struct timeval tv; gettimeofday(&tv, NULL); Loading Loading @@ -138,7 +147,8 @@ static void playSource(OMXClient *client, sp<MediaSource> &source) { rawSource = OMXCodec::Create( client->interface(), meta, false /* createEncoder */, source, NULL /* matchComponentName */, gPreferSoftwareCodec ? OMXCodec::kPreferSoftwareCodecs : 0); gPreferSoftwareCodec ? OMXCodec::kPreferSoftwareCodecs : 0, gSurface); if (rawSource == NULL) { fprintf(stderr, "Failed to instantiate decoder for '%s'.\n", mime); Loading Loading @@ -540,6 +550,7 @@ static void usage(const char *me) { fprintf(stderr, " -k seek test\n"); fprintf(stderr, " -x display a histogram of decoding times/fps " "(video only)\n"); fprintf(stderr, " -S allocate buffers from a surface\n"); } int main(int argc, char **argv) { Loading @@ -550,6 +561,7 @@ int main(int argc, char **argv) { bool dumpProfiles = false; bool extractThumbnail = false; bool seekTest = false; bool useSurfaceAlloc = false; gNumRepetitions = 1; gMaxNumFrames = 0; gReproduceBug = -1; Loading @@ -563,7 +575,7 @@ int main(int argc, char **argv) { sp<LiveSession> liveSession; int res; while ((res = getopt(argc, argv, "han:lm:b:ptsow:kx")) >= 0) { while ((res = getopt(argc, argv, "han:lm:b:ptsow:kxS")) >= 0) { switch (res) { case 'a': { Loading Loading @@ -642,6 +654,12 @@ int main(int argc, char **argv) { break; } case 'S': { useSurfaceAlloc = true; break; } case '?': case 'h': default: Loading Loading @@ -780,6 +798,39 @@ 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 } DataSource::RegisterDefaultSniffers(); OMXClient client; Loading Loading @@ -957,6 +1008,14 @@ int main(int argc, char **argv) { } } if (useSurfaceAlloc && !audioOnly) { gSurface.clear(); #if USE_SURFACE_COMPOSER composerClient->dispose(); #endif } client.disconnect(); return 0; Loading Loading
cmds/stagefright/Android.mk +1 −1 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ LOCAL_SRC_FILES:= \ LOCAL_SHARED_LIBRARIES := \ libstagefright libmedia libutils libbinder libstagefright_foundation \ libskia libskia libsurfaceflinger_client libgui LOCAL_C_INCLUDES:= \ $(JNI_H_INCLUDE) \ Loading
cmds/stagefright/stagefright.cpp +61 −2 Original line number Diff line number Diff line Loading @@ -55,6 +55,11 @@ #include <fcntl.h> #include <gui/SurfaceTextureClient.h> #include <surfaceflinger/ISurfaceComposer.h> #include <surfaceflinger/SurfaceComposerClient.h> using namespace android; static long gNumRepetitions; Loading @@ -66,6 +71,10 @@ static bool gWriteMP4; static bool gDisplayHistogram; static String8 gWriteMP4Filename; static sp<ANativeWindow> gSurface; #define USE_SURFACE_COMPOSER 0 static int64_t getNowUs() { struct timeval tv; gettimeofday(&tv, NULL); Loading Loading @@ -138,7 +147,8 @@ static void playSource(OMXClient *client, sp<MediaSource> &source) { rawSource = OMXCodec::Create( client->interface(), meta, false /* createEncoder */, source, NULL /* matchComponentName */, gPreferSoftwareCodec ? OMXCodec::kPreferSoftwareCodecs : 0); gPreferSoftwareCodec ? OMXCodec::kPreferSoftwareCodecs : 0, gSurface); if (rawSource == NULL) { fprintf(stderr, "Failed to instantiate decoder for '%s'.\n", mime); Loading Loading @@ -540,6 +550,7 @@ static void usage(const char *me) { fprintf(stderr, " -k seek test\n"); fprintf(stderr, " -x display a histogram of decoding times/fps " "(video only)\n"); fprintf(stderr, " -S allocate buffers from a surface\n"); } int main(int argc, char **argv) { Loading @@ -550,6 +561,7 @@ int main(int argc, char **argv) { bool dumpProfiles = false; bool extractThumbnail = false; bool seekTest = false; bool useSurfaceAlloc = false; gNumRepetitions = 1; gMaxNumFrames = 0; gReproduceBug = -1; Loading @@ -563,7 +575,7 @@ int main(int argc, char **argv) { sp<LiveSession> liveSession; int res; while ((res = getopt(argc, argv, "han:lm:b:ptsow:kx")) >= 0) { while ((res = getopt(argc, argv, "han:lm:b:ptsow:kxS")) >= 0) { switch (res) { case 'a': { Loading Loading @@ -642,6 +654,12 @@ int main(int argc, char **argv) { break; } case 'S': { useSurfaceAlloc = true; break; } case '?': case 'h': default: Loading Loading @@ -780,6 +798,39 @@ 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 } DataSource::RegisterDefaultSniffers(); OMXClient client; Loading Loading @@ -957,6 +1008,14 @@ int main(int argc, char **argv) { } } if (useSurfaceAlloc && !audioOnly) { gSurface.clear(); #if USE_SURFACE_COMPOSER composerClient->dispose(); #endif } client.disconnect(); return 0; Loading