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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConvert.Types.SccDestinationFramerate
import qualified Amazonka.Prelude as Prelude

-- | Settings related to SCC captions. SCC is a sidecar format that holds
-- captions in a file that is separate from the video container. Set up
-- sidecar captions in the same output group, but different output from
-- your video. For more information, see
-- https:\/\/docs.aws.amazon.com\/mediaconvert\/latest\/ug\/scc-srt-output-captions.html.
-- When you work directly in your JSON job specification, include this
-- object and any required children when you set destinationType to SCC.
--
-- /See:/ 'newSccDestinationSettings' smart constructor.
data SccDestinationSettings = SccDestinationSettings'
  { -- | Set Framerate (SccDestinationFramerate) to make sure that the captions
    -- and the video are synchronized in the output. Specify a frame rate that
    -- matches the frame rate of the associated video. If the video frame rate
    -- is 29.97, choose 29.97 dropframe (FRAMERATE_29_97_DROPFRAME) only if the
    -- video has video_insertion=true and drop_frame_timecode=true; otherwise,
    -- choose 29.97 non-dropframe (FRAMERATE_29_97_NON_DROPFRAME).
    SccDestinationSettings -> Maybe SccDestinationFramerate
framerate :: Prelude.Maybe SccDestinationFramerate
  }
  deriving (SccDestinationSettings -> SccDestinationSettings -> Bool
(SccDestinationSettings -> SccDestinationSettings -> Bool)
-> (SccDestinationSettings -> SccDestinationSettings -> Bool)
-> Eq SccDestinationSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SccDestinationSettings -> SccDestinationSettings -> Bool
$c/= :: SccDestinationSettings -> SccDestinationSettings -> Bool
== :: SccDestinationSettings -> SccDestinationSettings -> Bool
$c== :: SccDestinationSettings -> SccDestinationSettings -> Bool
Prelude.Eq, ReadPrec [SccDestinationSettings]
ReadPrec SccDestinationSettings
Int -> ReadS SccDestinationSettings
ReadS [SccDestinationSettings]
(Int -> ReadS SccDestinationSettings)
-> ReadS [SccDestinationSettings]
-> ReadPrec SccDestinationSettings
-> ReadPrec [SccDestinationSettings]
-> Read SccDestinationSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SccDestinationSettings]
$creadListPrec :: ReadPrec [SccDestinationSettings]
readPrec :: ReadPrec SccDestinationSettings
$creadPrec :: ReadPrec SccDestinationSettings
readList :: ReadS [SccDestinationSettings]
$creadList :: ReadS [SccDestinationSettings]
readsPrec :: Int -> ReadS SccDestinationSettings
$creadsPrec :: Int -> ReadS SccDestinationSettings
Prelude.Read, Int -> SccDestinationSettings -> ShowS
[SccDestinationSettings] -> ShowS
SccDestinationSettings -> String
(Int -> SccDestinationSettings -> ShowS)
-> (SccDestinationSettings -> String)
-> ([SccDestinationSettings] -> ShowS)
-> Show SccDestinationSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SccDestinationSettings] -> ShowS
$cshowList :: [SccDestinationSettings] -> ShowS
show :: SccDestinationSettings -> String
$cshow :: SccDestinationSettings -> String
showsPrec :: Int -> SccDestinationSettings -> ShowS
$cshowsPrec :: Int -> SccDestinationSettings -> ShowS
Prelude.Show, (forall x. SccDestinationSettings -> Rep SccDestinationSettings x)
-> (forall x.
    Rep SccDestinationSettings x -> SccDestinationSettings)
-> Generic SccDestinationSettings
forall x. Rep SccDestinationSettings x -> SccDestinationSettings
forall x. SccDestinationSettings -> Rep SccDestinationSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SccDestinationSettings x -> SccDestinationSettings
$cfrom :: forall x. SccDestinationSettings -> Rep SccDestinationSettings x
Prelude.Generic)

-- |
-- Create a value of 'SccDestinationSettings' 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:
--
-- 'framerate', 'sccDestinationSettings_framerate' - Set Framerate (SccDestinationFramerate) to make sure that the captions
-- and the video are synchronized in the output. Specify a frame rate that
-- matches the frame rate of the associated video. If the video frame rate
-- is 29.97, choose 29.97 dropframe (FRAMERATE_29_97_DROPFRAME) only if the
-- video has video_insertion=true and drop_frame_timecode=true; otherwise,
-- choose 29.97 non-dropframe (FRAMERATE_29_97_NON_DROPFRAME).
newSccDestinationSettings ::
  SccDestinationSettings
newSccDestinationSettings :: SccDestinationSettings
newSccDestinationSettings =
  SccDestinationSettings' :: Maybe SccDestinationFramerate -> SccDestinationSettings
SccDestinationSettings'
    { $sel:framerate:SccDestinationSettings' :: Maybe SccDestinationFramerate
framerate =
        Maybe SccDestinationFramerate
forall a. Maybe a
Prelude.Nothing
    }

-- | Set Framerate (SccDestinationFramerate) to make sure that the captions
-- and the video are synchronized in the output. Specify a frame rate that
-- matches the frame rate of the associated video. If the video frame rate
-- is 29.97, choose 29.97 dropframe (FRAMERATE_29_97_DROPFRAME) only if the
-- video has video_insertion=true and drop_frame_timecode=true; otherwise,
-- choose 29.97 non-dropframe (FRAMERATE_29_97_NON_DROPFRAME).
sccDestinationSettings_framerate :: Lens.Lens' SccDestinationSettings (Prelude.Maybe SccDestinationFramerate)
sccDestinationSettings_framerate :: (Maybe SccDestinationFramerate
 -> f (Maybe SccDestinationFramerate))
-> SccDestinationSettings -> f SccDestinationSettings
sccDestinationSettings_framerate = (SccDestinationSettings -> Maybe SccDestinationFramerate)
-> (SccDestinationSettings
    -> Maybe SccDestinationFramerate -> SccDestinationSettings)
-> Lens
     SccDestinationSettings
     SccDestinationSettings
     (Maybe SccDestinationFramerate)
     (Maybe SccDestinationFramerate)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SccDestinationSettings' {Maybe SccDestinationFramerate
framerate :: Maybe SccDestinationFramerate
$sel:framerate:SccDestinationSettings' :: SccDestinationSettings -> Maybe SccDestinationFramerate
framerate} -> Maybe SccDestinationFramerate
framerate) (\s :: SccDestinationSettings
s@SccDestinationSettings' {} Maybe SccDestinationFramerate
a -> SccDestinationSettings
s {$sel:framerate:SccDestinationSettings' :: Maybe SccDestinationFramerate
framerate = Maybe SccDestinationFramerate
a} :: SccDestinationSettings)

instance Core.FromJSON SccDestinationSettings where
  parseJSON :: Value -> Parser SccDestinationSettings
parseJSON =
    String
-> (Object -> Parser SccDestinationSettings)
-> Value
-> Parser SccDestinationSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SccDestinationSettings"
      ( \Object
x ->
          Maybe SccDestinationFramerate -> SccDestinationSettings
SccDestinationSettings'
            (Maybe SccDestinationFramerate -> SccDestinationSettings)
-> Parser (Maybe SccDestinationFramerate)
-> Parser SccDestinationSettings
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe SccDestinationFramerate)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"framerate")
      )

instance Prelude.Hashable SccDestinationSettings

instance Prelude.NFData SccDestinationSettings

instance Core.ToJSON SccDestinationSettings where
  toJSON :: SccDestinationSettings -> Value
toJSON SccDestinationSettings' {Maybe SccDestinationFramerate
framerate :: Maybe SccDestinationFramerate
$sel:framerate:SccDestinationSettings' :: SccDestinationSettings -> Maybe SccDestinationFramerate
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"framerate" Text -> SccDestinationFramerate -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SccDestinationFramerate -> Pair)
-> Maybe SccDestinationFramerate -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SccDestinationFramerate
framerate]
      )