mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-12 22:14:29 +02:00
examples,cosmetics: rm struct member '_' suffix
This is a follow up to:
ee8e8c62
Fix member naming for VP8LHistogram
This better matches Google style and clears some clang-tidy warnings.
Change-Id: If6a77a316e36a6d87abaa69692a34374ba6aed4f
This commit is contained in:
@ -87,9 +87,9 @@ typedef enum {
|
||||
} FeatureSubType;
|
||||
|
||||
typedef struct {
|
||||
FeatureSubType subtype_;
|
||||
const char* filename_;
|
||||
const char* params_;
|
||||
FeatureSubType subtype;
|
||||
const char* filename;
|
||||
const char* params;
|
||||
} FeatureArg;
|
||||
|
||||
typedef enum {
|
||||
@ -114,14 +114,14 @@ static const char* const kDescriptions[LAST_FEATURE] = {
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
CommandLineArguments cmd_args_;
|
||||
CommandLineArguments cmd_args;
|
||||
|
||||
ActionType action_type_;
|
||||
const char* input_;
|
||||
const char* output_;
|
||||
FeatureType type_;
|
||||
FeatureArg* args_;
|
||||
int arg_count_;
|
||||
ActionType action_type;
|
||||
const char* input;
|
||||
const char* output;
|
||||
FeatureType type;
|
||||
FeatureArg* args;
|
||||
int arg_count;
|
||||
} Config;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@ -132,8 +132,8 @@ static int CountOccurrences(const CommandLineArguments* const args,
|
||||
int i;
|
||||
int num_occurences = 0;
|
||||
|
||||
for (i = 0; i < args->argc_; ++i) {
|
||||
if (!strcmp(args->argv_[i], arg)) {
|
||||
for (i = 0; i < args->argc; ++i) {
|
||||
if (!strcmp(args->argv[i], arg)) {
|
||||
++num_occurences;
|
||||
}
|
||||
}
|
||||
@ -527,8 +527,8 @@ static int ParseBgcolorArgs(const char* args, uint32_t* const bgcolor) {
|
||||
|
||||
static void DeleteConfig(Config* const config) {
|
||||
if (config != NULL) {
|
||||
free(config->args_);
|
||||
ExUtilDeleteCommandLineArguments(&config->cmd_args_);
|
||||
free(config->args);
|
||||
ExUtilDeleteCommandLineArguments(&config->cmd_args);
|
||||
memset(config, 0, sizeof(*config));
|
||||
}
|
||||
}
|
||||
@ -605,9 +605,9 @@ static int ValidateCommandLine(const CommandLineArguments* const cmd_args,
|
||||
return ok;
|
||||
}
|
||||
|
||||
#define ACTION_IS_NIL (config->action_type_ == NIL_ACTION)
|
||||
#define ACTION_IS_NIL (config->action_type == NIL_ACTION)
|
||||
|
||||
#define FEATURETYPE_IS_NIL (config->type_ == NIL_FEATURE)
|
||||
#define FEATURETYPE_IS_NIL (config->type == NIL_FEATURE)
|
||||
|
||||
#define CHECK_NUM_ARGS_AT_LEAST(NUM, LABEL) \
|
||||
do { \
|
||||
@ -637,98 +637,98 @@ static int ParseCommandLine(Config* config, const W_CHAR** const unicode_argv) {
|
||||
int i = 0;
|
||||
int feature_arg_index = 0;
|
||||
int ok = 1;
|
||||
int argc = config->cmd_args_.argc_;
|
||||
const char* const* argv = config->cmd_args_.argv_;
|
||||
int argc = config->cmd_args.argc;
|
||||
const char* const* argv = config->cmd_args.argv;
|
||||
// Unicode file paths will be used if available.
|
||||
const char* const* wargv =
|
||||
(unicode_argv != NULL) ? (const char**)(unicode_argv + 1) : argv;
|
||||
|
||||
while (i < argc) {
|
||||
FeatureArg* const arg = &config->args_[feature_arg_index];
|
||||
FeatureArg* const arg = &config->args[feature_arg_index];
|
||||
if (argv[i][0] == '-') { // One of the action types or output.
|
||||
if (!strcmp(argv[i], "-set")) {
|
||||
if (ACTION_IS_NIL) {
|
||||
config->action_type_ = ACTION_SET;
|
||||
config->action_type = ACTION_SET;
|
||||
} else {
|
||||
ERROR_GOTO1("ERROR: Multiple actions specified.\n", ErrParse);
|
||||
}
|
||||
++i;
|
||||
} else if (!strcmp(argv[i], "-duration")) {
|
||||
CHECK_NUM_ARGS_AT_LEAST(2, ErrParse);
|
||||
if (ACTION_IS_NIL || config->action_type_ == ACTION_DURATION) {
|
||||
config->action_type_ = ACTION_DURATION;
|
||||
if (ACTION_IS_NIL || config->action_type == ACTION_DURATION) {
|
||||
config->action_type = ACTION_DURATION;
|
||||
} else {
|
||||
ERROR_GOTO1("ERROR: Multiple actions specified.\n", ErrParse);
|
||||
}
|
||||
if (FEATURETYPE_IS_NIL || config->type_ == FEATURE_DURATION) {
|
||||
config->type_ = FEATURE_DURATION;
|
||||
if (FEATURETYPE_IS_NIL || config->type == FEATURE_DURATION) {
|
||||
config->type = FEATURE_DURATION;
|
||||
} else {
|
||||
ERROR_GOTO1("ERROR: Multiple features specified.\n", ErrParse);
|
||||
}
|
||||
arg->params_ = argv[i + 1];
|
||||
arg->params = argv[i + 1];
|
||||
++feature_arg_index;
|
||||
i += 2;
|
||||
} else if (!strcmp(argv[i], "-get")) {
|
||||
if (ACTION_IS_NIL) {
|
||||
config->action_type_ = ACTION_GET;
|
||||
config->action_type = ACTION_GET;
|
||||
} else {
|
||||
ERROR_GOTO1("ERROR: Multiple actions specified.\n", ErrParse);
|
||||
}
|
||||
++i;
|
||||
} else if (!strcmp(argv[i], "-strip")) {
|
||||
if (ACTION_IS_NIL) {
|
||||
config->action_type_ = ACTION_STRIP;
|
||||
config->arg_count_ = 0;
|
||||
config->action_type = ACTION_STRIP;
|
||||
config->arg_count = 0;
|
||||
} else {
|
||||
ERROR_GOTO1("ERROR: Multiple actions specified.\n", ErrParse);
|
||||
}
|
||||
++i;
|
||||
} else if (!strcmp(argv[i], "-frame")) {
|
||||
CHECK_NUM_ARGS_AT_LEAST(3, ErrParse);
|
||||
if (ACTION_IS_NIL || config->action_type_ == ACTION_SET) {
|
||||
config->action_type_ = ACTION_SET;
|
||||
if (ACTION_IS_NIL || config->action_type == ACTION_SET) {
|
||||
config->action_type = ACTION_SET;
|
||||
} else {
|
||||
ERROR_GOTO1("ERROR: Multiple actions specified.\n", ErrParse);
|
||||
}
|
||||
if (FEATURETYPE_IS_NIL || config->type_ == FEATURE_ANMF) {
|
||||
config->type_ = FEATURE_ANMF;
|
||||
if (FEATURETYPE_IS_NIL || config->type == FEATURE_ANMF) {
|
||||
config->type = FEATURE_ANMF;
|
||||
} else {
|
||||
ERROR_GOTO1("ERROR: Multiple features specified.\n", ErrParse);
|
||||
}
|
||||
arg->subtype_ = SUBTYPE_ANMF;
|
||||
arg->filename_ = wargv[i + 1];
|
||||
arg->params_ = argv[i + 2];
|
||||
arg->subtype = SUBTYPE_ANMF;
|
||||
arg->filename = wargv[i + 1];
|
||||
arg->params = argv[i + 2];
|
||||
++feature_arg_index;
|
||||
i += 3;
|
||||
} else if (!strcmp(argv[i], "-loop") || !strcmp(argv[i], "-bgcolor")) {
|
||||
CHECK_NUM_ARGS_AT_LEAST(2, ErrParse);
|
||||
if (ACTION_IS_NIL || config->action_type_ == ACTION_SET) {
|
||||
config->action_type_ = ACTION_SET;
|
||||
if (ACTION_IS_NIL || config->action_type == ACTION_SET) {
|
||||
config->action_type = ACTION_SET;
|
||||
} else {
|
||||
ERROR_GOTO1("ERROR: Multiple actions specified.\n", ErrParse);
|
||||
}
|
||||
if (FEATURETYPE_IS_NIL || config->type_ == FEATURE_ANMF) {
|
||||
config->type_ = FEATURE_ANMF;
|
||||
if (FEATURETYPE_IS_NIL || config->type == FEATURE_ANMF) {
|
||||
config->type = FEATURE_ANMF;
|
||||
} else {
|
||||
ERROR_GOTO1("ERROR: Multiple features specified.\n", ErrParse);
|
||||
}
|
||||
arg->subtype_ =
|
||||
arg->subtype =
|
||||
!strcmp(argv[i], "-loop") ? SUBTYPE_LOOP : SUBTYPE_BGCOLOR;
|
||||
arg->params_ = argv[i + 1];
|
||||
arg->params = argv[i + 1];
|
||||
++feature_arg_index;
|
||||
i += 2;
|
||||
} else if (!strcmp(argv[i], "-o")) {
|
||||
CHECK_NUM_ARGS_AT_LEAST(2, ErrParse);
|
||||
config->output_ = wargv[i + 1];
|
||||
config->output = wargv[i + 1];
|
||||
i += 2;
|
||||
} else if (!strcmp(argv[i], "-info")) {
|
||||
CHECK_NUM_ARGS_EXACTLY(2, ErrParse);
|
||||
if (config->action_type_ != NIL_ACTION) {
|
||||
if (config->action_type != NIL_ACTION) {
|
||||
ERROR_GOTO1("ERROR: Multiple actions specified.\n", ErrParse);
|
||||
} else {
|
||||
config->action_type_ = ACTION_INFO;
|
||||
config->arg_count_ = 0;
|
||||
config->input_ = wargv[i + 1];
|
||||
config->action_type = ACTION_INFO;
|
||||
config->arg_count = 0;
|
||||
config->input = wargv[i + 1];
|
||||
}
|
||||
i += 2;
|
||||
} else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "-help")) {
|
||||
@ -746,8 +746,8 @@ static int ParseCommandLine(Config* config, const W_CHAR** const unicode_argv) {
|
||||
} else if (!strcmp(argv[i], "--")) {
|
||||
if (i < argc - 1) {
|
||||
++i;
|
||||
if (config->input_ == NULL) {
|
||||
config->input_ = wargv[i];
|
||||
if (config->input == NULL) {
|
||||
config->input = wargv[i];
|
||||
} else {
|
||||
ERROR_GOTO2("ERROR at '%s': Multiple input files specified.\n",
|
||||
argv[i], ErrParse);
|
||||
@ -765,43 +765,43 @@ static int ParseCommandLine(Config* config, const W_CHAR** const unicode_argv) {
|
||||
if (!strcmp(argv[i], "icc") || !strcmp(argv[i], "exif") ||
|
||||
!strcmp(argv[i], "xmp")) {
|
||||
if (FEATURETYPE_IS_NIL) {
|
||||
config->type_ = (!strcmp(argv[i], "icc")) ? FEATURE_ICCP :
|
||||
config->type = (!strcmp(argv[i], "icc")) ? FEATURE_ICCP :
|
||||
(!strcmp(argv[i], "exif")) ? FEATURE_EXIF : FEATURE_XMP;
|
||||
} else {
|
||||
ERROR_GOTO1("ERROR: Multiple features specified.\n", ErrParse);
|
||||
}
|
||||
if (config->action_type_ == ACTION_SET) {
|
||||
if (config->action_type == ACTION_SET) {
|
||||
CHECK_NUM_ARGS_AT_LEAST(2, ErrParse);
|
||||
arg->filename_ = wargv[i + 1];
|
||||
arg->filename = wargv[i + 1];
|
||||
++feature_arg_index;
|
||||
i += 2;
|
||||
} else {
|
||||
++i;
|
||||
}
|
||||
} else if (!strcmp(argv[i], "frame") &&
|
||||
(config->action_type_ == ACTION_GET)) {
|
||||
(config->action_type == ACTION_GET)) {
|
||||
CHECK_NUM_ARGS_AT_LEAST(2, ErrParse);
|
||||
config->type_ = FEATURE_ANMF;
|
||||
arg->params_ = argv[i + 1];
|
||||
config->type = FEATURE_ANMF;
|
||||
arg->params = argv[i + 1];
|
||||
++feature_arg_index;
|
||||
i += 2;
|
||||
} else if (!strcmp(argv[i], "loop") &&
|
||||
(config->action_type_ == ACTION_SET)) {
|
||||
(config->action_type == ACTION_SET)) {
|
||||
CHECK_NUM_ARGS_AT_LEAST(2, ErrParse);
|
||||
config->type_ = FEATURE_LOOP;
|
||||
arg->params_ = argv[i + 1];
|
||||
config->type = FEATURE_LOOP;
|
||||
arg->params = argv[i + 1];
|
||||
++feature_arg_index;
|
||||
i += 2;
|
||||
} else if (!strcmp(argv[i], "bgcolor") &&
|
||||
(config->action_type_ == ACTION_SET)) {
|
||||
(config->action_type == ACTION_SET)) {
|
||||
CHECK_NUM_ARGS_AT_LEAST(2, ErrParse);
|
||||
config->type_ = FEATURE_BGCOLOR;
|
||||
arg->params_ = argv[i + 1];
|
||||
config->type = FEATURE_BGCOLOR;
|
||||
arg->params = argv[i + 1];
|
||||
++feature_arg_index;
|
||||
i += 2;
|
||||
} else { // Assume input file.
|
||||
if (config->input_ == NULL) {
|
||||
config->input_ = wargv[i];
|
||||
if (config->input == NULL) {
|
||||
config->input = wargv[i];
|
||||
} else {
|
||||
ERROR_GOTO2("ERROR at '%s': Multiple input files specified.\n",
|
||||
argv[i], ErrParse);
|
||||
@ -824,21 +824,21 @@ static int ValidateConfig(Config* const config) {
|
||||
}
|
||||
|
||||
// Feature type.
|
||||
if (FEATURETYPE_IS_NIL && config->action_type_ != ACTION_INFO) {
|
||||
if (FEATURETYPE_IS_NIL && config->action_type != ACTION_INFO) {
|
||||
ERROR_GOTO1("ERROR: No feature specified.\n", ErrValidate2);
|
||||
}
|
||||
|
||||
// Input file.
|
||||
if (config->input_ == NULL) {
|
||||
if (config->action_type_ != ACTION_SET) {
|
||||
if (config->input == NULL) {
|
||||
if (config->action_type != ACTION_SET) {
|
||||
ERROR_GOTO1("ERROR: No input file specified.\n", ErrValidate2);
|
||||
} else if (config->type_ != FEATURE_ANMF) {
|
||||
} else if (config->type != FEATURE_ANMF) {
|
||||
ERROR_GOTO1("ERROR: No input file specified.\n", ErrValidate2);
|
||||
}
|
||||
}
|
||||
|
||||
// Output file.
|
||||
if (config->output_ == NULL && config->action_type_ != ACTION_INFO) {
|
||||
if (config->output == NULL && config->action_type != ACTION_INFO) {
|
||||
ERROR_GOTO1("ERROR: No output file specified.\n", ErrValidate2);
|
||||
}
|
||||
|
||||
@ -854,17 +854,17 @@ static int InitializeConfig(int argc, const char* argv[], Config* const config,
|
||||
|
||||
memset(config, 0, sizeof(*config));
|
||||
|
||||
ok = ExUtilInitCommandLineArguments(argc, argv, &config->cmd_args_);
|
||||
ok = ExUtilInitCommandLineArguments(argc, argv, &config->cmd_args);
|
||||
if (!ok) return 0;
|
||||
|
||||
// Validate command-line arguments.
|
||||
if (!ValidateCommandLine(&config->cmd_args_, &num_feature_args)) {
|
||||
if (!ValidateCommandLine(&config->cmd_args, &num_feature_args)) {
|
||||
ERROR_GOTO1("Exiting due to command-line parsing error.\n", Err1);
|
||||
}
|
||||
|
||||
config->arg_count_ = num_feature_args;
|
||||
config->args_ = (FeatureArg*)calloc(num_feature_args, sizeof(*config->args_));
|
||||
if (config->args_ == NULL) {
|
||||
config->arg_count = num_feature_args;
|
||||
config->args = (FeatureArg*)calloc(num_feature_args, sizeof(*config->args));
|
||||
if (config->args == NULL) {
|
||||
ERROR_GOTO1("ERROR: Memory allocation error.\n", Err1);
|
||||
}
|
||||
|
||||
@ -896,7 +896,7 @@ static int GetFrame(const WebPMux* mux, const Config* config) {
|
||||
WebPMuxFrameInfo info;
|
||||
WebPDataInit(&info.bitstream);
|
||||
|
||||
num = ExUtilGetInt(config->args_[0].params_, 10, &parse_error);
|
||||
num = ExUtilGetInt(config->args[0].params, 10, &parse_error);
|
||||
if (num < 0) {
|
||||
ERROR_GOTO1("ERROR: Frame/Fragment index must be non-negative.\n", ErrGet);
|
||||
}
|
||||
@ -921,7 +921,7 @@ static int GetFrame(const WebPMux* mux, const Config* config) {
|
||||
ErrorString(err), ErrGet);
|
||||
}
|
||||
|
||||
ok = WriteWebP(mux_single, config->output_);
|
||||
ok = WriteWebP(mux_single, config->output);
|
||||
|
||||
ErrGet:
|
||||
WebPDataClear(&info.bitstream);
|
||||
@ -936,11 +936,11 @@ static int Process(const Config* config) {
|
||||
WebPMuxError err = WEBP_MUX_OK;
|
||||
int ok = 1;
|
||||
|
||||
switch (config->action_type_) {
|
||||
switch (config->action_type) {
|
||||
case ACTION_GET: {
|
||||
ok = CreateMux(config->input_, &mux);
|
||||
ok = CreateMux(config->input, &mux);
|
||||
if (!ok) goto Err2;
|
||||
switch (config->type_) {
|
||||
switch (config->type) {
|
||||
case FEATURE_ANMF:
|
||||
ok = GetFrame(mux, config);
|
||||
break;
|
||||
@ -948,12 +948,12 @@ static int Process(const Config* config) {
|
||||
case FEATURE_ICCP:
|
||||
case FEATURE_EXIF:
|
||||
case FEATURE_XMP:
|
||||
err = WebPMuxGetChunk(mux, kFourccList[config->type_], &chunk);
|
||||
err = WebPMuxGetChunk(mux, kFourccList[config->type], &chunk);
|
||||
if (err != WEBP_MUX_OK) {
|
||||
ERROR_GOTO3("ERROR (%s): Could not get the %s.\n",
|
||||
ErrorString(err), kDescriptions[config->type_], Err2);
|
||||
ErrorString(err), kDescriptions[config->type], Err2);
|
||||
}
|
||||
ok = WriteData(config->output_, &chunk);
|
||||
ok = WriteData(config->output, &chunk);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -963,7 +963,7 @@ static int Process(const Config* config) {
|
||||
break;
|
||||
}
|
||||
case ACTION_SET: {
|
||||
switch (config->type_) {
|
||||
switch (config->type) {
|
||||
case FEATURE_ANMF: {
|
||||
int i;
|
||||
WebPMuxAnimParams params = { 0xFFFFFFFF, 0 };
|
||||
@ -972,11 +972,11 @@ static int Process(const Config* config) {
|
||||
ERROR_GOTO2("ERROR (%s): Could not allocate a mux object.\n",
|
||||
ErrorString(WEBP_MUX_MEMORY_ERROR), Err2);
|
||||
}
|
||||
for (i = 0; i < config->arg_count_; ++i) {
|
||||
switch (config->args_[i].subtype_) {
|
||||
for (i = 0; i < config->arg_count; ++i) {
|
||||
switch (config->args[i].subtype) {
|
||||
case SUBTYPE_BGCOLOR: {
|
||||
uint32_t bgcolor;
|
||||
ok = ParseBgcolorArgs(config->args_[i].params_, &bgcolor);
|
||||
ok = ParseBgcolorArgs(config->args[i].params, &bgcolor);
|
||||
if (!ok) {
|
||||
ERROR_GOTO1("ERROR: Could not parse the background color \n",
|
||||
Err2);
|
||||
@ -987,7 +987,7 @@ static int Process(const Config* config) {
|
||||
case SUBTYPE_LOOP: {
|
||||
int parse_error = 0;
|
||||
const int loop_count =
|
||||
ExUtilGetInt(config->args_[i].params_, 10, &parse_error);
|
||||
ExUtilGetInt(config->args[i].params, 10, &parse_error);
|
||||
if (loop_count < 0 || loop_count > 65535) {
|
||||
// Note: This is only a 'necessary' condition for loop_count
|
||||
// to be valid. The 'sufficient' conditioned in checked in
|
||||
@ -1003,10 +1003,10 @@ static int Process(const Config* config) {
|
||||
case SUBTYPE_ANMF: {
|
||||
WebPMuxFrameInfo frame;
|
||||
frame.id = WEBP_CHUNK_ANMF;
|
||||
ok = ExUtilReadFileToWebPData(config->args_[i].filename_,
|
||||
ok = ExUtilReadFileToWebPData(config->args[i].filename,
|
||||
&frame.bitstream);
|
||||
if (!ok) goto Err2;
|
||||
ok = ParseFrameArgs(config->args_[i].params_, &frame);
|
||||
ok = ParseFrameArgs(config->args[i].params, &frame);
|
||||
if (!ok) {
|
||||
WebPDataClear(&frame.bitstream);
|
||||
ERROR_GOTO1("ERROR: Could not parse frame properties.\n",
|
||||
@ -1037,15 +1037,15 @@ static int Process(const Config* config) {
|
||||
case FEATURE_ICCP:
|
||||
case FEATURE_EXIF:
|
||||
case FEATURE_XMP: {
|
||||
ok = CreateMux(config->input_, &mux);
|
||||
ok = CreateMux(config->input, &mux);
|
||||
if (!ok) goto Err2;
|
||||
ok = ExUtilReadFileToWebPData(config->args_[0].filename_, &chunk);
|
||||
ok = ExUtilReadFileToWebPData(config->args[0].filename, &chunk);
|
||||
if (!ok) goto Err2;
|
||||
err = WebPMuxSetChunk(mux, kFourccList[config->type_], &chunk, 1);
|
||||
err = WebPMuxSetChunk(mux, kFourccList[config->type], &chunk, 1);
|
||||
WebPDataClear(&chunk);
|
||||
if (err != WEBP_MUX_OK) {
|
||||
ERROR_GOTO3("ERROR (%s): Could not set the %s.\n",
|
||||
ErrorString(err), kDescriptions[config->type_], Err2);
|
||||
ErrorString(err), kDescriptions[config->type], Err2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1053,12 +1053,12 @@ static int Process(const Config* config) {
|
||||
WebPMuxAnimParams params = { 0xFFFFFFFF, 0 };
|
||||
int parse_error = 0;
|
||||
const int loop_count =
|
||||
ExUtilGetInt(config->args_[0].params_, 10, &parse_error);
|
||||
ExUtilGetInt(config->args[0].params, 10, &parse_error);
|
||||
if (loop_count < 0 || loop_count > 65535 || parse_error) {
|
||||
ERROR_GOTO1("ERROR: Loop count must be in the range 0 to 65535.\n",
|
||||
Err2);
|
||||
}
|
||||
ok = CreateMux(config->input_, &mux);
|
||||
ok = CreateMux(config->input, &mux);
|
||||
if (!ok) goto Err2;
|
||||
ok = (WebPMuxGetAnimationParams(mux, ¶ms) == WEBP_MUX_OK);
|
||||
if (!ok) {
|
||||
@ -1077,12 +1077,12 @@ static int Process(const Config* config) {
|
||||
case FEATURE_BGCOLOR: {
|
||||
WebPMuxAnimParams params = { 0xFFFFFFFF, 0 };
|
||||
uint32_t bgcolor;
|
||||
ok = ParseBgcolorArgs(config->args_[0].params_, &bgcolor);
|
||||
ok = ParseBgcolorArgs(config->args[0].params, &bgcolor);
|
||||
if (!ok) {
|
||||
ERROR_GOTO1("ERROR: Could not parse the background color.\n",
|
||||
Err2);
|
||||
}
|
||||
ok = CreateMux(config->input_, &mux);
|
||||
ok = CreateMux(config->input, &mux);
|
||||
if (!ok) goto Err2;
|
||||
ok = (WebPMuxGetAnimationParams(mux, ¶ms) == WEBP_MUX_OK);
|
||||
if (!ok) {
|
||||
@ -1103,12 +1103,12 @@ static int Process(const Config* config) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
ok = WriteWebP(mux, config->output_);
|
||||
ok = WriteWebP(mux, config->output);
|
||||
break;
|
||||
}
|
||||
case ACTION_DURATION: {
|
||||
int num_frames;
|
||||
ok = CreateMux(config->input_, &mux);
|
||||
ok = CreateMux(config->input, &mux);
|
||||
if (!ok) goto Err2;
|
||||
err = WebPMuxNumChunks(mux, WEBP_CHUNK_ANMF, &num_frames);
|
||||
ok = (err == WEBP_MUX_OK);
|
||||
@ -1118,7 +1118,7 @@ static int Process(const Config* config) {
|
||||
if (num_frames == 0) {
|
||||
fprintf(stderr, "Doesn't look like the source is animated. "
|
||||
"Skipping duration setting.\n");
|
||||
ok = WriteWebP(mux, config->output_);
|
||||
ok = WriteWebP(mux, config->output);
|
||||
if (!ok) goto Err2;
|
||||
} else {
|
||||
int i;
|
||||
@ -1130,11 +1130,11 @@ static int Process(const Config* config) {
|
||||
for (i = 0; i < num_frames; ++i) durations[i] = -1;
|
||||
|
||||
// Parse intervals to process.
|
||||
for (i = 0; i < config->arg_count_; ++i) {
|
||||
for (i = 0; i < config->arg_count; ++i) {
|
||||
int k;
|
||||
int args[3];
|
||||
int duration, start, end;
|
||||
const int nb_args = ExUtilGetInts(config->args_[i].params_,
|
||||
const int nb_args = ExUtilGetInts(config->args[i].params,
|
||||
10, 3, args);
|
||||
ok = (nb_args >= 1);
|
||||
if (!ok) goto Err3;
|
||||
@ -1178,7 +1178,7 @@ static int Process(const Config* config) {
|
||||
WebPDataClear(&frame.bitstream);
|
||||
}
|
||||
WebPMuxDelete(mux);
|
||||
ok = WriteWebP(new_mux, config->output_);
|
||||
ok = WriteWebP(new_mux, config->output);
|
||||
mux = new_mux; // transfer for the WebPMuxDelete() call
|
||||
new_mux = NULL;
|
||||
|
||||
@ -1190,24 +1190,24 @@ static int Process(const Config* config) {
|
||||
break;
|
||||
}
|
||||
case ACTION_STRIP: {
|
||||
ok = CreateMux(config->input_, &mux);
|
||||
ok = CreateMux(config->input, &mux);
|
||||
if (!ok) goto Err2;
|
||||
if (config->type_ == FEATURE_ICCP || config->type_ == FEATURE_EXIF ||
|
||||
config->type_ == FEATURE_XMP) {
|
||||
err = WebPMuxDeleteChunk(mux, kFourccList[config->type_]);
|
||||
if (config->type == FEATURE_ICCP || config->type == FEATURE_EXIF ||
|
||||
config->type == FEATURE_XMP) {
|
||||
err = WebPMuxDeleteChunk(mux, kFourccList[config->type]);
|
||||
if (err != WEBP_MUX_OK) {
|
||||
ERROR_GOTO3("ERROR (%s): Could not strip the %s.\n",
|
||||
ErrorString(err), kDescriptions[config->type_], Err2);
|
||||
ErrorString(err), kDescriptions[config->type], Err2);
|
||||
}
|
||||
} else {
|
||||
ERROR_GOTO1("ERROR: Invalid feature for action 'strip'.\n", Err2);
|
||||
break;
|
||||
}
|
||||
ok = WriteWebP(mux, config->output_);
|
||||
ok = WriteWebP(mux, config->output);
|
||||
break;
|
||||
}
|
||||
case ACTION_INFO: {
|
||||
ok = CreateMux(config->input_, &mux);
|
||||
ok = CreateMux(config->input, &mux);
|
||||
if (!ok) goto Err2;
|
||||
ok = (DisplayInfo(mux) == WEBP_MUX_OK);
|
||||
break;
|
||||
|
Reference in New Issue
Block a user