diff --git a/examples/heif_enc.cc b/examples/heif_enc.cc index 8627dce062..791fa48ab7 100644 --- a/examples/heif_enc.cc +++ b/examples/heif_enc.cc @@ -349,6 +349,29 @@ static void show_list_of_encoders(const heif_encoder_descriptor* const* encoder_ } +static const char* get_compression_format_name(heif_compression_format format) +{ + switch (format) { + case heif_compression_AV1: + return "AV1"; + break; + case heif_compression_HEVC: + return "HEVC"; + break; + case heif_compression_JPEG: + return "JPEG"; + break; + case heif_compression_JPEG2000: + return "JPEG-2000"; + break; + case heif_compression_uncompressed: + return "Uncompressed"; + break; + default: + assert(false); + } +} + static void show_list_of_all_encoders() { for (auto compression_format : {heif_compression_HEVC, heif_compression_AV1, heif_compression_JPEG, heif_compression_JPEG2000 @@ -687,7 +710,7 @@ int main(int argc, char** argv) active_encoder_descriptor = encoder_descriptors[idx]; } else { - std::cerr << "No " << (compressionFormat == heif_compression_AV1 ? "AV1" : "HEVC") << " encoder available.\n"; + std::cerr << "No " << get_compression_format_name(compressionFormat) << " encoder available.\n"; return 5; }