Merge "Change the order of -frame argument to be more natural"

This commit is contained in:
skal 2012-11-15 00:07:28 -08:00 committed by Gerrit Code Review
commit 8a7c3cc8ee
2 changed files with 23 additions and 11 deletions

View File

@ -23,11 +23,11 @@
-frgm fragment_4.webp +960+576 \ -frgm fragment_4.webp +960+576 \
-o out_fragment_container.webp -o out_fragment_container.webp
webpmux -frame anim_1.webp +0+0+0+0 \ webpmux -frame anim_1.webp +100+10+10 \
-frame anim_2.webp +25+25+100+1 \ -frame anim_2.webp +100+25+25+1 \
-frame anim_3.webp +50+50+100+1 \ -frame anim_3.webp +100+50+50+1 \
-frame anim_4.webp +0+0+100+0 \ -frame anim_4.webp +100 \
-loop 10 -bgcolor 255,255,255,255 \ -loop 10 -bgcolor 128,255,255,255 \
-o out_animation_container.webp -o out_animation_container.webp
webpmux -set icc image_profile.icc in.webp -o out_icc_container.webp webpmux -set icc image_profile.icc in.webp -o out_icc_container.webp
@ -394,9 +394,18 @@ static int WriteWebP(WebPMux* const mux, const char* filename) {
} }
static int ParseFrameArgs(const char* args, WebPMuxFrameInfo* const info) { static int ParseFrameArgs(const char* args, WebPMuxFrameInfo* const info) {
int dispose_method; int dispose_method, dummy;
if (sscanf(args, "+%d+%d+%d+%d", &info->x_offset, &info->y_offset, const int num_args = sscanf(args, "+%d+%d+%d+%d+%d",
&info->duration, &dispose_method) != 4) { &info->duration, &info->x_offset, &info->y_offset,
&dispose_method, &dummy);
switch (num_args) {
case 1:
info->x_offset = info->y_offset = 0; // fall through
case 3:
dispose_method = 0; // fall through
case 4:
break;
default:
return 0; return 0;
} }
// Note: The sanity of the following conversion is checked by // Note: The sanity of the following conversion is checked by

View File

@ -104,10 +104,13 @@ image offset for this fragment.
.SS FRAME_OPTIONS (\-frame) .SS FRAME_OPTIONS (\-frame)
.TP .TP
.B file_i +xi+yi+di+mi .B file_i +di[+xi+yi[+mi]]
Where: 'file_i' is the i'th frame (WebP format), 'xi','yi' specify the image Where: 'file_i' is the i'th frame (WebP format), 'xi','yi' specify the image
offset for this frame, 'di' is the pause duration before next frame and 'mi' is offset for this frame, 'di' is the pause duration before next frame and 'mi' is
the dispose method for this frame (0 or 1). the dispose method for this frame (0 for NONE or 1 for BACKGROUND).
'mi' can be omitted and will default to 0 (NONE).
Additionally, if 'mi' is ommitted then'xi' and 'yi' can be omitted and will
default to +0+0.
.TP .TP
.B \-loop n .B \-loop n
Loop the frames n number of times. 0 indicates the frames should loop forever. Loop the frames n number of times. 0 indicates the frames should loop forever.