vpxdec: add --loops option
Allows vpxdec to operate multiple times on the same input. Mostly useful for debugging/development. Change-Id: Icf25ece22e387052eade4438971eee5ff4f798ba
This commit is contained in:
parent
1fa04e1a03
commit
9596a4cc54
28
vpxdec.c
28
vpxdec.c
@ -67,6 +67,8 @@ static const struct {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#include "args.h"
|
#include "args.h"
|
||||||
|
static const arg_def_t looparg = ARG_DEF(NULL, "loops", 1,
|
||||||
|
"Number of times to decode the file");
|
||||||
static const arg_def_t codecarg = ARG_DEF(NULL, "codec", 1,
|
static const arg_def_t codecarg = ARG_DEF(NULL, "codec", 1,
|
||||||
"Codec to use");
|
"Codec to use");
|
||||||
static const arg_def_t use_yv12 = ARG_DEF(NULL, "yv12", 0,
|
static const arg_def_t use_yv12 = ARG_DEF(NULL, "yv12", 0,
|
||||||
@ -676,7 +678,7 @@ void generate_filename(const char *pattern, char *out, size_t q_len,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, const char **argv_) {
|
int main_loop(int argc, const char **argv_) {
|
||||||
vpx_codec_ctx_t decoder;
|
vpx_codec_ctx_t decoder;
|
||||||
char *fn = NULL;
|
char *fn = NULL;
|
||||||
int i;
|
int i;
|
||||||
@ -737,6 +739,8 @@ int main(int argc, const char **argv_) {
|
|||||||
else
|
else
|
||||||
die("Error: Unrecognized argument (%s) to --codec\n",
|
die("Error: Unrecognized argument (%s) to --codec\n",
|
||||||
arg.val);
|
arg.val);
|
||||||
|
} else if (arg_match(&arg, &looparg, argi)) {
|
||||||
|
// no-op
|
||||||
} else if (arg_match(&arg, &outputfile, argi))
|
} else if (arg_match(&arg, &outputfile, argi))
|
||||||
outfile_pattern = arg.val;
|
outfile_pattern = arg.val;
|
||||||
else if (arg_match(&arg, &use_yv12, argi)) {
|
else if (arg_match(&arg, &use_yv12, argi)) {
|
||||||
@ -1152,3 +1156,25 @@ fail:
|
|||||||
|
|
||||||
return frames_corrupted ? EXIT_FAILURE : EXIT_SUCCESS;
|
return frames_corrupted ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int main(int argc, const char **argv_) {
|
||||||
|
unsigned int loops = 1, i;
|
||||||
|
char **argv, **argi, **argj;
|
||||||
|
struct arg arg;
|
||||||
|
int error = 0;
|
||||||
|
|
||||||
|
argv = argv_dup(argc - 1, argv_ + 1);
|
||||||
|
for (argi = argj = argv; (*argj = *argi); argi += arg.argv_step) {
|
||||||
|
memset(&arg, 0, sizeof(arg));
|
||||||
|
arg.argv_step = 1;
|
||||||
|
|
||||||
|
if (arg_match(&arg, &looparg, argi)) {
|
||||||
|
loops = arg_parse_uint(&arg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(argv);
|
||||||
|
for (i = 0; !error && i < loops; i++)
|
||||||
|
error = main_loop(argc, argv_);
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user