Mark fragment options as experimental in webpmux

This is to disallow any accidental creation/parsing of fragmented images
by users.

Change-Id: I970a4bd5ec5a522867b24a0c9efb45164ae67047
This commit is contained in:
Urvang Joshi
2013-03-15 14:46:12 -07:00
parent 9b3db89473
commit 5dbd403029
3 changed files with 21 additions and 35 deletions

View File

@ -17,12 +17,6 @@
/* Usage examples:
Create container WebP file:
webpmux -frgm fragment_1.webp +0+0 \
-frgm fragment_2.webp +960+0 \
-frgm fragment_3.webp +0+576 \
-frgm fragment_4.webp +960+576 \
-o out_fragment_container.webp
webpmux -frame anim_1.webp +100+10+10 \
-frame anim_2.webp +100+25+25+1 \
-frame anim_3.webp +100+50+50+1 \
@ -52,6 +46,10 @@
webpmux -version
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
@ -185,6 +183,9 @@ static WebPMuxError DisplayInfo(const WebPMux* mux) {
uint32_t flag;
WebPMuxError err = WebPMuxGetFeatures(mux, &flag);
#ifndef WEBP_EXPERIMENTAL_FEATURES
if (flag & FRAGMENTS_FLAG) err = WEBP_MUX_INVALID_ARGUMENT;
#endif
RETURN_IF_ERROR("Failed to retrieve features\n");
if (flag == 0) {
@ -272,7 +273,9 @@ static void PrintHelp(void) {
printf("Usage: webpmux -get GET_OPTIONS INPUT -o OUTPUT\n");
printf(" webpmux -set SET_OPTIONS INPUT -o OUTPUT\n");
printf(" webpmux -strip STRIP_OPTIONS INPUT -o OUTPUT\n");
#ifdef WEBP_EXPERIMENTAL_FEATURES
printf(" webpmux -frgm FRAGMENT_OPTIONS [-frgm...] -o OUTPUT\n");
#endif
printf(" webpmux -frame FRAME_OPTIONS [-frame...] [-loop LOOP_COUNT]"
"\n");
printf(" [-bgcolor BACKGROUND_COLOR] -o OUTPUT\n");
@ -286,7 +289,9 @@ static void PrintHelp(void) {
printf(" icc Get ICC profile.\n");
printf(" exif Get EXIF metadata.\n");
printf(" xmp Get XMP metadata.\n");
#ifdef WEBP_EXPERIMENTAL_FEATURES
printf(" frgm n Get nth fragment.\n");
#endif
printf(" frame n Get nth frame.\n");
printf("\n");
@ -306,6 +311,7 @@ static void PrintHelp(void) {
printf(" exif Strip EXIF metadata.\n");
printf(" xmp Strip XMP metadata.\n");
#ifdef WEBP_EXPERIMENTAL_FEATURES
printf("\n");
printf("FRAGMENT_OPTIONS(i):\n");
printf(" Create fragmented image.\n");
@ -313,6 +319,7 @@ static void PrintHelp(void) {
printf(" where: 'file_i' is the i'th fragment (WebP format),\n");
printf(" 'xi','yi' specify the image offset for this fragment."
"\n");
#endif
printf("\n");
printf("FRAME_OPTIONS(i):\n");
@ -596,6 +603,7 @@ static int ParseCommandLine(int argc, const char* argv[],
arg->params_ = argv[i + 1];
++feature_arg_index;
i += 2;
#ifdef WEBP_EXPERIMENTAL_FEATURES
} else if (!strcmp(argv[i], "-frgm")) {
CHECK_NUM_ARGS_LESS(3, ErrParse);
if (ACTION_IS_NIL || config->action_type_ == ACTION_SET) {
@ -612,6 +620,7 @@ static int ParseCommandLine(int argc, const char* argv[],
arg->params_ = argv[i + 2];
++feature_arg_index;
i += 3;
#endif
} else if (!strcmp(argv[i], "-o")) {
CHECK_NUM_ARGS_LESS(2, ErrParse);
config->output_ = argv[i + 1];
@ -660,8 +669,12 @@ static int ParseCommandLine(int argc, const char* argv[],
} else {
++i;
}
#ifdef WEBP_EXPERIMENTAL_FEATURES
} else if ((!strcmp(argv[i], "frame") ||
!strcmp(argv[i], "frgm")) &&
#else
} else if (!strcmp(argv[i], "frame") &&
#endif
(config->action_type_ == ACTION_GET)) {
CHECK_NUM_ARGS_LESS(2, ErrParse);
feature->type_ = (!strcmp(argv[i], "frame")) ? FEATURE_ANMF :