decoder: Use glycin 1.0

This commit is contained in:
Sophie Herold 2023-12-25 21:34:18 +01:00
parent 0e490f38ad
commit f14cb540eb
9 changed files with 124 additions and 99 deletions

View file

@ -15,14 +15,16 @@
//
// SPDX-License-Identifier: GPL-3.0-or-later
use crate::util::gettext::*;
#[derive(Clone, Debug)]
pub struct ImageFormat {
mime_type: glycin::MimeType,
name: String,
name: Option<String>,
}
impl ImageFormat {
pub fn new(mime_type: glycin::MimeType, name: String) -> Self {
pub fn new(mime_type: glycin::MimeType, name: Option<String>) -> Self {
Self { mime_type, name }
}
@ -40,6 +42,10 @@ impl ImageFormat {
impl std::fmt::Display for ImageFormat {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
write!(f, "{}", self.name)
write!(
f,
"{}",
self.name.clone().unwrap_or_else(|| gettext("Unknown"))
)
}
}

View file

@ -74,7 +74,7 @@ impl GPSCoord {
}
fn position_exif(position: &[exif::Rational]) -> Option<(f64, Option<f64>, Option<f64>)> {
let (deg, mut min, mut sec) = (position.get(0)?, position.get(1), position.get(2));
let (deg, mut min, mut sec) = (position.first()?, position.get(1), position.get(2));
if let (Some(min_), Some(sec_)) = (min, sec) {
if min_.denom > 1 && sec_.num == 0 {