viddec3test: -h, --help command line options
[glsdk/omapdrmtest.git] / viddec3test.c
index 863dc89d7c38a5cb0cf73435dad5805efb49eddb..78a3548ebff3537b6f55a5f531ce5e67275c66a4 100644 (file)
@@ -62,6 +62,9 @@ usage(char *name)
        MSG("Usage: %s [OPTIONS] INFILE", name);
        MSG("Test of viddec3 decoder.");
        MSG("");
+       MSG("viddec3test options:");
+       MSG("\t-h, --help: Print this help and exit.");
+       MSG("");
        disp_usage();
 }
 
@@ -79,6 +82,7 @@ decoder_close(struct decoder *decoder)
        if (decoder->outArgs)        dce_free(decoder->outArgs);
        if (decoder->input_bo)       omap_bo_del(decoder->input_bo);
        if (decoder->demux)          demux_deinit(decoder->demux);
+       if (decoder->disp)           disp_close(decoder->disp);
 
        free(decoder);
 }
@@ -218,13 +222,14 @@ MSG("displayBufsMode: %d", decoder->params->displayBufsMode);
                goto fail;
        }
 
-       decoder->inBufs = malloc(sizeof(XDM2_BufDesc));
+       decoder->inBufs = calloc(1, sizeof(XDM2_BufDesc));
        decoder->inBufs->numBufs = 1;
        decoder->inBufs->descs[0].buf =
                        (XDAS_Int8 *)omap_bo_handle(decoder->input_bo);
+       decoder->inBufs->descs[0].bufSize.bytes = omap_bo_size(decoder->input_bo);
        decoder->inBufs->descs[0].memType = XDM_MEMTYPE_BO;
 
-       decoder->outBufs = malloc(sizeof(XDM2_BufDesc));
+       decoder->outBufs = calloc(1, sizeof(XDM2_BufDesc));
        decoder->outBufs->numBufs = 2;
        decoder->outBufs->descs[0].memType = XDM_MEMTYPE_BO;
        decoder->outBufs->descs[1].memType = XDM_MEMTYPE_BO;
@@ -279,7 +284,9 @@ decoder_process(struct decoder *decoder)
 
        inArgs->inputID = (XDAS_Int32)buf;
        outBufs->descs[0].buf = (XDAS_Int8 *)omap_bo_handle(buf->bo[0]);
+       outBufs->descs[0].bufSize.bytes = omap_bo_size(buf->bo[0]);
        outBufs->descs[1].buf = (XDAS_Int8 *)omap_bo_handle(buf->bo[1]);
+       outBufs->descs[1].bufSize.bytes = omap_bo_size(buf->bo[1]);
 
        tproc = mark(NULL);
        err = VIDDEC3_process(decoder->codec, inBufs, outBufs, inArgs, outArgs);
@@ -326,7 +333,11 @@ main(int argc, char **argv)
        int i, n, first = 0, ndecoders = 0;
 
        for (i = 1; i < argc; i++) {
-               if (!strcmp(argv[i], "--")) {
+               if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) {
+                       usage(argv[0]);
+                       exit(0);
+
+               } else if (!strcmp(argv[i], "--")) {
                        argv[first] = argv[0];
                        decoders[ndecoders++] = decoder_open(i - first, &argv[first]);
                        first = i;