Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChristophe Gisquet <christophe.gisquet@gmail.com>2014-05-29 20:48:39 +0400
committerMichael Niedermayer <michaelni@gmx.at>2014-05-29 23:26:48 +0400
commitbf7e9cc82a8482ae2811bfb86408026967acecdb (patch)
treef6ac534feabe9b9eb50d098cb39477ff26396698 /tests
parent7b4c46050e6824febb8f16d28d5148741aa8ad1a (diff)
tests: allow passing dimensions to videogen
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'tests')
-rw-r--r--tests/videogen.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/tests/videogen.c b/tests/videogen.c
index 94e6e77598..91da8b540c 100644
--- a/tests/videogen.c
+++ b/tests/videogen.c
@@ -141,23 +141,37 @@ static void gen_image(int num, int w, int h)
}
}
+void print_help(const char* name)
+{
+ printf("usage: %s file|dir [w=%i] [h=%i]\n"
+ "generate a test video stream\n",
+ name, DEFAULT_WIDTH, DEFAULT_HEIGHT);
+ exit(1);
+}
+
int main(int argc, char **argv)
{
int w, h, i;
char buf[1024];
int isdir = 0;
- if (argc != 2) {
- printf("usage: %s file|dir\n"
- "generate a test video stream\n", argv[0]);
- exit(1);
+ if (argc < 2 || argc > 4) {
+ print_help(argv[0]);
}
if (!freopen(argv[1], "wb", stdout))
isdir = 1;
w = DEFAULT_WIDTH;
+ if(argc > 2) {
+ w = atoi(argv[2]);
+ if (w < 1) print_help(argv[0]);
+ }
h = DEFAULT_HEIGHT;
+ if(argc > 3) {
+ h = atoi(argv[3]);
+ if (h < 1) print_help(argv[0]);
+ }
rgb_tab = malloc(w * h * 3);
wrap = w * 3;