examples: logging updates

- send errors to stderr
- send help to stdout
- add image size to webpmux -info output and send to stdout
- correct webpmux exit values

Change-Id: Ifd8e8493aab33a82765f7b7903cef345d96da9ae
This commit is contained in:
James Zern 2012-01-24 12:46:46 -08:00
parent 6c14aaddc4
commit 974aaff360
5 changed files with 117 additions and 123 deletions

View File

@ -8,49 +8,53 @@ Description:
============ ============
WebP Mux: library to create the MUX container object for features like WebP Mux: library to create the MUX container object for features like
Color profile, XMP metadata, Animation & Tiling. A reference command line color profile, XMP metadata, animation & tiling. A reference command line
tool 'webpmux' and Mux container specification 'MuxContainerSpec.pdf' are also tool 'webpmux' and Mux container specification 'doc/webp-container-spec.txt'
provided in this package. are also provided in this package.
WebP Mux tool: WebP Mux tool:
============== ==============
The examples/ directory contains tool (webpmux) for manipulating the WebP Mux The examples/ directory contains a tool (webpmux) for manipulating the WebP Mux
file. webpmux tool can be used to create a WebP container file and to extract or file. The webpmux tool can be used to create a WebP container file and to
strip relevant data from the container file. extract or strip relevant data from the container file.
A list of options is available using the -help command line flag: A list of options is available using the -help command line flag:
> webpmux -help > webpmux -help
Usage: webpmux -get GET_OPTIONS INPUT -o OUTPUT Usage: webpmux -get GET_OPTIONS INPUT -o OUTPUT
or: webpmux -set SET_OPTIONS INPUT -o OUTPUT webpmux -set SET_OPTIONS INPUT -o OUTPUT
or: webpmux -strip STRIP_OPTIONS INPUT -o OUTPUT webpmux -strip STRIP_OPTIONS INPUT -o OUTPUT
or: webpmux [-tile TILE_OPTIONS]... -o OUTPUT webpmux -tile TILE_OPTIONS [-tile...] -o OUTPUT
or: webpmux [-frame FRAME_OPTIONS]... -loop LOOP_COUNT -o OUTPUT webpmux -frame FRAME_OPTIONS [-frame...] -loop LOOP_COUNT -o OUTPUT
or: webpmux -info INPUT webpmux -info INPUT
or: webpmux -help OR -h webpmux [-h|-help]
GET_OPTIONS: GET_OPTIONS:
Extract relevant data.
icc Get ICCP Color profile. icc Get ICCP Color profile.
xmp Get XMP metadata. xmp Get XMP metadata.
tile n Get nth tile. tile n Get nth tile.
frame n Get nth frame. frame n Get nth frame.
SET_OPTIONS: SET_OPTIONS:
Set color profile/metadata.
icc Set ICC Color profile. icc Set ICC Color profile.
xmp Set XMP metadata. xmp Set XMP metadata.
STRIP_OPTIONS: STRIP_OPTIONS:
Strip color profile/metadata.
icc Strip ICCP color profile. icc Strip ICCP color profile.
xmp Strip XMP metadata. xmp Strip XMP metadata.
TILE_OPTIONS(i): TILE_OPTIONS(i):
Create tiled image.
file_i +xi+yi file_i +xi+yi
where: 'file_i' is the i'th tile (webp format), where: 'file_i' is the i'th tile (webp format),
'xi','yi' specify the image offset for this tile. 'xi','yi' specify the image offset for this tile.
FRAME_OPTIONS(i): FRAME_OPTIONS(i):
Create animation.
file_i +xi+yi+di file_i +xi+yi+di
where: 'file_i' is the i'th animation frame (webp format), where: 'file_i' is the i'th animation frame (webp format),
'xi','yi' specify the image offset for this frame. 'xi','yi' specify the image offset for this frame.
@ -58,8 +62,6 @@ FRAME_OPTIONS(i):
INPUT & OUTPUT are in webp format. INPUT & OUTPUT are in webp format.
WebP Mux API: WebP Mux API:
============== ==============
WebP Mux API contains methods for adding data to WebPMux (a MUX container object WebP Mux API contains methods for adding data to WebPMux (a MUX container object
@ -101,7 +103,6 @@ Example#2 (pseudo code): Get image & color profile data from a WebP file.
For detailed MUX-API reference, please refer to the header file (src/webp/mux.h) For detailed MUX-API reference, please refer to the header file (src/webp/mux.h)
Bugs: Bugs:
===== =====

View File

@ -104,7 +104,7 @@ static int ReadYUV(FILE* in_file, WebPPicture* const pic) {
{ \ { \
hr = (fn); \ hr = (fn); \
if (FAILED(hr) && verbose) \ if (FAILED(hr) && verbose) \
printf(#fn " failed %08x\n", hr); \ fprintf(stderr, #fn " failed %08x\n", hr); \
} \ } \
} while (0) } while (0)
@ -118,7 +118,7 @@ static HRESULT OpenInputStream(const char* filename, IStream** ppStream) {
HRESULT hr = S_OK; HRESULT hr = S_OK;
IFS(SHCreateStreamOnFileA(filename, STGM_READ, ppStream)); IFS(SHCreateStreamOnFileA(filename, STGM_READ, ppStream));
if (FAILED(hr)) if (FAILED(hr))
printf("Error opening input file %s (%08x)\n", filename, hr); fprintf(stderr, "Error opening input file %s (%08x)\n", filename, hr);
return hr; return hr;
} }
@ -148,9 +148,10 @@ static HRESULT ReadPictureWithWIC(const char* filename,
CLSCTX_INPROC_SERVER, MAKE_REFGUID(IID_IWICImagingFactory), CLSCTX_INPROC_SERVER, MAKE_REFGUID(IID_IWICImagingFactory),
(LPVOID*)&pFactory)); (LPVOID*)&pFactory));
if (hr == REGDB_E_CLASSNOTREG) { if (hr == REGDB_E_CLASSNOTREG) {
printf("Couldn't access Windows Imaging Component (are you running \n"); fprintf(stderr,
printf("Windows XP SP3 or newer?). Most formats not available.\n"); "Couldn't access Windows Imaging Component (are you running "
printf("Use -s for the available YUV input.\n"); "Windows XP SP3 or newer?). Most formats not available. "
"Use -s for the available YUV input.\n");
} }
// Prepare for image decoding. // Prepare for image decoding.
IFS(OpenInputStream(filename, &pStream)); IFS(OpenInputStream(filename, &pStream));
@ -158,7 +159,7 @@ static HRESULT ReadPictureWithWIC(const char* filename,
WICDecodeMetadataCacheOnDemand, &pDecoder)); WICDecodeMetadataCacheOnDemand, &pDecoder));
IFS(IWICBitmapDecoder_GetFrameCount(pDecoder, &frameCount)); IFS(IWICBitmapDecoder_GetFrameCount(pDecoder, &frameCount));
if (SUCCEEDED(hr) && frameCount == 0) { if (SUCCEEDED(hr) && frameCount == 0) {
printf("No frame found in input file.\n"); fprintf(stderr, "No frame found in input file.\n");
hr = E_FAIL; hr = E_FAIL;
} }
IFS(IWICBitmapDecoder_GetFrame(pDecoder, 0, &pFrame)); IFS(IWICBitmapDecoder_GetFrame(pDecoder, 0, &pFrame));
@ -333,8 +334,8 @@ static int ReadJPEG(FILE* in_file, WebPPicture* const pic) {
static int ReadJPEG(FILE* in_file, WebPPicture* const pic) { static int ReadJPEG(FILE* in_file, WebPPicture* const pic) {
(void)in_file; (void)in_file;
(void)pic; (void)pic;
printf("JPEG support not compiled. Please install the libjpeg development " fprintf(stderr, "JPEG support not compiled. Please install the libjpeg "
"package before building.\n"); "development package before building.\n");
return 0; return 0;
} }
#endif #endif
@ -433,8 +434,8 @@ static int ReadPNG(FILE* in_file, WebPPicture* const pic, int keep_alpha) {
(void)in_file; (void)in_file;
(void)pic; (void)pic;
(void)keep_alpha; (void)keep_alpha;
printf("PNG support not compiled. Please install the libpng development " fprintf(stderr, "PNG support not compiled. Please install the libpng "
"package before building.\n"); "development package before building.\n");
return 0; return 0;
} }
#endif #endif

View File

@ -71,7 +71,7 @@ typedef enum {
{ \ { \
hr = (fn); \ hr = (fn); \
if (FAILED(hr) && verbose) \ if (FAILED(hr) && verbose) \
printf(#fn " failed %08x\n", hr); \ fprintf(stderr, #fn " failed %08x\n", hr); \
} \ } \
} while (0) } while (0)
@ -86,7 +86,7 @@ static HRESULT CreateOutputStream(const char* out_file_name,
HRESULT hr = S_OK; HRESULT hr = S_OK;
IFS(SHCreateStreamOnFileA(out_file_name, STGM_WRITE | STGM_CREATE, ppStream)); IFS(SHCreateStreamOnFileA(out_file_name, STGM_WRITE | STGM_CREATE, ppStream));
if (FAILED(hr)) if (FAILED(hr))
printf("Error opening output file %s (%08x)\n", out_file_name, hr); fprintf(stderr, "Error opening output file %s (%08x)\n", out_file_name, hr);
return hr; return hr;
} }
@ -106,9 +106,10 @@ static HRESULT WriteUsingWIC(const char* out_file_name, REFGUID container_guid,
CLSCTX_INPROC_SERVER, MAKE_REFGUID(IID_IWICImagingFactory), CLSCTX_INPROC_SERVER, MAKE_REFGUID(IID_IWICImagingFactory),
(LPVOID*)&pFactory)); (LPVOID*)&pFactory));
if (hr == REGDB_E_CLASSNOTREG) { if (hr == REGDB_E_CLASSNOTREG) {
printf("Couldn't access Windows Imaging Component (are you running \n"); fprintf(stderr,
printf("Windows XP SP3 or newer?). PNG support not available.\n"); "Couldn't access Windows Imaging Component (are you running "
printf("Use -ppm or -pgm for available PPM and PGM formats.\n"); "Windows XP SP3 or newer?). PNG support not available. "
"Use -ppm or -pgm for available PPM and PGM formats.\n");
} }
IFS(CreateOutputStream(out_file_name, &pStream)); IFS(CreateOutputStream(out_file_name, &pStream));
IFS(IWICImagingFactory_CreateEncoder(pFactory, container_guid, NULL, IFS(IWICImagingFactory_CreateEncoder(pFactory, container_guid, NULL,
@ -189,15 +190,12 @@ static int WritePNG(FILE* out_file, const WebPDecBuffer* const buffer) {
return 1; return 1;
} }
#else // !HAVE_WINCODEC_H && !WEBP_HAVE_PNG #else // !HAVE_WINCODEC_H && !WEBP_HAVE_PNG
typedef uint32_t png_uint_32;
static int WritePNG(FILE* out_file, const WebPDecBuffer* const buffer) { static int WritePNG(FILE* out_file, const WebPDecBuffer* const buffer) {
(void)out_file; (void)out_file;
(void)buffer; (void)buffer;
printf("PNG support not compiled. Please install the libpng development " fprintf(stderr, "PNG support not compiled. Please install the libpng "
"package before building.\n"); "development package before building.\n");
printf("You can run with -ppm flag to decode in PPM format.\n"); fprintf(stderr, "You can run with -ppm flag to decode in PPM format.\n");
return 0; return 0;
} }
#endif #endif
@ -373,7 +371,7 @@ int main(int argc, const char *argv[]) {
} else if (!strcmp(argv[c], "-version")) { } else if (!strcmp(argv[c], "-version")) {
const int version = WebPGetDecoderVersion(); const int version = WebPGetDecoderVersion();
printf("%d.%d.%d\n", printf("%d.%d.%d\n",
(version >> 16) & 0xff, (version >> 8) & 0xff, version & 0xff); (version >> 16) & 0xff, (version >> 8) & 0xff, version & 0xff);
return 0; return 0;
} else if (!strcmp(argv[c], "-pgm")) { } else if (!strcmp(argv[c], "-pgm")) {
format = PGM; format = PGM;
@ -396,7 +394,7 @@ int main(int argc, const char *argv[]) {
VP8GetCPUInfo = NULL; VP8GetCPUInfo = NULL;
#endif #endif
} else if (argv[c][0] == '-') { } else if (argv[c][0] == '-') {
printf("Unknown option '%s'\n", argv[c]); fprintf(stderr, "Unknown option '%s'\n", argv[c]);
Help(); Help();
return -1; return -1;
} else { } else {
@ -405,7 +403,7 @@ int main(int argc, const char *argv[]) {
} }
if (in_file == NULL) { if (in_file == NULL) {
printf("missing input file!!\n"); fprintf(stderr, "missing input file!!\n");
Help(); Help();
return -1; return -1;
} }

View File

@ -164,39 +164,40 @@ static WebPMuxError DisplayInfo(const WebPMux* mux) {
} }
// Print the features present. // Print the features present.
fprintf(stderr, "Features present:"); printf("Features present:");
if (flag & ANIMATION_FLAG) fprintf(stderr, " animation"); if (flag & ANIMATION_FLAG) printf(" animation");
if (flag & TILE_FLAG) fprintf(stderr, " tiling"); if (flag & TILE_FLAG) printf(" tiling");
if (flag & ICCP_FLAG) fprintf(stderr, " icc profile"); if (flag & ICCP_FLAG) printf(" icc profile");
if (flag & META_FLAG) fprintf(stderr, " metadata"); if (flag & META_FLAG) printf(" metadata");
if (flag & ALPHA_FLAG) fprintf(stderr, " transparency"); if (flag & ALPHA_FLAG) printf(" transparency");
fprintf(stderr, "\n"); printf("\n");
if (flag & ANIMATION_FLAG) { if (flag & ANIMATION_FLAG) {
int nFrames; int nFrames;
uint32_t loop_count; uint32_t loop_count;
err = WebPMuxGetLoopCount(mux, &loop_count); err = WebPMuxGetLoopCount(mux, &loop_count);
RETURN_IF_ERROR("Failed to retrieve loop count\n"); RETURN_IF_ERROR("Failed to retrieve loop count\n");
fprintf(stderr, "Loop Count : %d\n", loop_count); printf("Loop Count : %d\n", loop_count);
err = WebPMuxNumNamedElements(mux, "frame", &nFrames); err = WebPMuxNumNamedElements(mux, "frame", &nFrames);
RETURN_IF_ERROR("Failed to retrieve number of frames\n"); RETURN_IF_ERROR("Failed to retrieve number of frames\n");
fprintf(stderr, "Number of frames: %d\n", nFrames); printf("Number of frames: %d\n", nFrames);
if (nFrames > 0) { if (nFrames > 0) {
int i; int i;
uint32_t x_offset, y_offset, duration; printf("No.: x_offset y_offset duration image_size");
fprintf(stderr, "No.: x_offset y_offset duration"); if (flag & ALPHA_FLAG) printf(" alpha_size");
if (flag & ALPHA_FLAG) fprintf(stderr, " alpha_size"); printf("\n");
fprintf(stderr, "\n");
for (i = 1; i <= nFrames; i++) { for (i = 1; i <= nFrames; i++) {
uint32_t x_offset, y_offset, duration;
WebPData image, alpha; WebPData image, alpha;
err = WebPMuxGetFrame(mux, i, &image, &alpha, err = WebPMuxGetFrame(mux, i, &image, &alpha,
&x_offset, &y_offset, &duration); &x_offset, &y_offset, &duration);
RETURN_IF_ERROR2("Failed to retrieve frame#%d\n", i); RETURN_IF_ERROR2("Failed to retrieve frame#%d\n", i);
fprintf(stderr, "%3d: %8d %8d %8d", i, x_offset, y_offset, duration); printf("%3d: %8d %8d %8d %10u",
if (flag & ALPHA_FLAG) fprintf(stderr, " %10u", alpha.size_); i, x_offset, y_offset, duration, image.size_);
fprintf(stderr, "\n"); if (flag & ALPHA_FLAG) printf(" %10u", alpha.size_);
printf("\n");
} }
} }
} }
@ -206,20 +207,21 @@ static WebPMuxError DisplayInfo(const WebPMux* mux) {
err = WebPMuxNumNamedElements(mux, "tile", &nTiles); err = WebPMuxNumNamedElements(mux, "tile", &nTiles);
RETURN_IF_ERROR("Failed to retrieve number of tiles\n"); RETURN_IF_ERROR("Failed to retrieve number of tiles\n");
fprintf(stderr, "Number of tiles: %d\n", nTiles); printf("Number of tiles: %d\n", nTiles);
if (nTiles > 0) { if (nTiles > 0) {
int i; int i;
uint32_t x_offset, y_offset; uint32_t x_offset, y_offset;
fprintf(stderr, "No.: x_offset y_offset"); printf("No.: x_offset y_offset image_size");
if (flag & ALPHA_FLAG) fprintf(stderr, " alpha_size"); if (flag & ALPHA_FLAG) printf(" alpha_size");
fprintf(stderr, "\n"); printf("\n");
for (i = 1; i <= nTiles; i++) { for (i = 1; i <= nTiles; i++) {
WebPData image, alpha; WebPData image, alpha;
err = WebPMuxGetTile(mux, i, &image, &alpha, &x_offset, &y_offset); err = WebPMuxGetTile(mux, i, &image, &alpha, &x_offset, &y_offset);
RETURN_IF_ERROR2("Failed to retrieve tile#%d\n", i); RETURN_IF_ERROR2("Failed to retrieve tile#%d\n", i);
fprintf(stderr, "%3d: %8d %8d", i, x_offset, y_offset); printf("%3d: %8d %8d %10u",
if (flag & ALPHA_FLAG) fprintf(stderr, " %10u", alpha.size_); i, x_offset, y_offset, image.size_);
fprintf(stderr, "\n"); if (flag & ALPHA_FLAG) printf(" %10u", alpha.size_);
printf("\n");
} }
} }
} }
@ -228,79 +230,72 @@ static WebPMuxError DisplayInfo(const WebPMux* mux) {
WebPData icc_profile; WebPData icc_profile;
err = WebPMuxGetColorProfile(mux, &icc_profile); err = WebPMuxGetColorProfile(mux, &icc_profile);
RETURN_IF_ERROR("Failed to retrieve the color profile\n"); RETURN_IF_ERROR("Failed to retrieve the color profile\n");
fprintf(stderr, "Size of the color profile data: %u\n", icc_profile.size_); printf("Size of the color profile data: %u\n", icc_profile.size_);
} }
if (flag & META_FLAG) { if (flag & META_FLAG) {
WebPData metadata; WebPData metadata;
err = WebPMuxGetMetadata(mux, &metadata); err = WebPMuxGetMetadata(mux, &metadata);
RETURN_IF_ERROR("Failed to retrieve the XMP metadata\n"); RETURN_IF_ERROR("Failed to retrieve the XMP metadata\n");
fprintf(stderr, "Size of the XMP metadata: %u\n", metadata.size_); printf("Size of the XMP metadata: %u\n", metadata.size_);
} }
if ((flag & ALPHA_FLAG) && !(flag & (ANIMATION_FLAG | TILE_FLAG))) { if ((flag & ALPHA_FLAG) && !(flag & (ANIMATION_FLAG | TILE_FLAG))) {
WebPData image, alpha; WebPData image, alpha;
err = WebPMuxGetImage(mux, &image, &alpha); err = WebPMuxGetImage(mux, &image, &alpha);
RETURN_IF_ERROR("Failed to retrieve the image\n"); RETURN_IF_ERROR("Failed to retrieve the image\n");
fprintf(stderr, "Size of the alpha data: %u\n", alpha.size_); printf("Size of the alpha data: %u\n", alpha.size_);
} }
return WEBP_MUX_OK; return WEBP_MUX_OK;
} }
static void PrintHelp(void) { static void PrintHelp(void) {
fprintf(stderr, "Usage: webpmux -get GET_OPTIONS INPUT -o OUTPUT " printf("Usage: webpmux -get GET_OPTIONS INPUT -o OUTPUT\n");
" Extract relevant data.\n"); printf(" webpmux -set SET_OPTIONS INPUT -o OUTPUT\n");
fprintf(stderr, " or: webpmux -set SET_OPTIONS INPUT -o OUTPUT " printf(" webpmux -strip STRIP_OPTIONS INPUT -o OUTPUT\n");
" Set color profile/metadata.\n"); printf(" webpmux -tile TILE_OPTIONS [-tile...] -o OUTPUT\n");
fprintf(stderr, " or: webpmux -strip STRIP_OPTIONS INPUT -o OUTPUT " printf(" webpmux -frame FRAME_OPTIONS [-frame...]");
" Strip color profile/metadata.\n"); printf(" -loop LOOP_COUNT -o OUTPUT\n");
fprintf(stderr, " or: webpmux [-tile TILE_OPTIONS]... -o OUTPUT " printf(" webpmux -info INPUT\n");
" Create tiled image.\n"); printf(" webpmux [-h|-help]\n");
fprintf(stderr, " or: webpmux [-frame FRAME_OPTIONS]... -loop LOOP_COUNT"
" -o OUTPUT Create animation.\n");
fprintf(stderr, " or: webpmux -info INPUT "
" Print info about given webp file.\n");
fprintf(stderr, " or: webpmux -help OR -h "
" Print this help.\n");
fprintf(stderr, "\n"); printf("\n");
fprintf(stderr, "GET_OPTIONS:\n"); printf("GET_OPTIONS:\n");
fprintf(stderr, " icc Get ICCP Color profile.\n"); printf(" Extract relevant data.\n");
fprintf(stderr, " xmp Get XMP metadata.\n"); printf(" icc Get ICCP Color profile.\n");
fprintf(stderr, " tile n Get nth tile.\n"); printf(" xmp Get XMP metadata.\n");
fprintf(stderr, " frame n Get nth frame.\n"); printf(" tile n Get nth tile.\n");
printf(" frame n Get nth frame.\n");
fprintf(stderr, "\n"); printf("\n");
fprintf(stderr, "SET_OPTIONS:\n"); printf("SET_OPTIONS:\n");
fprintf(stderr, " icc Set ICC Color profile.\n"); printf(" Set color profile/metadata.\n");
fprintf(stderr, " xmp Set XMP metadata.\n"); printf(" icc Set ICC Color profile.\n");
printf(" xmp Set XMP metadata.\n");
fprintf(stderr, "\n"); printf("\n");
fprintf(stderr, "STRIP_OPTIONS:\n"); printf("STRIP_OPTIONS:\n");
fprintf(stderr, " icc Strip ICCP color profile.\n"); printf(" Strip color profile/metadata.\n");
fprintf(stderr, " xmp Strip XMP metadata.\n"); printf(" icc Strip ICCP color profile.\n");
printf(" xmp Strip XMP metadata.\n");
fprintf(stderr, "\n"); printf("\n");
fprintf(stderr, "TILE_OPTIONS(i):\n"); printf("TILE_OPTIONS(i):\n");
fprintf(stderr, " file_i +xi+yi\n"); printf(" Create tiled image.\n");
fprintf(stderr, " where: 'file_i' is the i'th tile (webp format),\n"); printf(" file_i +xi+yi\n");
fprintf(stderr, " 'xi','yi' specify the image offset for this " printf(" where: 'file_i' is the i'th tile (webp format),\n");
"tile.\n"); printf(" 'xi','yi' specify the image offset for this tile.\n");
fprintf(stderr, "\n"); printf("\n");
fprintf(stderr, "FRAME_OPTIONS(i):\n"); printf("FRAME_OPTIONS(i):\n");
fprintf(stderr, " file_i +xi+yi+di\n"); printf(" Create animation.\n");
fprintf(stderr, " where: 'file_i' is the i'th animation frame (webp " printf(" file_i +xi+yi+di\n");
"format),\n"); printf(" where: 'file_i' is the i'th animation frame (webp format),\n");
fprintf(stderr, " 'xi','yi' specify the image offset for this " printf(" 'xi','yi' specify the image offset for this frame.\n");
"frame.\n"); printf(" 'di' is the pause duration before next frame.\n");
fprintf(stderr, " 'di' is the pause duration before next frame."
"\n");
fprintf(stderr, "\n"); printf("\nINPUT & OUTPUT are in webp format.\n");
fprintf(stderr, "INPUT & OUTPUT are in webp format.");
fprintf(stderr, "\n");
} }
static int ReadData(const char* filename, void** data_ptr, uint32_t* size_ptr) { static int ReadData(const char* filename, void** data_ptr, uint32_t* size_ptr) {
@ -654,7 +649,7 @@ static int ParseCommandLine(int argc, const char* argv[],
} else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "-help")) { } else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "-help")) {
PrintHelp(); PrintHelp();
DeleteConfig(config); DeleteConfig(config);
exit(1); exit(0);
} else { } else {
ERROR_GOTO2("ERROR: Unknown option: '%s'.\n", argv[i], ErrParse); ERROR_GOTO2("ERROR: Unknown option: '%s'.\n", argv[i], ErrParse);
} }
@ -1028,16 +1023,15 @@ static int Process(const WebPMuxConfig* config) {
// Main. // Main.
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
int ok = 1;
WebPMuxConfig* config; WebPMuxConfig* config;
ok = InitializeConfig(argc-1, argv+1, &config); int ok = InitializeConfig(argc - 1, argv + 1, &config);
if (ok) { if (ok) {
Process(config); ok = Process(config);
} else { } else {
PrintHelp(); PrintHelp();
} }
DeleteConfig(config); DeleteConfig(config);
return ok; return !ok;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
.\" Hey, EMACS: -*- nroff -*- .\" Hey, EMACS: -*- nroff -*-
.TH WEBPMUX 1 "November 3, 2011" .TH WEBPMUX 1 "January 24, 2012"
.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
@ -21,14 +21,14 @@ webpmux \- command line tool to create WebP Mux/container file.
.B \-o .B \-o
.I OUTPUT .I OUTPUT
.br .br
.B webpmux [ \-tile .B webpmux \-tile
.I TILE_OPTIONS .I TILE_OPTIONS
.B ]... \-o .B [\-tile...] \-o
.I OUTPUT .I OUTPUT
.br .br
.B webpmux [ \-frame .B webpmux \-frame
.I FRAME_OPTIONS .I FRAME_OPTIONS
.B ]... \-loop .B [\-frame...] \-loop
.I LOOP_COUNT .I LOOP_COUNT
.B \-o .B \-o
.I OUTPUT .I OUTPUT
@ -36,7 +36,7 @@ webpmux \- command line tool to create WebP Mux/container file.
.B webpmux \-info .B webpmux \-info
.I INPUT .I INPUT
.br .br
.B webpmux \-help .B webpmux [\-h|\-help]
.SH DESCRIPTION .SH DESCRIPTION
This manual page documents the This manual page documents the
.B webpmux .B webpmux