From bacb66b97be2ea85b96148463a074440f1efe9c1 Mon Sep 17 00:00:00 2001 From: Mike Welsh Date: Wed, 6 Jan 2021 00:42:10 -0800 Subject: [PATCH] core: Move Letterbox to config module --- core/src/config.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 core/src/config.rs diff --git a/core/src/config.rs b/core/src/config.rs new file mode 100644 index 000000000..10d6a50d9 --- /dev/null +++ b/core/src/config.rs @@ -0,0 +1,30 @@ +#[cfg(feature = "serde")] +use serde::{Deserialize, Serialize}; + +/// Controls whether the content is letterboxed or pillarboxed when the +/// player's aspect ratio does not match the movie's aspect ratio. +/// +/// When letterboxed, black bars will be rendered around the exterior +/// margins of the content. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde", serde(rename = "letterbox"))] +pub enum Letterbox { + /// The content will never be letterboxed. + #[cfg_attr(feature = "serde", serde(rename = "off"))] + Off, + + /// The content will only be letterboxed if the content is running fullscreen. + #[cfg_attr(feature = "serde", serde(rename = "fullscreen"))] + Fullscreen, + + /// The content will always be letterboxed. + #[cfg_attr(feature = "serde", serde(rename = "on"))] + On, +} + +impl Default for Letterbox { + fn default() -> Self { + Letterbox::Fullscreen + } +}