{-# 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.MultiplexVideoSettings
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MediaLive.Types.MultiplexVideoSettings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaLive.Types.MultiplexStatmuxVideoSettings
import qualified Amazonka.Prelude as Prelude

-- | The video configuration for each program in a multiplex.
--
-- /See:/ 'newMultiplexVideoSettings' smart constructor.
data MultiplexVideoSettings = MultiplexVideoSettings'
  { -- | The constant bitrate configuration for the video encode. When this field
    -- is defined, StatmuxSettings must be undefined.
    MultiplexVideoSettings -> Maybe Natural
constantBitrate :: Prelude.Maybe Prelude.Natural,
    -- | Statmux rate control settings. When this field is defined,
    -- ConstantBitrate must be undefined.
    MultiplexVideoSettings -> Maybe MultiplexStatmuxVideoSettings
statmuxSettings :: Prelude.Maybe MultiplexStatmuxVideoSettings
  }
  deriving (MultiplexVideoSettings -> MultiplexVideoSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MultiplexVideoSettings -> MultiplexVideoSettings -> Bool
$c/= :: MultiplexVideoSettings -> MultiplexVideoSettings -> Bool
== :: MultiplexVideoSettings -> MultiplexVideoSettings -> Bool
$c== :: MultiplexVideoSettings -> MultiplexVideoSettings -> Bool
Prelude.Eq, ReadPrec [MultiplexVideoSettings]
ReadPrec MultiplexVideoSettings
Int -> ReadS MultiplexVideoSettings
ReadS [MultiplexVideoSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MultiplexVideoSettings]
$creadListPrec :: ReadPrec [MultiplexVideoSettings]
readPrec :: ReadPrec MultiplexVideoSettings
$creadPrec :: ReadPrec MultiplexVideoSettings
readList :: ReadS [MultiplexVideoSettings]
$creadList :: ReadS [MultiplexVideoSettings]
readsPrec :: Int -> ReadS MultiplexVideoSettings
$creadsPrec :: Int -> ReadS MultiplexVideoSettings
Prelude.Read, Int -> MultiplexVideoSettings -> ShowS
[MultiplexVideoSettings] -> ShowS
MultiplexVideoSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MultiplexVideoSettings] -> ShowS
$cshowList :: [MultiplexVideoSettings] -> ShowS
show :: MultiplexVideoSettings -> String
$cshow :: MultiplexVideoSettings -> String
showsPrec :: Int -> MultiplexVideoSettings -> ShowS
$cshowsPrec :: Int -> MultiplexVideoSettings -> ShowS
Prelude.Show, forall x. Rep MultiplexVideoSettings x -> MultiplexVideoSettings
forall x. MultiplexVideoSettings -> Rep MultiplexVideoSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MultiplexVideoSettings x -> MultiplexVideoSettings
$cfrom :: forall x. MultiplexVideoSettings -> Rep MultiplexVideoSettings x
Prelude.Generic)

-- |
-- Create a value of 'MultiplexVideoSettings' 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:
--
-- 'constantBitrate', 'multiplexVideoSettings_constantBitrate' - The constant bitrate configuration for the video encode. When this field
-- is defined, StatmuxSettings must be undefined.
--
-- 'statmuxSettings', 'multiplexVideoSettings_statmuxSettings' - Statmux rate control settings. When this field is defined,
-- ConstantBitrate must be undefined.
newMultiplexVideoSettings ::
  MultiplexVideoSettings
newMultiplexVideoSettings :: MultiplexVideoSettings
newMultiplexVideoSettings =
  MultiplexVideoSettings'
    { $sel:constantBitrate:MultiplexVideoSettings' :: Maybe Natural
constantBitrate =
        forall a. Maybe a
Prelude.Nothing,
      $sel:statmuxSettings:MultiplexVideoSettings' :: Maybe MultiplexStatmuxVideoSettings
statmuxSettings = forall a. Maybe a
Prelude.Nothing
    }

-- | The constant bitrate configuration for the video encode. When this field
-- is defined, StatmuxSettings must be undefined.
multiplexVideoSettings_constantBitrate :: Lens.Lens' MultiplexVideoSettings (Prelude.Maybe Prelude.Natural)
multiplexVideoSettings_constantBitrate :: Lens' MultiplexVideoSettings (Maybe Natural)
multiplexVideoSettings_constantBitrate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MultiplexVideoSettings' {Maybe Natural
constantBitrate :: Maybe Natural
$sel:constantBitrate:MultiplexVideoSettings' :: MultiplexVideoSettings -> Maybe Natural
constantBitrate} -> Maybe Natural
constantBitrate) (\s :: MultiplexVideoSettings
s@MultiplexVideoSettings' {} Maybe Natural
a -> MultiplexVideoSettings
s {$sel:constantBitrate:MultiplexVideoSettings' :: Maybe Natural
constantBitrate = Maybe Natural
a} :: MultiplexVideoSettings)

-- | Statmux rate control settings. When this field is defined,
-- ConstantBitrate must be undefined.
multiplexVideoSettings_statmuxSettings :: Lens.Lens' MultiplexVideoSettings (Prelude.Maybe MultiplexStatmuxVideoSettings)
multiplexVideoSettings_statmuxSettings :: Lens' MultiplexVideoSettings (Maybe MultiplexStatmuxVideoSettings)
multiplexVideoSettings_statmuxSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MultiplexVideoSettings' {Maybe MultiplexStatmuxVideoSettings
statmuxSettings :: Maybe MultiplexStatmuxVideoSettings
$sel:statmuxSettings:MultiplexVideoSettings' :: MultiplexVideoSettings -> Maybe MultiplexStatmuxVideoSettings
statmuxSettings} -> Maybe MultiplexStatmuxVideoSettings
statmuxSettings) (\s :: MultiplexVideoSettings
s@MultiplexVideoSettings' {} Maybe MultiplexStatmuxVideoSettings
a -> MultiplexVideoSettings
s {$sel:statmuxSettings:MultiplexVideoSettings' :: Maybe MultiplexStatmuxVideoSettings
statmuxSettings = Maybe MultiplexStatmuxVideoSettings
a} :: MultiplexVideoSettings)

instance Data.FromJSON MultiplexVideoSettings where
  parseJSON :: Value -> Parser MultiplexVideoSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"MultiplexVideoSettings"
      ( \Object
x ->
          Maybe Natural
-> Maybe MultiplexStatmuxVideoSettings -> MultiplexVideoSettings
MultiplexVideoSettings'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"constantBitrate")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"statmuxSettings")
      )

instance Prelude.Hashable MultiplexVideoSettings where
  hashWithSalt :: Int -> MultiplexVideoSettings -> Int
hashWithSalt Int
_salt MultiplexVideoSettings' {Maybe Natural
Maybe MultiplexStatmuxVideoSettings
statmuxSettings :: Maybe MultiplexStatmuxVideoSettings
constantBitrate :: Maybe Natural
$sel:statmuxSettings:MultiplexVideoSettings' :: MultiplexVideoSettings -> Maybe MultiplexStatmuxVideoSettings
$sel:constantBitrate:MultiplexVideoSettings' :: MultiplexVideoSettings -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
constantBitrate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MultiplexStatmuxVideoSettings
statmuxSettings

instance Prelude.NFData MultiplexVideoSettings where
  rnf :: MultiplexVideoSettings -> ()
rnf MultiplexVideoSettings' {Maybe Natural
Maybe MultiplexStatmuxVideoSettings
statmuxSettings :: Maybe MultiplexStatmuxVideoSettings
constantBitrate :: Maybe Natural
$sel:statmuxSettings:MultiplexVideoSettings' :: MultiplexVideoSettings -> Maybe MultiplexStatmuxVideoSettings
$sel:constantBitrate:MultiplexVideoSettings' :: MultiplexVideoSettings -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
constantBitrate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe MultiplexStatmuxVideoSettings
statmuxSettings

instance Data.ToJSON MultiplexVideoSettings where
  toJSON :: MultiplexVideoSettings -> Value
toJSON MultiplexVideoSettings' {Maybe Natural
Maybe MultiplexStatmuxVideoSettings
statmuxSettings :: Maybe MultiplexStatmuxVideoSettings
constantBitrate :: Maybe Natural
$sel:statmuxSettings:MultiplexVideoSettings' :: MultiplexVideoSettings -> Maybe MultiplexStatmuxVideoSettings
$sel:constantBitrate:MultiplexVideoSettings' :: MultiplexVideoSettings -> Maybe Natural
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"constantBitrate" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
constantBitrate,
            (Key
"statmuxSettings" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MultiplexStatmuxVideoSettings
statmuxSettings
          ]
      )