mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-28 14:38:21 +01:00
GetVersion() methods for mux and demux
Also use the same in example binaries. Change-Id: Id4bb4c4231a6b8fe9ed4370a6f46567c52a04a17
This commit is contained in:
parent
b7eaa85d6a
commit
a5042a3240
@ -31,6 +31,7 @@ Usage: webpmux -get GET_OPTIONS INPUT -o OUTPUT
|
|||||||
[-bgcolor BACKGROUND_COLOR] -o OUTPUT
|
[-bgcolor BACKGROUND_COLOR] -o OUTPUT
|
||||||
webpmux -info INPUT
|
webpmux -info INPUT
|
||||||
webpmux [-h|-help]
|
webpmux [-h|-help]
|
||||||
|
webpmux -version
|
||||||
|
|
||||||
GET_OPTIONS:
|
GET_OPTIONS:
|
||||||
Extract relevant data.
|
Extract relevant data.
|
||||||
|
@ -233,9 +233,12 @@ int main(int argc, const char *argv[]) {
|
|||||||
} else if (!strcmp(argv[c], "-f") && c < argc - 1) {
|
} else if (!strcmp(argv[c], "-f") && c < argc - 1) {
|
||||||
config.filter_strength = strtol(argv[++c], NULL, 0);
|
config.filter_strength = strtol(argv[++c], NULL, 0);
|
||||||
} else if (!strcmp(argv[c], "-version")) {
|
} else if (!strcmp(argv[c], "-version")) {
|
||||||
const int version = WebPGetEncoderVersion();
|
const int enc_version = WebPGetEncoderVersion();
|
||||||
printf("%d.%d.%d\n",
|
const int mux_version = WebPGetMuxVersion();
|
||||||
(version >> 16) & 0xff, (version >> 8) & 0xff, version & 0xff);
|
printf("WebP Encoder version: %d.%d.%d\nWebP Mux version: %d.%d.%d\n",
|
||||||
|
(enc_version >> 16) & 0xff, (enc_version >> 8) & 0xff,
|
||||||
|
enc_version & 0xff, (mux_version >> 16) & 0xff,
|
||||||
|
(mux_version >> 8) & 0xff, mux_version & 0xff);
|
||||||
return 0;
|
return 0;
|
||||||
} else if (!strcmp(argv[c], "-quiet")) {
|
} else if (!strcmp(argv[c], "-quiet")) {
|
||||||
quiet = 1;
|
quiet = 1;
|
||||||
|
@ -278,9 +278,12 @@ int main(int argc, char *argv[]) {
|
|||||||
} else if (!strcmp(argv[c], "-info")) {
|
} else if (!strcmp(argv[c], "-info")) {
|
||||||
kParams.print_info = 1;
|
kParams.print_info = 1;
|
||||||
} else if (!strcmp(argv[c], "-version")) {
|
} else if (!strcmp(argv[c], "-version")) {
|
||||||
const int version = WebPGetDecoderVersion();
|
const int dec_version = WebPGetDecoderVersion();
|
||||||
printf("%d.%d.%d\n",
|
const int dmux_version = WebPGetDemuxVersion();
|
||||||
(version >> 16) & 0xff, (version >> 8) & 0xff, version & 0xff);
|
printf("WebP Decoder version: %d.%d.%d\nWebP Demux version: %d.%d.%d\n",
|
||||||
|
(dec_version >> 16) & 0xff, (dec_version >> 8) & 0xff,
|
||||||
|
dec_version & 0xff, (dmux_version >> 16) & 0xff,
|
||||||
|
(dmux_version >> 8) & 0xff, dmux_version & 0xff);
|
||||||
return 0;
|
return 0;
|
||||||
} else if (!strcmp(argv[c], "-mt")) {
|
} else if (!strcmp(argv[c], "-mt")) {
|
||||||
config.options.use_threads = 1;
|
config.options.use_threads = 1;
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
Misc:
|
Misc:
|
||||||
webpmux -info in.webp
|
webpmux -info in.webp
|
||||||
webpmux [ -h | -help ]
|
webpmux [ -h | -help ]
|
||||||
|
webpmux -version
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
@ -277,6 +278,7 @@ static void PrintHelp(void) {
|
|||||||
printf(" [-bgcolor BACKGROUND_COLOR] -o OUTPUT\n");
|
printf(" [-bgcolor BACKGROUND_COLOR] -o OUTPUT\n");
|
||||||
printf(" webpmux -info INPUT\n");
|
printf(" webpmux -info INPUT\n");
|
||||||
printf(" webpmux [-h|-help]\n");
|
printf(" webpmux [-h|-help]\n");
|
||||||
|
printf(" webpmux -version\n");
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("GET_OPTIONS:\n");
|
printf("GET_OPTIONS:\n");
|
||||||
@ -628,6 +630,12 @@ static int ParseCommandLine(int argc, const char* argv[],
|
|||||||
PrintHelp();
|
PrintHelp();
|
||||||
DeleteConfig(config);
|
DeleteConfig(config);
|
||||||
exit(0);
|
exit(0);
|
||||||
|
} else if (!strcmp(argv[i], "-version")) {
|
||||||
|
const int version = WebPGetMuxVersion();
|
||||||
|
printf("%d.%d.%d\n",
|
||||||
|
(version >> 16) & 0xff, (version >> 8) & 0xff, version & 0xff);
|
||||||
|
DeleteConfig(config);
|
||||||
|
exit(0);
|
||||||
} else {
|
} else {
|
||||||
ERROR_GOTO2("ERROR: Unknown option: '%s'.\n", argv[i], ErrParse);
|
ERROR_GOTO2("ERROR: Unknown option: '%s'.\n", argv[i], ErrParse);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
.\" Hey, EMACS: -*- nroff -*-
|
.\" Hey, EMACS: -*- nroff -*-
|
||||||
.TH WEBPMUX 1 "February 01, 2013"
|
.TH WEBPMUX 1 "February 26, 2013"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
webpmux \- command line tool to create WebP Mux/container file.
|
webpmux \- command line tool to create WebP Mux/container file.
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@ -43,6 +43,8 @@ webpmux \- command line tool to create WebP Mux/container file.
|
|||||||
.I INPUT
|
.I INPUT
|
||||||
.br
|
.br
|
||||||
.B webpmux [\-h|\-help]
|
.B webpmux [\-h|\-help]
|
||||||
|
.br
|
||||||
|
.B webpmux \-version
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
This manual page documents the
|
This manual page documents the
|
||||||
.B webpmux
|
.B webpmux
|
||||||
|
@ -21,6 +21,10 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define DMUX_MAJ_VERSION 0
|
||||||
|
#define DMUX_MIN_VERSION 1
|
||||||
|
#define DMUX_REV_VERSION 0
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
size_t start_; // start location of the data
|
size_t start_; // start location of the data
|
||||||
size_t end_; // end location
|
size_t end_; // end location
|
||||||
@ -88,6 +92,12 @@ static const ChunkParser kMasterChunks[] = {
|
|||||||
{ { '0', '0', '0', '0' }, NULL, NULL },
|
{ { '0', '0', '0', '0' }, NULL, NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
int WebPGetDemuxVersion(void) {
|
||||||
|
return (DMUX_MAJ_VERSION << 16) | (DMUX_MIN_VERSION << 8) | DMUX_REV_VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// MemBuffer
|
// MemBuffer
|
||||||
|
|
||||||
|
@ -24,6 +24,10 @@ extern "C" {
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Defines and constants.
|
// Defines and constants.
|
||||||
|
|
||||||
|
#define MUX_MAJ_VERSION 0
|
||||||
|
#define MUX_MIN_VERSION 1
|
||||||
|
#define MUX_REV_VERSION 0
|
||||||
|
|
||||||
// Chunk object.
|
// Chunk object.
|
||||||
typedef struct WebPChunk WebPChunk;
|
typedef struct WebPChunk WebPChunk;
|
||||||
struct WebPChunk {
|
struct WebPChunk {
|
||||||
|
@ -36,6 +36,12 @@ const ChunkInfo kChunks[] = {
|
|||||||
{ NIL_TAG, WEBP_CHUNK_NIL, UNDEFINED_CHUNK_SIZE }
|
{ NIL_TAG, WEBP_CHUNK_NIL, UNDEFINED_CHUNK_SIZE }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
int WebPGetMuxVersion(void) {
|
||||||
|
return (MUX_MAJ_VERSION << 16) | (MUX_MIN_VERSION << 8) | MUX_REV_VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Life of a chunk object.
|
// Life of a chunk object.
|
||||||
|
|
||||||
|
@ -62,6 +62,12 @@ typedef enum WebPFormatFeature WebPFormatFeature;
|
|||||||
typedef struct WebPIterator WebPIterator;
|
typedef struct WebPIterator WebPIterator;
|
||||||
typedef struct WebPChunkIterator WebPChunkIterator;
|
typedef struct WebPChunkIterator WebPChunkIterator;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Returns the version number of the demux library, packed in hexadecimal using
|
||||||
|
// 8bits for each of major/minor/revision. E.g: v2.5.7 is 0x020507.
|
||||||
|
WEBP_EXTERN(int) WebPGetDemuxVersion(void);
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Life of a Demux object
|
// Life of a Demux object
|
||||||
|
|
||||||
|
@ -87,6 +87,12 @@ enum WebPChunkId {
|
|||||||
WEBP_CHUNK_NIL
|
WEBP_CHUNK_NIL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Returns the version number of the mux library, packed in hexadecimal using
|
||||||
|
// 8bits or each of major/minor/revision. E.g: v2.5.7 is 0x020507.
|
||||||
|
WEBP_EXTERN(int) WebPGetMuxVersion(void);
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Life of a Mux object
|
// Life of a Mux object
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user