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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaLive.Types.AacSettings
import Amazonka.MediaLive.Types.Ac3Settings
import Amazonka.MediaLive.Types.Eac3Settings
import Amazonka.MediaLive.Types.Mp2Settings
import Amazonka.MediaLive.Types.PassThroughSettings
import Amazonka.MediaLive.Types.WavSettings
import qualified Amazonka.Prelude as Prelude

-- | Audio Codec Settings
--
-- /See:/ 'newAudioCodecSettings' smart constructor.
data AudioCodecSettings = AudioCodecSettings'
  { AudioCodecSettings -> Maybe PassThroughSettings
passThroughSettings :: Prelude.Maybe PassThroughSettings,
    AudioCodecSettings -> Maybe Ac3Settings
ac3Settings :: Prelude.Maybe Ac3Settings,
    AudioCodecSettings -> Maybe Mp2Settings
mp2Settings :: Prelude.Maybe Mp2Settings,
    AudioCodecSettings -> Maybe WavSettings
wavSettings :: Prelude.Maybe WavSettings,
    AudioCodecSettings -> Maybe AacSettings
aacSettings :: Prelude.Maybe AacSettings,
    AudioCodecSettings -> Maybe Eac3Settings
eac3Settings :: Prelude.Maybe Eac3Settings
  }
  deriving (AudioCodecSettings -> AudioCodecSettings -> Bool
(AudioCodecSettings -> AudioCodecSettings -> Bool)
-> (AudioCodecSettings -> AudioCodecSettings -> Bool)
-> Eq AudioCodecSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AudioCodecSettings -> AudioCodecSettings -> Bool
$c/= :: AudioCodecSettings -> AudioCodecSettings -> Bool
== :: AudioCodecSettings -> AudioCodecSettings -> Bool
$c== :: AudioCodecSettings -> AudioCodecSettings -> Bool
Prelude.Eq, ReadPrec [AudioCodecSettings]
ReadPrec AudioCodecSettings
Int -> ReadS AudioCodecSettings
ReadS [AudioCodecSettings]
(Int -> ReadS AudioCodecSettings)
-> ReadS [AudioCodecSettings]
-> ReadPrec AudioCodecSettings
-> ReadPrec [AudioCodecSettings]
-> Read AudioCodecSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AudioCodecSettings]
$creadListPrec :: ReadPrec [AudioCodecSettings]
readPrec :: ReadPrec AudioCodecSettings
$creadPrec :: ReadPrec AudioCodecSettings
readList :: ReadS [AudioCodecSettings]
$creadList :: ReadS [AudioCodecSettings]
readsPrec :: Int -> ReadS AudioCodecSettings
$creadsPrec :: Int -> ReadS AudioCodecSettings
Prelude.Read, Int -> AudioCodecSettings -> ShowS
[AudioCodecSettings] -> ShowS
AudioCodecSettings -> String
(Int -> AudioCodecSettings -> ShowS)
-> (AudioCodecSettings -> String)
-> ([AudioCodecSettings] -> ShowS)
-> Show AudioCodecSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AudioCodecSettings] -> ShowS
$cshowList :: [AudioCodecSettings] -> ShowS
show :: AudioCodecSettings -> String
$cshow :: AudioCodecSettings -> String
showsPrec :: Int -> AudioCodecSettings -> ShowS
$cshowsPrec :: Int -> AudioCodecSettings -> ShowS
Prelude.Show, (forall x. AudioCodecSettings -> Rep AudioCodecSettings x)
-> (forall x. Rep AudioCodecSettings x -> AudioCodecSettings)
-> Generic AudioCodecSettings
forall x. Rep AudioCodecSettings x -> AudioCodecSettings
forall x. AudioCodecSettings -> Rep AudioCodecSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AudioCodecSettings x -> AudioCodecSettings
$cfrom :: forall x. AudioCodecSettings -> Rep AudioCodecSettings x
Prelude.Generic)

-- |
-- Create a value of 'AudioCodecSettings' 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:
--
-- 'passThroughSettings', 'audioCodecSettings_passThroughSettings' - Undocumented member.
--
-- 'ac3Settings', 'audioCodecSettings_ac3Settings' - Undocumented member.
--
-- 'mp2Settings', 'audioCodecSettings_mp2Settings' - Undocumented member.
--
-- 'wavSettings', 'audioCodecSettings_wavSettings' - Undocumented member.
--
-- 'aacSettings', 'audioCodecSettings_aacSettings' - Undocumented member.
--
-- 'eac3Settings', 'audioCodecSettings_eac3Settings' - Undocumented member.
newAudioCodecSettings ::
  AudioCodecSettings
newAudioCodecSettings :: AudioCodecSettings
newAudioCodecSettings =
  AudioCodecSettings' :: Maybe PassThroughSettings
-> Maybe Ac3Settings
-> Maybe Mp2Settings
-> Maybe WavSettings
-> Maybe AacSettings
-> Maybe Eac3Settings
-> AudioCodecSettings
AudioCodecSettings'
    { $sel:passThroughSettings:AudioCodecSettings' :: Maybe PassThroughSettings
passThroughSettings =
        Maybe PassThroughSettings
forall a. Maybe a
Prelude.Nothing,
      $sel:ac3Settings:AudioCodecSettings' :: Maybe Ac3Settings
ac3Settings = Maybe Ac3Settings
forall a. Maybe a
Prelude.Nothing,
      $sel:mp2Settings:AudioCodecSettings' :: Maybe Mp2Settings
mp2Settings = Maybe Mp2Settings
forall a. Maybe a
Prelude.Nothing,
      $sel:wavSettings:AudioCodecSettings' :: Maybe WavSettings
wavSettings = Maybe WavSettings
forall a. Maybe a
Prelude.Nothing,
      $sel:aacSettings:AudioCodecSettings' :: Maybe AacSettings
aacSettings = Maybe AacSettings
forall a. Maybe a
Prelude.Nothing,
      $sel:eac3Settings:AudioCodecSettings' :: Maybe Eac3Settings
eac3Settings = Maybe Eac3Settings
forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
audioCodecSettings_passThroughSettings :: Lens.Lens' AudioCodecSettings (Prelude.Maybe PassThroughSettings)
audioCodecSettings_passThroughSettings :: (Maybe PassThroughSettings -> f (Maybe PassThroughSettings))
-> AudioCodecSettings -> f AudioCodecSettings
audioCodecSettings_passThroughSettings = (AudioCodecSettings -> Maybe PassThroughSettings)
-> (AudioCodecSettings
    -> Maybe PassThroughSettings -> AudioCodecSettings)
-> Lens
     AudioCodecSettings
     AudioCodecSettings
     (Maybe PassThroughSettings)
     (Maybe PassThroughSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AudioCodecSettings' {Maybe PassThroughSettings
passThroughSettings :: Maybe PassThroughSettings
$sel:passThroughSettings:AudioCodecSettings' :: AudioCodecSettings -> Maybe PassThroughSettings
passThroughSettings} -> Maybe PassThroughSettings
passThroughSettings) (\s :: AudioCodecSettings
s@AudioCodecSettings' {} Maybe PassThroughSettings
a -> AudioCodecSettings
s {$sel:passThroughSettings:AudioCodecSettings' :: Maybe PassThroughSettings
passThroughSettings = Maybe PassThroughSettings
a} :: AudioCodecSettings)

-- | Undocumented member.
audioCodecSettings_ac3Settings :: Lens.Lens' AudioCodecSettings (Prelude.Maybe Ac3Settings)
audioCodecSettings_ac3Settings :: (Maybe Ac3Settings -> f (Maybe Ac3Settings))
-> AudioCodecSettings -> f AudioCodecSettings
audioCodecSettings_ac3Settings = (AudioCodecSettings -> Maybe Ac3Settings)
-> (AudioCodecSettings -> Maybe Ac3Settings -> AudioCodecSettings)
-> Lens
     AudioCodecSettings
     AudioCodecSettings
     (Maybe Ac3Settings)
     (Maybe Ac3Settings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AudioCodecSettings' {Maybe Ac3Settings
ac3Settings :: Maybe Ac3Settings
$sel:ac3Settings:AudioCodecSettings' :: AudioCodecSettings -> Maybe Ac3Settings
ac3Settings} -> Maybe Ac3Settings
ac3Settings) (\s :: AudioCodecSettings
s@AudioCodecSettings' {} Maybe Ac3Settings
a -> AudioCodecSettings
s {$sel:ac3Settings:AudioCodecSettings' :: Maybe Ac3Settings
ac3Settings = Maybe Ac3Settings
a} :: AudioCodecSettings)

-- | Undocumented member.
audioCodecSettings_mp2Settings :: Lens.Lens' AudioCodecSettings (Prelude.Maybe Mp2Settings)
audioCodecSettings_mp2Settings :: (Maybe Mp2Settings -> f (Maybe Mp2Settings))
-> AudioCodecSettings -> f AudioCodecSettings
audioCodecSettings_mp2Settings = (AudioCodecSettings -> Maybe Mp2Settings)
-> (AudioCodecSettings -> Maybe Mp2Settings -> AudioCodecSettings)
-> Lens
     AudioCodecSettings
     AudioCodecSettings
     (Maybe Mp2Settings)
     (Maybe Mp2Settings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AudioCodecSettings' {Maybe Mp2Settings
mp2Settings :: Maybe Mp2Settings
$sel:mp2Settings:AudioCodecSettings' :: AudioCodecSettings -> Maybe Mp2Settings
mp2Settings} -> Maybe Mp2Settings
mp2Settings) (\s :: AudioCodecSettings
s@AudioCodecSettings' {} Maybe Mp2Settings
a -> AudioCodecSettings
s {$sel:mp2Settings:AudioCodecSettings' :: Maybe Mp2Settings
mp2Settings = Maybe Mp2Settings
a} :: AudioCodecSettings)

-- | Undocumented member.
audioCodecSettings_wavSettings :: Lens.Lens' AudioCodecSettings (Prelude.Maybe WavSettings)
audioCodecSettings_wavSettings :: (Maybe WavSettings -> f (Maybe WavSettings))
-> AudioCodecSettings -> f AudioCodecSettings
audioCodecSettings_wavSettings = (AudioCodecSettings -> Maybe WavSettings)
-> (AudioCodecSettings -> Maybe WavSettings -> AudioCodecSettings)
-> Lens
     AudioCodecSettings
     AudioCodecSettings
     (Maybe WavSettings)
     (Maybe WavSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AudioCodecSettings' {Maybe WavSettings
wavSettings :: Maybe WavSettings
$sel:wavSettings:AudioCodecSettings' :: AudioCodecSettings -> Maybe WavSettings
wavSettings} -> Maybe WavSettings
wavSettings) (\s :: AudioCodecSettings
s@AudioCodecSettings' {} Maybe WavSettings
a -> AudioCodecSettings
s {$sel:wavSettings:AudioCodecSettings' :: Maybe WavSettings
wavSettings = Maybe WavSettings
a} :: AudioCodecSettings)

-- | Undocumented member.
audioCodecSettings_aacSettings :: Lens.Lens' AudioCodecSettings (Prelude.Maybe AacSettings)
audioCodecSettings_aacSettings :: (Maybe AacSettings -> f (Maybe AacSettings))
-> AudioCodecSettings -> f AudioCodecSettings
audioCodecSettings_aacSettings = (AudioCodecSettings -> Maybe AacSettings)
-> (AudioCodecSettings -> Maybe AacSettings -> AudioCodecSettings)
-> Lens
     AudioCodecSettings
     AudioCodecSettings
     (Maybe AacSettings)
     (Maybe AacSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AudioCodecSettings' {Maybe AacSettings
aacSettings :: Maybe AacSettings
$sel:aacSettings:AudioCodecSettings' :: AudioCodecSettings -> Maybe AacSettings
aacSettings} -> Maybe AacSettings
aacSettings) (\s :: AudioCodecSettings
s@AudioCodecSettings' {} Maybe AacSettings
a -> AudioCodecSettings
s {$sel:aacSettings:AudioCodecSettings' :: Maybe AacSettings
aacSettings = Maybe AacSettings
a} :: AudioCodecSettings)

-- | Undocumented member.
audioCodecSettings_eac3Settings :: Lens.Lens' AudioCodecSettings (Prelude.Maybe Eac3Settings)
audioCodecSettings_eac3Settings :: (Maybe Eac3Settings -> f (Maybe Eac3Settings))
-> AudioCodecSettings -> f AudioCodecSettings
audioCodecSettings_eac3Settings = (AudioCodecSettings -> Maybe Eac3Settings)
-> (AudioCodecSettings -> Maybe Eac3Settings -> AudioCodecSettings)
-> Lens
     AudioCodecSettings
     AudioCodecSettings
     (Maybe Eac3Settings)
     (Maybe Eac3Settings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AudioCodecSettings' {Maybe Eac3Settings
eac3Settings :: Maybe Eac3Settings
$sel:eac3Settings:AudioCodecSettings' :: AudioCodecSettings -> Maybe Eac3Settings
eac3Settings} -> Maybe Eac3Settings
eac3Settings) (\s :: AudioCodecSettings
s@AudioCodecSettings' {} Maybe Eac3Settings
a -> AudioCodecSettings
s {$sel:eac3Settings:AudioCodecSettings' :: Maybe Eac3Settings
eac3Settings = Maybe Eac3Settings
a} :: AudioCodecSettings)

instance Core.FromJSON AudioCodecSettings where
  parseJSON :: Value -> Parser AudioCodecSettings
parseJSON =
    String
-> (Object -> Parser AudioCodecSettings)
-> Value
-> Parser AudioCodecSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AudioCodecSettings"
      ( \Object
x ->
          Maybe PassThroughSettings
-> Maybe Ac3Settings
-> Maybe Mp2Settings
-> Maybe WavSettings
-> Maybe AacSettings
-> Maybe Eac3Settings
-> AudioCodecSettings
AudioCodecSettings'
            (Maybe PassThroughSettings
 -> Maybe Ac3Settings
 -> Maybe Mp2Settings
 -> Maybe WavSettings
 -> Maybe AacSettings
 -> Maybe Eac3Settings
 -> AudioCodecSettings)
-> Parser (Maybe PassThroughSettings)
-> Parser
     (Maybe Ac3Settings
      -> Maybe Mp2Settings
      -> Maybe WavSettings
      -> Maybe AacSettings
      -> Maybe Eac3Settings
      -> AudioCodecSettings)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe PassThroughSettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"passThroughSettings")
            Parser
  (Maybe Ac3Settings
   -> Maybe Mp2Settings
   -> Maybe WavSettings
   -> Maybe AacSettings
   -> Maybe Eac3Settings
   -> AudioCodecSettings)
-> Parser (Maybe Ac3Settings)
-> Parser
     (Maybe Mp2Settings
      -> Maybe WavSettings
      -> Maybe AacSettings
      -> Maybe Eac3Settings
      -> AudioCodecSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Ac3Settings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ac3Settings")
            Parser
  (Maybe Mp2Settings
   -> Maybe WavSettings
   -> Maybe AacSettings
   -> Maybe Eac3Settings
   -> AudioCodecSettings)
-> Parser (Maybe Mp2Settings)
-> Parser
     (Maybe WavSettings
      -> Maybe AacSettings -> Maybe Eac3Settings -> AudioCodecSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Mp2Settings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"mp2Settings")
            Parser
  (Maybe WavSettings
   -> Maybe AacSettings -> Maybe Eac3Settings -> AudioCodecSettings)
-> Parser (Maybe WavSettings)
-> Parser
     (Maybe AacSettings -> Maybe Eac3Settings -> AudioCodecSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe WavSettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"wavSettings")
            Parser
  (Maybe AacSettings -> Maybe Eac3Settings -> AudioCodecSettings)
-> Parser (Maybe AacSettings)
-> Parser (Maybe Eac3Settings -> AudioCodecSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AacSettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"aacSettings")
            Parser (Maybe Eac3Settings -> AudioCodecSettings)
-> Parser (Maybe Eac3Settings) -> Parser AudioCodecSettings
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Eac3Settings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"eac3Settings")
      )

instance Prelude.Hashable AudioCodecSettings

instance Prelude.NFData AudioCodecSettings

instance Core.ToJSON AudioCodecSettings where
  toJSON :: AudioCodecSettings -> Value
toJSON AudioCodecSettings' {Maybe AacSettings
Maybe Ac3Settings
Maybe Eac3Settings
Maybe Mp2Settings
Maybe PassThroughSettings
Maybe WavSettings
eac3Settings :: Maybe Eac3Settings
aacSettings :: Maybe AacSettings
wavSettings :: Maybe WavSettings
mp2Settings :: Maybe Mp2Settings
ac3Settings :: Maybe Ac3Settings
passThroughSettings :: Maybe PassThroughSettings
$sel:eac3Settings:AudioCodecSettings' :: AudioCodecSettings -> Maybe Eac3Settings
$sel:aacSettings:AudioCodecSettings' :: AudioCodecSettings -> Maybe AacSettings
$sel:wavSettings:AudioCodecSettings' :: AudioCodecSettings -> Maybe WavSettings
$sel:mp2Settings:AudioCodecSettings' :: AudioCodecSettings -> Maybe Mp2Settings
$sel:ac3Settings:AudioCodecSettings' :: AudioCodecSettings -> Maybe Ac3Settings
$sel:passThroughSettings:AudioCodecSettings' :: AudioCodecSettings -> Maybe PassThroughSettings
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"passThroughSettings" Text -> PassThroughSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (PassThroughSettings -> Pair)
-> Maybe PassThroughSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe PassThroughSettings
passThroughSettings,
            (Text
"ac3Settings" Text -> Ac3Settings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Ac3Settings -> Pair) -> Maybe Ac3Settings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Ac3Settings
ac3Settings,
            (Text
"mp2Settings" Text -> Mp2Settings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Mp2Settings -> Pair) -> Maybe Mp2Settings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Mp2Settings
mp2Settings,
            (Text
"wavSettings" Text -> WavSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (WavSettings -> Pair) -> Maybe WavSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe WavSettings
wavSettings,
            (Text
"aacSettings" Text -> AacSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (AacSettings -> Pair) -> Maybe AacSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AacSettings
aacSettings,
            (Text
"eac3Settings" Text -> Eac3Settings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Eac3Settings -> Pair) -> Maybe Eac3Settings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Eac3Settings
eac3Settings
          ]
      )