Skip to content

Commit

Permalink
show correct compression format name (not just AV1/HEVC)
Browse files Browse the repository at this point in the history
  • Loading branch information
farindk committed Oct 31, 2023
1 parent 8ff8227 commit e547b74
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion examples/heif_enc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit e547b74

Please sign in to comment.