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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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,
    -- | This field is unused and deprecated.
    EmbeddedSourceSettings -> Maybe Natural
source608TrackNumber :: Prelude.Maybe Prelude.Natural,
    -- | 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
  }
  deriving (EmbeddedSourceSettings -> EmbeddedSourceSettings -> Bool
(EmbeddedSourceSettings -> EmbeddedSourceSettings -> Bool)
-> (EmbeddedSourceSettings -> EmbeddedSourceSettings -> Bool)
-> Eq EmbeddedSourceSettings
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]
(Int -> ReadS EmbeddedSourceSettings)
-> ReadS [EmbeddedSourceSettings]
-> ReadPrec EmbeddedSourceSettings
-> ReadPrec [EmbeddedSourceSettings]
-> Read 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
(Int -> EmbeddedSourceSettings -> ShowS)
-> (EmbeddedSourceSettings -> String)
-> ([EmbeddedSourceSettings] -> ShowS)
-> Show EmbeddedSourceSettings
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. EmbeddedSourceSettings -> Rep EmbeddedSourceSettings x)
-> (forall x.
    Rep EmbeddedSourceSettings x -> EmbeddedSourceSettings)
-> Generic EmbeddedSourceSettings
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.
--
-- 'source608TrackNumber', 'embeddedSourceSettings_source608TrackNumber' - This field is unused and deprecated.
--
-- 'source608ChannelNumber', 'embeddedSourceSettings_source608ChannelNumber' - Specifies the 608\/708 channel number within the video track from which
-- to extract captions. Unused for passthrough.
newEmbeddedSourceSettings ::
  EmbeddedSourceSettings
newEmbeddedSourceSettings :: EmbeddedSourceSettings
newEmbeddedSourceSettings =
  EmbeddedSourceSettings' :: Maybe EmbeddedConvert608To708
-> Maybe EmbeddedScte20Detection
-> Maybe Natural
-> Maybe Natural
-> EmbeddedSourceSettings
EmbeddedSourceSettings'
    { $sel:convert608To708:EmbeddedSourceSettings' :: Maybe EmbeddedConvert608To708
convert608To708 =
        Maybe EmbeddedConvert608To708
forall a. Maybe a
Prelude.Nothing,
      $sel:scte20Detection:EmbeddedSourceSettings' :: Maybe EmbeddedScte20Detection
scte20Detection = Maybe EmbeddedScte20Detection
forall a. Maybe a
Prelude.Nothing,
      $sel:source608TrackNumber:EmbeddedSourceSettings' :: Maybe Natural
source608TrackNumber = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:source608ChannelNumber:EmbeddedSourceSettings' :: Maybe Natural
source608ChannelNumber = Maybe Natural
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 :: (Maybe EmbeddedConvert608To708
 -> f (Maybe EmbeddedConvert608To708))
-> EmbeddedSourceSettings -> f EmbeddedSourceSettings
embeddedSourceSettings_convert608To708 = (EmbeddedSourceSettings -> Maybe EmbeddedConvert608To708)
-> (EmbeddedSourceSettings
    -> Maybe EmbeddedConvert608To708 -> EmbeddedSourceSettings)
-> Lens
     EmbeddedSourceSettings
     EmbeddedSourceSettings
     (Maybe EmbeddedConvert608To708)
     (Maybe EmbeddedConvert608To708)
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 :: (Maybe EmbeddedScte20Detection
 -> f (Maybe EmbeddedScte20Detection))
-> EmbeddedSourceSettings -> f EmbeddedSourceSettings
embeddedSourceSettings_scte20Detection = (EmbeddedSourceSettings -> Maybe EmbeddedScte20Detection)
-> (EmbeddedSourceSettings
    -> Maybe EmbeddedScte20Detection -> EmbeddedSourceSettings)
-> Lens
     EmbeddedSourceSettings
     EmbeddedSourceSettings
     (Maybe EmbeddedScte20Detection)
     (Maybe EmbeddedScte20Detection)
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)

-- | This field is unused and deprecated.
embeddedSourceSettings_source608TrackNumber :: Lens.Lens' EmbeddedSourceSettings (Prelude.Maybe Prelude.Natural)
embeddedSourceSettings_source608TrackNumber :: (Maybe Natural -> f (Maybe Natural))
-> EmbeddedSourceSettings -> f EmbeddedSourceSettings
embeddedSourceSettings_source608TrackNumber = (EmbeddedSourceSettings -> Maybe Natural)
-> (EmbeddedSourceSettings
    -> Maybe Natural -> EmbeddedSourceSettings)
-> Lens
     EmbeddedSourceSettings
     EmbeddedSourceSettings
     (Maybe Natural)
     (Maybe Natural)
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)

-- | 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 :: (Maybe Natural -> f (Maybe Natural))
-> EmbeddedSourceSettings -> f EmbeddedSourceSettings
embeddedSourceSettings_source608ChannelNumber = (EmbeddedSourceSettings -> Maybe Natural)
-> (EmbeddedSourceSettings
    -> Maybe Natural -> EmbeddedSourceSettings)
-> Lens
     EmbeddedSourceSettings
     EmbeddedSourceSettings
     (Maybe Natural)
     (Maybe Natural)
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)

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

instance Prelude.Hashable EmbeddedSourceSettings

instance Prelude.NFData EmbeddedSourceSettings

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