You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
fate: avoid freopen(NULL) in videogen/rotozoom
A number of systems do not implement freopen() with a NULL filename correctly. This changes these programs to output individual images if opening a named output argument as a file fails, in this case assuming it is a directory. Signed-off-by: Mans Rullgard <mans@mansr.com>
This commit is contained in:
@@ -16,10 +16,10 @@ tests/data/asynth-%.wav: tests/audiogen$(HOSTEXESUF) | tests/data
|
|||||||
$(M)./$< $@ $(subst -, ,$*)
|
$(M)./$< $@ $(subst -, ,$*)
|
||||||
|
|
||||||
tests/data/vsynth1.yuv: tests/videogen$(HOSTEXESUF) | tests/data
|
tests/data/vsynth1.yuv: tests/videogen$(HOSTEXESUF) | tests/data
|
||||||
$(M)$< >$@
|
$(M)$< $@
|
||||||
|
|
||||||
tests/data/vsynth2.yuv: tests/rotozoom$(HOSTEXESUF) | tests/data
|
tests/data/vsynth2.yuv: tests/rotozoom$(HOSTEXESUF) | tests/data
|
||||||
$(M)$< $(SRC_PATH)/tests/lena.pnm >$@
|
$(M)$< $(SRC_PATH)/tests/lena.pnm $@
|
||||||
|
|
||||||
tests/data/asynth% tests/data/vsynth%.yuv tests/vsynth%/00.pgm: TAG = GEN
|
tests/data/asynth% tests/data/vsynth%.yuv tests/vsynth%/00.pgm: TAG = GEN
|
||||||
|
|
||||||
|
@@ -158,15 +158,16 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
int w, h, i;
|
int w, h, i;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
int isdir = 0;
|
||||||
|
|
||||||
if (argc > 3) {
|
if (argc != 3) {
|
||||||
printf("usage: %s image.pnm [directory/]\n"
|
printf("usage: %s image.pnm file|dir\n"
|
||||||
"generate a test video stream\n", argv[0]);
|
"generate a test video stream\n", argv[0]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc < 3)
|
if (!freopen(argv[2], "wb", stdout))
|
||||||
err_if(!freopen(NULL, "wb", stdout));
|
isdir = 1;
|
||||||
|
|
||||||
w = DEFAULT_WIDTH;
|
w = DEFAULT_WIDTH;
|
||||||
h = DEFAULT_HEIGHT;
|
h = DEFAULT_HEIGHT;
|
||||||
@@ -181,7 +182,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
for (i = 0; i < DEFAULT_NB_PICT; i++) {
|
for (i = 0; i < DEFAULT_NB_PICT; i++) {
|
||||||
gen_image(i, w, h);
|
gen_image(i, w, h);
|
||||||
if (argc > 2) {
|
if (isdir) {
|
||||||
snprintf(buf, sizeof(buf), "%s%02d.pgm", argv[2], i);
|
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 {
|
} else {
|
||||||
|
@@ -145,15 +145,16 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
int w, h, i;
|
int w, h, i;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
int isdir = 0;
|
||||||
|
|
||||||
if (argc > 2) {
|
if (argc != 2) {
|
||||||
printf("usage: %s [file]\n"
|
printf("usage: %s file|dir\n"
|
||||||
"generate a test video stream\n", argv[0]);
|
"generate a test video stream\n", argv[0]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc < 2)
|
if (!freopen(argv[1], "wb", stdout))
|
||||||
err_if(!freopen(NULL, "wb", stdout));
|
isdir = 1;
|
||||||
|
|
||||||
w = DEFAULT_WIDTH;
|
w = DEFAULT_WIDTH;
|
||||||
h = DEFAULT_HEIGHT;
|
h = DEFAULT_HEIGHT;
|
||||||
@@ -165,7 +166,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
for (i = 0; i < DEFAULT_NB_PICT; i++) {
|
for (i = 0; i < DEFAULT_NB_PICT; i++) {
|
||||||
gen_image(i, w, h);
|
gen_image(i, w, h);
|
||||||
if (argc > 1) {
|
if (isdir) {
|
||||||
snprintf(buf, sizeof(buf), "%s%02d.pgm", argv[1], i);
|
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 {
|
} else {
|
||||||
|
Reference in New Issue
Block a user