diff options
author | James Zern <jzern@google.com> | 2017-01-24 23:37:36 -0800 |
---|---|---|
committer | James Zern <jzern@google.com> | 2017-01-25 08:17:39 +0000 |
commit | 0d8e05880c01cc0339a1f1531baa11f031dc6c26 (patch) | |
tree | d51a57ec748e8785bbe0320af68d84d19a530394 | |
parent | b045013970d64fb6d2984a9af8f2a034721a2a0c (diff) | |
download | libwebp-0d8e05880c01cc0339a1f1531baa11f031dc6c26.tar.gz |
img2webp: treat -loop as a no-op w/single images
or in cases where duplicates have been reduced to one
Change-Id: I145cd61b6792b021617f1234f0ba36e2a3128d84
-rw-r--r-- | examples/img2webp.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/examples/img2webp.c b/examples/img2webp.c index 799a64cc..d9012cc4 100644 --- a/examples/img2webp.c +++ b/examples/img2webp.c @@ -85,10 +85,15 @@ static int ReadImage(const char filename[], WebPPicture* const pic) { static int SetLoopCount(int loop_count, WebPData* const webp_data) { int ok = 1; WebPMuxError err; + uint32_t features; WebPMuxAnimParams new_params; WebPMux* const mux = WebPMuxCreate(webp_data, 1); if (mux == NULL) return 0; + err = WebPMuxGetFeatures(mux, &features); + ok = (err == WEBP_MUX_OK); + if (!ok || !(features & ANIMATION_FLAG)) goto End; + err = WebPMuxGetAnimationParams(mux, &new_params); ok = (err == WEBP_MUX_OK); if (ok) { @@ -101,6 +106,8 @@ static int SetLoopCount(int loop_count, WebPData* const webp_data) { err = WebPMuxAssemble(mux, webp_data); ok = (err == WEBP_MUX_OK); } + + End: WebPMuxDelete(mux); if (!ok) { fprintf(stderr, "Error during loop-count setting\n"); |