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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaLive.Types.HlsH265PackagingType
import Amazonka.MediaLive.Types.HlsSettings
import qualified Amazonka.Prelude as Prelude

-- | Hls Output Settings
--
-- /See:/ 'newHlsOutputSettings' smart constructor.
data HlsOutputSettings = HlsOutputSettings'
  { -- | Only applicable when this output is referencing an H.265 video
    -- description. Specifies whether MP4 segments should be packaged as HEV1
    -- or HVC1.
    HlsOutputSettings -> Maybe HlsH265PackagingType
h265PackagingType :: Prelude.Maybe HlsH265PackagingType,
    -- | String concatenated to end of segment filenames.
    HlsOutputSettings -> Maybe Text
segmentModifier :: Prelude.Maybe Prelude.Text,
    -- | String concatenated to the end of the destination filename. Accepts
    -- \\\"Format Identifiers\\\":#formatIdentifierParameters.
    HlsOutputSettings -> Maybe Text
nameModifier :: Prelude.Maybe Prelude.Text,
    -- | Settings regarding the underlying stream. These settings are different
    -- for audio-only outputs.
    HlsOutputSettings -> HlsSettings
hlsSettings :: HlsSettings
  }
  deriving (HlsOutputSettings -> HlsOutputSettings -> Bool
(HlsOutputSettings -> HlsOutputSettings -> Bool)
-> (HlsOutputSettings -> HlsOutputSettings -> Bool)
-> Eq HlsOutputSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HlsOutputSettings -> HlsOutputSettings -> Bool
$c/= :: HlsOutputSettings -> HlsOutputSettings -> Bool
== :: HlsOutputSettings -> HlsOutputSettings -> Bool
$c== :: HlsOutputSettings -> HlsOutputSettings -> Bool
Prelude.Eq, ReadPrec [HlsOutputSettings]
ReadPrec HlsOutputSettings
Int -> ReadS HlsOutputSettings
ReadS [HlsOutputSettings]
(Int -> ReadS HlsOutputSettings)
-> ReadS [HlsOutputSettings]
-> ReadPrec HlsOutputSettings
-> ReadPrec [HlsOutputSettings]
-> Read HlsOutputSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HlsOutputSettings]
$creadListPrec :: ReadPrec [HlsOutputSettings]
readPrec :: ReadPrec HlsOutputSettings
$creadPrec :: ReadPrec HlsOutputSettings
readList :: ReadS [HlsOutputSettings]
$creadList :: ReadS [HlsOutputSettings]
readsPrec :: Int -> ReadS HlsOutputSettings
$creadsPrec :: Int -> ReadS HlsOutputSettings
Prelude.Read, Int -> HlsOutputSettings -> ShowS
[HlsOutputSettings] -> ShowS
HlsOutputSettings -> String
(Int -> HlsOutputSettings -> ShowS)
-> (HlsOutputSettings -> String)
-> ([HlsOutputSettings] -> ShowS)
-> Show HlsOutputSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HlsOutputSettings] -> ShowS
$cshowList :: [HlsOutputSettings] -> ShowS
show :: HlsOutputSettings -> String
$cshow :: HlsOutputSettings -> String
showsPrec :: Int -> HlsOutputSettings -> ShowS
$cshowsPrec :: Int -> HlsOutputSettings -> ShowS
Prelude.Show, (forall x. HlsOutputSettings -> Rep HlsOutputSettings x)
-> (forall x. Rep HlsOutputSettings x -> HlsOutputSettings)
-> Generic HlsOutputSettings
forall x. Rep HlsOutputSettings x -> HlsOutputSettings
forall x. HlsOutputSettings -> Rep HlsOutputSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HlsOutputSettings x -> HlsOutputSettings
$cfrom :: forall x. HlsOutputSettings -> Rep HlsOutputSettings x
Prelude.Generic)

-- |
-- Create a value of 'HlsOutputSettings' 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:
--
-- 'h265PackagingType', 'hlsOutputSettings_h265PackagingType' - Only applicable when this output is referencing an H.265 video
-- description. Specifies whether MP4 segments should be packaged as HEV1
-- or HVC1.
--
-- 'segmentModifier', 'hlsOutputSettings_segmentModifier' - String concatenated to end of segment filenames.
--
-- 'nameModifier', 'hlsOutputSettings_nameModifier' - String concatenated to the end of the destination filename. Accepts
-- \\\"Format Identifiers\\\":#formatIdentifierParameters.
--
-- 'hlsSettings', 'hlsOutputSettings_hlsSettings' - Settings regarding the underlying stream. These settings are different
-- for audio-only outputs.
newHlsOutputSettings ::
  -- | 'hlsSettings'
  HlsSettings ->
  HlsOutputSettings
newHlsOutputSettings :: HlsSettings -> HlsOutputSettings
newHlsOutputSettings HlsSettings
pHlsSettings_ =
  HlsOutputSettings' :: Maybe HlsH265PackagingType
-> Maybe Text -> Maybe Text -> HlsSettings -> HlsOutputSettings
HlsOutputSettings'
    { $sel:h265PackagingType:HlsOutputSettings' :: Maybe HlsH265PackagingType
h265PackagingType =
        Maybe HlsH265PackagingType
forall a. Maybe a
Prelude.Nothing,
      $sel:segmentModifier:HlsOutputSettings' :: Maybe Text
segmentModifier = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nameModifier:HlsOutputSettings' :: Maybe Text
nameModifier = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:hlsSettings:HlsOutputSettings' :: HlsSettings
hlsSettings = HlsSettings
pHlsSettings_
    }

-- | Only applicable when this output is referencing an H.265 video
-- description. Specifies whether MP4 segments should be packaged as HEV1
-- or HVC1.
hlsOutputSettings_h265PackagingType :: Lens.Lens' HlsOutputSettings (Prelude.Maybe HlsH265PackagingType)
hlsOutputSettings_h265PackagingType :: (Maybe HlsH265PackagingType -> f (Maybe HlsH265PackagingType))
-> HlsOutputSettings -> f HlsOutputSettings
hlsOutputSettings_h265PackagingType = (HlsOutputSettings -> Maybe HlsH265PackagingType)
-> (HlsOutputSettings
    -> Maybe HlsH265PackagingType -> HlsOutputSettings)
-> Lens
     HlsOutputSettings
     HlsOutputSettings
     (Maybe HlsH265PackagingType)
     (Maybe HlsH265PackagingType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsOutputSettings' {Maybe HlsH265PackagingType
h265PackagingType :: Maybe HlsH265PackagingType
$sel:h265PackagingType:HlsOutputSettings' :: HlsOutputSettings -> Maybe HlsH265PackagingType
h265PackagingType} -> Maybe HlsH265PackagingType
h265PackagingType) (\s :: HlsOutputSettings
s@HlsOutputSettings' {} Maybe HlsH265PackagingType
a -> HlsOutputSettings
s {$sel:h265PackagingType:HlsOutputSettings' :: Maybe HlsH265PackagingType
h265PackagingType = Maybe HlsH265PackagingType
a} :: HlsOutputSettings)

-- | String concatenated to end of segment filenames.
hlsOutputSettings_segmentModifier :: Lens.Lens' HlsOutputSettings (Prelude.Maybe Prelude.Text)
hlsOutputSettings_segmentModifier :: (Maybe Text -> f (Maybe Text))
-> HlsOutputSettings -> f HlsOutputSettings
hlsOutputSettings_segmentModifier = (HlsOutputSettings -> Maybe Text)
-> (HlsOutputSettings -> Maybe Text -> HlsOutputSettings)
-> Lens
     HlsOutputSettings HlsOutputSettings (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsOutputSettings' {Maybe Text
segmentModifier :: Maybe Text
$sel:segmentModifier:HlsOutputSettings' :: HlsOutputSettings -> Maybe Text
segmentModifier} -> Maybe Text
segmentModifier) (\s :: HlsOutputSettings
s@HlsOutputSettings' {} Maybe Text
a -> HlsOutputSettings
s {$sel:segmentModifier:HlsOutputSettings' :: Maybe Text
segmentModifier = Maybe Text
a} :: HlsOutputSettings)

-- | String concatenated to the end of the destination filename. Accepts
-- \\\"Format Identifiers\\\":#formatIdentifierParameters.
hlsOutputSettings_nameModifier :: Lens.Lens' HlsOutputSettings (Prelude.Maybe Prelude.Text)
hlsOutputSettings_nameModifier :: (Maybe Text -> f (Maybe Text))
-> HlsOutputSettings -> f HlsOutputSettings
hlsOutputSettings_nameModifier = (HlsOutputSettings -> Maybe Text)
-> (HlsOutputSettings -> Maybe Text -> HlsOutputSettings)
-> Lens
     HlsOutputSettings HlsOutputSettings (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsOutputSettings' {Maybe Text
nameModifier :: Maybe Text
$sel:nameModifier:HlsOutputSettings' :: HlsOutputSettings -> Maybe Text
nameModifier} -> Maybe Text
nameModifier) (\s :: HlsOutputSettings
s@HlsOutputSettings' {} Maybe Text
a -> HlsOutputSettings
s {$sel:nameModifier:HlsOutputSettings' :: Maybe Text
nameModifier = Maybe Text
a} :: HlsOutputSettings)

-- | Settings regarding the underlying stream. These settings are different
-- for audio-only outputs.
hlsOutputSettings_hlsSettings :: Lens.Lens' HlsOutputSettings HlsSettings
hlsOutputSettings_hlsSettings :: (HlsSettings -> f HlsSettings)
-> HlsOutputSettings -> f HlsOutputSettings
hlsOutputSettings_hlsSettings = (HlsOutputSettings -> HlsSettings)
-> (HlsOutputSettings -> HlsSettings -> HlsOutputSettings)
-> Lens HlsOutputSettings HlsOutputSettings HlsSettings HlsSettings
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsOutputSettings' {HlsSettings
hlsSettings :: HlsSettings
$sel:hlsSettings:HlsOutputSettings' :: HlsOutputSettings -> HlsSettings
hlsSettings} -> HlsSettings
hlsSettings) (\s :: HlsOutputSettings
s@HlsOutputSettings' {} HlsSettings
a -> HlsOutputSettings
s {$sel:hlsSettings:HlsOutputSettings' :: HlsSettings
hlsSettings = HlsSettings
a} :: HlsOutputSettings)

instance Core.FromJSON HlsOutputSettings where
  parseJSON :: Value -> Parser HlsOutputSettings
parseJSON =
    String
-> (Object -> Parser HlsOutputSettings)
-> Value
-> Parser HlsOutputSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"HlsOutputSettings"
      ( \Object
x ->
          Maybe HlsH265PackagingType
-> Maybe Text -> Maybe Text -> HlsSettings -> HlsOutputSettings
HlsOutputSettings'
            (Maybe HlsH265PackagingType
 -> Maybe Text -> Maybe Text -> HlsSettings -> HlsOutputSettings)
-> Parser (Maybe HlsH265PackagingType)
-> Parser
     (Maybe Text -> Maybe Text -> HlsSettings -> HlsOutputSettings)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe HlsH265PackagingType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"h265PackagingType")
            Parser
  (Maybe Text -> Maybe Text -> HlsSettings -> HlsOutputSettings)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> HlsSettings -> HlsOutputSettings)
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
"segmentModifier")
            Parser (Maybe Text -> HlsSettings -> HlsOutputSettings)
-> Parser (Maybe Text) -> Parser (HlsSettings -> HlsOutputSettings)
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
"nameModifier")
            Parser (HlsSettings -> HlsOutputSettings)
-> Parser HlsSettings -> Parser HlsOutputSettings
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser HlsSettings
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"hlsSettings")
      )

instance Prelude.Hashable HlsOutputSettings

instance Prelude.NFData HlsOutputSettings

instance Core.ToJSON HlsOutputSettings where
  toJSON :: HlsOutputSettings -> Value
toJSON HlsOutputSettings' {Maybe Text
Maybe HlsH265PackagingType
HlsSettings
hlsSettings :: HlsSettings
nameModifier :: Maybe Text
segmentModifier :: Maybe Text
h265PackagingType :: Maybe HlsH265PackagingType
$sel:hlsSettings:HlsOutputSettings' :: HlsOutputSettings -> HlsSettings
$sel:nameModifier:HlsOutputSettings' :: HlsOutputSettings -> Maybe Text
$sel:segmentModifier:HlsOutputSettings' :: HlsOutputSettings -> Maybe Text
$sel:h265PackagingType:HlsOutputSettings' :: HlsOutputSettings -> Maybe HlsH265PackagingType
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"h265PackagingType" Text -> HlsH265PackagingType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (HlsH265PackagingType -> Pair)
-> Maybe HlsH265PackagingType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe HlsH265PackagingType
h265PackagingType,
            (Text
"segmentModifier" 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
segmentModifier,
            (Text
"nameModifier" 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
nameModifier,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"hlsSettings" Text -> HlsSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= HlsSettings
hlsSettings)
          ]
      )