summaryrefslogtreecommitdiff
path: root/tests/rotozoom.c
diff options
context:
space:
mode:
authorMans Rullgard <mans@mansr.com>2012-05-17 15:55:14 +0100
committerMans Rullgard <mans@mansr.com>2012-05-29 08:27:19 +0100
commit7e5880e0cb041d0f1362bddd75130471ffc811ce (patch)
treed6f21c578766d7e26636a62a8f833dd407275376 /tests/rotozoom.c
parente999b641df85c4e7fa89dde1c681ddd1d38b0090 (diff)
fate: teach videogen/rotozoom to output a single raw video stream
This makes videogen/rotozoom output a raw video stream on stdout if no output directory is specified. Signed-off-by: Mans Rullgard <mans@mansr.com>
Diffstat (limited to 'tests/rotozoom.c')
-rw-r--r--tests/rotozoom.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/tests/rotozoom.c b/tests/rotozoom.c
index 48c06b017e..683e070860 100644
--- a/tests/rotozoom.c
+++ b/tests/rotozoom.c
@@ -159,12 +159,15 @@ int main(int argc, char **argv)
int w, h, i;
char buf[1024];
- if (argc != 3) {
- printf("usage: %s directory/ image.pnm\n"
+ if (argc > 3) {
+ printf("usage: %s image.pnm [directory/]\n"
"generate a test video stream\n", argv[0]);
return 1;
}
+ if (argc < 3)
+ err_if(!freopen(NULL, "wb", stdout));
+
w = DEFAULT_WIDTH;
h = DEFAULT_HEIGHT;
@@ -173,13 +176,17 @@ int main(int argc, char **argv)
width = w;
height = h;
- if (init_demo(argv[2]))
+ if (init_demo(argv[1]))
return 1;
for (i = 0; i < DEFAULT_NB_PICT; i++) {
- snprintf(buf, sizeof(buf), "%s%02d.pgm", argv[1], i);
gen_image(i, w, h);
- pgmyuv_save(buf, w, h, rgb_tab);
+ if (argc > 2) {
+ snprintf(buf, sizeof(buf), "%s%02d.pgm", argv[2], i);
+ pgmyuv_save(buf, w, h, rgb_tab);
+ } else {
+ pgmyuv_save(NULL, w, h, rgb_tab);
+ }
}
free(rgb_tab);