more intended usage
This commit is contained in:
parent
dad647c612
commit
ecf3c21075
1
Makefile
1
Makefile
|
@ -1,5 +1,4 @@
|
||||||
RM := rm -f
|
RM := rm -f
|
||||||
CC := gcc
|
|
||||||
CFLAGS := -O3 -Wall -Isrc -I/usr/include/ffmpeg
|
CFLAGS := -O3 -Wall -Isrc -I/usr/include/ffmpeg
|
||||||
LIBS := -lavformat -lavutil -lavcodec
|
LIBS := -lavformat -lavutil -lavcodec
|
||||||
LDFLAGS :=
|
LDFLAGS :=
|
||||||
|
|
|
@ -30,6 +30,11 @@ int main(int argc, char *argv[])
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (avformat_find_stream_info(format, NULL) < 0) {
|
||||||
|
printf("Couldn't read file \n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (!mediatools_validate_video(format)) {
|
if (!mediatools_validate_video(format)) {
|
||||||
// Error is printed by validation function
|
// Error is printed by validation function
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -62,7 +62,7 @@ int mediatools_validate_video(AVFormatContext *format)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (strstr(iformat->name, "gif")) {
|
} else if (strcmp(iformat->name, "gif") == 0) {
|
||||||
switch (vpar->codec_id) {
|
switch (vpar->codec_id) {
|
||||||
default:
|
default:
|
||||||
printf("Bad video codec for GIF container (must be GIF)\n");
|
printf("Bad video codec for GIF container (must be GIF)\n");
|
||||||
|
@ -70,18 +70,43 @@ int mediatools_validate_video(AVFormatContext *format)
|
||||||
case AV_CODEC_ID_GIF:
|
case AV_CODEC_ID_GIF:
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
} else if (strcmp(iformat->name, "image2") == 0) {
|
||||||
|
switch (vpar->codec_id) {
|
||||||
|
default:
|
||||||
|
printf("Bad video codec for image2 container (must be JPEG)\n");
|
||||||
|
return false;
|
||||||
|
case AV_CODEC_ID_MJPEG:
|
||||||
|
;
|
||||||
|
}
|
||||||
|
} else if (strcmp(iformat->name, "png_pipe") == 0 || strcmp(iformat->name, "apng") == 0) {
|
||||||
|
switch (vpar->codec_id) {
|
||||||
|
default:
|
||||||
|
printf("Bad video codec for PNG container (must be PNG)\n");
|
||||||
|
return false;
|
||||||
|
case AV_CODEC_ID_PNG:
|
||||||
|
case AV_CODEC_ID_APNG:
|
||||||
|
;
|
||||||
|
}
|
||||||
|
} else if (strcmp(iformat->name, "svg_pipe") == 0) {
|
||||||
|
switch (vpar->codec_id) {
|
||||||
|
default:
|
||||||
|
printf("Bad video codec for SVG container (must be SVG)\n");
|
||||||
|
return false;
|
||||||
|
case AV_CODEC_ID_SVG:
|
||||||
|
;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
printf("Unknown input format\n");
|
printf("Unknown input format\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vpar->width < 2 || vpar->width > 4096) {
|
if (vpar->width < 1 || vpar->width > 4096) {
|
||||||
printf("Bad width %d (must be 2..4096)\n", vpar->width);
|
printf("Bad width %d (must be 1..4096)\n", vpar->width);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vpar->height < 2 || vpar->height > 4096) {
|
if (vpar->height < 1 || vpar->height > 4096) {
|
||||||
printf("Bad height %d (must be 2..4096)\n", vpar->height);
|
printf("Bad height %d (must be 1..4096)\n", vpar->height);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue