jetstream_events.rs (2619B)
1 use std::borrow::Cow; 2 use std::path::PathBuf; 3 4 use simple_c2pa::ExifData; 5 6 #[derive(Debug, Clone, serde::Deserialize, serde::Serialize)] 7 pub struct FileToImport { 8 pub path: PathBuf, 9 } 10 11 #[derive(Debug, Clone, serde::Deserialize, serde::Serialize)] 12 pub struct ExifCleanupRequest { 13 pub path: PathBuf, 14 } 15 16 // Essentially a transport wrapper for [simple_c2pa::assertions::ExifData] 17 #[derive(Debug, Clone, serde::Deserialize, serde::Serialize)] 18 pub struct Exif<'a> { 19 pub gps_version_id: Option<Cow<'a, str>>, 20 pub latitude: Option<Cow<'a, str>>, 21 pub longitude: Option<Cow<'a, str>>, 22 pub altitude_ref: Option<u8>, 23 pub altitude: Option<Cow<'a, str>>, 24 pub timestamp: Option<Cow<'a, str>>, 25 pub speed_ref: Option<Cow<'a, str>>, 26 pub speed: Option<Cow<'a, str>>, 27 pub direction_ref: Option<Cow<'a, str>>, 28 pub direction: Option<Cow<'a, str>>, 29 pub destination_bearing_ref: Option<Cow<'a, str>>, 30 pub destination_bearing: Option<Cow<'a, str>>, 31 pub positioning_error: Option<Cow<'a, str>>, 32 pub exposure_time: Option<Cow<'a, str>>, 33 pub f_number: Option<f64>, 34 pub color_space: Option<u8>, 35 pub digital_zoom_ratio: Option<f64>, 36 pub make: Option<Cow<'a, str>>, 37 pub model: Option<Cow<'a, str>>, 38 pub lens_make: Option<Cow<'a, str>>, 39 pub lens_model: Option<Cow<'a, str>>, 40 pub lens_specification: Option<Vec<f64>>, 41 } 42 43 impl<'a> From<Exif<'a>> for ExifData<'a> { 44 fn from(exif: Exif<'a>) -> Self { 45 ExifData { 46 gps_version_id: exif.gps_version_id, 47 latitude: exif.latitude, 48 longitude: exif.longitude, 49 altitude_ref: exif.altitude_ref, 50 altitude: exif.altitude, 51 timestamp: exif.timestamp, 52 speed_ref: exif.speed_ref, 53 speed: exif.speed, 54 direction_ref: exif.direction_ref, 55 direction: exif.direction, 56 destination_bearing_ref: exif.destination_bearing_ref, 57 destination_bearing: exif.destination_bearing, 58 positioning_error: exif.positioning_error, 59 exposure_time: exif.exposure_time, 60 f_number: exif.f_number, 61 color_space: exif.color_space, 62 digital_zoom_ratio: exif.digital_zoom_ratio, 63 make: exif.make, 64 model: exif.model, 65 lens_make: exif.lens_make, 66 lens_model: exif.lens_model, 67 lens_specification: exif.lens_specification, 68 } 69 } 70 } 71 72 #[derive(Debug, Clone, serde::Deserialize, serde::Serialize)] 73 pub struct C2PASignRequest<'a> { 74 pub path: PathBuf, 75 pub exif: Option<Exif<'a>>, 76 }