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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaLive.Types.Fmp4NielsenId3Behavior
import Amazonka.MediaLive.Types.Fmp4TimedMetadataBehavior
import qualified Amazonka.Prelude as Prelude

-- | Fmp4 Hls Settings
--
-- /See:/ 'newFmp4HlsSettings' smart constructor.
data Fmp4HlsSettings = Fmp4HlsSettings'
  { -- | If set to passthrough, Nielsen inaudible tones for media tracking will
    -- be detected in the input audio and an equivalent ID3 tag will be
    -- inserted in the output.
    Fmp4HlsSettings -> Maybe Fmp4NielsenId3Behavior
nielsenId3Behavior :: Prelude.Maybe Fmp4NielsenId3Behavior,
    -- | List all the audio groups that are used with the video output stream.
    -- Input all the audio GROUP-IDs that are associated to the video, separate
    -- by \',\'.
    Fmp4HlsSettings -> Maybe Text
audioRenditionSets :: Prelude.Maybe Prelude.Text,
    -- | When set to passthrough, timed metadata is passed through from input to
    -- output.
    Fmp4HlsSettings -> Maybe Fmp4TimedMetadataBehavior
timedMetadataBehavior :: Prelude.Maybe Fmp4TimedMetadataBehavior
  }
  deriving (Fmp4HlsSettings -> Fmp4HlsSettings -> Bool
(Fmp4HlsSettings -> Fmp4HlsSettings -> Bool)
-> (Fmp4HlsSettings -> Fmp4HlsSettings -> Bool)
-> Eq Fmp4HlsSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Fmp4HlsSettings -> Fmp4HlsSettings -> Bool
$c/= :: Fmp4HlsSettings -> Fmp4HlsSettings -> Bool
== :: Fmp4HlsSettings -> Fmp4HlsSettings -> Bool
$c== :: Fmp4HlsSettings -> Fmp4HlsSettings -> Bool
Prelude.Eq, ReadPrec [Fmp4HlsSettings]
ReadPrec Fmp4HlsSettings
Int -> ReadS Fmp4HlsSettings
ReadS [Fmp4HlsSettings]
(Int -> ReadS Fmp4HlsSettings)
-> ReadS [Fmp4HlsSettings]
-> ReadPrec Fmp4HlsSettings
-> ReadPrec [Fmp4HlsSettings]
-> Read Fmp4HlsSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Fmp4HlsSettings]
$creadListPrec :: ReadPrec [Fmp4HlsSettings]
readPrec :: ReadPrec Fmp4HlsSettings
$creadPrec :: ReadPrec Fmp4HlsSettings
readList :: ReadS [Fmp4HlsSettings]
$creadList :: ReadS [Fmp4HlsSettings]
readsPrec :: Int -> ReadS Fmp4HlsSettings
$creadsPrec :: Int -> ReadS Fmp4HlsSettings
Prelude.Read, Int -> Fmp4HlsSettings -> ShowS
[Fmp4HlsSettings] -> ShowS
Fmp4HlsSettings -> String
(Int -> Fmp4HlsSettings -> ShowS)
-> (Fmp4HlsSettings -> String)
-> ([Fmp4HlsSettings] -> ShowS)
-> Show Fmp4HlsSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Fmp4HlsSettings] -> ShowS
$cshowList :: [Fmp4HlsSettings] -> ShowS
show :: Fmp4HlsSettings -> String
$cshow :: Fmp4HlsSettings -> String
showsPrec :: Int -> Fmp4HlsSettings -> ShowS
$cshowsPrec :: Int -> Fmp4HlsSettings -> ShowS
Prelude.Show, (forall x. Fmp4HlsSettings -> Rep Fmp4HlsSettings x)
-> (forall x. Rep Fmp4HlsSettings x -> Fmp4HlsSettings)
-> Generic Fmp4HlsSettings
forall x. Rep Fmp4HlsSettings x -> Fmp4HlsSettings
forall x. Fmp4HlsSettings -> Rep Fmp4HlsSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Fmp4HlsSettings x -> Fmp4HlsSettings
$cfrom :: forall x. Fmp4HlsSettings -> Rep Fmp4HlsSettings x
Prelude.Generic)

-- |
-- Create a value of 'Fmp4HlsSettings' 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:
--
-- 'nielsenId3Behavior', 'fmp4HlsSettings_nielsenId3Behavior' - If set to passthrough, Nielsen inaudible tones for media tracking will
-- be detected in the input audio and an equivalent ID3 tag will be
-- inserted in the output.
--
-- 'audioRenditionSets', 'fmp4HlsSettings_audioRenditionSets' - List all the audio groups that are used with the video output stream.
-- Input all the audio GROUP-IDs that are associated to the video, separate
-- by \',\'.
--
-- 'timedMetadataBehavior', 'fmp4HlsSettings_timedMetadataBehavior' - When set to passthrough, timed metadata is passed through from input to
-- output.
newFmp4HlsSettings ::
  Fmp4HlsSettings
newFmp4HlsSettings :: Fmp4HlsSettings
newFmp4HlsSettings =
  Fmp4HlsSettings' :: Maybe Fmp4NielsenId3Behavior
-> Maybe Text -> Maybe Fmp4TimedMetadataBehavior -> Fmp4HlsSettings
Fmp4HlsSettings'
    { $sel:nielsenId3Behavior:Fmp4HlsSettings' :: Maybe Fmp4NielsenId3Behavior
nielsenId3Behavior =
        Maybe Fmp4NielsenId3Behavior
forall a. Maybe a
Prelude.Nothing,
      $sel:audioRenditionSets:Fmp4HlsSettings' :: Maybe Text
audioRenditionSets = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:timedMetadataBehavior:Fmp4HlsSettings' :: Maybe Fmp4TimedMetadataBehavior
timedMetadataBehavior = Maybe Fmp4TimedMetadataBehavior
forall a. Maybe a
Prelude.Nothing
    }

-- | If set to passthrough, Nielsen inaudible tones for media tracking will
-- be detected in the input audio and an equivalent ID3 tag will be
-- inserted in the output.
fmp4HlsSettings_nielsenId3Behavior :: Lens.Lens' Fmp4HlsSettings (Prelude.Maybe Fmp4NielsenId3Behavior)
fmp4HlsSettings_nielsenId3Behavior :: (Maybe Fmp4NielsenId3Behavior -> f (Maybe Fmp4NielsenId3Behavior))
-> Fmp4HlsSettings -> f Fmp4HlsSettings
fmp4HlsSettings_nielsenId3Behavior = (Fmp4HlsSettings -> Maybe Fmp4NielsenId3Behavior)
-> (Fmp4HlsSettings
    -> Maybe Fmp4NielsenId3Behavior -> Fmp4HlsSettings)
-> Lens
     Fmp4HlsSettings
     Fmp4HlsSettings
     (Maybe Fmp4NielsenId3Behavior)
     (Maybe Fmp4NielsenId3Behavior)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Fmp4HlsSettings' {Maybe Fmp4NielsenId3Behavior
nielsenId3Behavior :: Maybe Fmp4NielsenId3Behavior
$sel:nielsenId3Behavior:Fmp4HlsSettings' :: Fmp4HlsSettings -> Maybe Fmp4NielsenId3Behavior
nielsenId3Behavior} -> Maybe Fmp4NielsenId3Behavior
nielsenId3Behavior) (\s :: Fmp4HlsSettings
s@Fmp4HlsSettings' {} Maybe Fmp4NielsenId3Behavior
a -> Fmp4HlsSettings
s {$sel:nielsenId3Behavior:Fmp4HlsSettings' :: Maybe Fmp4NielsenId3Behavior
nielsenId3Behavior = Maybe Fmp4NielsenId3Behavior
a} :: Fmp4HlsSettings)

-- | List all the audio groups that are used with the video output stream.
-- Input all the audio GROUP-IDs that are associated to the video, separate
-- by \',\'.
fmp4HlsSettings_audioRenditionSets :: Lens.Lens' Fmp4HlsSettings (Prelude.Maybe Prelude.Text)
fmp4HlsSettings_audioRenditionSets :: (Maybe Text -> f (Maybe Text))
-> Fmp4HlsSettings -> f Fmp4HlsSettings
fmp4HlsSettings_audioRenditionSets = (Fmp4HlsSettings -> Maybe Text)
-> (Fmp4HlsSettings -> Maybe Text -> Fmp4HlsSettings)
-> Lens Fmp4HlsSettings Fmp4HlsSettings (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Fmp4HlsSettings' {Maybe Text
audioRenditionSets :: Maybe Text
$sel:audioRenditionSets:Fmp4HlsSettings' :: Fmp4HlsSettings -> Maybe Text
audioRenditionSets} -> Maybe Text
audioRenditionSets) (\s :: Fmp4HlsSettings
s@Fmp4HlsSettings' {} Maybe Text
a -> Fmp4HlsSettings
s {$sel:audioRenditionSets:Fmp4HlsSettings' :: Maybe Text
audioRenditionSets = Maybe Text
a} :: Fmp4HlsSettings)

-- | When set to passthrough, timed metadata is passed through from input to
-- output.
fmp4HlsSettings_timedMetadataBehavior :: Lens.Lens' Fmp4HlsSettings (Prelude.Maybe Fmp4TimedMetadataBehavior)
fmp4HlsSettings_timedMetadataBehavior :: (Maybe Fmp4TimedMetadataBehavior
 -> f (Maybe Fmp4TimedMetadataBehavior))
-> Fmp4HlsSettings -> f Fmp4HlsSettings
fmp4HlsSettings_timedMetadataBehavior = (Fmp4HlsSettings -> Maybe Fmp4TimedMetadataBehavior)
-> (Fmp4HlsSettings
    -> Maybe Fmp4TimedMetadataBehavior -> Fmp4HlsSettings)
-> Lens
     Fmp4HlsSettings
     Fmp4HlsSettings
     (Maybe Fmp4TimedMetadataBehavior)
     (Maybe Fmp4TimedMetadataBehavior)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Fmp4HlsSettings' {Maybe Fmp4TimedMetadataBehavior
timedMetadataBehavior :: Maybe Fmp4TimedMetadataBehavior
$sel:timedMetadataBehavior:Fmp4HlsSettings' :: Fmp4HlsSettings -> Maybe Fmp4TimedMetadataBehavior
timedMetadataBehavior} -> Maybe Fmp4TimedMetadataBehavior
timedMetadataBehavior) (\s :: Fmp4HlsSettings
s@Fmp4HlsSettings' {} Maybe Fmp4TimedMetadataBehavior
a -> Fmp4HlsSettings
s {$sel:timedMetadataBehavior:Fmp4HlsSettings' :: Maybe Fmp4TimedMetadataBehavior
timedMetadataBehavior = Maybe Fmp4TimedMetadataBehavior
a} :: Fmp4HlsSettings)

instance Core.FromJSON Fmp4HlsSettings where
  parseJSON :: Value -> Parser Fmp4HlsSettings
parseJSON =
    String
-> (Object -> Parser Fmp4HlsSettings)
-> Value
-> Parser Fmp4HlsSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Fmp4HlsSettings"
      ( \Object
x ->
          Maybe Fmp4NielsenId3Behavior
-> Maybe Text -> Maybe Fmp4TimedMetadataBehavior -> Fmp4HlsSettings
Fmp4HlsSettings'
            (Maybe Fmp4NielsenId3Behavior
 -> Maybe Text
 -> Maybe Fmp4TimedMetadataBehavior
 -> Fmp4HlsSettings)
-> Parser (Maybe Fmp4NielsenId3Behavior)
-> Parser
     (Maybe Text -> Maybe Fmp4TimedMetadataBehavior -> Fmp4HlsSettings)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Fmp4NielsenId3Behavior)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"nielsenId3Behavior")
            Parser
  (Maybe Text -> Maybe Fmp4TimedMetadataBehavior -> Fmp4HlsSettings)
-> Parser (Maybe Text)
-> Parser (Maybe Fmp4TimedMetadataBehavior -> Fmp4HlsSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"audioRenditionSets")
            Parser (Maybe Fmp4TimedMetadataBehavior -> Fmp4HlsSettings)
-> Parser (Maybe Fmp4TimedMetadataBehavior)
-> Parser Fmp4HlsSettings
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Fmp4TimedMetadataBehavior)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"timedMetadataBehavior")
      )

instance Prelude.Hashable Fmp4HlsSettings

instance Prelude.NFData Fmp4HlsSettings

instance Core.ToJSON Fmp4HlsSettings where
  toJSON :: Fmp4HlsSettings -> Value
toJSON Fmp4HlsSettings' {Maybe Text
Maybe Fmp4NielsenId3Behavior
Maybe Fmp4TimedMetadataBehavior
timedMetadataBehavior :: Maybe Fmp4TimedMetadataBehavior
audioRenditionSets :: Maybe Text
nielsenId3Behavior :: Maybe Fmp4NielsenId3Behavior
$sel:timedMetadataBehavior:Fmp4HlsSettings' :: Fmp4HlsSettings -> Maybe Fmp4TimedMetadataBehavior
$sel:audioRenditionSets:Fmp4HlsSettings' :: Fmp4HlsSettings -> Maybe Text
$sel:nielsenId3Behavior:Fmp4HlsSettings' :: Fmp4HlsSettings -> Maybe Fmp4NielsenId3Behavior
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"nielsenId3Behavior" Text -> Fmp4NielsenId3Behavior -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Fmp4NielsenId3Behavior -> Pair)
-> Maybe Fmp4NielsenId3Behavior -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Fmp4NielsenId3Behavior
nielsenId3Behavior,
            (Text
"audioRenditionSets" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
audioRenditionSets,
            (Text
"timedMetadataBehavior" Text -> Fmp4TimedMetadataBehavior -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Fmp4TimedMetadataBehavior -> Pair)
-> Maybe Fmp4TimedMetadataBehavior -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Fmp4TimedMetadataBehavior
timedMetadataBehavior
          ]
      )