webpinfo: output format as a human readable string

Change-Id: I3a3d95bae049ee1053c9d92a364cf1b75f277f81
This commit is contained in:
James Zern 2017-03-17 00:23:11 -07:00
parent bb175a935e
commit 2cb58ab2d7

View File

@ -28,6 +28,12 @@
#define snprintf _snprintf #define snprintf _snprintf
#endif #endif
static const char* const kFormats[3] = {
"Unknown",
"Lossy",
"Lossless"
};
typedef enum { typedef enum {
WEBP_INFO_OK = 0, WEBP_INFO_OK = 0,
WEBP_INFO_TRUNCATED_DATA, WEBP_INFO_TRUNCATED_DATA,
@ -402,9 +408,10 @@ static WebPInfoStatus ProcessImageChunk(const ChunkData* const chunk_data,
return WEBP_INFO_BITSTREAM_ERROR; return WEBP_INFO_BITSTREAM_ERROR;
} }
if (!webp_info->quiet_) { if (!webp_info->quiet_) {
printf(" Width %d\n Height %d\n Alpha %d\n Animation %d\n Format %d\n", assert(features.format >= 0 && features.format <= 2);
printf(" Width %d\n Height %d\n Alpha %d\n Animation %d\n Format %s\n",
features.width, features.height, features.has_alpha, features.width, features.height, features.has_alpha,
features.has_animation, features.format); features.has_animation, kFormats[features.format]);
} }
if (webp_info->is_processing_anim_frame_) { if (webp_info->is_processing_anim_frame_) {
++webp_info->anmf_subchunk_counts_[chunk_data->id_ == CHUNK_VP8 ? 0 : 1]; ++webp_info->anmf_subchunk_counts_[chunk_data->id_ == CHUNK_VP8 ? 0 : 1];