{-# 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.MediaConvert.Types.DolbyVision
-- 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.MediaConvert.Types.DolbyVision where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConvert.Types.DolbyVisionLevel6Metadata
import Amazonka.MediaConvert.Types.DolbyVisionLevel6Mode
import Amazonka.MediaConvert.Types.DolbyVisionProfile
import qualified Amazonka.Prelude as Prelude

-- | With AWS Elemental MediaConvert, you can create profile 5 Dolby Vision
-- outputs from MXF and IMF sources that contain mastering information as
-- frame-interleaved Dolby Vision metadata.
--
-- /See:/ 'newDolbyVision' smart constructor.
data DolbyVision = DolbyVision'
  { -- | In the current MediaConvert implementation, the Dolby Vision profile is
    -- always 5 (PROFILE_5). Therefore, all of your inputs must contain Dolby
    -- Vision frame interleaved data.
    DolbyVision -> Maybe DolbyVisionProfile
profile :: Prelude.Maybe DolbyVisionProfile,
    -- | Use Dolby Vision Mode to choose how the service will handle Dolby Vision
    -- MaxCLL and MaxFALL properies.
    DolbyVision -> Maybe DolbyVisionLevel6Mode
l6Mode :: Prelude.Maybe DolbyVisionLevel6Mode,
    -- | Use these settings when you set DolbyVisionLevel6Mode to SPECIFY to
    -- override the MaxCLL and MaxFALL values in your input with new values.
    DolbyVision -> Maybe DolbyVisionLevel6Metadata
l6Metadata :: Prelude.Maybe DolbyVisionLevel6Metadata
  }
  deriving (DolbyVision -> DolbyVision -> Bool
(DolbyVision -> DolbyVision -> Bool)
-> (DolbyVision -> DolbyVision -> Bool) -> Eq DolbyVision
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DolbyVision -> DolbyVision -> Bool
$c/= :: DolbyVision -> DolbyVision -> Bool
== :: DolbyVision -> DolbyVision -> Bool
$c== :: DolbyVision -> DolbyVision -> Bool
Prelude.Eq, ReadPrec [DolbyVision]
ReadPrec DolbyVision
Int -> ReadS DolbyVision
ReadS [DolbyVision]
(Int -> ReadS DolbyVision)
-> ReadS [DolbyVision]
-> ReadPrec DolbyVision
-> ReadPrec [DolbyVision]
-> Read DolbyVision
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DolbyVision]
$creadListPrec :: ReadPrec [DolbyVision]
readPrec :: ReadPrec DolbyVision
$creadPrec :: ReadPrec DolbyVision
readList :: ReadS [DolbyVision]
$creadList :: ReadS [DolbyVision]
readsPrec :: Int -> ReadS DolbyVision
$creadsPrec :: Int -> ReadS DolbyVision
Prelude.Read, Int -> DolbyVision -> ShowS
[DolbyVision] -> ShowS
DolbyVision -> String
(Int -> DolbyVision -> ShowS)
-> (DolbyVision -> String)
-> ([DolbyVision] -> ShowS)
-> Show DolbyVision
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DolbyVision] -> ShowS
$cshowList :: [DolbyVision] -> ShowS
show :: DolbyVision -> String
$cshow :: DolbyVision -> String
showsPrec :: Int -> DolbyVision -> ShowS
$cshowsPrec :: Int -> DolbyVision -> ShowS
Prelude.Show, (forall x. DolbyVision -> Rep DolbyVision x)
-> (forall x. Rep DolbyVision x -> DolbyVision)
-> Generic DolbyVision
forall x. Rep DolbyVision x -> DolbyVision
forall x. DolbyVision -> Rep DolbyVision x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DolbyVision x -> DolbyVision
$cfrom :: forall x. DolbyVision -> Rep DolbyVision x
Prelude.Generic)

-- |
-- Create a value of 'DolbyVision' 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:
--
-- 'profile', 'dolbyVision_profile' - In the current MediaConvert implementation, the Dolby Vision profile is
-- always 5 (PROFILE_5). Therefore, all of your inputs must contain Dolby
-- Vision frame interleaved data.
--
-- 'l6Mode', 'dolbyVision_l6Mode' - Use Dolby Vision Mode to choose how the service will handle Dolby Vision
-- MaxCLL and MaxFALL properies.
--
-- 'l6Metadata', 'dolbyVision_l6Metadata' - Use these settings when you set DolbyVisionLevel6Mode to SPECIFY to
-- override the MaxCLL and MaxFALL values in your input with new values.
newDolbyVision ::
  DolbyVision
newDolbyVision :: DolbyVision
newDolbyVision =
  DolbyVision' :: Maybe DolbyVisionProfile
-> Maybe DolbyVisionLevel6Mode
-> Maybe DolbyVisionLevel6Metadata
-> DolbyVision
DolbyVision'
    { $sel:profile:DolbyVision' :: Maybe DolbyVisionProfile
profile = Maybe DolbyVisionProfile
forall a. Maybe a
Prelude.Nothing,
      $sel:l6Mode:DolbyVision' :: Maybe DolbyVisionLevel6Mode
l6Mode = Maybe DolbyVisionLevel6Mode
forall a. Maybe a
Prelude.Nothing,
      $sel:l6Metadata:DolbyVision' :: Maybe DolbyVisionLevel6Metadata
l6Metadata = Maybe DolbyVisionLevel6Metadata
forall a. Maybe a
Prelude.Nothing
    }

-- | In the current MediaConvert implementation, the Dolby Vision profile is
-- always 5 (PROFILE_5). Therefore, all of your inputs must contain Dolby
-- Vision frame interleaved data.
dolbyVision_profile :: Lens.Lens' DolbyVision (Prelude.Maybe DolbyVisionProfile)
dolbyVision_profile :: (Maybe DolbyVisionProfile -> f (Maybe DolbyVisionProfile))
-> DolbyVision -> f DolbyVision
dolbyVision_profile = (DolbyVision -> Maybe DolbyVisionProfile)
-> (DolbyVision -> Maybe DolbyVisionProfile -> DolbyVision)
-> Lens
     DolbyVision
     DolbyVision
     (Maybe DolbyVisionProfile)
     (Maybe DolbyVisionProfile)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DolbyVision' {Maybe DolbyVisionProfile
profile :: Maybe DolbyVisionProfile
$sel:profile:DolbyVision' :: DolbyVision -> Maybe DolbyVisionProfile
profile} -> Maybe DolbyVisionProfile
profile) (\s :: DolbyVision
s@DolbyVision' {} Maybe DolbyVisionProfile
a -> DolbyVision
s {$sel:profile:DolbyVision' :: Maybe DolbyVisionProfile
profile = Maybe DolbyVisionProfile
a} :: DolbyVision)

-- | Use Dolby Vision Mode to choose how the service will handle Dolby Vision
-- MaxCLL and MaxFALL properies.
dolbyVision_l6Mode :: Lens.Lens' DolbyVision (Prelude.Maybe DolbyVisionLevel6Mode)
dolbyVision_l6Mode :: (Maybe DolbyVisionLevel6Mode -> f (Maybe DolbyVisionLevel6Mode))
-> DolbyVision -> f DolbyVision
dolbyVision_l6Mode = (DolbyVision -> Maybe DolbyVisionLevel6Mode)
-> (DolbyVision -> Maybe DolbyVisionLevel6Mode -> DolbyVision)
-> Lens
     DolbyVision
     DolbyVision
     (Maybe DolbyVisionLevel6Mode)
     (Maybe DolbyVisionLevel6Mode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DolbyVision' {Maybe DolbyVisionLevel6Mode
l6Mode :: Maybe DolbyVisionLevel6Mode
$sel:l6Mode:DolbyVision' :: DolbyVision -> Maybe DolbyVisionLevel6Mode
l6Mode} -> Maybe DolbyVisionLevel6Mode
l6Mode) (\s :: DolbyVision
s@DolbyVision' {} Maybe DolbyVisionLevel6Mode
a -> DolbyVision
s {$sel:l6Mode:DolbyVision' :: Maybe DolbyVisionLevel6Mode
l6Mode = Maybe DolbyVisionLevel6Mode
a} :: DolbyVision)

-- | Use these settings when you set DolbyVisionLevel6Mode to SPECIFY to
-- override the MaxCLL and MaxFALL values in your input with new values.
dolbyVision_l6Metadata :: Lens.Lens' DolbyVision (Prelude.Maybe DolbyVisionLevel6Metadata)
dolbyVision_l6Metadata :: (Maybe DolbyVisionLevel6Metadata
 -> f (Maybe DolbyVisionLevel6Metadata))
-> DolbyVision -> f DolbyVision
dolbyVision_l6Metadata = (DolbyVision -> Maybe DolbyVisionLevel6Metadata)
-> (DolbyVision -> Maybe DolbyVisionLevel6Metadata -> DolbyVision)
-> Lens
     DolbyVision
     DolbyVision
     (Maybe DolbyVisionLevel6Metadata)
     (Maybe DolbyVisionLevel6Metadata)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DolbyVision' {Maybe DolbyVisionLevel6Metadata
l6Metadata :: Maybe DolbyVisionLevel6Metadata
$sel:l6Metadata:DolbyVision' :: DolbyVision -> Maybe DolbyVisionLevel6Metadata
l6Metadata} -> Maybe DolbyVisionLevel6Metadata
l6Metadata) (\s :: DolbyVision
s@DolbyVision' {} Maybe DolbyVisionLevel6Metadata
a -> DolbyVision
s {$sel:l6Metadata:DolbyVision' :: Maybe DolbyVisionLevel6Metadata
l6Metadata = Maybe DolbyVisionLevel6Metadata
a} :: DolbyVision)

instance Core.FromJSON DolbyVision where
  parseJSON :: Value -> Parser DolbyVision
parseJSON =
    String
-> (Object -> Parser DolbyVision) -> Value -> Parser DolbyVision
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DolbyVision"
      ( \Object
x ->
          Maybe DolbyVisionProfile
-> Maybe DolbyVisionLevel6Mode
-> Maybe DolbyVisionLevel6Metadata
-> DolbyVision
DolbyVision'
            (Maybe DolbyVisionProfile
 -> Maybe DolbyVisionLevel6Mode
 -> Maybe DolbyVisionLevel6Metadata
 -> DolbyVision)
-> Parser (Maybe DolbyVisionProfile)
-> Parser
     (Maybe DolbyVisionLevel6Mode
      -> Maybe DolbyVisionLevel6Metadata -> DolbyVision)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe DolbyVisionProfile)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"profile")
            Parser
  (Maybe DolbyVisionLevel6Mode
   -> Maybe DolbyVisionLevel6Metadata -> DolbyVision)
-> Parser (Maybe DolbyVisionLevel6Mode)
-> Parser (Maybe DolbyVisionLevel6Metadata -> DolbyVision)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DolbyVisionLevel6Mode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"l6Mode")
            Parser (Maybe DolbyVisionLevel6Metadata -> DolbyVision)
-> Parser (Maybe DolbyVisionLevel6Metadata) -> Parser DolbyVision
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DolbyVisionLevel6Metadata)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"l6Metadata")
      )

instance Prelude.Hashable DolbyVision

instance Prelude.NFData DolbyVision

instance Core.ToJSON DolbyVision where
  toJSON :: DolbyVision -> Value
toJSON DolbyVision' {Maybe DolbyVisionLevel6Metadata
Maybe DolbyVisionLevel6Mode
Maybe DolbyVisionProfile
l6Metadata :: Maybe DolbyVisionLevel6Metadata
l6Mode :: Maybe DolbyVisionLevel6Mode
profile :: Maybe DolbyVisionProfile
$sel:l6Metadata:DolbyVision' :: DolbyVision -> Maybe DolbyVisionLevel6Metadata
$sel:l6Mode:DolbyVision' :: DolbyVision -> Maybe DolbyVisionLevel6Mode
$sel:profile:DolbyVision' :: DolbyVision -> Maybe DolbyVisionProfile
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"profile" Text -> DolbyVisionProfile -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (DolbyVisionProfile -> Pair)
-> Maybe DolbyVisionProfile -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DolbyVisionProfile
profile,
            (Text
"l6Mode" Text -> DolbyVisionLevel6Mode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (DolbyVisionLevel6Mode -> Pair)
-> Maybe DolbyVisionLevel6Mode -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DolbyVisionLevel6Mode
l6Mode,
            (Text
"l6Metadata" Text -> DolbyVisionLevel6Metadata -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (DolbyVisionLevel6Metadata -> Pair)
-> Maybe DolbyVisionLevel6Metadata -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DolbyVisionLevel6Metadata
l6Metadata
          ]
      )