decoder: Detect HEIC/HEIF via guessed mime type

This will not cover files with wrong extensions. But
we don't have a magic byte sniffer in place yet.

Issue #115
This commit is contained in:
Sophie Herold 2023-04-06 22:01:36 +02:00 • committed by Christopher Davis
parent c041dcad3d
commit 65e967c235

View file

@ -160,6 +160,11 @@ impl Decoder {
if content_type.split('+').next() == Some("image/svg") {
update_sender.send(DecoderUpdate::Format(ImageFormat::Svg));
return Ok(FormatDecoder::Svg(Svg::new(path, update_sender, tiles)));
} else if ["image/avif", "image/heif", "image/heic"]
.contains(&content_type.as_str())
{
update_sender.send(DecoderUpdate::Format(ImageFormat::Heif));
return Ok(FormatDecoder::Heif(Heif::new(path, update_sender, tiles)));
} else {
bail!(i18n_f("Unknown image format: {}", &[content_type.as_str()]));
}