cwebp: add support for stdin input

we map the input file into memory, even in the non-stdin case.
This is less efficient than letting the png/jpeg/... decoding libraries
use fread()'s, but more general.

Change-Id: I4501cb9a1daf69593eb8e3326c115cd8cbdf92fd
This commit is contained in:
Pascal Massimino
2015-12-08 08:22:41 +01:00
parent 6c702b81ac
commit a9947c3244
9 changed files with 154 additions and 93 deletions

View File

@ -22,12 +22,11 @@ extern "C" {
struct Metadata;
struct WebPPicture;
// Reads a JPEG from 'filename', returning the decoded output in 'pic'.
// If 'filename' is equal '-', input is read from stdin.
// Reads a JPEG from 'data', returning the decoded output in 'pic'.
// The output is RGB or YUV depending on pic->use_argb value.
// Returns true on success.
int ReadJPEG(const char* const filename, struct WebPPicture* const pic,
struct Metadata* const metadata);
int ReadJPEG(const uint8_t* const data, size_t data_size,
struct WebPPicture* const pic, struct Metadata* const metadata);
#ifdef __cplusplus
} // extern "C"