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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 H265Settings
h265Settings :: Prelude.Maybe H265Settings,
    VideoCodecSettings -> Maybe H264Settings
h264Settings :: Prelude.Maybe H264Settings,
    VideoCodecSettings -> Maybe Mpeg2Settings
mpeg2Settings :: Prelude.Maybe Mpeg2Settings
  }
  deriving (VideoCodecSettings -> VideoCodecSettings -> Bool
(VideoCodecSettings -> VideoCodecSettings -> Bool)
-> (VideoCodecSettings -> VideoCodecSettings -> Bool)
-> Eq VideoCodecSettings
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]
(Int -> ReadS VideoCodecSettings)
-> ReadS [VideoCodecSettings]
-> ReadPrec VideoCodecSettings
-> ReadPrec [VideoCodecSettings]
-> Read 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
(Int -> VideoCodecSettings -> ShowS)
-> (VideoCodecSettings -> String)
-> ([VideoCodecSettings] -> ShowS)
-> Show VideoCodecSettings
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. VideoCodecSettings -> Rep VideoCodecSettings x)
-> (forall x. Rep VideoCodecSettings x -> VideoCodecSettings)
-> Generic VideoCodecSettings
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.
--
-- 'h265Settings', 'videoCodecSettings_h265Settings' - Undocumented member.
--
-- 'h264Settings', 'videoCodecSettings_h264Settings' - Undocumented member.
--
-- 'mpeg2Settings', 'videoCodecSettings_mpeg2Settings' - Undocumented member.
newVideoCodecSettings ::
  VideoCodecSettings
newVideoCodecSettings :: VideoCodecSettings
newVideoCodecSettings =
  VideoCodecSettings' :: Maybe FrameCaptureSettings
-> Maybe H265Settings
-> Maybe H264Settings
-> Maybe Mpeg2Settings
-> VideoCodecSettings
VideoCodecSettings'
    { $sel:frameCaptureSettings:VideoCodecSettings' :: Maybe FrameCaptureSettings
frameCaptureSettings =
        Maybe FrameCaptureSettings
forall a. Maybe a
Prelude.Nothing,
      $sel:h265Settings:VideoCodecSettings' :: Maybe H265Settings
h265Settings = Maybe H265Settings
forall a. Maybe a
Prelude.Nothing,
      $sel:h264Settings:VideoCodecSettings' :: Maybe H264Settings
h264Settings = Maybe H264Settings
forall a. Maybe a
Prelude.Nothing,
      $sel:mpeg2Settings:VideoCodecSettings' :: Maybe Mpeg2Settings
mpeg2Settings = Maybe Mpeg2Settings
forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
videoCodecSettings_frameCaptureSettings :: Lens.Lens' VideoCodecSettings (Prelude.Maybe FrameCaptureSettings)
videoCodecSettings_frameCaptureSettings :: (Maybe FrameCaptureSettings -> f (Maybe FrameCaptureSettings))
-> VideoCodecSettings -> f VideoCodecSettings
videoCodecSettings_frameCaptureSettings = (VideoCodecSettings -> Maybe FrameCaptureSettings)
-> (VideoCodecSettings
    -> Maybe FrameCaptureSettings -> VideoCodecSettings)
-> Lens
     VideoCodecSettings
     VideoCodecSettings
     (Maybe FrameCaptureSettings)
     (Maybe 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_h265Settings :: Lens.Lens' VideoCodecSettings (Prelude.Maybe H265Settings)
videoCodecSettings_h265Settings :: (Maybe H265Settings -> f (Maybe H265Settings))
-> VideoCodecSettings -> f VideoCodecSettings
videoCodecSettings_h265Settings = (VideoCodecSettings -> Maybe H265Settings)
-> (VideoCodecSettings -> Maybe H265Settings -> VideoCodecSettings)
-> Lens
     VideoCodecSettings
     VideoCodecSettings
     (Maybe H265Settings)
     (Maybe 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_h264Settings :: Lens.Lens' VideoCodecSettings (Prelude.Maybe H264Settings)
videoCodecSettings_h264Settings :: (Maybe H264Settings -> f (Maybe H264Settings))
-> VideoCodecSettings -> f VideoCodecSettings
videoCodecSettings_h264Settings = (VideoCodecSettings -> Maybe H264Settings)
-> (VideoCodecSettings -> Maybe H264Settings -> VideoCodecSettings)
-> Lens
     VideoCodecSettings
     VideoCodecSettings
     (Maybe H264Settings)
     (Maybe 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_mpeg2Settings :: Lens.Lens' VideoCodecSettings (Prelude.Maybe Mpeg2Settings)
videoCodecSettings_mpeg2Settings :: (Maybe Mpeg2Settings -> f (Maybe Mpeg2Settings))
-> VideoCodecSettings -> f VideoCodecSettings
videoCodecSettings_mpeg2Settings = (VideoCodecSettings -> Maybe Mpeg2Settings)
-> (VideoCodecSettings
    -> Maybe Mpeg2Settings -> VideoCodecSettings)
-> Lens
     VideoCodecSettings
     VideoCodecSettings
     (Maybe Mpeg2Settings)
     (Maybe 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 Core.FromJSON VideoCodecSettings where
  parseJSON :: Value -> Parser VideoCodecSettings
parseJSON =
    String
-> (Object -> Parser VideoCodecSettings)
-> Value
-> Parser VideoCodecSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"VideoCodecSettings"
      ( \Object
x ->
          Maybe FrameCaptureSettings
-> Maybe H265Settings
-> Maybe H264Settings
-> Maybe Mpeg2Settings
-> VideoCodecSettings
VideoCodecSettings'
            (Maybe FrameCaptureSettings
 -> Maybe H265Settings
 -> Maybe H264Settings
 -> Maybe Mpeg2Settings
 -> VideoCodecSettings)
-> Parser (Maybe FrameCaptureSettings)
-> Parser
     (Maybe H265Settings
      -> Maybe H264Settings -> Maybe Mpeg2Settings -> VideoCodecSettings)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe FrameCaptureSettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"frameCaptureSettings")
            Parser
  (Maybe H265Settings
   -> Maybe H264Settings -> Maybe Mpeg2Settings -> VideoCodecSettings)
-> Parser (Maybe H265Settings)
-> Parser
     (Maybe H264Settings -> Maybe Mpeg2Settings -> VideoCodecSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe H265Settings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"h265Settings")
            Parser
  (Maybe H264Settings -> Maybe Mpeg2Settings -> VideoCodecSettings)
-> Parser (Maybe H264Settings)
-> Parser (Maybe Mpeg2Settings -> VideoCodecSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe H264Settings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"h264Settings")
            Parser (Maybe Mpeg2Settings -> VideoCodecSettings)
-> Parser (Maybe Mpeg2Settings) -> Parser VideoCodecSettings
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Mpeg2Settings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"mpeg2Settings")
      )

instance Prelude.Hashable VideoCodecSettings

instance Prelude.NFData VideoCodecSettings

instance Core.ToJSON VideoCodecSettings where
  toJSON :: VideoCodecSettings -> Value
toJSON VideoCodecSettings' {Maybe FrameCaptureSettings
Maybe Mpeg2Settings
Maybe H265Settings
Maybe H264Settings
mpeg2Settings :: Maybe Mpeg2Settings
h264Settings :: Maybe H264Settings
h265Settings :: Maybe H265Settings
frameCaptureSettings :: Maybe FrameCaptureSettings
$sel:mpeg2Settings:VideoCodecSettings' :: VideoCodecSettings -> Maybe Mpeg2Settings
$sel:h264Settings:VideoCodecSettings' :: VideoCodecSettings -> Maybe H264Settings
$sel:h265Settings:VideoCodecSettings' :: VideoCodecSettings -> Maybe H265Settings
$sel:frameCaptureSettings:VideoCodecSettings' :: VideoCodecSettings -> Maybe FrameCaptureSettings
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"frameCaptureSettings" Text -> FrameCaptureSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (FrameCaptureSettings -> Pair)
-> Maybe FrameCaptureSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FrameCaptureSettings
frameCaptureSettings,
            (Text
"h265Settings" Text -> H265Settings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (H265Settings -> Pair) -> Maybe H265Settings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe H265Settings
h265Settings,
            (Text
"h264Settings" Text -> H264Settings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (H264Settings -> Pair) -> Maybe H264Settings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe H264Settings
h264Settings,
            (Text
"mpeg2Settings" Text -> Mpeg2Settings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Mpeg2Settings -> Pair) -> Maybe Mpeg2Settings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Mpeg2Settings
mpeg2Settings
          ]
      )