2012-05-12 01:00:57 +02:00
|
|
|
// Copyright 2012 Google Inc. All Rights Reserved.
|
|
|
|
//
|
2013-06-07 08:05:58 +02:00
|
|
|
// Use of this source code is governed by a BSD-style license
|
|
|
|
// that can be found in the COPYING file in the root of the source
|
|
|
|
// tree. An additional intellectual property rights grant can be found
|
|
|
|
// in the file PATENTS. All contributing project authors may
|
|
|
|
// be found in the AUTHORS file in the root of the source tree.
|
2012-05-12 01:00:57 +02:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Utility functions used by the example programs.
|
|
|
|
//
|
|
|
|
|
2016-07-22 01:10:05 +02:00
|
|
|
#ifndef WEBP_EXAMPLES_EXAMPLE_UTIL_H_
|
|
|
|
#define WEBP_EXAMPLES_EXAMPLE_UTIL_H_
|
2012-05-12 01:00:57 +02:00
|
|
|
|
2016-07-21 03:25:00 +02:00
|
|
|
#include "webp/types.h"
|
2018-02-08 08:09:14 +01:00
|
|
|
#include "webp/mux_types.h"
|
2012-05-12 01:00:57 +02:00
|
|
|
|
2013-11-25 23:43:12 +01:00
|
|
|
#ifdef __cplusplus
|
2012-05-12 01:00:57 +02:00
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2014-09-11 08:35:48 +02:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// String parsing
|
|
|
|
|
|
|
|
// Parses 'v' using strto(ul|l|d)(). If error is non-NULL, '*error' is set to
|
|
|
|
// true on failure while on success it is left unmodified to allow chaining of
|
|
|
|
// calls. An error is only printed on the first occurrence.
|
|
|
|
uint32_t ExUtilGetUInt(const char* const v, int base, int* const error);
|
|
|
|
int ExUtilGetInt(const char* const v, int base, int* const error);
|
|
|
|
float ExUtilGetFloat(const char* const v, int* const error);
|
|
|
|
|
add a "-duration duration,start,end" option to webpmux
this will force a constant duration for an interval of frames
in an animation.
Notes:
a) '-duration [...]' can be repeated as many times as needed.
b) intervals are taken into account in option order. If they overlap, values will be overwritten.
c) 'start' and 'end' can be omitted, but not the duration value.
d) 'end' can be equal to '0', in which case it means 'last frame'
e) single-image files are untouched (ie. not turned into an animation file).
Some example usage:
webpmux -duration 150 in.webp -o out.webp
webpmux -duration 33,10,0 in.webp -o out.webp
webpmux -duration 200,2 -duration 150,0,50 in.webp -o out.webp
Change-Id: I9b595dafa77f9221bacd080be7858b1457f54636
2016-10-21 15:14:45 +02:00
|
|
|
// This variant of ExUtilGetInt() will parse multiple integers from a
|
|
|
|
// comma-separated list. Up to 'max_output' integers are parsed.
|
|
|
|
// The result is placed in the output[] array, and the number of integers
|
|
|
|
// actually parsed is returned, or -1 if an error occurred.
|
|
|
|
int ExUtilGetInts(const char* v, int base, int max_output, int output[]);
|
|
|
|
|
2018-02-08 08:09:14 +01:00
|
|
|
// Reads a file named 'filename' into a WebPData structure. The content of
|
|
|
|
// webp_data is overwritten. Returns false in case of error.
|
|
|
|
int ExUtilReadFileToWebPData(const char* const filename,
|
|
|
|
WebPData* const webp_data);
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// Command-line arguments
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int argc_;
|
|
|
|
const char** argv_;
|
|
|
|
WebPData argv_data_;
|
|
|
|
int own_argv_;
|
|
|
|
} CommandLineArguments;
|
|
|
|
|
|
|
|
// Initializes the structure from the command-line parameters. If there is
|
|
|
|
// only one parameter and it does not start with a '-', then it is assumed to
|
|
|
|
// be a file name. This file will be read and tokenized into command-line
|
|
|
|
// arguments. The content of 'args' is overwritten.
|
|
|
|
// Returns false in case of error (memory allocation failure, non
|
|
|
|
// existing file, too many arguments, ...).
|
|
|
|
int ExUtilInitCommandLineArguments(int argc, const char* argv[],
|
|
|
|
CommandLineArguments* const args);
|
|
|
|
|
|
|
|
// Deallocate all memory and reset 'args'.
|
|
|
|
void ExUtilDeleteCommandLineArguments(CommandLineArguments* const args);
|
|
|
|
|
2013-11-25 23:43:12 +01:00
|
|
|
#ifdef __cplusplus
|
2012-05-12 01:00:57 +02:00
|
|
|
} // extern "C"
|
|
|
|
#endif
|
|
|
|
|
2016-07-22 01:10:05 +02:00
|
|
|
#endif // WEBP_EXAMPLES_EXAMPLE_UTIL_H_
|