summaryrefslogtreecommitdiff
path: root/tests/utils.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/utils.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/utils.c')
-rw-r--r--tests/utils.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/tests/utils.c b/tests/utils.c
index 5310a114f5..2fdc491f49 100644
--- a/tests/utils.c
+++ b/tests/utils.c
@@ -115,20 +115,37 @@ static void pgmyuv_save(const char *filename, int w, int h,
rgb24_to_yuv420p(lum_tab, cb_tab, cr_tab, rgb_tab, w, h);
- f = fopen(filename, "wb");
- fprintf(f, "P5\n%d %d\n%d\n", w, h * 3 / 2, 255);
+ if (filename) {
+ f = fopen(filename, "wb");
+ fprintf(f, "P5\n%d %d\n%d\n", w, h * 3 / 2, 255);
+ } else {
+ f = stdout;
+ }
+
err_if(fwrite(lum_tab, 1, w * h, f) != w * h);
h2 = h / 2;
w2 = w / 2;
cb = cb_tab;
cr = cr_tab;
- for (i = 0; i < h2; i++) {
- err_if(fwrite(cb, 1, w2, f) != w2);
- err_if(fwrite(cr, 1, w2, f) != w2);
- cb += w2;
- cr += w2;
+
+ if (filename) {
+ for (i = 0; i < h2; i++) {
+ err_if(fwrite(cb, 1, w2, f) != w2);
+ err_if(fwrite(cr, 1, w2, f) != w2);
+ cb += w2;
+ cr += w2;
+ }
+ fclose(f);
+ } else {
+ for (i = 0; i < h2; i++) {
+ err_if(fwrite(cb, 1, w2, f) != w2);
+ cb += w2;
+ }
+ for (i = 0; i < h2; i++) {
+ err_if(fwrite(cr, 1, w2, f) != w2);
+ cr += w2;
+ }
}
- fclose(f);
free(lum_tab);
free(cb_tab);