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

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

-- | These settings control how the service handles timecodes throughout the
-- job. These settings don\'t affect input clipping.
--
-- /See:/ 'newTimecodeConfig' smart constructor.
data TimecodeConfig = TimecodeConfig'
  { -- | Only use when you set Source (TimecodeSource) to Specified start
    -- (SPECIFIEDSTART). Use Start timecode (Start) to specify the timecode for
    -- the initial frame. Use 24-hour format with frame number, (HH:MM:SS:FF)
    -- or (HH:MM:SS;FF).
    TimecodeConfig -> Maybe Text
start :: Prelude.Maybe Prelude.Text,
    -- | Only applies to outputs that support program-date-time stamp. Use
    -- Timestamp offset (TimestampOffset) to overwrite the timecode date
    -- without affecting the time and frame number. Provide the new date as a
    -- string in the format \"yyyy-mm-dd\". To use Time stamp offset, you must
    -- also enable Insert program-date-time (InsertProgramDateTime) in the
    -- output settings. For example, if the date part of your timecodes is
    -- 2002-1-25 and you want to change it to one year later, set Timestamp
    -- offset (TimestampOffset) to 2003-1-25.
    TimecodeConfig -> Maybe Text
timestampOffset :: Prelude.Maybe Prelude.Text,
    -- | If you use an editing platform that relies on an anchor timecode, use
    -- Anchor Timecode (Anchor) to specify a timecode that will match the input
    -- video frame to the output video frame. Use 24-hour format with frame
    -- number, (HH:MM:SS:FF) or (HH:MM:SS;FF). This setting ignores frame rate
    -- conversion. System behavior for Anchor Timecode varies depending on your
    -- setting for Source (TimecodeSource). * If Source (TimecodeSource) is set
    -- to Specified Start (SPECIFIEDSTART), the first input frame is the
    -- specified value in Start Timecode (Start). Anchor Timecode (Anchor) and
    -- Start Timecode (Start) are used calculate output timecode. * If Source
    -- (TimecodeSource) is set to Start at 0 (ZEROBASED) the first frame is
    -- 00:00:00:00. * If Source (TimecodeSource) is set to Embedded (EMBEDDED),
    -- the first frame is the timecode value on the first input frame of the
    -- input.
    TimecodeConfig -> Maybe Text
anchor :: Prelude.Maybe Prelude.Text,
    -- | Use Source (TimecodeSource) to set how timecodes are handled within this
    -- job. To make sure that your video, audio, captions, and markers are
    -- synchronized and that time-based features, such as image inserter, work
    -- correctly, choose the Timecode source option that matches your assets.
    -- All timecodes are in a 24-hour format with frame number (HH:MM:SS:FF). *
    -- Embedded (EMBEDDED) - Use the timecode that is in the input video. If no
    -- embedded timecode is in the source, the service will use Start at 0
    -- (ZEROBASED) instead. * Start at 0 (ZEROBASED) - Set the timecode of the
    -- initial frame to 00:00:00:00. * Specified Start (SPECIFIEDSTART) - Set
    -- the timecode of the initial frame to a value other than zero. You use
    -- Start timecode (Start) to provide this value.
    TimecodeConfig -> Maybe TimecodeSource
source :: Prelude.Maybe TimecodeSource
  }
  deriving (TimecodeConfig -> TimecodeConfig -> Bool
(TimecodeConfig -> TimecodeConfig -> Bool)
-> (TimecodeConfig -> TimecodeConfig -> Bool) -> Eq TimecodeConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TimecodeConfig -> TimecodeConfig -> Bool
$c/= :: TimecodeConfig -> TimecodeConfig -> Bool
== :: TimecodeConfig -> TimecodeConfig -> Bool
$c== :: TimecodeConfig -> TimecodeConfig -> Bool
Prelude.Eq, ReadPrec [TimecodeConfig]
ReadPrec TimecodeConfig
Int -> ReadS TimecodeConfig
ReadS [TimecodeConfig]
(Int -> ReadS TimecodeConfig)
-> ReadS [TimecodeConfig]
-> ReadPrec TimecodeConfig
-> ReadPrec [TimecodeConfig]
-> Read TimecodeConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TimecodeConfig]
$creadListPrec :: ReadPrec [TimecodeConfig]
readPrec :: ReadPrec TimecodeConfig
$creadPrec :: ReadPrec TimecodeConfig
readList :: ReadS [TimecodeConfig]
$creadList :: ReadS [TimecodeConfig]
readsPrec :: Int -> ReadS TimecodeConfig
$creadsPrec :: Int -> ReadS TimecodeConfig
Prelude.Read, Int -> TimecodeConfig -> ShowS
[TimecodeConfig] -> ShowS
TimecodeConfig -> String
(Int -> TimecodeConfig -> ShowS)
-> (TimecodeConfig -> String)
-> ([TimecodeConfig] -> ShowS)
-> Show TimecodeConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TimecodeConfig] -> ShowS
$cshowList :: [TimecodeConfig] -> ShowS
show :: TimecodeConfig -> String
$cshow :: TimecodeConfig -> String
showsPrec :: Int -> TimecodeConfig -> ShowS
$cshowsPrec :: Int -> TimecodeConfig -> ShowS
Prelude.Show, (forall x. TimecodeConfig -> Rep TimecodeConfig x)
-> (forall x. Rep TimecodeConfig x -> TimecodeConfig)
-> Generic TimecodeConfig
forall x. Rep TimecodeConfig x -> TimecodeConfig
forall x. TimecodeConfig -> Rep TimecodeConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TimecodeConfig x -> TimecodeConfig
$cfrom :: forall x. TimecodeConfig -> Rep TimecodeConfig x
Prelude.Generic)

-- |
-- Create a value of 'TimecodeConfig' 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:
--
-- 'start', 'timecodeConfig_start' - Only use when you set Source (TimecodeSource) to Specified start
-- (SPECIFIEDSTART). Use Start timecode (Start) to specify the timecode for
-- the initial frame. Use 24-hour format with frame number, (HH:MM:SS:FF)
-- or (HH:MM:SS;FF).
--
-- 'timestampOffset', 'timecodeConfig_timestampOffset' - Only applies to outputs that support program-date-time stamp. Use
-- Timestamp offset (TimestampOffset) to overwrite the timecode date
-- without affecting the time and frame number. Provide the new date as a
-- string in the format \"yyyy-mm-dd\". To use Time stamp offset, you must
-- also enable Insert program-date-time (InsertProgramDateTime) in the
-- output settings. For example, if the date part of your timecodes is
-- 2002-1-25 and you want to change it to one year later, set Timestamp
-- offset (TimestampOffset) to 2003-1-25.
--
-- 'anchor', 'timecodeConfig_anchor' - If you use an editing platform that relies on an anchor timecode, use
-- Anchor Timecode (Anchor) to specify a timecode that will match the input
-- video frame to the output video frame. Use 24-hour format with frame
-- number, (HH:MM:SS:FF) or (HH:MM:SS;FF). This setting ignores frame rate
-- conversion. System behavior for Anchor Timecode varies depending on your
-- setting for Source (TimecodeSource). * If Source (TimecodeSource) is set
-- to Specified Start (SPECIFIEDSTART), the first input frame is the
-- specified value in Start Timecode (Start). Anchor Timecode (Anchor) and
-- Start Timecode (Start) are used calculate output timecode. * If Source
-- (TimecodeSource) is set to Start at 0 (ZEROBASED) the first frame is
-- 00:00:00:00. * If Source (TimecodeSource) is set to Embedded (EMBEDDED),
-- the first frame is the timecode value on the first input frame of the
-- input.
--
-- 'source', 'timecodeConfig_source' - Use Source (TimecodeSource) to set how timecodes are handled within this
-- job. To make sure that your video, audio, captions, and markers are
-- synchronized and that time-based features, such as image inserter, work
-- correctly, choose the Timecode source option that matches your assets.
-- All timecodes are in a 24-hour format with frame number (HH:MM:SS:FF). *
-- Embedded (EMBEDDED) - Use the timecode that is in the input video. If no
-- embedded timecode is in the source, the service will use Start at 0
-- (ZEROBASED) instead. * Start at 0 (ZEROBASED) - Set the timecode of the
-- initial frame to 00:00:00:00. * Specified Start (SPECIFIEDSTART) - Set
-- the timecode of the initial frame to a value other than zero. You use
-- Start timecode (Start) to provide this value.
newTimecodeConfig ::
  TimecodeConfig
newTimecodeConfig :: TimecodeConfig
newTimecodeConfig =
  TimecodeConfig' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe TimecodeSource
-> TimecodeConfig
TimecodeConfig'
    { $sel:start:TimecodeConfig' :: Maybe Text
start = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:timestampOffset:TimecodeConfig' :: Maybe Text
timestampOffset = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:anchor:TimecodeConfig' :: Maybe Text
anchor = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:source:TimecodeConfig' :: Maybe TimecodeSource
source = Maybe TimecodeSource
forall a. Maybe a
Prelude.Nothing
    }

-- | Only use when you set Source (TimecodeSource) to Specified start
-- (SPECIFIEDSTART). Use Start timecode (Start) to specify the timecode for
-- the initial frame. Use 24-hour format with frame number, (HH:MM:SS:FF)
-- or (HH:MM:SS;FF).
timecodeConfig_start :: Lens.Lens' TimecodeConfig (Prelude.Maybe Prelude.Text)
timecodeConfig_start :: (Maybe Text -> f (Maybe Text))
-> TimecodeConfig -> f TimecodeConfig
timecodeConfig_start = (TimecodeConfig -> Maybe Text)
-> (TimecodeConfig -> Maybe Text -> TimecodeConfig)
-> Lens TimecodeConfig TimecodeConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimecodeConfig' {Maybe Text
start :: Maybe Text
$sel:start:TimecodeConfig' :: TimecodeConfig -> Maybe Text
start} -> Maybe Text
start) (\s :: TimecodeConfig
s@TimecodeConfig' {} Maybe Text
a -> TimecodeConfig
s {$sel:start:TimecodeConfig' :: Maybe Text
start = Maybe Text
a} :: TimecodeConfig)

-- | Only applies to outputs that support program-date-time stamp. Use
-- Timestamp offset (TimestampOffset) to overwrite the timecode date
-- without affecting the time and frame number. Provide the new date as a
-- string in the format \"yyyy-mm-dd\". To use Time stamp offset, you must
-- also enable Insert program-date-time (InsertProgramDateTime) in the
-- output settings. For example, if the date part of your timecodes is
-- 2002-1-25 and you want to change it to one year later, set Timestamp
-- offset (TimestampOffset) to 2003-1-25.
timecodeConfig_timestampOffset :: Lens.Lens' TimecodeConfig (Prelude.Maybe Prelude.Text)
timecodeConfig_timestampOffset :: (Maybe Text -> f (Maybe Text))
-> TimecodeConfig -> f TimecodeConfig
timecodeConfig_timestampOffset = (TimecodeConfig -> Maybe Text)
-> (TimecodeConfig -> Maybe Text -> TimecodeConfig)
-> Lens TimecodeConfig TimecodeConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimecodeConfig' {Maybe Text
timestampOffset :: Maybe Text
$sel:timestampOffset:TimecodeConfig' :: TimecodeConfig -> Maybe Text
timestampOffset} -> Maybe Text
timestampOffset) (\s :: TimecodeConfig
s@TimecodeConfig' {} Maybe Text
a -> TimecodeConfig
s {$sel:timestampOffset:TimecodeConfig' :: Maybe Text
timestampOffset = Maybe Text
a} :: TimecodeConfig)

-- | If you use an editing platform that relies on an anchor timecode, use
-- Anchor Timecode (Anchor) to specify a timecode that will match the input
-- video frame to the output video frame. Use 24-hour format with frame
-- number, (HH:MM:SS:FF) or (HH:MM:SS;FF). This setting ignores frame rate
-- conversion. System behavior for Anchor Timecode varies depending on your
-- setting for Source (TimecodeSource). * If Source (TimecodeSource) is set
-- to Specified Start (SPECIFIEDSTART), the first input frame is the
-- specified value in Start Timecode (Start). Anchor Timecode (Anchor) and
-- Start Timecode (Start) are used calculate output timecode. * If Source
-- (TimecodeSource) is set to Start at 0 (ZEROBASED) the first frame is
-- 00:00:00:00. * If Source (TimecodeSource) is set to Embedded (EMBEDDED),
-- the first frame is the timecode value on the first input frame of the
-- input.
timecodeConfig_anchor :: Lens.Lens' TimecodeConfig (Prelude.Maybe Prelude.Text)
timecodeConfig_anchor :: (Maybe Text -> f (Maybe Text))
-> TimecodeConfig -> f TimecodeConfig
timecodeConfig_anchor = (TimecodeConfig -> Maybe Text)
-> (TimecodeConfig -> Maybe Text -> TimecodeConfig)
-> Lens TimecodeConfig TimecodeConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimecodeConfig' {Maybe Text
anchor :: Maybe Text
$sel:anchor:TimecodeConfig' :: TimecodeConfig -> Maybe Text
anchor} -> Maybe Text
anchor) (\s :: TimecodeConfig
s@TimecodeConfig' {} Maybe Text
a -> TimecodeConfig
s {$sel:anchor:TimecodeConfig' :: Maybe Text
anchor = Maybe Text
a} :: TimecodeConfig)

-- | Use Source (TimecodeSource) to set how timecodes are handled within this
-- job. To make sure that your video, audio, captions, and markers are
-- synchronized and that time-based features, such as image inserter, work
-- correctly, choose the Timecode source option that matches your assets.
-- All timecodes are in a 24-hour format with frame number (HH:MM:SS:FF). *
-- Embedded (EMBEDDED) - Use the timecode that is in the input video. If no
-- embedded timecode is in the source, the service will use Start at 0
-- (ZEROBASED) instead. * Start at 0 (ZEROBASED) - Set the timecode of the
-- initial frame to 00:00:00:00. * Specified Start (SPECIFIEDSTART) - Set
-- the timecode of the initial frame to a value other than zero. You use
-- Start timecode (Start) to provide this value.
timecodeConfig_source :: Lens.Lens' TimecodeConfig (Prelude.Maybe TimecodeSource)
timecodeConfig_source :: (Maybe TimecodeSource -> f (Maybe TimecodeSource))
-> TimecodeConfig -> f TimecodeConfig
timecodeConfig_source = (TimecodeConfig -> Maybe TimecodeSource)
-> (TimecodeConfig -> Maybe TimecodeSource -> TimecodeConfig)
-> Lens
     TimecodeConfig
     TimecodeConfig
     (Maybe TimecodeSource)
     (Maybe TimecodeSource)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimecodeConfig' {Maybe TimecodeSource
source :: Maybe TimecodeSource
$sel:source:TimecodeConfig' :: TimecodeConfig -> Maybe TimecodeSource
source} -> Maybe TimecodeSource
source) (\s :: TimecodeConfig
s@TimecodeConfig' {} Maybe TimecodeSource
a -> TimecodeConfig
s {$sel:source:TimecodeConfig' :: Maybe TimecodeSource
source = Maybe TimecodeSource
a} :: TimecodeConfig)

instance Core.FromJSON TimecodeConfig where
  parseJSON :: Value -> Parser TimecodeConfig
parseJSON =
    String
-> (Object -> Parser TimecodeConfig)
-> Value
-> Parser TimecodeConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TimecodeConfig"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe TimecodeSource
-> TimecodeConfig
TimecodeConfig'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe TimecodeSource
 -> TimecodeConfig)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe TimecodeSource -> TimecodeConfig)
forall (f :: * -> *) a b. Functor 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
"start")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe TimecodeSource -> TimecodeConfig)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe TimecodeSource -> TimecodeConfig)
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
"timestampOffset")
            Parser (Maybe Text -> Maybe TimecodeSource -> TimecodeConfig)
-> Parser (Maybe Text)
-> Parser (Maybe TimecodeSource -> TimecodeConfig)
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
"anchor")
            Parser (Maybe TimecodeSource -> TimecodeConfig)
-> Parser (Maybe TimecodeSource) -> Parser TimecodeConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe TimecodeSource)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"source")
      )

instance Prelude.Hashable TimecodeConfig

instance Prelude.NFData TimecodeConfig

instance Core.ToJSON TimecodeConfig where
  toJSON :: TimecodeConfig -> Value
toJSON TimecodeConfig' {Maybe Text
Maybe TimecodeSource
source :: Maybe TimecodeSource
anchor :: Maybe Text
timestampOffset :: Maybe Text
start :: Maybe Text
$sel:source:TimecodeConfig' :: TimecodeConfig -> Maybe TimecodeSource
$sel:anchor:TimecodeConfig' :: TimecodeConfig -> Maybe Text
$sel:timestampOffset:TimecodeConfig' :: TimecodeConfig -> Maybe Text
$sel:start:TimecodeConfig' :: TimecodeConfig -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"start" 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
start,
            (Text
"timestampOffset" 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
timestampOffset,
            (Text
"anchor" 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
anchor,
            (Text
"source" Text -> TimecodeSource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (TimecodeSource -> Pair) -> Maybe TimecodeSource -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TimecodeSource
source
          ]
      )