{-# 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.MediaConnect.Types.EncodingParametersRequest
-- 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.MediaConnect.Types.EncodingParametersRequest where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaConnect.Types.EncoderProfile
import qualified Amazonka.Prelude as Prelude

-- | A collection of parameters that determine how MediaConnect will convert
-- the content. These fields only apply to outputs on flows that have a CDI
-- source.
--
-- /See:/ 'newEncodingParametersRequest' smart constructor.
data EncodingParametersRequest = EncodingParametersRequest'
  { -- | A setting on the encoder that drives compression settings. This property
    -- only applies to video media streams associated with outputs that use the
    -- ST 2110 JPEG XS protocol, if at least one source on the flow uses the
    -- CDI protocol.
    EncodingParametersRequest -> EncoderProfile
encoderProfile :: EncoderProfile,
    -- | A value that is used to calculate compression for an output. The bitrate
    -- of the output is calculated as follows: Output bitrate = (1 \/
    -- compressionFactor) * (source bitrate) This property only applies to
    -- outputs that use the ST 2110 JPEG XS protocol, with a flow source that
    -- uses the CDI protocol. Valid values are floating point numbers in the
    -- range of 3.0 to 10.0, inclusive.
    EncodingParametersRequest -> Double
compressionFactor :: Prelude.Double
  }
  deriving (EncodingParametersRequest -> EncodingParametersRequest -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EncodingParametersRequest -> EncodingParametersRequest -> Bool
$c/= :: EncodingParametersRequest -> EncodingParametersRequest -> Bool
== :: EncodingParametersRequest -> EncodingParametersRequest -> Bool
$c== :: EncodingParametersRequest -> EncodingParametersRequest -> Bool
Prelude.Eq, ReadPrec [EncodingParametersRequest]
ReadPrec EncodingParametersRequest
Int -> ReadS EncodingParametersRequest
ReadS [EncodingParametersRequest]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EncodingParametersRequest]
$creadListPrec :: ReadPrec [EncodingParametersRequest]
readPrec :: ReadPrec EncodingParametersRequest
$creadPrec :: ReadPrec EncodingParametersRequest
readList :: ReadS [EncodingParametersRequest]
$creadList :: ReadS [EncodingParametersRequest]
readsPrec :: Int -> ReadS EncodingParametersRequest
$creadsPrec :: Int -> ReadS EncodingParametersRequest
Prelude.Read, Int -> EncodingParametersRequest -> ShowS
[EncodingParametersRequest] -> ShowS
EncodingParametersRequest -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EncodingParametersRequest] -> ShowS
$cshowList :: [EncodingParametersRequest] -> ShowS
show :: EncodingParametersRequest -> String
$cshow :: EncodingParametersRequest -> String
showsPrec :: Int -> EncodingParametersRequest -> ShowS
$cshowsPrec :: Int -> EncodingParametersRequest -> ShowS
Prelude.Show, forall x.
Rep EncodingParametersRequest x -> EncodingParametersRequest
forall x.
EncodingParametersRequest -> Rep EncodingParametersRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep EncodingParametersRequest x -> EncodingParametersRequest
$cfrom :: forall x.
EncodingParametersRequest -> Rep EncodingParametersRequest x
Prelude.Generic)

-- |
-- Create a value of 'EncodingParametersRequest' 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:
--
-- 'encoderProfile', 'encodingParametersRequest_encoderProfile' - A setting on the encoder that drives compression settings. This property
-- only applies to video media streams associated with outputs that use the
-- ST 2110 JPEG XS protocol, if at least one source on the flow uses the
-- CDI protocol.
--
-- 'compressionFactor', 'encodingParametersRequest_compressionFactor' - A value that is used to calculate compression for an output. The bitrate
-- of the output is calculated as follows: Output bitrate = (1 \/
-- compressionFactor) * (source bitrate) This property only applies to
-- outputs that use the ST 2110 JPEG XS protocol, with a flow source that
-- uses the CDI protocol. Valid values are floating point numbers in the
-- range of 3.0 to 10.0, inclusive.
newEncodingParametersRequest ::
  -- | 'encoderProfile'
  EncoderProfile ->
  -- | 'compressionFactor'
  Prelude.Double ->
  EncodingParametersRequest
newEncodingParametersRequest :: EncoderProfile -> Double -> EncodingParametersRequest
newEncodingParametersRequest
  EncoderProfile
pEncoderProfile_
  Double
pCompressionFactor_ =
    EncodingParametersRequest'
      { $sel:encoderProfile:EncodingParametersRequest' :: EncoderProfile
encoderProfile =
          EncoderProfile
pEncoderProfile_,
        $sel:compressionFactor:EncodingParametersRequest' :: Double
compressionFactor = Double
pCompressionFactor_
      }

-- | A setting on the encoder that drives compression settings. This property
-- only applies to video media streams associated with outputs that use the
-- ST 2110 JPEG XS protocol, if at least one source on the flow uses the
-- CDI protocol.
encodingParametersRequest_encoderProfile :: Lens.Lens' EncodingParametersRequest EncoderProfile
encodingParametersRequest_encoderProfile :: Lens' EncodingParametersRequest EncoderProfile
encodingParametersRequest_encoderProfile = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EncodingParametersRequest' {EncoderProfile
encoderProfile :: EncoderProfile
$sel:encoderProfile:EncodingParametersRequest' :: EncodingParametersRequest -> EncoderProfile
encoderProfile} -> EncoderProfile
encoderProfile) (\s :: EncodingParametersRequest
s@EncodingParametersRequest' {} EncoderProfile
a -> EncodingParametersRequest
s {$sel:encoderProfile:EncodingParametersRequest' :: EncoderProfile
encoderProfile = EncoderProfile
a} :: EncodingParametersRequest)

-- | A value that is used to calculate compression for an output. The bitrate
-- of the output is calculated as follows: Output bitrate = (1 \/
-- compressionFactor) * (source bitrate) This property only applies to
-- outputs that use the ST 2110 JPEG XS protocol, with a flow source that
-- uses the CDI protocol. Valid values are floating point numbers in the
-- range of 3.0 to 10.0, inclusive.
encodingParametersRequest_compressionFactor :: Lens.Lens' EncodingParametersRequest Prelude.Double
encodingParametersRequest_compressionFactor :: Lens' EncodingParametersRequest Double
encodingParametersRequest_compressionFactor = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EncodingParametersRequest' {Double
compressionFactor :: Double
$sel:compressionFactor:EncodingParametersRequest' :: EncodingParametersRequest -> Double
compressionFactor} -> Double
compressionFactor) (\s :: EncodingParametersRequest
s@EncodingParametersRequest' {} Double
a -> EncodingParametersRequest
s {$sel:compressionFactor:EncodingParametersRequest' :: Double
compressionFactor = Double
a} :: EncodingParametersRequest)

instance Prelude.Hashable EncodingParametersRequest where
  hashWithSalt :: Int -> EncodingParametersRequest -> Int
hashWithSalt Int
_salt EncodingParametersRequest' {Double
EncoderProfile
compressionFactor :: Double
encoderProfile :: EncoderProfile
$sel:compressionFactor:EncodingParametersRequest' :: EncodingParametersRequest -> Double
$sel:encoderProfile:EncodingParametersRequest' :: EncodingParametersRequest -> EncoderProfile
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` EncoderProfile
encoderProfile
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Double
compressionFactor

instance Prelude.NFData EncodingParametersRequest where
  rnf :: EncodingParametersRequest -> ()
rnf EncodingParametersRequest' {Double
EncoderProfile
compressionFactor :: Double
encoderProfile :: EncoderProfile
$sel:compressionFactor:EncodingParametersRequest' :: EncodingParametersRequest -> Double
$sel:encoderProfile:EncodingParametersRequest' :: EncodingParametersRequest -> EncoderProfile
..} =
    forall a. NFData a => a -> ()
Prelude.rnf EncoderProfile
encoderProfile
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Double
compressionFactor

instance Data.ToJSON EncodingParametersRequest where
  toJSON :: EncodingParametersRequest -> Value
toJSON EncodingParametersRequest' {Double
EncoderProfile
compressionFactor :: Double
encoderProfile :: EncoderProfile
$sel:compressionFactor:EncodingParametersRequest' :: EncodingParametersRequest -> Double
$sel:encoderProfile:EncodingParametersRequest' :: EncodingParametersRequest -> EncoderProfile
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"encoderProfile" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= EncoderProfile
encoderProfile),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"compressionFactor" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Double
compressionFactor)
          ]
      )