mirror of https://git.videolan.org/git/ffmpeg.git
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>
This commit is contained in:
parent
e999b641df
commit
7e5880e0cb
|
@ -14,7 +14,7 @@ tests/vsynth1/00.pgm: tests/videogen$(HOSTEXESUF) | tests/vsynth1
|
||||||
$(M)./$< 'tests/vsynth1/'
|
$(M)./$< 'tests/vsynth1/'
|
||||||
|
|
||||||
tests/vsynth2/00.pgm: tests/rotozoom$(HOSTEXESUF) | tests/vsynth2
|
tests/vsynth2/00.pgm: tests/rotozoom$(HOSTEXESUF) | tests/vsynth2
|
||||||
$(M)./$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
|
$(M)./$< $(SRC_PATH)/tests/lena.pnm 'tests/vsynth2/'
|
||||||
|
|
||||||
tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF) | tests/data
|
tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF) | tests/data
|
||||||
$(M)./$< $@
|
$(M)./$< $@
|
||||||
|
|
|
@ -159,12 +159,15 @@ int main(int argc, char **argv)
|
||||||
int w, h, i;
|
int w, h, i;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
if (argc != 3) {
|
if (argc > 3) {
|
||||||
printf("usage: %s directory/ image.pnm\n"
|
printf("usage: %s image.pnm [directory/]\n"
|
||||||
"generate a test video stream\n", argv[0]);
|
"generate a test video stream\n", argv[0]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (argc < 3)
|
||||||
|
err_if(!freopen(NULL, "wb", stdout));
|
||||||
|
|
||||||
w = DEFAULT_WIDTH;
|
w = DEFAULT_WIDTH;
|
||||||
h = DEFAULT_HEIGHT;
|
h = DEFAULT_HEIGHT;
|
||||||
|
|
||||||
|
@ -173,13 +176,17 @@ int main(int argc, char **argv)
|
||||||
width = w;
|
width = w;
|
||||||
height = h;
|
height = h;
|
||||||
|
|
||||||
if (init_demo(argv[2]))
|
if (init_demo(argv[1]))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
for (i = 0; i < DEFAULT_NB_PICT; i++) {
|
for (i = 0; i < DEFAULT_NB_PICT; i++) {
|
||||||
snprintf(buf, sizeof(buf), "%s%02d.pgm", argv[1], i);
|
|
||||||
gen_image(i, w, h);
|
gen_image(i, w, h);
|
||||||
|
if (argc > 2) {
|
||||||
|
snprintf(buf, sizeof(buf), "%s%02d.pgm", argv[2], i);
|
||||||
pgmyuv_save(buf, w, h, rgb_tab);
|
pgmyuv_save(buf, w, h, rgb_tab);
|
||||||
|
} else {
|
||||||
|
pgmyuv_save(NULL, w, h, rgb_tab);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free(rgb_tab);
|
free(rgb_tab);
|
||||||
|
|
|
@ -115,13 +115,20 @@ static void pgmyuv_save(const char *filename, int w, int h,
|
||||||
|
|
||||||
rgb24_to_yuv420p(lum_tab, cb_tab, cr_tab, rgb_tab, w, h);
|
rgb24_to_yuv420p(lum_tab, cb_tab, cr_tab, rgb_tab, w, h);
|
||||||
|
|
||||||
|
if (filename) {
|
||||||
f = fopen(filename, "wb");
|
f = fopen(filename, "wb");
|
||||||
fprintf(f, "P5\n%d %d\n%d\n", w, h * 3 / 2, 255);
|
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);
|
err_if(fwrite(lum_tab, 1, w * h, f) != w * h);
|
||||||
h2 = h / 2;
|
h2 = h / 2;
|
||||||
w2 = w / 2;
|
w2 = w / 2;
|
||||||
cb = cb_tab;
|
cb = cb_tab;
|
||||||
cr = cr_tab;
|
cr = cr_tab;
|
||||||
|
|
||||||
|
if (filename) {
|
||||||
for (i = 0; i < h2; i++) {
|
for (i = 0; i < h2; i++) {
|
||||||
err_if(fwrite(cb, 1, w2, f) != w2);
|
err_if(fwrite(cb, 1, w2, f) != w2);
|
||||||
err_if(fwrite(cr, 1, w2, f) != w2);
|
err_if(fwrite(cr, 1, w2, f) != w2);
|
||||||
|
@ -129,6 +136,16 @@ static void pgmyuv_save(const char *filename, int w, int h,
|
||||||
cr += w2;
|
cr += w2;
|
||||||
}
|
}
|
||||||
fclose(f);
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
free(lum_tab);
|
free(lum_tab);
|
||||||
free(cb_tab);
|
free(cb_tab);
|
||||||
|
|
|
@ -146,12 +146,15 @@ int main(int argc, char **argv)
|
||||||
int w, h, i;
|
int w, h, i;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
if (argc != 2) {
|
if (argc > 2) {
|
||||||
printf("usage: %s file\n"
|
printf("usage: %s [file]\n"
|
||||||
"generate a test video stream\n", argv[0]);
|
"generate a test video stream\n", argv[0]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (argc < 2)
|
||||||
|
err_if(!freopen(NULL, "wb", stdout));
|
||||||
|
|
||||||
w = DEFAULT_WIDTH;
|
w = DEFAULT_WIDTH;
|
||||||
h = DEFAULT_HEIGHT;
|
h = DEFAULT_HEIGHT;
|
||||||
|
|
||||||
|
@ -161,9 +164,13 @@ int main(int argc, char **argv)
|
||||||
height = h;
|
height = h;
|
||||||
|
|
||||||
for (i = 0; i < DEFAULT_NB_PICT; i++) {
|
for (i = 0; i < DEFAULT_NB_PICT; i++) {
|
||||||
snprintf(buf, sizeof(buf), "%s%02d.pgm", argv[1], i);
|
|
||||||
gen_image(i, w, h);
|
gen_image(i, w, h);
|
||||||
|
if (argc > 1) {
|
||||||
|
snprintf(buf, sizeof(buf), "%s%02d.pgm", argv[1], i);
|
||||||
pgmyuv_save(buf, w, h, rgb_tab);
|
pgmyuv_save(buf, w, h, rgb_tab);
|
||||||
|
} else {
|
||||||
|
pgmyuv_save(NULL, w, h, rgb_tab);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free(rgb_tab);
|
free(rgb_tab);
|
||||||
|
|
Loading…
Reference in New Issue