Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e764bbf9 authored by Andreas Huber's avatar Andreas Huber Committed by Android (Google) Code Review
Browse files

Merge "New option in the stagefright commandline tool."

parents 306bafcd 16f78631
Loading
Loading
Loading
Loading
+42 −35
Original line number Original line Diff line number Diff line
@@ -74,8 +74,6 @@ static String8 gWriteMP4Filename;


static sp<ANativeWindow> gSurface;
static sp<ANativeWindow> gSurface;


#define USE_SURFACE_COMPOSER 0

static int64_t getNowUs() {
static int64_t getNowUs() {
    struct timeval tv;
    struct timeval tv;
    gettimeofday(&tv, NULL);
    gettimeofday(&tv, NULL);
@@ -579,6 +577,7 @@ static void usage(const char *me) {
    fprintf(stderr, "       -x display a histogram of decoding times/fps "
    fprintf(stderr, "       -x display a histogram of decoding times/fps "
                    "(video only)\n");
                    "(video only)\n");
    fprintf(stderr, "       -S allocate buffers from a surface\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) {
int main(int argc, char **argv) {
@@ -590,6 +589,7 @@ int main(int argc, char **argv) {
    bool extractThumbnail = false;
    bool extractThumbnail = false;
    bool seekTest = false;
    bool seekTest = false;
    bool useSurfaceAlloc = false;
    bool useSurfaceAlloc = false;
    bool useSurfaceTexAlloc = false;
    gNumRepetitions = 1;
    gNumRepetitions = 1;
    gMaxNumFrames = 0;
    gMaxNumFrames = 0;
    gReproduceBug = -1;
    gReproduceBug = -1;
@@ -604,7 +604,7 @@ int main(int argc, char **argv) {
    sp<LiveSession> liveSession;
    sp<LiveSession> liveSession;


    int res;
    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) {
        switch (res) {
            case 'a':
            case 'a':
            {
            {
@@ -695,6 +695,12 @@ int main(int argc, char **argv) {
                break;
                break;
            }
            }


            case 'T':
            {
                useSurfaceTexAlloc = true;
                break;
            }

            case '?':
            case '?':
            case 'h':
            case 'h':
            default:
            default:
@@ -843,13 +849,12 @@ int main(int argc, char **argv) {
    sp<SurfaceComposerClient> composerClient;
    sp<SurfaceComposerClient> composerClient;
    sp<SurfaceControl> control;
    sp<SurfaceControl> control;


    if (useSurfaceAlloc && !audioOnly) {
    if ((useSurfaceAlloc || useSurfaceTexAlloc) && !audioOnly) {
#if USE_SURFACE_COMPOSER
        if (useSurfaceAlloc) {
            composerClient = new SurfaceComposerClient;
            composerClient = new SurfaceComposerClient;
            CHECK_EQ(composerClient->initCheck(), (status_t)OK);
            CHECK_EQ(composerClient->initCheck(), (status_t)OK);


            control = composerClient->createSurface(
            control = composerClient->createSurface(
                getpid(),
                    String8("A Surface"),
                    String8("A Surface"),
                    0,
                    0,
                    1280,
                    1280,
@@ -867,10 +872,12 @@ int main(int argc, char **argv) {


            gSurface = control->getSurface();
            gSurface = control->getSurface();
            CHECK(gSurface != NULL);
            CHECK(gSurface != NULL);
#else
        } else {
            CHECK(useSurfaceTexAlloc);

            sp<SurfaceTexture> texture = new SurfaceTexture(0 /* tex */);
            sp<SurfaceTexture> texture = new SurfaceTexture(0 /* tex */);
            gSurface = new SurfaceTextureClient(texture);
            gSurface = new SurfaceTextureClient(texture);
#endif
        }
    }
    }


    DataSource::RegisterDefaultSniffers();
    DataSource::RegisterDefaultSniffers();
@@ -1061,12 +1068,12 @@ int main(int argc, char **argv) {
        }
        }
    }
    }


    if (useSurfaceAlloc && !audioOnly) {
    if ((useSurfaceAlloc || useSurfaceTexAlloc) && !audioOnly) {
        gSurface.clear();
        gSurface.clear();


#if USE_SURFACE_COMPOSER
        if (useSurfaceAlloc) {
            composerClient->dispose();
            composerClient->dispose();
#endif
        }
    }
    }


    client.disconnect();
    client.disconnect();