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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaLive.Types.AacCodingMode
import Amazonka.MediaLive.Types.AacInputType
import Amazonka.MediaLive.Types.AacProfile
import Amazonka.MediaLive.Types.AacRateControlMode
import Amazonka.MediaLive.Types.AacRawFormat
import Amazonka.MediaLive.Types.AacSpec
import Amazonka.MediaLive.Types.AacVbrQuality
import qualified Amazonka.Prelude as Prelude

-- | Aac Settings
--
-- /See:/ 'newAacSettings' smart constructor.
data AacSettings = AacSettings'
  { -- | Sets LATM \/ LOAS AAC output for raw containers.
    AacSettings -> Maybe AacRawFormat
rawFormat :: Prelude.Maybe AacRawFormat,
    -- | Mono, Stereo, or 5.1 channel layout. Valid values depend on rate control
    -- mode and profile. The adReceiverMix setting receives a stereo
    -- description plus control track and emits a mono AAC encode of the
    -- description track, with control data emitted in the PES header as per
    -- ETSI TS 101 154 Annex E.
    AacSettings -> Maybe AacCodingMode
codingMode :: Prelude.Maybe AacCodingMode,
    -- | AAC Profile.
    AacSettings -> Maybe AacProfile
profile :: Prelude.Maybe AacProfile,
    -- | Rate Control Mode.
    AacSettings -> Maybe AacRateControlMode
rateControlMode :: Prelude.Maybe AacRateControlMode,
    -- | Sample rate in Hz. Valid values depend on rate control mode and profile.
    AacSettings -> Maybe Double
sampleRate :: Prelude.Maybe Prelude.Double,
    -- | Use MPEG-2 AAC audio instead of MPEG-4 AAC audio for raw or MPEG-2
    -- Transport Stream containers.
    AacSettings -> Maybe AacSpec
spec :: Prelude.Maybe AacSpec,
    -- | Average bitrate in bits\/second. Valid values depend on rate control
    -- mode and profile.
    AacSettings -> Maybe Double
bitrate :: Prelude.Maybe Prelude.Double,
    -- | VBR Quality Level - Only used if rateControlMode is VBR.
    AacSettings -> Maybe AacVbrQuality
vbrQuality :: Prelude.Maybe AacVbrQuality,
    -- | Set to \"broadcasterMixedAd\" when input contains pre-mixed main audio +
    -- AD (narration) as a stereo pair. The Audio Type field (audioType) will
    -- be set to 3, which signals to downstream systems that this stream
    -- contains \"broadcaster mixed AD\". Note that the input received by the
    -- encoder must contain pre-mixed audio; the encoder does not perform the
    -- mixing. The values in audioTypeControl and audioType (in
    -- AudioDescription) are ignored when set to broadcasterMixedAd. Leave set
    -- to \"normal\" when input does not contain pre-mixed audio + AD.
    AacSettings -> Maybe AacInputType
inputType :: Prelude.Maybe AacInputType
  }
  deriving (AacSettings -> AacSettings -> Bool
(AacSettings -> AacSettings -> Bool)
-> (AacSettings -> AacSettings -> Bool) -> Eq AacSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AacSettings -> AacSettings -> Bool
$c/= :: AacSettings -> AacSettings -> Bool
== :: AacSettings -> AacSettings -> Bool
$c== :: AacSettings -> AacSettings -> Bool
Prelude.Eq, ReadPrec [AacSettings]
ReadPrec AacSettings
Int -> ReadS AacSettings
ReadS [AacSettings]
(Int -> ReadS AacSettings)
-> ReadS [AacSettings]
-> ReadPrec AacSettings
-> ReadPrec [AacSettings]
-> Read AacSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AacSettings]
$creadListPrec :: ReadPrec [AacSettings]
readPrec :: ReadPrec AacSettings
$creadPrec :: ReadPrec AacSettings
readList :: ReadS [AacSettings]
$creadList :: ReadS [AacSettings]
readsPrec :: Int -> ReadS AacSettings
$creadsPrec :: Int -> ReadS AacSettings
Prelude.Read, Int -> AacSettings -> ShowS
[AacSettings] -> ShowS
AacSettings -> String
(Int -> AacSettings -> ShowS)
-> (AacSettings -> String)
-> ([AacSettings] -> ShowS)
-> Show AacSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AacSettings] -> ShowS
$cshowList :: [AacSettings] -> ShowS
show :: AacSettings -> String
$cshow :: AacSettings -> String
showsPrec :: Int -> AacSettings -> ShowS
$cshowsPrec :: Int -> AacSettings -> ShowS
Prelude.Show, (forall x. AacSettings -> Rep AacSettings x)
-> (forall x. Rep AacSettings x -> AacSettings)
-> Generic AacSettings
forall x. Rep AacSettings x -> AacSettings
forall x. AacSettings -> Rep AacSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AacSettings x -> AacSettings
$cfrom :: forall x. AacSettings -> Rep AacSettings x
Prelude.Generic)

-- |
-- Create a value of 'AacSettings' 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:
--
-- 'rawFormat', 'aacSettings_rawFormat' - Sets LATM \/ LOAS AAC output for raw containers.
--
-- 'codingMode', 'aacSettings_codingMode' - Mono, Stereo, or 5.1 channel layout. Valid values depend on rate control
-- mode and profile. The adReceiverMix setting receives a stereo
-- description plus control track and emits a mono AAC encode of the
-- description track, with control data emitted in the PES header as per
-- ETSI TS 101 154 Annex E.
--
-- 'profile', 'aacSettings_profile' - AAC Profile.
--
-- 'rateControlMode', 'aacSettings_rateControlMode' - Rate Control Mode.
--
-- 'sampleRate', 'aacSettings_sampleRate' - Sample rate in Hz. Valid values depend on rate control mode and profile.
--
-- 'spec', 'aacSettings_spec' - Use MPEG-2 AAC audio instead of MPEG-4 AAC audio for raw or MPEG-2
-- Transport Stream containers.
--
-- 'bitrate', 'aacSettings_bitrate' - Average bitrate in bits\/second. Valid values depend on rate control
-- mode and profile.
--
-- 'vbrQuality', 'aacSettings_vbrQuality' - VBR Quality Level - Only used if rateControlMode is VBR.
--
-- 'inputType', 'aacSettings_inputType' - Set to \"broadcasterMixedAd\" when input contains pre-mixed main audio +
-- AD (narration) as a stereo pair. The Audio Type field (audioType) will
-- be set to 3, which signals to downstream systems that this stream
-- contains \"broadcaster mixed AD\". Note that the input received by the
-- encoder must contain pre-mixed audio; the encoder does not perform the
-- mixing. The values in audioTypeControl and audioType (in
-- AudioDescription) are ignored when set to broadcasterMixedAd. Leave set
-- to \"normal\" when input does not contain pre-mixed audio + AD.
newAacSettings ::
  AacSettings
newAacSettings :: AacSettings
newAacSettings =
  AacSettings' :: Maybe AacRawFormat
-> Maybe AacCodingMode
-> Maybe AacProfile
-> Maybe AacRateControlMode
-> Maybe Double
-> Maybe AacSpec
-> Maybe Double
-> Maybe AacVbrQuality
-> Maybe AacInputType
-> AacSettings
AacSettings'
    { $sel:rawFormat:AacSettings' :: Maybe AacRawFormat
rawFormat = Maybe AacRawFormat
forall a. Maybe a
Prelude.Nothing,
      $sel:codingMode:AacSettings' :: Maybe AacCodingMode
codingMode = Maybe AacCodingMode
forall a. Maybe a
Prelude.Nothing,
      $sel:profile:AacSettings' :: Maybe AacProfile
profile = Maybe AacProfile
forall a. Maybe a
Prelude.Nothing,
      $sel:rateControlMode:AacSettings' :: Maybe AacRateControlMode
rateControlMode = Maybe AacRateControlMode
forall a. Maybe a
Prelude.Nothing,
      $sel:sampleRate:AacSettings' :: Maybe Double
sampleRate = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:spec:AacSettings' :: Maybe AacSpec
spec = Maybe AacSpec
forall a. Maybe a
Prelude.Nothing,
      $sel:bitrate:AacSettings' :: Maybe Double
bitrate = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:vbrQuality:AacSettings' :: Maybe AacVbrQuality
vbrQuality = Maybe AacVbrQuality
forall a. Maybe a
Prelude.Nothing,
      $sel:inputType:AacSettings' :: Maybe AacInputType
inputType = Maybe AacInputType
forall a. Maybe a
Prelude.Nothing
    }

-- | Sets LATM \/ LOAS AAC output for raw containers.
aacSettings_rawFormat :: Lens.Lens' AacSettings (Prelude.Maybe AacRawFormat)
aacSettings_rawFormat :: (Maybe AacRawFormat -> f (Maybe AacRawFormat))
-> AacSettings -> f AacSettings
aacSettings_rawFormat = (AacSettings -> Maybe AacRawFormat)
-> (AacSettings -> Maybe AacRawFormat -> AacSettings)
-> Lens
     AacSettings AacSettings (Maybe AacRawFormat) (Maybe AacRawFormat)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AacSettings' {Maybe AacRawFormat
rawFormat :: Maybe AacRawFormat
$sel:rawFormat:AacSettings' :: AacSettings -> Maybe AacRawFormat
rawFormat} -> Maybe AacRawFormat
rawFormat) (\s :: AacSettings
s@AacSettings' {} Maybe AacRawFormat
a -> AacSettings
s {$sel:rawFormat:AacSettings' :: Maybe AacRawFormat
rawFormat = Maybe AacRawFormat
a} :: AacSettings)

-- | Mono, Stereo, or 5.1 channel layout. Valid values depend on rate control
-- mode and profile. The adReceiverMix setting receives a stereo
-- description plus control track and emits a mono AAC encode of the
-- description track, with control data emitted in the PES header as per
-- ETSI TS 101 154 Annex E.
aacSettings_codingMode :: Lens.Lens' AacSettings (Prelude.Maybe AacCodingMode)
aacSettings_codingMode :: (Maybe AacCodingMode -> f (Maybe AacCodingMode))
-> AacSettings -> f AacSettings
aacSettings_codingMode = (AacSettings -> Maybe AacCodingMode)
-> (AacSettings -> Maybe AacCodingMode -> AacSettings)
-> Lens
     AacSettings AacSettings (Maybe AacCodingMode) (Maybe AacCodingMode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AacSettings' {Maybe AacCodingMode
codingMode :: Maybe AacCodingMode
$sel:codingMode:AacSettings' :: AacSettings -> Maybe AacCodingMode
codingMode} -> Maybe AacCodingMode
codingMode) (\s :: AacSettings
s@AacSettings' {} Maybe AacCodingMode
a -> AacSettings
s {$sel:codingMode:AacSettings' :: Maybe AacCodingMode
codingMode = Maybe AacCodingMode
a} :: AacSettings)

-- | AAC Profile.
aacSettings_profile :: Lens.Lens' AacSettings (Prelude.Maybe AacProfile)
aacSettings_profile :: (Maybe AacProfile -> f (Maybe AacProfile))
-> AacSettings -> f AacSettings
aacSettings_profile = (AacSettings -> Maybe AacProfile)
-> (AacSettings -> Maybe AacProfile -> AacSettings)
-> Lens
     AacSettings AacSettings (Maybe AacProfile) (Maybe AacProfile)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AacSettings' {Maybe AacProfile
profile :: Maybe AacProfile
$sel:profile:AacSettings' :: AacSettings -> Maybe AacProfile
profile} -> Maybe AacProfile
profile) (\s :: AacSettings
s@AacSettings' {} Maybe AacProfile
a -> AacSettings
s {$sel:profile:AacSettings' :: Maybe AacProfile
profile = Maybe AacProfile
a} :: AacSettings)

-- | Rate Control Mode.
aacSettings_rateControlMode :: Lens.Lens' AacSettings (Prelude.Maybe AacRateControlMode)
aacSettings_rateControlMode :: (Maybe AacRateControlMode -> f (Maybe AacRateControlMode))
-> AacSettings -> f AacSettings
aacSettings_rateControlMode = (AacSettings -> Maybe AacRateControlMode)
-> (AacSettings -> Maybe AacRateControlMode -> AacSettings)
-> Lens
     AacSettings
     AacSettings
     (Maybe AacRateControlMode)
     (Maybe AacRateControlMode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AacSettings' {Maybe AacRateControlMode
rateControlMode :: Maybe AacRateControlMode
$sel:rateControlMode:AacSettings' :: AacSettings -> Maybe AacRateControlMode
rateControlMode} -> Maybe AacRateControlMode
rateControlMode) (\s :: AacSettings
s@AacSettings' {} Maybe AacRateControlMode
a -> AacSettings
s {$sel:rateControlMode:AacSettings' :: Maybe AacRateControlMode
rateControlMode = Maybe AacRateControlMode
a} :: AacSettings)

-- | Sample rate in Hz. Valid values depend on rate control mode and profile.
aacSettings_sampleRate :: Lens.Lens' AacSettings (Prelude.Maybe Prelude.Double)
aacSettings_sampleRate :: (Maybe Double -> f (Maybe Double)) -> AacSettings -> f AacSettings
aacSettings_sampleRate = (AacSettings -> Maybe Double)
-> (AacSettings -> Maybe Double -> AacSettings)
-> Lens AacSettings AacSettings (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AacSettings' {Maybe Double
sampleRate :: Maybe Double
$sel:sampleRate:AacSettings' :: AacSettings -> Maybe Double
sampleRate} -> Maybe Double
sampleRate) (\s :: AacSettings
s@AacSettings' {} Maybe Double
a -> AacSettings
s {$sel:sampleRate:AacSettings' :: Maybe Double
sampleRate = Maybe Double
a} :: AacSettings)

-- | Use MPEG-2 AAC audio instead of MPEG-4 AAC audio for raw or MPEG-2
-- Transport Stream containers.
aacSettings_spec :: Lens.Lens' AacSettings (Prelude.Maybe AacSpec)
aacSettings_spec :: (Maybe AacSpec -> f (Maybe AacSpec))
-> AacSettings -> f AacSettings
aacSettings_spec = (AacSettings -> Maybe AacSpec)
-> (AacSettings -> Maybe AacSpec -> AacSettings)
-> Lens AacSettings AacSettings (Maybe AacSpec) (Maybe AacSpec)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AacSettings' {Maybe AacSpec
spec :: Maybe AacSpec
$sel:spec:AacSettings' :: AacSettings -> Maybe AacSpec
spec} -> Maybe AacSpec
spec) (\s :: AacSettings
s@AacSettings' {} Maybe AacSpec
a -> AacSettings
s {$sel:spec:AacSettings' :: Maybe AacSpec
spec = Maybe AacSpec
a} :: AacSettings)

-- | Average bitrate in bits\/second. Valid values depend on rate control
-- mode and profile.
aacSettings_bitrate :: Lens.Lens' AacSettings (Prelude.Maybe Prelude.Double)
aacSettings_bitrate :: (Maybe Double -> f (Maybe Double)) -> AacSettings -> f AacSettings
aacSettings_bitrate = (AacSettings -> Maybe Double)
-> (AacSettings -> Maybe Double -> AacSettings)
-> Lens AacSettings AacSettings (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AacSettings' {Maybe Double
bitrate :: Maybe Double
$sel:bitrate:AacSettings' :: AacSettings -> Maybe Double
bitrate} -> Maybe Double
bitrate) (\s :: AacSettings
s@AacSettings' {} Maybe Double
a -> AacSettings
s {$sel:bitrate:AacSettings' :: Maybe Double
bitrate = Maybe Double
a} :: AacSettings)

-- | VBR Quality Level - Only used if rateControlMode is VBR.
aacSettings_vbrQuality :: Lens.Lens' AacSettings (Prelude.Maybe AacVbrQuality)
aacSettings_vbrQuality :: (Maybe AacVbrQuality -> f (Maybe AacVbrQuality))
-> AacSettings -> f AacSettings
aacSettings_vbrQuality = (AacSettings -> Maybe AacVbrQuality)
-> (AacSettings -> Maybe AacVbrQuality -> AacSettings)
-> Lens
     AacSettings AacSettings (Maybe AacVbrQuality) (Maybe AacVbrQuality)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AacSettings' {Maybe AacVbrQuality
vbrQuality :: Maybe AacVbrQuality
$sel:vbrQuality:AacSettings' :: AacSettings -> Maybe AacVbrQuality
vbrQuality} -> Maybe AacVbrQuality
vbrQuality) (\s :: AacSettings
s@AacSettings' {} Maybe AacVbrQuality
a -> AacSettings
s {$sel:vbrQuality:AacSettings' :: Maybe AacVbrQuality
vbrQuality = Maybe AacVbrQuality
a} :: AacSettings)

-- | Set to \"broadcasterMixedAd\" when input contains pre-mixed main audio +
-- AD (narration) as a stereo pair. The Audio Type field (audioType) will
-- be set to 3, which signals to downstream systems that this stream
-- contains \"broadcaster mixed AD\". Note that the input received by the
-- encoder must contain pre-mixed audio; the encoder does not perform the
-- mixing. The values in audioTypeControl and audioType (in
-- AudioDescription) are ignored when set to broadcasterMixedAd. Leave set
-- to \"normal\" when input does not contain pre-mixed audio + AD.
aacSettings_inputType :: Lens.Lens' AacSettings (Prelude.Maybe AacInputType)
aacSettings_inputType :: (Maybe AacInputType -> f (Maybe AacInputType))
-> AacSettings -> f AacSettings
aacSettings_inputType = (AacSettings -> Maybe AacInputType)
-> (AacSettings -> Maybe AacInputType -> AacSettings)
-> Lens
     AacSettings AacSettings (Maybe AacInputType) (Maybe AacInputType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AacSettings' {Maybe AacInputType
inputType :: Maybe AacInputType
$sel:inputType:AacSettings' :: AacSettings -> Maybe AacInputType
inputType} -> Maybe AacInputType
inputType) (\s :: AacSettings
s@AacSettings' {} Maybe AacInputType
a -> AacSettings
s {$sel:inputType:AacSettings' :: Maybe AacInputType
inputType = Maybe AacInputType
a} :: AacSettings)

instance Core.FromJSON AacSettings where
  parseJSON :: Value -> Parser AacSettings
parseJSON =
    String
-> (Object -> Parser AacSettings) -> Value -> Parser AacSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AacSettings"
      ( \Object
x ->
          Maybe AacRawFormat
-> Maybe AacCodingMode
-> Maybe AacProfile
-> Maybe AacRateControlMode
-> Maybe Double
-> Maybe AacSpec
-> Maybe Double
-> Maybe AacVbrQuality
-> Maybe AacInputType
-> AacSettings
AacSettings'
            (Maybe AacRawFormat
 -> Maybe AacCodingMode
 -> Maybe AacProfile
 -> Maybe AacRateControlMode
 -> Maybe Double
 -> Maybe AacSpec
 -> Maybe Double
 -> Maybe AacVbrQuality
 -> Maybe AacInputType
 -> AacSettings)
-> Parser (Maybe AacRawFormat)
-> Parser
     (Maybe AacCodingMode
      -> Maybe AacProfile
      -> Maybe AacRateControlMode
      -> Maybe Double
      -> Maybe AacSpec
      -> Maybe Double
      -> Maybe AacVbrQuality
      -> Maybe AacInputType
      -> AacSettings)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe AacRawFormat)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"rawFormat")
            Parser
  (Maybe AacCodingMode
   -> Maybe AacProfile
   -> Maybe AacRateControlMode
   -> Maybe Double
   -> Maybe AacSpec
   -> Maybe Double
   -> Maybe AacVbrQuality
   -> Maybe AacInputType
   -> AacSettings)
-> Parser (Maybe AacCodingMode)
-> Parser
     (Maybe AacProfile
      -> Maybe AacRateControlMode
      -> Maybe Double
      -> Maybe AacSpec
      -> Maybe Double
      -> Maybe AacVbrQuality
      -> Maybe AacInputType
      -> AacSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AacCodingMode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"codingMode")
            Parser
  (Maybe AacProfile
   -> Maybe AacRateControlMode
   -> Maybe Double
   -> Maybe AacSpec
   -> Maybe Double
   -> Maybe AacVbrQuality
   -> Maybe AacInputType
   -> AacSettings)
-> Parser (Maybe AacProfile)
-> Parser
     (Maybe AacRateControlMode
      -> Maybe Double
      -> Maybe AacSpec
      -> Maybe Double
      -> Maybe AacVbrQuality
      -> Maybe AacInputType
      -> AacSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AacProfile)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"profile")
            Parser
  (Maybe AacRateControlMode
   -> Maybe Double
   -> Maybe AacSpec
   -> Maybe Double
   -> Maybe AacVbrQuality
   -> Maybe AacInputType
   -> AacSettings)
-> Parser (Maybe AacRateControlMode)
-> Parser
     (Maybe Double
      -> Maybe AacSpec
      -> Maybe Double
      -> Maybe AacVbrQuality
      -> Maybe AacInputType
      -> AacSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AacRateControlMode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"rateControlMode")
            Parser
  (Maybe Double
   -> Maybe AacSpec
   -> Maybe Double
   -> Maybe AacVbrQuality
   -> Maybe AacInputType
   -> AacSettings)
-> Parser (Maybe Double)
-> Parser
     (Maybe AacSpec
      -> Maybe Double
      -> Maybe AacVbrQuality
      -> Maybe AacInputType
      -> AacSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"sampleRate")
            Parser
  (Maybe AacSpec
   -> Maybe Double
   -> Maybe AacVbrQuality
   -> Maybe AacInputType
   -> AacSettings)
-> Parser (Maybe AacSpec)
-> Parser
     (Maybe Double
      -> Maybe AacVbrQuality -> Maybe AacInputType -> AacSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AacSpec)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"spec")
            Parser
  (Maybe Double
   -> Maybe AacVbrQuality -> Maybe AacInputType -> AacSettings)
-> Parser (Maybe Double)
-> Parser
     (Maybe AacVbrQuality -> Maybe AacInputType -> AacSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"bitrate")
            Parser (Maybe AacVbrQuality -> Maybe AacInputType -> AacSettings)
-> Parser (Maybe AacVbrQuality)
-> Parser (Maybe AacInputType -> AacSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AacVbrQuality)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"vbrQuality")
            Parser (Maybe AacInputType -> AacSettings)
-> Parser (Maybe AacInputType) -> Parser AacSettings
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AacInputType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"inputType")
      )

instance Prelude.Hashable AacSettings

instance Prelude.NFData AacSettings

instance Core.ToJSON AacSettings where
  toJSON :: AacSettings -> Value
toJSON AacSettings' {Maybe Double
Maybe AacCodingMode
Maybe AacInputType
Maybe AacProfile
Maybe AacRateControlMode
Maybe AacRawFormat
Maybe AacSpec
Maybe AacVbrQuality
inputType :: Maybe AacInputType
vbrQuality :: Maybe AacVbrQuality
bitrate :: Maybe Double
spec :: Maybe AacSpec
sampleRate :: Maybe Double
rateControlMode :: Maybe AacRateControlMode
profile :: Maybe AacProfile
codingMode :: Maybe AacCodingMode
rawFormat :: Maybe AacRawFormat
$sel:inputType:AacSettings' :: AacSettings -> Maybe AacInputType
$sel:vbrQuality:AacSettings' :: AacSettings -> Maybe AacVbrQuality
$sel:bitrate:AacSettings' :: AacSettings -> Maybe Double
$sel:spec:AacSettings' :: AacSettings -> Maybe AacSpec
$sel:sampleRate:AacSettings' :: AacSettings -> Maybe Double
$sel:rateControlMode:AacSettings' :: AacSettings -> Maybe AacRateControlMode
$sel:profile:AacSettings' :: AacSettings -> Maybe AacProfile
$sel:codingMode:AacSettings' :: AacSettings -> Maybe AacCodingMode
$sel:rawFormat:AacSettings' :: AacSettings -> Maybe AacRawFormat
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"rawFormat" Text -> AacRawFormat -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (AacRawFormat -> Pair) -> Maybe AacRawFormat -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AacRawFormat
rawFormat,
            (Text
"codingMode" Text -> AacCodingMode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (AacCodingMode -> Pair) -> Maybe AacCodingMode -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AacCodingMode
codingMode,
            (Text
"profile" Text -> AacProfile -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (AacProfile -> Pair) -> Maybe AacProfile -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AacProfile
profile,
            (Text
"rateControlMode" Text -> AacRateControlMode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AacRateControlMode -> Pair)
-> Maybe AacRateControlMode -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AacRateControlMode
rateControlMode,
            (Text
"sampleRate" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Double -> Pair) -> Maybe Double -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
sampleRate,
            (Text
"spec" Text -> AacSpec -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (AacSpec -> Pair) -> Maybe AacSpec -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AacSpec
spec,
            (Text
"bitrate" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Double -> Pair) -> Maybe Double -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
bitrate,
            (Text
"vbrQuality" Text -> AacVbrQuality -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (AacVbrQuality -> Pair) -> Maybe AacVbrQuality -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AacVbrQuality
vbrQuality,
            (Text
"inputType" Text -> AacInputType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (AacInputType -> Pair) -> Maybe AacInputType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AacInputType
inputType
          ]
      )