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

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

-- | Statmux rate control settings
--
-- /See:/ 'newMultiplexStatmuxVideoSettings' smart constructor.
data MultiplexStatmuxVideoSettings = 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 -> Maybe Int
priority :: Prelude.Maybe Prelude.Int,
    -- | Minimum statmux bitrate.
    MultiplexStatmuxVideoSettings -> Maybe Natural
minimumBitrate :: Prelude.Maybe Prelude.Natural,
    -- | Maximum statmux bitrate.
    MultiplexStatmuxVideoSettings -> Maybe Natural
maximumBitrate :: Prelude.Maybe Prelude.Natural
  }
  deriving (MultiplexStatmuxVideoSettings
-> MultiplexStatmuxVideoSettings -> Bool
(MultiplexStatmuxVideoSettings
 -> MultiplexStatmuxVideoSettings -> Bool)
-> (MultiplexStatmuxVideoSettings
    -> MultiplexStatmuxVideoSettings -> Bool)
-> Eq MultiplexStatmuxVideoSettings
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]
(Int -> ReadS MultiplexStatmuxVideoSettings)
-> ReadS [MultiplexStatmuxVideoSettings]
-> ReadPrec MultiplexStatmuxVideoSettings
-> ReadPrec [MultiplexStatmuxVideoSettings]
-> Read 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
(Int -> MultiplexStatmuxVideoSettings -> ShowS)
-> (MultiplexStatmuxVideoSettings -> String)
-> ([MultiplexStatmuxVideoSettings] -> ShowS)
-> Show MultiplexStatmuxVideoSettings
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.
 MultiplexStatmuxVideoSettings
 -> Rep MultiplexStatmuxVideoSettings x)
-> (forall x.
    Rep MultiplexStatmuxVideoSettings x
    -> MultiplexStatmuxVideoSettings)
-> Generic MultiplexStatmuxVideoSettings
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:
--
-- '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.
--
-- 'minimumBitrate', 'multiplexStatmuxVideoSettings_minimumBitrate' - Minimum statmux bitrate.
--
-- 'maximumBitrate', 'multiplexStatmuxVideoSettings_maximumBitrate' - Maximum statmux bitrate.
newMultiplexStatmuxVideoSettings ::
  MultiplexStatmuxVideoSettings
newMultiplexStatmuxVideoSettings :: MultiplexStatmuxVideoSettings
newMultiplexStatmuxVideoSettings =
  MultiplexStatmuxVideoSettings' :: Maybe Int
-> Maybe Natural -> Maybe Natural -> MultiplexStatmuxVideoSettings
MultiplexStatmuxVideoSettings'
    { $sel:priority:MultiplexStatmuxVideoSettings' :: Maybe Int
priority =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:minimumBitrate:MultiplexStatmuxVideoSettings' :: Maybe Natural
minimumBitrate = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:maximumBitrate:MultiplexStatmuxVideoSettings' :: Maybe Natural
maximumBitrate = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe Int -> f (Maybe Int))
-> MultiplexStatmuxVideoSettings -> f MultiplexStatmuxVideoSettings
multiplexStatmuxVideoSettings_priority = (MultiplexStatmuxVideoSettings -> Maybe Int)
-> (MultiplexStatmuxVideoSettings
    -> Maybe Int -> MultiplexStatmuxVideoSettings)
-> Lens
     MultiplexStatmuxVideoSettings
     MultiplexStatmuxVideoSettings
     (Maybe Int)
     (Maybe Int)
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)

-- | Minimum statmux bitrate.
multiplexStatmuxVideoSettings_minimumBitrate :: Lens.Lens' MultiplexStatmuxVideoSettings (Prelude.Maybe Prelude.Natural)
multiplexStatmuxVideoSettings_minimumBitrate :: (Maybe Natural -> f (Maybe Natural))
-> MultiplexStatmuxVideoSettings -> f MultiplexStatmuxVideoSettings
multiplexStatmuxVideoSettings_minimumBitrate = (MultiplexStatmuxVideoSettings -> Maybe Natural)
-> (MultiplexStatmuxVideoSettings
    -> Maybe Natural -> MultiplexStatmuxVideoSettings)
-> Lens
     MultiplexStatmuxVideoSettings
     MultiplexStatmuxVideoSettings
     (Maybe Natural)
     (Maybe Natural)
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)

-- | Maximum statmux bitrate.
multiplexStatmuxVideoSettings_maximumBitrate :: Lens.Lens' MultiplexStatmuxVideoSettings (Prelude.Maybe Prelude.Natural)
multiplexStatmuxVideoSettings_maximumBitrate :: (Maybe Natural -> f (Maybe Natural))
-> MultiplexStatmuxVideoSettings -> f MultiplexStatmuxVideoSettings
multiplexStatmuxVideoSettings_maximumBitrate = (MultiplexStatmuxVideoSettings -> Maybe Natural)
-> (MultiplexStatmuxVideoSettings
    -> Maybe Natural -> MultiplexStatmuxVideoSettings)
-> Lens
     MultiplexStatmuxVideoSettings
     MultiplexStatmuxVideoSettings
     (Maybe Natural)
     (Maybe Natural)
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)

instance Core.FromJSON MultiplexStatmuxVideoSettings where
  parseJSON :: Value -> Parser MultiplexStatmuxVideoSettings
parseJSON =
    String
-> (Object -> Parser MultiplexStatmuxVideoSettings)
-> Value
-> Parser MultiplexStatmuxVideoSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MultiplexStatmuxVideoSettings"
      ( \Object
x ->
          Maybe Int
-> Maybe Natural -> Maybe Natural -> MultiplexStatmuxVideoSettings
MultiplexStatmuxVideoSettings'
            (Maybe Int
 -> Maybe Natural -> Maybe Natural -> MultiplexStatmuxVideoSettings)
-> Parser (Maybe Int)
-> Parser
     (Maybe Natural -> Maybe Natural -> MultiplexStatmuxVideoSettings)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"priority")
            Parser
  (Maybe Natural -> Maybe Natural -> MultiplexStatmuxVideoSettings)
-> Parser (Maybe Natural)
-> Parser (Maybe Natural -> MultiplexStatmuxVideoSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"minimumBitrate")
            Parser (Maybe Natural -> MultiplexStatmuxVideoSettings)
-> Parser (Maybe Natural) -> Parser MultiplexStatmuxVideoSettings
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"maximumBitrate")
      )

instance
  Prelude.Hashable
    MultiplexStatmuxVideoSettings

instance Prelude.NFData MultiplexStatmuxVideoSettings

instance Core.ToJSON MultiplexStatmuxVideoSettings where
  toJSON :: MultiplexStatmuxVideoSettings -> Value
toJSON MultiplexStatmuxVideoSettings' {Maybe Int
Maybe Natural
maximumBitrate :: Maybe Natural
minimumBitrate :: Maybe Natural
priority :: Maybe Int
$sel:maximumBitrate:MultiplexStatmuxVideoSettings' :: MultiplexStatmuxVideoSettings -> Maybe Natural
$sel:minimumBitrate:MultiplexStatmuxVideoSettings' :: MultiplexStatmuxVideoSettings -> Maybe Natural
$sel:priority:MultiplexStatmuxVideoSettings' :: MultiplexStatmuxVideoSettings -> Maybe Int
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"priority" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
priority,
            (Text
"minimumBitrate" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
minimumBitrate,
            (Text
"maximumBitrate" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maximumBitrate
          ]
      )