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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaLive.Types.AudioOnlyHlsSegmentType
import Amazonka.MediaLive.Types.AudioOnlyHlsTrackType
import Amazonka.MediaLive.Types.InputLocation
import qualified Amazonka.Prelude as Prelude

-- | Audio Only Hls Settings
--
-- /See:/ 'newAudioOnlyHlsSettings' smart constructor.
data AudioOnlyHlsSettings = AudioOnlyHlsSettings'
  { -- | Optional. Specifies the .jpg or .png image to use as the cover art for
    -- an audio-only output. We recommend a low bit-size file because the image
    -- increases the output audio bandwidth. The image is attached to the audio
    -- as an ID3 tag, frame type APIC, picture type 0x10, as per the \"ID3 tag
    -- version 2.4.0 - Native Frames\" standard.
    AudioOnlyHlsSettings -> Maybe InputLocation
audioOnlyImage :: Prelude.Maybe InputLocation,
    -- | Specifies the segment type.
    AudioOnlyHlsSettings -> Maybe AudioOnlyHlsSegmentType
segmentType :: Prelude.Maybe AudioOnlyHlsSegmentType,
    -- | Specifies the group to which the audio Rendition belongs.
    AudioOnlyHlsSettings -> Maybe Text
audioGroupId :: Prelude.Maybe Prelude.Text,
    -- | Four types of audio-only tracks are supported: Audio-Only Variant Stream
    -- The client can play back this audio-only stream instead of video in
    -- low-bandwidth scenarios. Represented as an EXT-X-STREAM-INF in the HLS
    -- manifest. Alternate Audio, Auto Select, Default Alternate rendition that
    -- the client should try to play back by default. Represented as an
    -- EXT-X-MEDIA in the HLS manifest with DEFAULT=YES, AUTOSELECT=YES
    -- Alternate Audio, Auto Select, Not Default Alternate rendition that the
    -- client may try to play back by default. Represented as an EXT-X-MEDIA in
    -- the HLS manifest with DEFAULT=NO, AUTOSELECT=YES Alternate Audio, not
    -- Auto Select Alternate rendition that the client will not try to play
    -- back by default. Represented as an EXT-X-MEDIA in the HLS manifest with
    -- DEFAULT=NO, AUTOSELECT=NO
    AudioOnlyHlsSettings -> Maybe AudioOnlyHlsTrackType
audioTrackType :: Prelude.Maybe AudioOnlyHlsTrackType
  }
  deriving (AudioOnlyHlsSettings -> AudioOnlyHlsSettings -> Bool
(AudioOnlyHlsSettings -> AudioOnlyHlsSettings -> Bool)
-> (AudioOnlyHlsSettings -> AudioOnlyHlsSettings -> Bool)
-> Eq AudioOnlyHlsSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AudioOnlyHlsSettings -> AudioOnlyHlsSettings -> Bool
$c/= :: AudioOnlyHlsSettings -> AudioOnlyHlsSettings -> Bool
== :: AudioOnlyHlsSettings -> AudioOnlyHlsSettings -> Bool
$c== :: AudioOnlyHlsSettings -> AudioOnlyHlsSettings -> Bool
Prelude.Eq, ReadPrec [AudioOnlyHlsSettings]
ReadPrec AudioOnlyHlsSettings
Int -> ReadS AudioOnlyHlsSettings
ReadS [AudioOnlyHlsSettings]
(Int -> ReadS AudioOnlyHlsSettings)
-> ReadS [AudioOnlyHlsSettings]
-> ReadPrec AudioOnlyHlsSettings
-> ReadPrec [AudioOnlyHlsSettings]
-> Read AudioOnlyHlsSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AudioOnlyHlsSettings]
$creadListPrec :: ReadPrec [AudioOnlyHlsSettings]
readPrec :: ReadPrec AudioOnlyHlsSettings
$creadPrec :: ReadPrec AudioOnlyHlsSettings
readList :: ReadS [AudioOnlyHlsSettings]
$creadList :: ReadS [AudioOnlyHlsSettings]
readsPrec :: Int -> ReadS AudioOnlyHlsSettings
$creadsPrec :: Int -> ReadS AudioOnlyHlsSettings
Prelude.Read, Int -> AudioOnlyHlsSettings -> ShowS
[AudioOnlyHlsSettings] -> ShowS
AudioOnlyHlsSettings -> String
(Int -> AudioOnlyHlsSettings -> ShowS)
-> (AudioOnlyHlsSettings -> String)
-> ([AudioOnlyHlsSettings] -> ShowS)
-> Show AudioOnlyHlsSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AudioOnlyHlsSettings] -> ShowS
$cshowList :: [AudioOnlyHlsSettings] -> ShowS
show :: AudioOnlyHlsSettings -> String
$cshow :: AudioOnlyHlsSettings -> String
showsPrec :: Int -> AudioOnlyHlsSettings -> ShowS
$cshowsPrec :: Int -> AudioOnlyHlsSettings -> ShowS
Prelude.Show, (forall x. AudioOnlyHlsSettings -> Rep AudioOnlyHlsSettings x)
-> (forall x. Rep AudioOnlyHlsSettings x -> AudioOnlyHlsSettings)
-> Generic AudioOnlyHlsSettings
forall x. Rep AudioOnlyHlsSettings x -> AudioOnlyHlsSettings
forall x. AudioOnlyHlsSettings -> Rep AudioOnlyHlsSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AudioOnlyHlsSettings x -> AudioOnlyHlsSettings
$cfrom :: forall x. AudioOnlyHlsSettings -> Rep AudioOnlyHlsSettings x
Prelude.Generic)

-- |
-- Create a value of 'AudioOnlyHlsSettings' 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:
--
-- 'audioOnlyImage', 'audioOnlyHlsSettings_audioOnlyImage' - Optional. Specifies the .jpg or .png image to use as the cover art for
-- an audio-only output. We recommend a low bit-size file because the image
-- increases the output audio bandwidth. The image is attached to the audio
-- as an ID3 tag, frame type APIC, picture type 0x10, as per the \"ID3 tag
-- version 2.4.0 - Native Frames\" standard.
--
-- 'segmentType', 'audioOnlyHlsSettings_segmentType' - Specifies the segment type.
--
-- 'audioGroupId', 'audioOnlyHlsSettings_audioGroupId' - Specifies the group to which the audio Rendition belongs.
--
-- 'audioTrackType', 'audioOnlyHlsSettings_audioTrackType' - Four types of audio-only tracks are supported: Audio-Only Variant Stream
-- The client can play back this audio-only stream instead of video in
-- low-bandwidth scenarios. Represented as an EXT-X-STREAM-INF in the HLS
-- manifest. Alternate Audio, Auto Select, Default Alternate rendition that
-- the client should try to play back by default. Represented as an
-- EXT-X-MEDIA in the HLS manifest with DEFAULT=YES, AUTOSELECT=YES
-- Alternate Audio, Auto Select, Not Default Alternate rendition that the
-- client may try to play back by default. Represented as an EXT-X-MEDIA in
-- the HLS manifest with DEFAULT=NO, AUTOSELECT=YES Alternate Audio, not
-- Auto Select Alternate rendition that the client will not try to play
-- back by default. Represented as an EXT-X-MEDIA in the HLS manifest with
-- DEFAULT=NO, AUTOSELECT=NO
newAudioOnlyHlsSettings ::
  AudioOnlyHlsSettings
newAudioOnlyHlsSettings :: AudioOnlyHlsSettings
newAudioOnlyHlsSettings =
  AudioOnlyHlsSettings' :: Maybe InputLocation
-> Maybe AudioOnlyHlsSegmentType
-> Maybe Text
-> Maybe AudioOnlyHlsTrackType
-> AudioOnlyHlsSettings
AudioOnlyHlsSettings'
    { $sel:audioOnlyImage:AudioOnlyHlsSettings' :: Maybe InputLocation
audioOnlyImage =
        Maybe InputLocation
forall a. Maybe a
Prelude.Nothing,
      $sel:segmentType:AudioOnlyHlsSettings' :: Maybe AudioOnlyHlsSegmentType
segmentType = Maybe AudioOnlyHlsSegmentType
forall a. Maybe a
Prelude.Nothing,
      $sel:audioGroupId:AudioOnlyHlsSettings' :: Maybe Text
audioGroupId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:audioTrackType:AudioOnlyHlsSettings' :: Maybe AudioOnlyHlsTrackType
audioTrackType = Maybe AudioOnlyHlsTrackType
forall a. Maybe a
Prelude.Nothing
    }

-- | Optional. Specifies the .jpg or .png image to use as the cover art for
-- an audio-only output. We recommend a low bit-size file because the image
-- increases the output audio bandwidth. The image is attached to the audio
-- as an ID3 tag, frame type APIC, picture type 0x10, as per the \"ID3 tag
-- version 2.4.0 - Native Frames\" standard.
audioOnlyHlsSettings_audioOnlyImage :: Lens.Lens' AudioOnlyHlsSettings (Prelude.Maybe InputLocation)
audioOnlyHlsSettings_audioOnlyImage :: (Maybe InputLocation -> f (Maybe InputLocation))
-> AudioOnlyHlsSettings -> f AudioOnlyHlsSettings
audioOnlyHlsSettings_audioOnlyImage = (AudioOnlyHlsSettings -> Maybe InputLocation)
-> (AudioOnlyHlsSettings
    -> Maybe InputLocation -> AudioOnlyHlsSettings)
-> Lens
     AudioOnlyHlsSettings
     AudioOnlyHlsSettings
     (Maybe InputLocation)
     (Maybe InputLocation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AudioOnlyHlsSettings' {Maybe InputLocation
audioOnlyImage :: Maybe InputLocation
$sel:audioOnlyImage:AudioOnlyHlsSettings' :: AudioOnlyHlsSettings -> Maybe InputLocation
audioOnlyImage} -> Maybe InputLocation
audioOnlyImage) (\s :: AudioOnlyHlsSettings
s@AudioOnlyHlsSettings' {} Maybe InputLocation
a -> AudioOnlyHlsSettings
s {$sel:audioOnlyImage:AudioOnlyHlsSettings' :: Maybe InputLocation
audioOnlyImage = Maybe InputLocation
a} :: AudioOnlyHlsSettings)

-- | Specifies the segment type.
audioOnlyHlsSettings_segmentType :: Lens.Lens' AudioOnlyHlsSettings (Prelude.Maybe AudioOnlyHlsSegmentType)
audioOnlyHlsSettings_segmentType :: (Maybe AudioOnlyHlsSegmentType
 -> f (Maybe AudioOnlyHlsSegmentType))
-> AudioOnlyHlsSettings -> f AudioOnlyHlsSettings
audioOnlyHlsSettings_segmentType = (AudioOnlyHlsSettings -> Maybe AudioOnlyHlsSegmentType)
-> (AudioOnlyHlsSettings
    -> Maybe AudioOnlyHlsSegmentType -> AudioOnlyHlsSettings)
-> Lens
     AudioOnlyHlsSettings
     AudioOnlyHlsSettings
     (Maybe AudioOnlyHlsSegmentType)
     (Maybe AudioOnlyHlsSegmentType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AudioOnlyHlsSettings' {Maybe AudioOnlyHlsSegmentType
segmentType :: Maybe AudioOnlyHlsSegmentType
$sel:segmentType:AudioOnlyHlsSettings' :: AudioOnlyHlsSettings -> Maybe AudioOnlyHlsSegmentType
segmentType} -> Maybe AudioOnlyHlsSegmentType
segmentType) (\s :: AudioOnlyHlsSettings
s@AudioOnlyHlsSettings' {} Maybe AudioOnlyHlsSegmentType
a -> AudioOnlyHlsSettings
s {$sel:segmentType:AudioOnlyHlsSettings' :: Maybe AudioOnlyHlsSegmentType
segmentType = Maybe AudioOnlyHlsSegmentType
a} :: AudioOnlyHlsSettings)

-- | Specifies the group to which the audio Rendition belongs.
audioOnlyHlsSettings_audioGroupId :: Lens.Lens' AudioOnlyHlsSettings (Prelude.Maybe Prelude.Text)
audioOnlyHlsSettings_audioGroupId :: (Maybe Text -> f (Maybe Text))
-> AudioOnlyHlsSettings -> f AudioOnlyHlsSettings
audioOnlyHlsSettings_audioGroupId = (AudioOnlyHlsSettings -> Maybe Text)
-> (AudioOnlyHlsSettings -> Maybe Text -> AudioOnlyHlsSettings)
-> Lens
     AudioOnlyHlsSettings AudioOnlyHlsSettings (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AudioOnlyHlsSettings' {Maybe Text
audioGroupId :: Maybe Text
$sel:audioGroupId:AudioOnlyHlsSettings' :: AudioOnlyHlsSettings -> Maybe Text
audioGroupId} -> Maybe Text
audioGroupId) (\s :: AudioOnlyHlsSettings
s@AudioOnlyHlsSettings' {} Maybe Text
a -> AudioOnlyHlsSettings
s {$sel:audioGroupId:AudioOnlyHlsSettings' :: Maybe Text
audioGroupId = Maybe Text
a} :: AudioOnlyHlsSettings)

-- | Four types of audio-only tracks are supported: Audio-Only Variant Stream
-- The client can play back this audio-only stream instead of video in
-- low-bandwidth scenarios. Represented as an EXT-X-STREAM-INF in the HLS
-- manifest. Alternate Audio, Auto Select, Default Alternate rendition that
-- the client should try to play back by default. Represented as an
-- EXT-X-MEDIA in the HLS manifest with DEFAULT=YES, AUTOSELECT=YES
-- Alternate Audio, Auto Select, Not Default Alternate rendition that the
-- client may try to play back by default. Represented as an EXT-X-MEDIA in
-- the HLS manifest with DEFAULT=NO, AUTOSELECT=YES Alternate Audio, not
-- Auto Select Alternate rendition that the client will not try to play
-- back by default. Represented as an EXT-X-MEDIA in the HLS manifest with
-- DEFAULT=NO, AUTOSELECT=NO
audioOnlyHlsSettings_audioTrackType :: Lens.Lens' AudioOnlyHlsSettings (Prelude.Maybe AudioOnlyHlsTrackType)
audioOnlyHlsSettings_audioTrackType :: (Maybe AudioOnlyHlsTrackType -> f (Maybe AudioOnlyHlsTrackType))
-> AudioOnlyHlsSettings -> f AudioOnlyHlsSettings
audioOnlyHlsSettings_audioTrackType = (AudioOnlyHlsSettings -> Maybe AudioOnlyHlsTrackType)
-> (AudioOnlyHlsSettings
    -> Maybe AudioOnlyHlsTrackType -> AudioOnlyHlsSettings)
-> Lens
     AudioOnlyHlsSettings
     AudioOnlyHlsSettings
     (Maybe AudioOnlyHlsTrackType)
     (Maybe AudioOnlyHlsTrackType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AudioOnlyHlsSettings' {Maybe AudioOnlyHlsTrackType
audioTrackType :: Maybe AudioOnlyHlsTrackType
$sel:audioTrackType:AudioOnlyHlsSettings' :: AudioOnlyHlsSettings -> Maybe AudioOnlyHlsTrackType
audioTrackType} -> Maybe AudioOnlyHlsTrackType
audioTrackType) (\s :: AudioOnlyHlsSettings
s@AudioOnlyHlsSettings' {} Maybe AudioOnlyHlsTrackType
a -> AudioOnlyHlsSettings
s {$sel:audioTrackType:AudioOnlyHlsSettings' :: Maybe AudioOnlyHlsTrackType
audioTrackType = Maybe AudioOnlyHlsTrackType
a} :: AudioOnlyHlsSettings)

instance Core.FromJSON AudioOnlyHlsSettings where
  parseJSON :: Value -> Parser AudioOnlyHlsSettings
parseJSON =
    String
-> (Object -> Parser AudioOnlyHlsSettings)
-> Value
-> Parser AudioOnlyHlsSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AudioOnlyHlsSettings"
      ( \Object
x ->
          Maybe InputLocation
-> Maybe AudioOnlyHlsSegmentType
-> Maybe Text
-> Maybe AudioOnlyHlsTrackType
-> AudioOnlyHlsSettings
AudioOnlyHlsSettings'
            (Maybe InputLocation
 -> Maybe AudioOnlyHlsSegmentType
 -> Maybe Text
 -> Maybe AudioOnlyHlsTrackType
 -> AudioOnlyHlsSettings)
-> Parser (Maybe InputLocation)
-> Parser
     (Maybe AudioOnlyHlsSegmentType
      -> Maybe Text
      -> Maybe AudioOnlyHlsTrackType
      -> AudioOnlyHlsSettings)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe InputLocation)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"audioOnlyImage")
            Parser
  (Maybe AudioOnlyHlsSegmentType
   -> Maybe Text
   -> Maybe AudioOnlyHlsTrackType
   -> AudioOnlyHlsSettings)
-> Parser (Maybe AudioOnlyHlsSegmentType)
-> Parser
     (Maybe Text -> Maybe AudioOnlyHlsTrackType -> AudioOnlyHlsSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AudioOnlyHlsSegmentType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"segmentType")
            Parser
  (Maybe Text -> Maybe AudioOnlyHlsTrackType -> AudioOnlyHlsSettings)
-> Parser (Maybe Text)
-> Parser (Maybe AudioOnlyHlsTrackType -> AudioOnlyHlsSettings)
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
"audioGroupId")
            Parser (Maybe AudioOnlyHlsTrackType -> AudioOnlyHlsSettings)
-> Parser (Maybe AudioOnlyHlsTrackType)
-> Parser AudioOnlyHlsSettings
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AudioOnlyHlsTrackType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"audioTrackType")
      )

instance Prelude.Hashable AudioOnlyHlsSettings

instance Prelude.NFData AudioOnlyHlsSettings

instance Core.ToJSON AudioOnlyHlsSettings where
  toJSON :: AudioOnlyHlsSettings -> Value
toJSON AudioOnlyHlsSettings' {Maybe Text
Maybe AudioOnlyHlsSegmentType
Maybe AudioOnlyHlsTrackType
Maybe InputLocation
audioTrackType :: Maybe AudioOnlyHlsTrackType
audioGroupId :: Maybe Text
segmentType :: Maybe AudioOnlyHlsSegmentType
audioOnlyImage :: Maybe InputLocation
$sel:audioTrackType:AudioOnlyHlsSettings' :: AudioOnlyHlsSettings -> Maybe AudioOnlyHlsTrackType
$sel:audioGroupId:AudioOnlyHlsSettings' :: AudioOnlyHlsSettings -> Maybe Text
$sel:segmentType:AudioOnlyHlsSettings' :: AudioOnlyHlsSettings -> Maybe AudioOnlyHlsSegmentType
$sel:audioOnlyImage:AudioOnlyHlsSettings' :: AudioOnlyHlsSettings -> Maybe InputLocation
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"audioOnlyImage" Text -> InputLocation -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (InputLocation -> Pair) -> Maybe InputLocation -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe InputLocation
audioOnlyImage,
            (Text
"segmentType" Text -> AudioOnlyHlsSegmentType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (AudioOnlyHlsSegmentType -> Pair)
-> Maybe AudioOnlyHlsSegmentType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AudioOnlyHlsSegmentType
segmentType,
            (Text
"audioGroupId" 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
audioGroupId,
            (Text
"audioTrackType" Text -> AudioOnlyHlsTrackType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AudioOnlyHlsTrackType -> Pair)
-> Maybe AudioOnlyHlsTrackType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AudioOnlyHlsTrackType
audioTrackType
          ]
      )