| 37 | | $retcode = $t->run_and_catch(sub { |
|---|
| 38 | | qx($conf->{"focr_bin_gifsicle"} --unoptimize $tfile3 \'#$index\' >$tfile2 2>>$efile); |
|---|
| 39 | | }); |
|---|
| 40 | | } else { |
|---|
| 41 | | my $retcode = $t->run_and_catch(sub { |
|---|
| 42 | | qx($conf->{"focr_bin_gifsicle"} --unoptimize $tfile \'#$index\' >$tfile2 2>>$efile); |
|---|
| 43 | | }); |
|---|
| | 37 | if ($retcode) { |
|---|
| | 38 | debuglog("$conf->{'focr_bin_gifinter'}: Timed out [$retcode], image not reduced!"); |
|---|
| | 39 | } else { |
|---|
| | 40 | $tfile = $tfile3; |
|---|
| | 41 | } |
|---|
| | 42 | } |
|---|
| | 43 | my $retcode = $t->run_and_catch(sub { |
|---|
| | 44 | qx($conf->{focr_bin_gifsicle} --unoptimize $tfile \'#$index\' >$tfile2 2>>$efile); |
|---|
| | 45 | }); |
|---|
| | 46 | if ($retcode) { |
|---|
| | 47 | debuglog("$conf->{focr_bin_gifinter}: cannot extract image#${index}"); |
|---|
| | 48 | return $tfile; |
|---|
| 70 | | my %info = ( 'loop' => 0, |
|---|
| 71 | | 'loop_count' => 0, |
|---|
| 72 | | 'delays' => [], |
|---|
| 73 | | 'has_local_color_table' => 0 ); |
|---|
| 74 | | |
|---|
| 75 | | if ($globalinfo =~ /^ \s* loop \s+ (forever|count \s+ (\d+))/mx) { |
|---|
| 76 | | $info{'loop'} = 1; |
|---|
| 77 | | $info{'loop_count'} = $2 ? ($2 + 0) : 0; |
|---|
| 78 | | } |
|---|
| 79 | | |
|---|
| 80 | | my $frameno = 0; |
|---|
| 81 | | foreach my $info (@frameinfo) { |
|---|
| 82 | | # We could just match the delays, but we'll also check the image#'s |
|---|
| 83 | | # as a sanity check. |
|---|
| 84 | | my ($n, $delay) = $info =~ m{ image \s+ \#(\d+) |
|---|
| | 87 | my $frameno = 0; |
|---|
| | 88 | foreach my $info (@frameinfo) { |
|---|
| | 89 | # We could just match the delays, but we'll also check the image#'s |
|---|
| | 90 | # as a sanity check. |
|---|
| | 91 | my ($n, $delay) = $info =~ m{ image \s+ \#(\d+) |
|---|
| 87 | | #FIXME: Handle this error |
|---|
| 88 | | $n == $frameno |
|---|
| 89 | | or debuglog ( "Trouble parsing 'gifsicle --info' output.\n" |
|---|
| 90 | | . " Expected 'image \#$frameno', found 'image \#$n'" ); |
|---|
| 91 | | |
|---|
| 92 | | $info{'delays'}->[$frameno++] = $delay ? $delay + 0.0 : 0.0; |
|---|
| 93 | | $info{'has_local_color_table'} ||= $output =~ /local\s+color\s+table/; |
|---|
| | 94 | if ($n != $frameno) { |
|---|
| | 95 | debuglog ( "Trouble parsing 'gifsicle --info' output.\n" |
|---|
| | 96 | . " Expected 'image \#$frameno', found 'image \#$n', skipping..." ); |
|---|
| | 97 | $info{'error'}++; |
|---|
| | 98 | } else { |
|---|
| | 99 | $info{'delays'}->[$frameno++] = $delay ? $delay + 0.0 : 0.0; |
|---|
| | 100 | $info{'has_local_color_table'} ||= $output =~ /local\s+color\s+table/; |
|---|
| | 101 | } |
|---|
| | 102 | } |
|---|