{-# 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.MultiplexStatmuxVideoSettings
-- 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.MultiplexStatmuxVideoSettings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Statmux rate control settings
--
-- /See:/ 'newMultiplexStatmuxVideoSettings' smart constructor.
data MultiplexStatmuxVideoSettings = MultiplexStatmuxVideoSettings'
  { -- | Maximum statmux bitrate.
    MultiplexStatmuxVideoSettings -> Maybe Natural
maximumBitrate :: Prelude.Maybe Prelude.Natural,
    -- | Minimum statmux bitrate.
    MultiplexStatmuxVideoSettings -> Maybe Natural
minimumBitrate :: Prelude.Maybe Prelude.Natural,
    -- | The purpose of the priority is to use a combination of the\\nmultiplex
    -- rate control algorithm and the QVBR capability of the\\nencoder to
    -- prioritize the video quality of some channels in a\\nmultiplex over
    -- others. Channels that have a higher priority will\\nget higher video
    -- quality at the expense of the video quality of\\nother channels in the
    -- multiplex with lower priority.
    MultiplexStatmuxVideoSettings -> Maybe Int
priority :: Prelude.Maybe Prelude.Int
  }
  deriving (MultiplexStatmuxVideoSettings
-> MultiplexStatmuxVideoSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MultiplexStatmuxVideoSettings
-> MultiplexStatmuxVideoSettings -> Bool
$c/= :: MultiplexStatmuxVideoSettings
-> MultiplexStatmuxVideoSettings -> Bool
== :: MultiplexStatmuxVideoSettings
-> MultiplexStatmuxVideoSettings -> Bool
$c== :: MultiplexStatmuxVideoSettings
-> MultiplexStatmuxVideoSettings -> Bool
Prelude.Eq, ReadPrec [MultiplexStatmuxVideoSettings]
ReadPrec MultiplexStatmuxVideoSettings
Int -> ReadS MultiplexStatmuxVideoSettings
ReadS [MultiplexStatmuxVideoSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MultiplexStatmuxVideoSettings]
$creadListPrec :: ReadPrec [MultiplexStatmuxVideoSettings]
readPrec :: ReadPrec MultiplexStatmuxVideoSettings
$creadPrec :: ReadPrec MultiplexStatmuxVideoSettings
readList :: ReadS [MultiplexStatmuxVideoSettings]
$creadList :: ReadS [MultiplexStatmuxVideoSettings]
readsPrec :: Int -> ReadS MultiplexStatmuxVideoSettings
$creadsPrec :: Int -> ReadS MultiplexStatmuxVideoSettings
Prelude.Read, Int -> MultiplexStatmuxVideoSettings -> ShowS
[MultiplexStatmuxVideoSettings] -> ShowS
MultiplexStatmuxVideoSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MultiplexStatmuxVideoSettings] -> ShowS
$cshowList :: [MultiplexStatmuxVideoSettings] -> ShowS
show :: MultiplexStatmuxVideoSettings -> String
$cshow :: MultiplexStatmuxVideoSettings -> String
showsPrec :: Int -> MultiplexStatmuxVideoSettings -> ShowS
$cshowsPrec :: Int -> MultiplexStatmuxVideoSettings -> ShowS
Prelude.Show, forall x.
Rep MultiplexStatmuxVideoSettings x
-> MultiplexStatmuxVideoSettings
forall x.
MultiplexStatmuxVideoSettings
-> Rep MultiplexStatmuxVideoSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MultiplexStatmuxVideoSettings x
-> MultiplexStatmuxVideoSettings
$cfrom :: forall x.
MultiplexStatmuxVideoSettings
-> Rep MultiplexStatmuxVideoSettings x
Prelude.Generic)

-- |
-- Create a value of 'MultiplexStatmuxVideoSettings' 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:
--
-- 'maximumBitrate', 'multiplexStatmuxVideoSettings_maximumBitrate' - Maximum statmux bitrate.
--
-- 'minimumBitrate', 'multiplexStatmuxVideoSettings_minimumBitrate' - Minimum statmux bitrate.
--
-- 'priority', 'multiplexStatmuxVideoSettings_priority' - The purpose of the priority is to use a combination of the\\nmultiplex
-- rate control algorithm and the QVBR capability of the\\nencoder to
-- prioritize the video quality of some channels in a\\nmultiplex over
-- others. Channels that have a higher priority will\\nget higher video
-- quality at the expense of the video quality of\\nother channels in the
-- multiplex with lower priority.
newMultiplexStatmuxVideoSettings ::
  MultiplexStatmuxVideoSettings
newMultiplexStatmuxVideoSettings :: MultiplexStatmuxVideoSettings
newMultiplexStatmuxVideoSettings =
  MultiplexStatmuxVideoSettings'
    { $sel:maximumBitrate:MultiplexStatmuxVideoSettings' :: Maybe Natural
maximumBitrate =
        forall a. Maybe a
Prelude.Nothing,
      $sel:minimumBitrate:MultiplexStatmuxVideoSettings' :: Maybe Natural
minimumBitrate = forall a. Maybe a
Prelude.Nothing,
      $sel:priority:MultiplexStatmuxVideoSettings' :: Maybe Int
priority = forall a. Maybe a
Prelude.Nothing
    }

-- | Maximum statmux bitrate.
multiplexStatmuxVideoSettings_maximumBitrate :: Lens.Lens' MultiplexStatmuxVideoSettings (Prelude.Maybe Prelude.Natural)
multiplexStatmuxVideoSettings_maximumBitrate :: Lens' MultiplexStatmuxVideoSettings (Maybe Natural)
multiplexStatmuxVideoSettings_maximumBitrate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MultiplexStatmuxVideoSettings' {Maybe Natural
maximumBitrate :: Maybe Natural
$sel:maximumBitrate:MultiplexStatmuxVideoSettings' :: MultiplexStatmuxVideoSettings -> Maybe Natural
maximumBitrate} -> Maybe Natural
maximumBitrate) (\s :: MultiplexStatmuxVideoSettings
s@MultiplexStatmuxVideoSettings' {} Maybe Natural
a -> MultiplexStatmuxVideoSettings
s {$sel:maximumBitrate:MultiplexStatmuxVideoSettings' :: Maybe Natural
maximumBitrate = Maybe Natural
a} :: MultiplexStatmuxVideoSettings)

-- | Minimum statmux bitrate.
multiplexStatmuxVideoSettings_minimumBitrate :: Lens.Lens' MultiplexStatmuxVideoSettings (Prelude.Maybe Prelude.Natural)
multiplexStatmuxVideoSettings_minimumBitrate :: Lens' MultiplexStatmuxVideoSettings (Maybe Natural)
multiplexStatmuxVideoSettings_minimumBitrate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MultiplexStatmuxVideoSettings' {Maybe Natural
minimumBitrate :: Maybe Natural
$sel:minimumBitrate:MultiplexStatmuxVideoSettings' :: MultiplexStatmuxVideoSettings -> Maybe Natural
minimumBitrate} -> Maybe Natural
minimumBitrate) (\s :: MultiplexStatmuxVideoSettings
s@MultiplexStatmuxVideoSettings' {} Maybe Natural
a -> MultiplexStatmuxVideoSettings
s {$sel:minimumBitrate:MultiplexStatmuxVideoSettings' :: Maybe Natural
minimumBitrate = Maybe Natural
a} :: MultiplexStatmuxVideoSettings)

-- | The purpose of the priority is to use a combination of the\\nmultiplex
-- rate control algorithm and the QVBR capability of the\\nencoder to
-- prioritize the video quality of some channels in a\\nmultiplex over
-- others. Channels that have a higher priority will\\nget higher video
-- quality at the expense of the video quality of\\nother channels in the
-- multiplex with lower priority.
multiplexStatmuxVideoSettings_priority :: Lens.Lens' MultiplexStatmuxVideoSettings (Prelude.Maybe Prelude.Int)
multiplexStatmuxVideoSettings_priority :: Lens' MultiplexStatmuxVideoSettings (Maybe Int)
multiplexStatmuxVideoSettings_priority = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MultiplexStatmuxVideoSettings' {Maybe Int
priority :: Maybe Int
$sel:priority:MultiplexStatmuxVideoSettings' :: MultiplexStatmuxVideoSettings -> Maybe Int
priority} -> Maybe Int
priority) (\s :: MultiplexStatmuxVideoSettings
s@MultiplexStatmuxVideoSettings' {} Maybe Int
a -> MultiplexStatmuxVideoSettings
s {$sel:priority:MultiplexStatmuxVideoSettings' :: Maybe Int
priority = Maybe Int
a} :: MultiplexStatmuxVideoSettings)

instance Data.FromJSON MultiplexStatmuxVideoSettings where
  parseJSON :: Value -> Parser MultiplexStatmuxVideoSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"MultiplexStatmuxVideoSettings"
      ( \Object
x ->
          Maybe Natural
-> Maybe Natural -> Maybe Int -> MultiplexStatmuxVideoSettings
MultiplexStatmuxVideoSettings'
            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
"maximumBitrate")
            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
"minimumBitrate")
            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
"priority")
      )

instance
  Prelude.Hashable
    MultiplexStatmuxVideoSettings
  where
  hashWithSalt :: Int -> MultiplexStatmuxVideoSettings -> Int
hashWithSalt Int
_salt MultiplexStatmuxVideoSettings' {Maybe Int
Maybe Natural
priority :: Maybe Int
minimumBitrate :: Maybe Natural
maximumBitrate :: Maybe Natural
$sel:priority:MultiplexStatmuxVideoSettings' :: MultiplexStatmuxVideoSettings -> Maybe Int
$sel:minimumBitrate:MultiplexStatmuxVideoSettings' :: MultiplexStatmuxVideoSettings -> Maybe Natural
$sel:maximumBitrate:MultiplexStatmuxVideoSettings' :: MultiplexStatmuxVideoSettings -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maximumBitrate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
minimumBitrate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
priority

instance Prelude.NFData MultiplexStatmuxVideoSettings where
  rnf :: MultiplexStatmuxVideoSettings -> ()
rnf MultiplexStatmuxVideoSettings' {Maybe Int
Maybe Natural
priority :: Maybe Int
minimumBitrate :: Maybe Natural
maximumBitrate :: Maybe Natural
$sel:priority:MultiplexStatmuxVideoSettings' :: MultiplexStatmuxVideoSettings -> Maybe Int
$sel:minimumBitrate:MultiplexStatmuxVideoSettings' :: MultiplexStatmuxVideoSettings -> Maybe Natural
$sel:maximumBitrate:MultiplexStatmuxVideoSettings' :: MultiplexStatmuxVideoSettings -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maximumBitrate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
minimumBitrate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
priority

instance Data.ToJSON MultiplexStatmuxVideoSettings where
  toJSON :: MultiplexStatmuxVideoSettings -> Value
toJSON MultiplexStatmuxVideoSettings' {Maybe Int
Maybe Natural
priority :: Maybe Int
minimumBitrate :: Maybe Natural
maximumBitrate :: Maybe Natural
$sel:priority:MultiplexStatmuxVideoSettings' :: MultiplexStatmuxVideoSettings -> Maybe Int
$sel:minimumBitrate:MultiplexStatmuxVideoSettings' :: MultiplexStatmuxVideoSettings -> Maybe Natural
$sel:maximumBitrate:MultiplexStatmuxVideoSettings' :: MultiplexStatmuxVideoSettings -> Maybe Natural
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"maximumBitrate" 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
maximumBitrate,
            (Key
"minimumBitrate" 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
minimumBitrate,
            (Key
"priority" 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 Int
priority
          ]
      )