{-# 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.VideoCodecSettings
-- 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.VideoCodecSettings 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.FrameCaptureSettings
import Amazonka.MediaLive.Types.H264Settings
import Amazonka.MediaLive.Types.H265Settings
import Amazonka.MediaLive.Types.Mpeg2Settings
import qualified Amazonka.Prelude as Prelude

-- | Video Codec Settings
--
-- /See:/ 'newVideoCodecSettings' smart constructor.
data VideoCodecSettings = VideoCodecSettings'
  { VideoCodecSettings -> Maybe FrameCaptureSettings
frameCaptureSettings :: Prelude.Maybe FrameCaptureSettings,
    VideoCodecSettings -> Maybe H264Settings
h264Settings :: Prelude.Maybe H264Settings,
    VideoCodecSettings -> Maybe H265Settings
h265Settings :: Prelude.Maybe H265Settings,
    VideoCodecSettings -> Maybe Mpeg2Settings
mpeg2Settings :: Prelude.Maybe Mpeg2Settings
  }
  deriving (VideoCodecSettings -> VideoCodecSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VideoCodecSettings -> VideoCodecSettings -> Bool
$c/= :: VideoCodecSettings -> VideoCodecSettings -> Bool
== :: VideoCodecSettings -> VideoCodecSettings -> Bool
$c== :: VideoCodecSettings -> VideoCodecSettings -> Bool
Prelude.Eq, ReadPrec [VideoCodecSettings]
ReadPrec VideoCodecSettings
Int -> ReadS VideoCodecSettings
ReadS [VideoCodecSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VideoCodecSettings]
$creadListPrec :: ReadPrec [VideoCodecSettings]
readPrec :: ReadPrec VideoCodecSettings
$creadPrec :: ReadPrec VideoCodecSettings
readList :: ReadS [VideoCodecSettings]
$creadList :: ReadS [VideoCodecSettings]
readsPrec :: Int -> ReadS VideoCodecSettings
$creadsPrec :: Int -> ReadS VideoCodecSettings
Prelude.Read, Int -> VideoCodecSettings -> ShowS
[VideoCodecSettings] -> ShowS
VideoCodecSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VideoCodecSettings] -> ShowS
$cshowList :: [VideoCodecSettings] -> ShowS
show :: VideoCodecSettings -> String
$cshow :: VideoCodecSettings -> String
showsPrec :: Int -> VideoCodecSettings -> ShowS
$cshowsPrec :: Int -> VideoCodecSettings -> ShowS
Prelude.Show, forall x. Rep VideoCodecSettings x -> VideoCodecSettings
forall x. VideoCodecSettings -> Rep VideoCodecSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VideoCodecSettings x -> VideoCodecSettings
$cfrom :: forall x. VideoCodecSettings -> Rep VideoCodecSettings x
Prelude.Generic)

-- |
-- Create a value of 'VideoCodecSettings' 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:
--
-- 'frameCaptureSettings', 'videoCodecSettings_frameCaptureSettings' - Undocumented member.
--
-- 'h264Settings', 'videoCodecSettings_h264Settings' - Undocumented member.
--
-- 'h265Settings', 'videoCodecSettings_h265Settings' - Undocumented member.
--
-- 'mpeg2Settings', 'videoCodecSettings_mpeg2Settings' - Undocumented member.
newVideoCodecSettings ::
  VideoCodecSettings
newVideoCodecSettings :: VideoCodecSettings
newVideoCodecSettings =
  VideoCodecSettings'
    { $sel:frameCaptureSettings:VideoCodecSettings' :: Maybe FrameCaptureSettings
frameCaptureSettings =
        forall a. Maybe a
Prelude.Nothing,
      $sel:h264Settings:VideoCodecSettings' :: Maybe H264Settings
h264Settings = forall a. Maybe a
Prelude.Nothing,
      $sel:h265Settings:VideoCodecSettings' :: Maybe H265Settings
h265Settings = forall a. Maybe a
Prelude.Nothing,
      $sel:mpeg2Settings:VideoCodecSettings' :: Maybe Mpeg2Settings
mpeg2Settings = forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
videoCodecSettings_frameCaptureSettings :: Lens.Lens' VideoCodecSettings (Prelude.Maybe FrameCaptureSettings)
videoCodecSettings_frameCaptureSettings :: Lens' VideoCodecSettings (Maybe FrameCaptureSettings)
videoCodecSettings_frameCaptureSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VideoCodecSettings' {Maybe FrameCaptureSettings
frameCaptureSettings :: Maybe FrameCaptureSettings
$sel:frameCaptureSettings:VideoCodecSettings' :: VideoCodecSettings -> Maybe FrameCaptureSettings
frameCaptureSettings} -> Maybe FrameCaptureSettings
frameCaptureSettings) (\s :: VideoCodecSettings
s@VideoCodecSettings' {} Maybe FrameCaptureSettings
a -> VideoCodecSettings
s {$sel:frameCaptureSettings:VideoCodecSettings' :: Maybe FrameCaptureSettings
frameCaptureSettings = Maybe FrameCaptureSettings
a} :: VideoCodecSettings)

-- | Undocumented member.
videoCodecSettings_h264Settings :: Lens.Lens' VideoCodecSettings (Prelude.Maybe H264Settings)
videoCodecSettings_h264Settings :: Lens' VideoCodecSettings (Maybe H264Settings)
videoCodecSettings_h264Settings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VideoCodecSettings' {Maybe H264Settings
h264Settings :: Maybe H264Settings
$sel:h264Settings:VideoCodecSettings' :: VideoCodecSettings -> Maybe H264Settings
h264Settings} -> Maybe H264Settings
h264Settings) (\s :: VideoCodecSettings
s@VideoCodecSettings' {} Maybe H264Settings
a -> VideoCodecSettings
s {$sel:h264Settings:VideoCodecSettings' :: Maybe H264Settings
h264Settings = Maybe H264Settings
a} :: VideoCodecSettings)

-- | Undocumented member.
videoCodecSettings_h265Settings :: Lens.Lens' VideoCodecSettings (Prelude.Maybe H265Settings)
videoCodecSettings_h265Settings :: Lens' VideoCodecSettings (Maybe H265Settings)
videoCodecSettings_h265Settings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VideoCodecSettings' {Maybe H265Settings
h265Settings :: Maybe H265Settings
$sel:h265Settings:VideoCodecSettings' :: VideoCodecSettings -> Maybe H265Settings
h265Settings} -> Maybe H265Settings
h265Settings) (\s :: VideoCodecSettings
s@VideoCodecSettings' {} Maybe H265Settings
a -> VideoCodecSettings
s {$sel:h265Settings:VideoCodecSettings' :: Maybe H265Settings
h265Settings = Maybe H265Settings
a} :: VideoCodecSettings)

-- | Undocumented member.
videoCodecSettings_mpeg2Settings :: Lens.Lens' VideoCodecSettings (Prelude.Maybe Mpeg2Settings)
videoCodecSettings_mpeg2Settings :: Lens' VideoCodecSettings (Maybe Mpeg2Settings)
videoCodecSettings_mpeg2Settings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VideoCodecSettings' {Maybe Mpeg2Settings
mpeg2Settings :: Maybe Mpeg2Settings
$sel:mpeg2Settings:VideoCodecSettings' :: VideoCodecSettings -> Maybe Mpeg2Settings
mpeg2Settings} -> Maybe Mpeg2Settings
mpeg2Settings) (\s :: VideoCodecSettings
s@VideoCodecSettings' {} Maybe Mpeg2Settings
a -> VideoCodecSettings
s {$sel:mpeg2Settings:VideoCodecSettings' :: Maybe Mpeg2Settings
mpeg2Settings = Maybe Mpeg2Settings
a} :: VideoCodecSettings)

instance Data.FromJSON VideoCodecSettings where
  parseJSON :: Value -> Parser VideoCodecSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"VideoCodecSettings"
      ( \Object
x ->
          Maybe FrameCaptureSettings
-> Maybe H264Settings
-> Maybe H265Settings
-> Maybe Mpeg2Settings
-> VideoCodecSettings
VideoCodecSettings'
            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
"frameCaptureSettings")
            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
"h264Settings")
            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
"h265Settings")
            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
"mpeg2Settings")
      )

instance Prelude.Hashable VideoCodecSettings where
  hashWithSalt :: Int -> VideoCodecSettings -> Int
hashWithSalt Int
_salt VideoCodecSettings' {Maybe Mpeg2Settings
Maybe H265Settings
Maybe H264Settings
Maybe FrameCaptureSettings
mpeg2Settings :: Maybe Mpeg2Settings
h265Settings :: Maybe H265Settings
h264Settings :: Maybe H264Settings
frameCaptureSettings :: Maybe FrameCaptureSettings
$sel:mpeg2Settings:VideoCodecSettings' :: VideoCodecSettings -> Maybe Mpeg2Settings
$sel:h265Settings:VideoCodecSettings' :: VideoCodecSettings -> Maybe H265Settings
$sel:h264Settings:VideoCodecSettings' :: VideoCodecSettings -> Maybe H264Settings
$sel:frameCaptureSettings:VideoCodecSettings' :: VideoCodecSettings -> Maybe FrameCaptureSettings
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FrameCaptureSettings
frameCaptureSettings
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe H264Settings
h264Settings
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe H265Settings
h265Settings
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Mpeg2Settings
mpeg2Settings

instance Prelude.NFData VideoCodecSettings where
  rnf :: VideoCodecSettings -> ()
rnf VideoCodecSettings' {Maybe Mpeg2Settings
Maybe H265Settings
Maybe H264Settings
Maybe FrameCaptureSettings
mpeg2Settings :: Maybe Mpeg2Settings
h265Settings :: Maybe H265Settings
h264Settings :: Maybe H264Settings
frameCaptureSettings :: Maybe FrameCaptureSettings
$sel:mpeg2Settings:VideoCodecSettings' :: VideoCodecSettings -> Maybe Mpeg2Settings
$sel:h265Settings:VideoCodecSettings' :: VideoCodecSettings -> Maybe H265Settings
$sel:h264Settings:VideoCodecSettings' :: VideoCodecSettings -> Maybe H264Settings
$sel:frameCaptureSettings:VideoCodecSettings' :: VideoCodecSettings -> Maybe FrameCaptureSettings
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe FrameCaptureSettings
frameCaptureSettings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe H264Settings
h264Settings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe H265Settings
h265Settings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Mpeg2Settings
mpeg2Settings

instance Data.ToJSON VideoCodecSettings where
  toJSON :: VideoCodecSettings -> Value
toJSON VideoCodecSettings' {Maybe Mpeg2Settings
Maybe H265Settings
Maybe H264Settings
Maybe FrameCaptureSettings
mpeg2Settings :: Maybe Mpeg2Settings
h265Settings :: Maybe H265Settings
h264Settings :: Maybe H264Settings
frameCaptureSettings :: Maybe FrameCaptureSettings
$sel:mpeg2Settings:VideoCodecSettings' :: VideoCodecSettings -> Maybe Mpeg2Settings
$sel:h265Settings:VideoCodecSettings' :: VideoCodecSettings -> Maybe H265Settings
$sel:h264Settings:VideoCodecSettings' :: VideoCodecSettings -> Maybe H264Settings
$sel:frameCaptureSettings:VideoCodecSettings' :: VideoCodecSettings -> Maybe FrameCaptureSettings
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"frameCaptureSettings" 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 FrameCaptureSettings
frameCaptureSettings,
            (Key
"h264Settings" 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 H264Settings
h264Settings,
            (Key
"h265Settings" 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 H265Settings
h265Settings,
            (Key
"mpeg2Settings" 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 Mpeg2Settings
mpeg2Settings
          ]
      )