{-# 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.EmbeddedSourceSettings
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MediaLive.Types.EmbeddedSourceSettings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaLive.Types.EmbeddedConvert608To708
import Amazonka.MediaLive.Types.EmbeddedScte20Detection
import qualified Amazonka.Prelude as Prelude

-- | Embedded Source Settings
--
-- /See:/ 'newEmbeddedSourceSettings' smart constructor.
data EmbeddedSourceSettings = EmbeddedSourceSettings'
  { -- | If upconvert, 608 data is both passed through via the \"608
    -- compatibility bytes\" fields of the 708 wrapper as well as translated
    -- into 708. 708 data present in the source content will be discarded.
    EmbeddedSourceSettings -> Maybe EmbeddedConvert608To708
convert608To708 :: Prelude.Maybe EmbeddedConvert608To708,
    -- | Set to \"auto\" to handle streams with intermittent and\/or non-aligned
    -- SCTE-20 and Embedded captions.
    EmbeddedSourceSettings -> Maybe EmbeddedScte20Detection
scte20Detection :: Prelude.Maybe EmbeddedScte20Detection,
    -- | Specifies the 608\/708 channel number within the video track from which
    -- to extract captions. Unused for passthrough.
    EmbeddedSourceSettings -> Maybe Natural
source608ChannelNumber :: Prelude.Maybe Prelude.Natural,
    -- | This field is unused and deprecated.
    EmbeddedSourceSettings -> Maybe Natural
source608TrackNumber :: Prelude.Maybe Prelude.Natural
  }
  deriving (EmbeddedSourceSettings -> EmbeddedSourceSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EmbeddedSourceSettings -> EmbeddedSourceSettings -> Bool
$c/= :: EmbeddedSourceSettings -> EmbeddedSourceSettings -> Bool
== :: EmbeddedSourceSettings -> EmbeddedSourceSettings -> Bool
$c== :: EmbeddedSourceSettings -> EmbeddedSourceSettings -> Bool
Prelude.Eq, ReadPrec [EmbeddedSourceSettings]
ReadPrec EmbeddedSourceSettings
Int -> ReadS EmbeddedSourceSettings
ReadS [EmbeddedSourceSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EmbeddedSourceSettings]
$creadListPrec :: ReadPrec [EmbeddedSourceSettings]
readPrec :: ReadPrec EmbeddedSourceSettings
$creadPrec :: ReadPrec EmbeddedSourceSettings
readList :: ReadS [EmbeddedSourceSettings]
$creadList :: ReadS [EmbeddedSourceSettings]
readsPrec :: Int -> ReadS EmbeddedSourceSettings
$creadsPrec :: Int -> ReadS EmbeddedSourceSettings
Prelude.Read, Int -> EmbeddedSourceSettings -> ShowS
[EmbeddedSourceSettings] -> ShowS
EmbeddedSourceSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EmbeddedSourceSettings] -> ShowS
$cshowList :: [EmbeddedSourceSettings] -> ShowS
show :: EmbeddedSourceSettings -> String
$cshow :: EmbeddedSourceSettings -> String
showsPrec :: Int -> EmbeddedSourceSettings -> ShowS
$cshowsPrec :: Int -> EmbeddedSourceSettings -> ShowS
Prelude.Show, forall x. Rep EmbeddedSourceSettings x -> EmbeddedSourceSettings
forall x. EmbeddedSourceSettings -> Rep EmbeddedSourceSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EmbeddedSourceSettings x -> EmbeddedSourceSettings
$cfrom :: forall x. EmbeddedSourceSettings -> Rep EmbeddedSourceSettings x
Prelude.Generic)

-- |
-- Create a value of 'EmbeddedSourceSettings' 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:
--
-- 'convert608To708', 'embeddedSourceSettings_convert608To708' - If upconvert, 608 data is both passed through via the \"608
-- compatibility bytes\" fields of the 708 wrapper as well as translated
-- into 708. 708 data present in the source content will be discarded.
--
-- 'scte20Detection', 'embeddedSourceSettings_scte20Detection' - Set to \"auto\" to handle streams with intermittent and\/or non-aligned
-- SCTE-20 and Embedded captions.
--
-- 'source608ChannelNumber', 'embeddedSourceSettings_source608ChannelNumber' - Specifies the 608\/708 channel number within the video track from which
-- to extract captions. Unused for passthrough.
--
-- 'source608TrackNumber', 'embeddedSourceSettings_source608TrackNumber' - This field is unused and deprecated.
newEmbeddedSourceSettings ::
  EmbeddedSourceSettings
newEmbeddedSourceSettings :: EmbeddedSourceSettings
newEmbeddedSourceSettings =
  EmbeddedSourceSettings'
    { $sel:convert608To708:EmbeddedSourceSettings' :: Maybe EmbeddedConvert608To708
convert608To708 =
        forall a. Maybe a
Prelude.Nothing,
      $sel:scte20Detection:EmbeddedSourceSettings' :: Maybe EmbeddedScte20Detection
scte20Detection = forall a. Maybe a
Prelude.Nothing,
      $sel:source608ChannelNumber:EmbeddedSourceSettings' :: Maybe Natural
source608ChannelNumber = forall a. Maybe a
Prelude.Nothing,
      $sel:source608TrackNumber:EmbeddedSourceSettings' :: Maybe Natural
source608TrackNumber = forall a. Maybe a
Prelude.Nothing
    }

-- | If upconvert, 608 data is both passed through via the \"608
-- compatibility bytes\" fields of the 708 wrapper as well as translated
-- into 708. 708 data present in the source content will be discarded.
embeddedSourceSettings_convert608To708 :: Lens.Lens' EmbeddedSourceSettings (Prelude.Maybe EmbeddedConvert608To708)
embeddedSourceSettings_convert608To708 :: Lens' EmbeddedSourceSettings (Maybe EmbeddedConvert608To708)
embeddedSourceSettings_convert608To708 = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EmbeddedSourceSettings' {Maybe EmbeddedConvert608To708
convert608To708 :: Maybe EmbeddedConvert608To708
$sel:convert608To708:EmbeddedSourceSettings' :: EmbeddedSourceSettings -> Maybe EmbeddedConvert608To708
convert608To708} -> Maybe EmbeddedConvert608To708
convert608To708) (\s :: EmbeddedSourceSettings
s@EmbeddedSourceSettings' {} Maybe EmbeddedConvert608To708
a -> EmbeddedSourceSettings
s {$sel:convert608To708:EmbeddedSourceSettings' :: Maybe EmbeddedConvert608To708
convert608To708 = Maybe EmbeddedConvert608To708
a} :: EmbeddedSourceSettings)

-- | Set to \"auto\" to handle streams with intermittent and\/or non-aligned
-- SCTE-20 and Embedded captions.
embeddedSourceSettings_scte20Detection :: Lens.Lens' EmbeddedSourceSettings (Prelude.Maybe EmbeddedScte20Detection)
embeddedSourceSettings_scte20Detection :: Lens' EmbeddedSourceSettings (Maybe EmbeddedScte20Detection)
embeddedSourceSettings_scte20Detection = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EmbeddedSourceSettings' {Maybe EmbeddedScte20Detection
scte20Detection :: Maybe EmbeddedScte20Detection
$sel:scte20Detection:EmbeddedSourceSettings' :: EmbeddedSourceSettings -> Maybe EmbeddedScte20Detection
scte20Detection} -> Maybe EmbeddedScte20Detection
scte20Detection) (\s :: EmbeddedSourceSettings
s@EmbeddedSourceSettings' {} Maybe EmbeddedScte20Detection
a -> EmbeddedSourceSettings
s {$sel:scte20Detection:EmbeddedSourceSettings' :: Maybe EmbeddedScte20Detection
scte20Detection = Maybe EmbeddedScte20Detection
a} :: EmbeddedSourceSettings)

-- | Specifies the 608\/708 channel number within the video track from which
-- to extract captions. Unused for passthrough.
embeddedSourceSettings_source608ChannelNumber :: Lens.Lens' EmbeddedSourceSettings (Prelude.Maybe Prelude.Natural)
embeddedSourceSettings_source608ChannelNumber :: Lens' EmbeddedSourceSettings (Maybe Natural)
embeddedSourceSettings_source608ChannelNumber = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EmbeddedSourceSettings' {Maybe Natural
source608ChannelNumber :: Maybe Natural
$sel:source608ChannelNumber:EmbeddedSourceSettings' :: EmbeddedSourceSettings -> Maybe Natural
source608ChannelNumber} -> Maybe Natural
source608ChannelNumber) (\s :: EmbeddedSourceSettings
s@EmbeddedSourceSettings' {} Maybe Natural
a -> EmbeddedSourceSettings
s {$sel:source608ChannelNumber:EmbeddedSourceSettings' :: Maybe Natural
source608ChannelNumber = Maybe Natural
a} :: EmbeddedSourceSettings)

-- | This field is unused and deprecated.
embeddedSourceSettings_source608TrackNumber :: Lens.Lens' EmbeddedSourceSettings (Prelude.Maybe Prelude.Natural)
embeddedSourceSettings_source608TrackNumber :: Lens' EmbeddedSourceSettings (Maybe Natural)
embeddedSourceSettings_source608TrackNumber = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EmbeddedSourceSettings' {Maybe Natural
source608TrackNumber :: Maybe Natural
$sel:source608TrackNumber:EmbeddedSourceSettings' :: EmbeddedSourceSettings -> Maybe Natural
source608TrackNumber} -> Maybe Natural
source608TrackNumber) (\s :: EmbeddedSourceSettings
s@EmbeddedSourceSettings' {} Maybe Natural
a -> EmbeddedSourceSettings
s {$sel:source608TrackNumber:EmbeddedSourceSettings' :: Maybe Natural
source608TrackNumber = Maybe Natural
a} :: EmbeddedSourceSettings)

instance Data.FromJSON EmbeddedSourceSettings where
  parseJSON :: Value -> Parser EmbeddedSourceSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EmbeddedSourceSettings"
      ( \Object
x ->
          Maybe EmbeddedConvert608To708
-> Maybe EmbeddedScte20Detection
-> Maybe Natural
-> Maybe Natural
-> EmbeddedSourceSettings
EmbeddedSourceSettings'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"convert608To708")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"scte20Detection")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"source608ChannelNumber")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"source608TrackNumber")
      )

instance Prelude.Hashable EmbeddedSourceSettings where
  hashWithSalt :: Int -> EmbeddedSourceSettings -> Int
hashWithSalt Int
_salt EmbeddedSourceSettings' {Maybe Natural
Maybe EmbeddedConvert608To708
Maybe EmbeddedScte20Detection
source608TrackNumber :: Maybe Natural
source608ChannelNumber :: Maybe Natural
scte20Detection :: Maybe EmbeddedScte20Detection
convert608To708 :: Maybe EmbeddedConvert608To708
$sel:source608TrackNumber:EmbeddedSourceSettings' :: EmbeddedSourceSettings -> Maybe Natural
$sel:source608ChannelNumber:EmbeddedSourceSettings' :: EmbeddedSourceSettings -> Maybe Natural
$sel:scte20Detection:EmbeddedSourceSettings' :: EmbeddedSourceSettings -> Maybe EmbeddedScte20Detection
$sel:convert608To708:EmbeddedSourceSettings' :: EmbeddedSourceSettings -> Maybe EmbeddedConvert608To708
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EmbeddedConvert608To708
convert608To708
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EmbeddedScte20Detection
scte20Detection
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
source608ChannelNumber
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
source608TrackNumber

instance Prelude.NFData EmbeddedSourceSettings where
  rnf :: EmbeddedSourceSettings -> ()
rnf EmbeddedSourceSettings' {Maybe Natural
Maybe EmbeddedConvert608To708
Maybe EmbeddedScte20Detection
source608TrackNumber :: Maybe Natural
source608ChannelNumber :: Maybe Natural
scte20Detection :: Maybe EmbeddedScte20Detection
convert608To708 :: Maybe EmbeddedConvert608To708
$sel:source608TrackNumber:EmbeddedSourceSettings' :: EmbeddedSourceSettings -> Maybe Natural
$sel:source608ChannelNumber:EmbeddedSourceSettings' :: EmbeddedSourceSettings -> Maybe Natural
$sel:scte20Detection:EmbeddedSourceSettings' :: EmbeddedSourceSettings -> Maybe EmbeddedScte20Detection
$sel:convert608To708:EmbeddedSourceSettings' :: EmbeddedSourceSettings -> Maybe EmbeddedConvert608To708
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe EmbeddedConvert608To708
convert608To708
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe EmbeddedScte20Detection
scte20Detection
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
source608ChannelNumber
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
source608TrackNumber

instance Data.ToJSON EmbeddedSourceSettings where
  toJSON :: EmbeddedSourceSettings -> Value
toJSON EmbeddedSourceSettings' {Maybe Natural
Maybe EmbeddedConvert608To708
Maybe EmbeddedScte20Detection
source608TrackNumber :: Maybe Natural
source608ChannelNumber :: Maybe Natural
scte20Detection :: Maybe EmbeddedScte20Detection
convert608To708 :: Maybe EmbeddedConvert608To708
$sel:source608TrackNumber:EmbeddedSourceSettings' :: EmbeddedSourceSettings -> Maybe Natural
$sel:source608ChannelNumber:EmbeddedSourceSettings' :: EmbeddedSourceSettings -> Maybe Natural
$sel:scte20Detection:EmbeddedSourceSettings' :: EmbeddedSourceSettings -> Maybe EmbeddedScte20Detection
$sel:convert608To708:EmbeddedSourceSettings' :: EmbeddedSourceSettings -> Maybe EmbeddedConvert608To708
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"convert608To708" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EmbeddedConvert608To708
convert608To708,
            (Key
"scte20Detection" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EmbeddedScte20Detection
scte20Detection,
            (Key
"source608ChannelNumber" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
source608ChannelNumber,
            (Key
"source608TrackNumber" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
source608TrackNumber
          ]
      )