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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConvert.Types.EmbeddedConvert608To708
import Amazonka.MediaConvert.Types.EmbeddedTerminateCaptions
import qualified Amazonka.Prelude as Prelude

-- | Settings for embedded captions Source
--
-- /See:/ 'newEmbeddedSourceSettings' smart constructor.
data EmbeddedSourceSettings = EmbeddedSourceSettings'
  { -- | Specify whether this set of input captions appears in your outputs in
    -- both 608 and 708 format. If you choose Upconvert (UPCONVERT),
    -- MediaConvert includes the captions data in two ways: it passes the 608
    -- data through using the 608 compatibility bytes fields of the 708
    -- wrapper, and it also translates the 608 data into 708.
    EmbeddedSourceSettings -> Maybe EmbeddedConvert608To708
convert608To708 :: Prelude.Maybe EmbeddedConvert608To708,
    -- | By default, the service terminates any unterminated captions at the end
    -- of each input. If you want the caption to continue onto your next input,
    -- disable this setting.
    EmbeddedSourceSettings -> Maybe EmbeddedTerminateCaptions
terminateCaptions :: Prelude.Maybe EmbeddedTerminateCaptions,
    -- | Specifies the video track index used for extracting captions. The system
    -- only supports one input video track, so this should always be set to
    -- \'1\'.
    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' - Specify whether this set of input captions appears in your outputs in
-- both 608 and 708 format. If you choose Upconvert (UPCONVERT),
-- MediaConvert includes the captions data in two ways: it passes the 608
-- data through using the 608 compatibility bytes fields of the 708
-- wrapper, and it also translates the 608 data into 708.
--
-- 'terminateCaptions', 'embeddedSourceSettings_terminateCaptions' - By default, the service terminates any unterminated captions at the end
-- of each input. If you want the caption to continue onto your next input,
-- disable this setting.
--
-- 'source608TrackNumber', 'embeddedSourceSettings_source608TrackNumber' - Specifies the video track index used for extracting captions. The system
-- only supports one input video track, so this should always be set to
-- \'1\'.
--
-- '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 EmbeddedTerminateCaptions
-> Maybe Natural
-> Maybe Natural
-> EmbeddedSourceSettings
EmbeddedSourceSettings'
    { $sel:convert608To708:EmbeddedSourceSettings' :: Maybe EmbeddedConvert608To708
convert608To708 =
        Maybe EmbeddedConvert608To708
forall a. Maybe a
Prelude.Nothing,
      $sel:terminateCaptions:EmbeddedSourceSettings' :: Maybe EmbeddedTerminateCaptions
terminateCaptions = Maybe EmbeddedTerminateCaptions
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
    }

-- | Specify whether this set of input captions appears in your outputs in
-- both 608 and 708 format. If you choose Upconvert (UPCONVERT),
-- MediaConvert includes the captions data in two ways: it passes the 608
-- data through using the 608 compatibility bytes fields of the 708
-- wrapper, and it also translates the 608 data into 708.
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)

-- | By default, the service terminates any unterminated captions at the end
-- of each input. If you want the caption to continue onto your next input,
-- disable this setting.
embeddedSourceSettings_terminateCaptions :: Lens.Lens' EmbeddedSourceSettings (Prelude.Maybe EmbeddedTerminateCaptions)
embeddedSourceSettings_terminateCaptions :: (Maybe EmbeddedTerminateCaptions
 -> f (Maybe EmbeddedTerminateCaptions))
-> EmbeddedSourceSettings -> f EmbeddedSourceSettings
embeddedSourceSettings_terminateCaptions = (EmbeddedSourceSettings -> Maybe EmbeddedTerminateCaptions)
-> (EmbeddedSourceSettings
    -> Maybe EmbeddedTerminateCaptions -> EmbeddedSourceSettings)
-> Lens
     EmbeddedSourceSettings
     EmbeddedSourceSettings
     (Maybe EmbeddedTerminateCaptions)
     (Maybe EmbeddedTerminateCaptions)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EmbeddedSourceSettings' {Maybe EmbeddedTerminateCaptions
terminateCaptions :: Maybe EmbeddedTerminateCaptions
$sel:terminateCaptions:EmbeddedSourceSettings' :: EmbeddedSourceSettings -> Maybe EmbeddedTerminateCaptions
terminateCaptions} -> Maybe EmbeddedTerminateCaptions
terminateCaptions) (\s :: EmbeddedSourceSettings
s@EmbeddedSourceSettings' {} Maybe EmbeddedTerminateCaptions
a -> EmbeddedSourceSettings
s {$sel:terminateCaptions:EmbeddedSourceSettings' :: Maybe EmbeddedTerminateCaptions
terminateCaptions = Maybe EmbeddedTerminateCaptions
a} :: EmbeddedSourceSettings)

-- | Specifies the video track index used for extracting captions. The system
-- only supports one input video track, so this should always be set to
-- \'1\'.
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 EmbeddedTerminateCaptions
-> Maybe Natural
-> Maybe Natural
-> EmbeddedSourceSettings
EmbeddedSourceSettings'
            (Maybe EmbeddedConvert608To708
 -> Maybe EmbeddedTerminateCaptions
 -> Maybe Natural
 -> Maybe Natural
 -> EmbeddedSourceSettings)
-> Parser (Maybe EmbeddedConvert608To708)
-> Parser
     (Maybe EmbeddedTerminateCaptions
      -> 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 EmbeddedTerminateCaptions
   -> Maybe Natural -> Maybe Natural -> EmbeddedSourceSettings)
-> Parser (Maybe EmbeddedTerminateCaptions)
-> 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 EmbeddedTerminateCaptions)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"terminateCaptions")
            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 EmbeddedTerminateCaptions
source608ChannelNumber :: Maybe Natural
source608TrackNumber :: Maybe Natural
terminateCaptions :: Maybe EmbeddedTerminateCaptions
convert608To708 :: Maybe EmbeddedConvert608To708
$sel:source608ChannelNumber:EmbeddedSourceSettings' :: EmbeddedSourceSettings -> Maybe Natural
$sel:source608TrackNumber:EmbeddedSourceSettings' :: EmbeddedSourceSettings -> Maybe Natural
$sel:terminateCaptions:EmbeddedSourceSettings' :: EmbeddedSourceSettings -> Maybe EmbeddedTerminateCaptions
$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
"terminateCaptions" Text -> EmbeddedTerminateCaptions -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (EmbeddedTerminateCaptions -> Pair)
-> Maybe EmbeddedTerminateCaptions -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EmbeddedTerminateCaptions
terminateCaptions,
            (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
          ]
      )