{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.MediaLive.Types.VideoSelector
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MediaLive.Types.VideoSelector where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaLive.Types.VideoSelectorColorSpace
import Amazonka.MediaLive.Types.VideoSelectorColorSpaceSettings
import Amazonka.MediaLive.Types.VideoSelectorColorSpaceUsage
import Amazonka.MediaLive.Types.VideoSelectorSettings
import qualified Amazonka.Prelude as Prelude

-- | Specifies a particular video stream within an input source. An input may
-- have only a single video selector.
--
-- /See:/ 'newVideoSelector' smart constructor.
data VideoSelector = VideoSelector'
  { -- | The video selector settings.
    VideoSelector -> Maybe VideoSelectorSettings
selectorSettings :: Prelude.Maybe VideoSelectorSettings,
    -- | Applies only if colorSpace is a value other than follow. This field
    -- controls how the value in the colorSpace field will be used. fallback
    -- means that when the input does include color space data, that data will
    -- be used, but when the input has no color space data, the value in
    -- colorSpace will be used. Choose fallback if your input is sometimes
    -- missing color space data, but when it does have color space data, that
    -- data is correct. force means to always use the value in colorSpace.
    -- Choose force if your input usually has no color space data or might have
    -- unreliable color space data.
    VideoSelector -> Maybe VideoSelectorColorSpaceUsage
colorSpaceUsage :: Prelude.Maybe VideoSelectorColorSpaceUsage,
    -- | Color space settings
    VideoSelector -> Maybe VideoSelectorColorSpaceSettings
colorSpaceSettings :: Prelude.Maybe VideoSelectorColorSpaceSettings,
    -- | Specifies the color space of an input. This setting works in tandem with
    -- colorSpaceUsage and a video description\'s colorSpaceSettingsChoice to
    -- determine if any conversion will be performed.
    VideoSelector -> Maybe VideoSelectorColorSpace
colorSpace :: Prelude.Maybe VideoSelectorColorSpace
  }
  deriving (VideoSelector -> VideoSelector -> Bool
(VideoSelector -> VideoSelector -> Bool)
-> (VideoSelector -> VideoSelector -> Bool) -> Eq VideoSelector
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VideoSelector -> VideoSelector -> Bool
$c/= :: VideoSelector -> VideoSelector -> Bool
== :: VideoSelector -> VideoSelector -> Bool
$c== :: VideoSelector -> VideoSelector -> Bool
Prelude.Eq, ReadPrec [VideoSelector]
ReadPrec VideoSelector
Int -> ReadS VideoSelector
ReadS [VideoSelector]
(Int -> ReadS VideoSelector)
-> ReadS [VideoSelector]
-> ReadPrec VideoSelector
-> ReadPrec [VideoSelector]
-> Read VideoSelector
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VideoSelector]
$creadListPrec :: ReadPrec [VideoSelector]
readPrec :: ReadPrec VideoSelector
$creadPrec :: ReadPrec VideoSelector
readList :: ReadS [VideoSelector]
$creadList :: ReadS [VideoSelector]
readsPrec :: Int -> ReadS VideoSelector
$creadsPrec :: Int -> ReadS VideoSelector
Prelude.Read, Int -> VideoSelector -> ShowS
[VideoSelector] -> ShowS
VideoSelector -> String
(Int -> VideoSelector -> ShowS)
-> (VideoSelector -> String)
-> ([VideoSelector] -> ShowS)
-> Show VideoSelector
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VideoSelector] -> ShowS
$cshowList :: [VideoSelector] -> ShowS
show :: VideoSelector -> String
$cshow :: VideoSelector -> String
showsPrec :: Int -> VideoSelector -> ShowS
$cshowsPrec :: Int -> VideoSelector -> ShowS
Prelude.Show, (forall x. VideoSelector -> Rep VideoSelector x)
-> (forall x. Rep VideoSelector x -> VideoSelector)
-> Generic VideoSelector
forall x. Rep VideoSelector x -> VideoSelector
forall x. VideoSelector -> Rep VideoSelector x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VideoSelector x -> VideoSelector
$cfrom :: forall x. VideoSelector -> Rep VideoSelector x
Prelude.Generic)

-- |
-- Create a value of 'VideoSelector' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'selectorSettings', 'videoSelector_selectorSettings' - The video selector settings.
--
-- 'colorSpaceUsage', 'videoSelector_colorSpaceUsage' - Applies only if colorSpace is a value other than follow. This field
-- controls how the value in the colorSpace field will be used. fallback
-- means that when the input does include color space data, that data will
-- be used, but when the input has no color space data, the value in
-- colorSpace will be used. Choose fallback if your input is sometimes
-- missing color space data, but when it does have color space data, that
-- data is correct. force means to always use the value in colorSpace.
-- Choose force if your input usually has no color space data or might have
-- unreliable color space data.
--
-- 'colorSpaceSettings', 'videoSelector_colorSpaceSettings' - Color space settings
--
-- 'colorSpace', 'videoSelector_colorSpace' - Specifies the color space of an input. This setting works in tandem with
-- colorSpaceUsage and a video description\'s colorSpaceSettingsChoice to
-- determine if any conversion will be performed.
newVideoSelector ::
  VideoSelector
newVideoSelector :: VideoSelector
newVideoSelector =
  VideoSelector' :: Maybe VideoSelectorSettings
-> Maybe VideoSelectorColorSpaceUsage
-> Maybe VideoSelectorColorSpaceSettings
-> Maybe VideoSelectorColorSpace
-> VideoSelector
VideoSelector'
    { $sel:selectorSettings:VideoSelector' :: Maybe VideoSelectorSettings
selectorSettings = Maybe VideoSelectorSettings
forall a. Maybe a
Prelude.Nothing,
      $sel:colorSpaceUsage:VideoSelector' :: Maybe VideoSelectorColorSpaceUsage
colorSpaceUsage = Maybe VideoSelectorColorSpaceUsage
forall a. Maybe a
Prelude.Nothing,
      $sel:colorSpaceSettings:VideoSelector' :: Maybe VideoSelectorColorSpaceSettings
colorSpaceSettings = Maybe VideoSelectorColorSpaceSettings
forall a. Maybe a
Prelude.Nothing,
      $sel:colorSpace:VideoSelector' :: Maybe VideoSelectorColorSpace
colorSpace = Maybe VideoSelectorColorSpace
forall a. Maybe a
Prelude.Nothing
    }

-- | The video selector settings.
videoSelector_selectorSettings :: Lens.Lens' VideoSelector (Prelude.Maybe VideoSelectorSettings)
videoSelector_selectorSettings :: (Maybe VideoSelectorSettings -> f (Maybe VideoSelectorSettings))
-> VideoSelector -> f VideoSelector
videoSelector_selectorSettings = (VideoSelector -> Maybe VideoSelectorSettings)
-> (VideoSelector -> Maybe VideoSelectorSettings -> VideoSelector)
-> Lens
     VideoSelector
     VideoSelector
     (Maybe VideoSelectorSettings)
     (Maybe VideoSelectorSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VideoSelector' {Maybe VideoSelectorSettings
selectorSettings :: Maybe VideoSelectorSettings
$sel:selectorSettings:VideoSelector' :: VideoSelector -> Maybe VideoSelectorSettings
selectorSettings} -> Maybe VideoSelectorSettings
selectorSettings) (\s :: VideoSelector
s@VideoSelector' {} Maybe VideoSelectorSettings
a -> VideoSelector
s {$sel:selectorSettings:VideoSelector' :: Maybe VideoSelectorSettings
selectorSettings = Maybe VideoSelectorSettings
a} :: VideoSelector)

-- | Applies only if colorSpace is a value other than follow. This field
-- controls how the value in the colorSpace field will be used. fallback
-- means that when the input does include color space data, that data will
-- be used, but when the input has no color space data, the value in
-- colorSpace will be used. Choose fallback if your input is sometimes
-- missing color space data, but when it does have color space data, that
-- data is correct. force means to always use the value in colorSpace.
-- Choose force if your input usually has no color space data or might have
-- unreliable color space data.
videoSelector_colorSpaceUsage :: Lens.Lens' VideoSelector (Prelude.Maybe VideoSelectorColorSpaceUsage)
videoSelector_colorSpaceUsage :: (Maybe VideoSelectorColorSpaceUsage
 -> f (Maybe VideoSelectorColorSpaceUsage))
-> VideoSelector -> f VideoSelector
videoSelector_colorSpaceUsage = (VideoSelector -> Maybe VideoSelectorColorSpaceUsage)
-> (VideoSelector
    -> Maybe VideoSelectorColorSpaceUsage -> VideoSelector)
-> Lens
     VideoSelector
     VideoSelector
     (Maybe VideoSelectorColorSpaceUsage)
     (Maybe VideoSelectorColorSpaceUsage)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VideoSelector' {Maybe VideoSelectorColorSpaceUsage
colorSpaceUsage :: Maybe VideoSelectorColorSpaceUsage
$sel:colorSpaceUsage:VideoSelector' :: VideoSelector -> Maybe VideoSelectorColorSpaceUsage
colorSpaceUsage} -> Maybe VideoSelectorColorSpaceUsage
colorSpaceUsage) (\s :: VideoSelector
s@VideoSelector' {} Maybe VideoSelectorColorSpaceUsage
a -> VideoSelector
s {$sel:colorSpaceUsage:VideoSelector' :: Maybe VideoSelectorColorSpaceUsage
colorSpaceUsage = Maybe VideoSelectorColorSpaceUsage
a} :: VideoSelector)

-- | Color space settings
videoSelector_colorSpaceSettings :: Lens.Lens' VideoSelector (Prelude.Maybe VideoSelectorColorSpaceSettings)
videoSelector_colorSpaceSettings :: (Maybe VideoSelectorColorSpaceSettings
 -> f (Maybe VideoSelectorColorSpaceSettings))
-> VideoSelector -> f VideoSelector
videoSelector_colorSpaceSettings = (VideoSelector -> Maybe VideoSelectorColorSpaceSettings)
-> (VideoSelector
    -> Maybe VideoSelectorColorSpaceSettings -> VideoSelector)
-> Lens
     VideoSelector
     VideoSelector
     (Maybe VideoSelectorColorSpaceSettings)
     (Maybe VideoSelectorColorSpaceSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VideoSelector' {Maybe VideoSelectorColorSpaceSettings
colorSpaceSettings :: Maybe VideoSelectorColorSpaceSettings
$sel:colorSpaceSettings:VideoSelector' :: VideoSelector -> Maybe VideoSelectorColorSpaceSettings
colorSpaceSettings} -> Maybe VideoSelectorColorSpaceSettings
colorSpaceSettings) (\s :: VideoSelector
s@VideoSelector' {} Maybe VideoSelectorColorSpaceSettings
a -> VideoSelector
s {$sel:colorSpaceSettings:VideoSelector' :: Maybe VideoSelectorColorSpaceSettings
colorSpaceSettings = Maybe VideoSelectorColorSpaceSettings
a} :: VideoSelector)

-- | Specifies the color space of an input. This setting works in tandem with
-- colorSpaceUsage and a video description\'s colorSpaceSettingsChoice to
-- determine if any conversion will be performed.
videoSelector_colorSpace :: Lens.Lens' VideoSelector (Prelude.Maybe VideoSelectorColorSpace)
videoSelector_colorSpace :: (Maybe VideoSelectorColorSpace
 -> f (Maybe VideoSelectorColorSpace))
-> VideoSelector -> f VideoSelector
videoSelector_colorSpace = (VideoSelector -> Maybe VideoSelectorColorSpace)
-> (VideoSelector
    -> Maybe VideoSelectorColorSpace -> VideoSelector)
-> Lens
     VideoSelector
     VideoSelector
     (Maybe VideoSelectorColorSpace)
     (Maybe VideoSelectorColorSpace)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VideoSelector' {Maybe VideoSelectorColorSpace
colorSpace :: Maybe VideoSelectorColorSpace
$sel:colorSpace:VideoSelector' :: VideoSelector -> Maybe VideoSelectorColorSpace
colorSpace} -> Maybe VideoSelectorColorSpace
colorSpace) (\s :: VideoSelector
s@VideoSelector' {} Maybe VideoSelectorColorSpace
a -> VideoSelector
s {$sel:colorSpace:VideoSelector' :: Maybe VideoSelectorColorSpace
colorSpace = Maybe VideoSelectorColorSpace
a} :: VideoSelector)

instance Core.FromJSON VideoSelector where
  parseJSON :: Value -> Parser VideoSelector
parseJSON =
    String
-> (Object -> Parser VideoSelector)
-> Value
-> Parser VideoSelector
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"VideoSelector"
      ( \Object
x ->
          Maybe VideoSelectorSettings
-> Maybe VideoSelectorColorSpaceUsage
-> Maybe VideoSelectorColorSpaceSettings
-> Maybe VideoSelectorColorSpace
-> VideoSelector
VideoSelector'
            (Maybe VideoSelectorSettings
 -> Maybe VideoSelectorColorSpaceUsage
 -> Maybe VideoSelectorColorSpaceSettings
 -> Maybe VideoSelectorColorSpace
 -> VideoSelector)
-> Parser (Maybe VideoSelectorSettings)
-> Parser
     (Maybe VideoSelectorColorSpaceUsage
      -> Maybe VideoSelectorColorSpaceSettings
      -> Maybe VideoSelectorColorSpace
      -> VideoSelector)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe VideoSelectorSettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"selectorSettings")
            Parser
  (Maybe VideoSelectorColorSpaceUsage
   -> Maybe VideoSelectorColorSpaceSettings
   -> Maybe VideoSelectorColorSpace
   -> VideoSelector)
-> Parser (Maybe VideoSelectorColorSpaceUsage)
-> Parser
     (Maybe VideoSelectorColorSpaceSettings
      -> Maybe VideoSelectorColorSpace -> VideoSelector)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe VideoSelectorColorSpaceUsage)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"colorSpaceUsage")
            Parser
  (Maybe VideoSelectorColorSpaceSettings
   -> Maybe VideoSelectorColorSpace -> VideoSelector)
-> Parser (Maybe VideoSelectorColorSpaceSettings)
-> Parser (Maybe VideoSelectorColorSpace -> VideoSelector)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe VideoSelectorColorSpaceSettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"colorSpaceSettings")
            Parser (Maybe VideoSelectorColorSpace -> VideoSelector)
-> Parser (Maybe VideoSelectorColorSpace) -> Parser VideoSelector
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe VideoSelectorColorSpace)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"colorSpace")
      )

instance Prelude.Hashable VideoSelector

instance Prelude.NFData VideoSelector

instance Core.ToJSON VideoSelector where
  toJSON :: VideoSelector -> Value
toJSON VideoSelector' {Maybe VideoSelectorColorSpace
Maybe VideoSelectorColorSpaceSettings
Maybe VideoSelectorColorSpaceUsage
Maybe VideoSelectorSettings
colorSpace :: Maybe VideoSelectorColorSpace
colorSpaceSettings :: Maybe VideoSelectorColorSpaceSettings
colorSpaceUsage :: Maybe VideoSelectorColorSpaceUsage
selectorSettings :: Maybe VideoSelectorSettings
$sel:colorSpace:VideoSelector' :: VideoSelector -> Maybe VideoSelectorColorSpace
$sel:colorSpaceSettings:VideoSelector' :: VideoSelector -> Maybe VideoSelectorColorSpaceSettings
$sel:colorSpaceUsage:VideoSelector' :: VideoSelector -> Maybe VideoSelectorColorSpaceUsage
$sel:selectorSettings:VideoSelector' :: VideoSelector -> Maybe VideoSelectorSettings
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"selectorSettings" Text -> VideoSelectorSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (VideoSelectorSettings -> Pair)
-> Maybe VideoSelectorSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe VideoSelectorSettings
selectorSettings,
            (Text
"colorSpaceUsage" Text -> VideoSelectorColorSpaceUsage -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (VideoSelectorColorSpaceUsage -> Pair)
-> Maybe VideoSelectorColorSpaceUsage -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe VideoSelectorColorSpaceUsage
colorSpaceUsage,
            (Text
"colorSpaceSettings" Text -> VideoSelectorColorSpaceSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (VideoSelectorColorSpaceSettings -> Pair)
-> Maybe VideoSelectorColorSpaceSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe VideoSelectorColorSpaceSettings
colorSpaceSettings,
            (Text
"colorSpace" Text -> VideoSelectorColorSpace -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (VideoSelectorColorSpace -> Pair)
-> Maybe VideoSelectorColorSpace -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe VideoSelectorColorSpace
colorSpace
          ]
      )