mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-24 12:48:23 +01:00
img2webp: add a warning for unused options
This may help prevent confusion when placing frame options after the target frame. Note for compatibility this isn't fatal, but the behavior may change in the future. Bug: webp:381372617 Change-Id: I9f3b51e60ff650ccc6fd29b8f5f607c3771a8a55
This commit is contained in:
parent
1b4c967fbb
commit
e4f7a9f0c7
@ -151,6 +151,7 @@ int main(int argc, const char* argv[]) {
|
||||
WebPData webp_data;
|
||||
int c;
|
||||
int have_input = 0;
|
||||
int last_input_index = 0;
|
||||
CommandLineArguments cmd_args;
|
||||
int ok;
|
||||
|
||||
@ -279,6 +280,7 @@ int main(int argc, const char* argv[]) {
|
||||
// read next input image
|
||||
pic.use_argb = 1;
|
||||
ok = ReadImage((const char*)GET_WARGV_SHIFTED(argv, c), &pic);
|
||||
last_input_index = c;
|
||||
if (!ok) goto End;
|
||||
|
||||
if (enc == NULL) {
|
||||
@ -317,6 +319,13 @@ int main(int argc, const char* argv[]) {
|
||||
++pic_num;
|
||||
}
|
||||
|
||||
for (c = last_input_index + 1; c < argc; ++c) {
|
||||
if (argv[c] != NULL) {
|
||||
fprintf(stderr, "Warning: unused option [%s]!"
|
||||
" Frame options go before the input frame.\n", argv[c]);
|
||||
}
|
||||
}
|
||||
|
||||
// add a last fake frame to signal the last duration
|
||||
ok = ok && WebPAnimEncoderAdd(enc, NULL, timestamp_ms, NULL);
|
||||
ok = ok && WebPAnimEncoderAssemble(enc, &webp_data);
|
||||
|
Loading…
Reference in New Issue
Block a user