From 862d296cf9b1a7975bc725bc60646077f0ad8fdc Mon Sep 17 00:00:00 2001 From: James Zern Date: Wed, 23 Jul 2014 16:13:56 -0700 Subject: [PATCH] restore mux API compatibility protect WebPMuxSetCanvasSize w/a WEBP_MUX_ABI_VERSION check Change-Id: I6b01af55ebb4cc4c860d3cbf43be722077896748 --- examples/gif2webp.c | 2 ++ src/mux/muxedit.c | 2 ++ src/webp/mux.h | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/gif2webp.c b/examples/gif2webp.c index 71d526e4..e8dcbd3e 100644 --- a/examples/gif2webp.c +++ b/examples/gif2webp.c @@ -449,6 +449,7 @@ int main(int argc, const char *argv[]) { gif->SWidth, gif->SHeight); } } +#if WEBP_MUX_ABI_VERSION > 0x0101 // Set definitive canvas size. err = WebPMuxSetCanvasSize(mux, gif->SWidth, gif->SHeight); if (err != WEBP_MUX_OK) { @@ -456,6 +457,7 @@ int main(int argc, const char *argv[]) { gif->SWidth, gif->SHeight); goto End; } +#endif // Allocate current buffer. frame.width = gif->SWidth; frame.height = gif->SHeight; diff --git a/src/mux/muxedit.c b/src/mux/muxedit.c index 18f7052d..24ca471b 100644 --- a/src/mux/muxedit.c +++ b/src/mux/muxedit.c @@ -362,6 +362,7 @@ WebPMuxError WebPMuxSetAnimationParams(WebPMux* mux, return MuxSet(mux, kChunks[IDX_ANIM].tag, 1, &anim, 1); } +#if WEBP_MUX_ABI_VERSION > 0x0101 WebPMuxError WebPMuxSetCanvasSize(WebPMux* mux, int width, int height) { WebPMuxError err; @@ -387,6 +388,7 @@ WebPMuxError WebPMuxSetCanvasSize(WebPMux* mux, mux->canvas_height_ = height; return WEBP_MUX_OK; } +#endif //------------------------------------------------------------------------------ // Delete API(s). diff --git a/src/webp/mux.h b/src/webp/mux.h index 578d9e02..1ae03b34 100644 --- a/src/webp/mux.h +++ b/src/webp/mux.h @@ -55,7 +55,7 @@ extern "C" { #endif -#define WEBP_MUX_ABI_VERSION 0x0102 // MAJOR(8b) + MINOR(8b) +#define WEBP_MUX_ABI_VERSION 0x0101 // MAJOR(8b) + MINOR(8b) // Note: forward declaring enumerations is not allowed in (strict) C and C++, // the types are left here for reference. @@ -310,6 +310,7 @@ WEBP_EXTERN(WebPMuxError) WebPMuxGetAnimationParams( //------------------------------------------------------------------------------ // Misc Utilities. +#if WEBP_MUX_ABI_VERSION > 0x0101 // Sets the canvas size for the mux object. The width and height can be // specified explicitly or left as zero (0, 0). // * When width and height are specified explicitly, then this frame bound is @@ -327,6 +328,7 @@ WEBP_EXTERN(WebPMuxError) WebPMuxGetAnimationParams( // WEBP_MUX_OK - on success. WEBP_EXTERN(WebPMuxError) WebPMuxSetCanvasSize(WebPMux* mux, int width, int height); +#endif // Gets the canvas size from the mux object. // Note: This method assumes that the VP8X chunk, if present, is up-to-date.