make ReadPNG and ReadJPEG take a filename instead of a FILE

-> read is a bit slower (memory allocation and such) than reading directly from disk.

-> we're not yet ready to accept stdin as input (-- -) because we still need to guess
the file type with GetImageType(). And since we can't rewind on stdin, this will need
a bit more work before being able to read from stdin.

Change-Id: I6491fac4b07d28d1854518325ead88669656ddbf
This commit is contained in:
Pascal Massimino
2015-12-06 09:23:17 +01:00
parent d478e58960
commit 4c60f63c64
5 changed files with 98 additions and 23 deletions

View File

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