mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 00:32:11 +01:00
Have convert-to-nia emit 'best effort' bad frames
This commit is contained in:
1 parent
e53497abe3
commit
8397a35a50
2 files changed
+11
-2
No files matched your search
@@ -545,6 +545,7 @@ convert_frames() {
|
||||
|
||||
// Decode the frame (the pixels).
|
||||
wuffs_base__status df_status;
|
||||
const char* decode_frame_io_error_message = NULL;
|
||||
while (true) {
|
||||
df_status = wuffs_base__image_decoder__decode_frame(
|
||||
g_image_decoder, &g_pixbuf, &g_src,
|
||||
@@ -555,7 +556,13 @@ convert_frames() {
|
||||
if (df_status.repr != wuffs_base__suspension__short_read) {
|
||||
break;
|
||||
}
|
||||
TRY(read_more_src());
|
||||
decode_frame_io_error_message = read_more_src();
|
||||
if (decode_frame_io_error_message != NULL) {
|
||||
// Neuter the "short read" df_status so that convert_frames returns the
|
||||
// I/O error message instead.
|
||||
df_status.repr = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!g_flags.first_frame_only) {
|
||||
@@ -568,6 +575,8 @@ convert_frames() {
|
||||
|
||||
if (df_status.repr != NULL) {
|
||||
return wuffs_base__status__message(&df_status);
|
||||
} else if (decode_frame_io_error_message != NULL) {
|
||||
return decode_frame_io_error_message;
|
||||
} else if (g_flags.first_frame_only) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ b727da8b test/data/hibiscus.regular.gif
|
||||
dcbb225a test/data/hippopotamus.bmp
|
||||
ed4b78fc test/data/hippopotamus.interlaced.gif
|
||||
dcbb225a test/data/hippopotamus.interlaced.png
|
||||
45bf0281 test/data/hippopotamus.interlaced.truncated.gif
|
||||
c3c4bd65 test/data/hippopotamus.interlaced.truncated.gif
|
||||
d3bbed27 test/data/hippopotamus.masked-with-muybridge.gif
|
||||
7e6acf01 test/data/hippopotamus.masked-with-muybridge.png
|
||||
dcbb225a test/data/hippopotamus.nie
|
||||
|
||||
Reference in new issue
Block a user