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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaLive.Types.VideoCodecSettings
import Amazonka.MediaLive.Types.VideoDescriptionRespondToAfd
import Amazonka.MediaLive.Types.VideoDescriptionScalingBehavior
import qualified Amazonka.Prelude as Prelude

-- | Video settings for this stream.
--
-- /See:/ 'newVideoDescription' smart constructor.
data VideoDescription = VideoDescription'
  { -- | Output video height, in pixels. Must be an even number. For most codecs,
    -- you can leave this field and width blank in order to use the height and
    -- width (resolution) from the source. Note, however, that leaving blank is
    -- not recommended. For the Frame Capture codec, height and width are
    -- required.
    VideoDescription -> Maybe Int
height :: Prelude.Maybe Prelude.Int,
    -- | Changes the strength of the anti-alias filter used for scaling. 0 is the
    -- softest setting, 100 is the sharpest. A setting of 50 is recommended for
    -- most content.
    VideoDescription -> Maybe Natural
sharpness :: Prelude.Maybe Prelude.Natural,
    -- | Output video width, in pixels. Must be an even number. For most codecs,
    -- you can leave this field and height blank in order to use the height and
    -- width (resolution) from the source. Note, however, that leaving blank is
    -- not recommended. For the Frame Capture codec, height and width are
    -- required.
    VideoDescription -> Maybe Int
width :: Prelude.Maybe Prelude.Int,
    -- | STRETCH_TO_OUTPUT configures the output position to stretch the video to
    -- the specified output resolution (height and width). This option will
    -- override any position value. DEFAULT may insert black boxes (pillar
    -- boxes or letter boxes) around the video to provide the specified output
    -- resolution.
    VideoDescription -> Maybe VideoDescriptionScalingBehavior
scalingBehavior :: Prelude.Maybe VideoDescriptionScalingBehavior,
    -- | Indicates how MediaLive will respond to the AFD values that might be in
    -- the input video. If you do not know what AFD signaling is, or if your
    -- downstream system has not given you guidance, choose PASSTHROUGH.
    -- RESPOND: MediaLive clips the input video using a formula that uses the
    -- AFD values (configured in afdSignaling ), the input display aspect
    -- ratio, and the output display aspect ratio. MediaLive also includes the
    -- AFD values in the output, unless the codec for this encode is
    -- FRAME_CAPTURE. PASSTHROUGH: MediaLive ignores the AFD values and does
    -- not clip the video. But MediaLive does include the values in the output.
    -- NONE: MediaLive does not clip the input video and does not include the
    -- AFD values in the output
    VideoDescription -> Maybe VideoDescriptionRespondToAfd
respondToAfd :: Prelude.Maybe VideoDescriptionRespondToAfd,
    -- | Video codec settings.
    VideoDescription -> Maybe VideoCodecSettings
codecSettings :: Prelude.Maybe VideoCodecSettings,
    -- | The name of this VideoDescription. Outputs will use this name to
    -- uniquely identify this Description. Description names should be unique
    -- within this Live Event.
    VideoDescription -> Text
name :: Prelude.Text
  }
  deriving (VideoDescription -> VideoDescription -> Bool
(VideoDescription -> VideoDescription -> Bool)
-> (VideoDescription -> VideoDescription -> Bool)
-> Eq VideoDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VideoDescription -> VideoDescription -> Bool
$c/= :: VideoDescription -> VideoDescription -> Bool
== :: VideoDescription -> VideoDescription -> Bool
$c== :: VideoDescription -> VideoDescription -> Bool
Prelude.Eq, ReadPrec [VideoDescription]
ReadPrec VideoDescription
Int -> ReadS VideoDescription
ReadS [VideoDescription]
(Int -> ReadS VideoDescription)
-> ReadS [VideoDescription]
-> ReadPrec VideoDescription
-> ReadPrec [VideoDescription]
-> Read VideoDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VideoDescription]
$creadListPrec :: ReadPrec [VideoDescription]
readPrec :: ReadPrec VideoDescription
$creadPrec :: ReadPrec VideoDescription
readList :: ReadS [VideoDescription]
$creadList :: ReadS [VideoDescription]
readsPrec :: Int -> ReadS VideoDescription
$creadsPrec :: Int -> ReadS VideoDescription
Prelude.Read, Int -> VideoDescription -> ShowS
[VideoDescription] -> ShowS
VideoDescription -> String
(Int -> VideoDescription -> ShowS)
-> (VideoDescription -> String)
-> ([VideoDescription] -> ShowS)
-> Show VideoDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VideoDescription] -> ShowS
$cshowList :: [VideoDescription] -> ShowS
show :: VideoDescription -> String
$cshow :: VideoDescription -> String
showsPrec :: Int -> VideoDescription -> ShowS
$cshowsPrec :: Int -> VideoDescription -> ShowS
Prelude.Show, (forall x. VideoDescription -> Rep VideoDescription x)
-> (forall x. Rep VideoDescription x -> VideoDescription)
-> Generic VideoDescription
forall x. Rep VideoDescription x -> VideoDescription
forall x. VideoDescription -> Rep VideoDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VideoDescription x -> VideoDescription
$cfrom :: forall x. VideoDescription -> Rep VideoDescription x
Prelude.Generic)

-- |
-- Create a value of 'VideoDescription' 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:
--
-- 'height', 'videoDescription_height' - Output video height, in pixels. Must be an even number. For most codecs,
-- you can leave this field and width blank in order to use the height and
-- width (resolution) from the source. Note, however, that leaving blank is
-- not recommended. For the Frame Capture codec, height and width are
-- required.
--
-- 'sharpness', 'videoDescription_sharpness' - Changes the strength of the anti-alias filter used for scaling. 0 is the
-- softest setting, 100 is the sharpest. A setting of 50 is recommended for
-- most content.
--
-- 'width', 'videoDescription_width' - Output video width, in pixels. Must be an even number. For most codecs,
-- you can leave this field and height blank in order to use the height and
-- width (resolution) from the source. Note, however, that leaving blank is
-- not recommended. For the Frame Capture codec, height and width are
-- required.
--
-- 'scalingBehavior', 'videoDescription_scalingBehavior' - STRETCH_TO_OUTPUT configures the output position to stretch the video to
-- the specified output resolution (height and width). This option will
-- override any position value. DEFAULT may insert black boxes (pillar
-- boxes or letter boxes) around the video to provide the specified output
-- resolution.
--
-- 'respondToAfd', 'videoDescription_respondToAfd' - Indicates how MediaLive will respond to the AFD values that might be in
-- the input video. If you do not know what AFD signaling is, or if your
-- downstream system has not given you guidance, choose PASSTHROUGH.
-- RESPOND: MediaLive clips the input video using a formula that uses the
-- AFD values (configured in afdSignaling ), the input display aspect
-- ratio, and the output display aspect ratio. MediaLive also includes the
-- AFD values in the output, unless the codec for this encode is
-- FRAME_CAPTURE. PASSTHROUGH: MediaLive ignores the AFD values and does
-- not clip the video. But MediaLive does include the values in the output.
-- NONE: MediaLive does not clip the input video and does not include the
-- AFD values in the output
--
-- 'codecSettings', 'videoDescription_codecSettings' - Video codec settings.
--
-- 'name', 'videoDescription_name' - The name of this VideoDescription. Outputs will use this name to
-- uniquely identify this Description. Description names should be unique
-- within this Live Event.
newVideoDescription ::
  -- | 'name'
  Prelude.Text ->
  VideoDescription
newVideoDescription :: Text -> VideoDescription
newVideoDescription Text
pName_ =
  VideoDescription' :: Maybe Int
-> Maybe Natural
-> Maybe Int
-> Maybe VideoDescriptionScalingBehavior
-> Maybe VideoDescriptionRespondToAfd
-> Maybe VideoCodecSettings
-> Text
-> VideoDescription
VideoDescription'
    { $sel:height:VideoDescription' :: Maybe Int
height = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:sharpness:VideoDescription' :: Maybe Natural
sharpness = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:width:VideoDescription' :: Maybe Int
width = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:scalingBehavior:VideoDescription' :: Maybe VideoDescriptionScalingBehavior
scalingBehavior = Maybe VideoDescriptionScalingBehavior
forall a. Maybe a
Prelude.Nothing,
      $sel:respondToAfd:VideoDescription' :: Maybe VideoDescriptionRespondToAfd
respondToAfd = Maybe VideoDescriptionRespondToAfd
forall a. Maybe a
Prelude.Nothing,
      $sel:codecSettings:VideoDescription' :: Maybe VideoCodecSettings
codecSettings = Maybe VideoCodecSettings
forall a. Maybe a
Prelude.Nothing,
      $sel:name:VideoDescription' :: Text
name = Text
pName_
    }

-- | Output video height, in pixels. Must be an even number. For most codecs,
-- you can leave this field and width blank in order to use the height and
-- width (resolution) from the source. Note, however, that leaving blank is
-- not recommended. For the Frame Capture codec, height and width are
-- required.
videoDescription_height :: Lens.Lens' VideoDescription (Prelude.Maybe Prelude.Int)
videoDescription_height :: (Maybe Int -> f (Maybe Int))
-> VideoDescription -> f VideoDescription
videoDescription_height = (VideoDescription -> Maybe Int)
-> (VideoDescription -> Maybe Int -> VideoDescription)
-> Lens VideoDescription VideoDescription (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VideoDescription' {Maybe Int
height :: Maybe Int
$sel:height:VideoDescription' :: VideoDescription -> Maybe Int
height} -> Maybe Int
height) (\s :: VideoDescription
s@VideoDescription' {} Maybe Int
a -> VideoDescription
s {$sel:height:VideoDescription' :: Maybe Int
height = Maybe Int
a} :: VideoDescription)

-- | Changes the strength of the anti-alias filter used for scaling. 0 is the
-- softest setting, 100 is the sharpest. A setting of 50 is recommended for
-- most content.
videoDescription_sharpness :: Lens.Lens' VideoDescription (Prelude.Maybe Prelude.Natural)
videoDescription_sharpness :: (Maybe Natural -> f (Maybe Natural))
-> VideoDescription -> f VideoDescription
videoDescription_sharpness = (VideoDescription -> Maybe Natural)
-> (VideoDescription -> Maybe Natural -> VideoDescription)
-> Lens
     VideoDescription VideoDescription (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VideoDescription' {Maybe Natural
sharpness :: Maybe Natural
$sel:sharpness:VideoDescription' :: VideoDescription -> Maybe Natural
sharpness} -> Maybe Natural
sharpness) (\s :: VideoDescription
s@VideoDescription' {} Maybe Natural
a -> VideoDescription
s {$sel:sharpness:VideoDescription' :: Maybe Natural
sharpness = Maybe Natural
a} :: VideoDescription)

-- | Output video width, in pixels. Must be an even number. For most codecs,
-- you can leave this field and height blank in order to use the height and
-- width (resolution) from the source. Note, however, that leaving blank is
-- not recommended. For the Frame Capture codec, height and width are
-- required.
videoDescription_width :: Lens.Lens' VideoDescription (Prelude.Maybe Prelude.Int)
videoDescription_width :: (Maybe Int -> f (Maybe Int))
-> VideoDescription -> f VideoDescription
videoDescription_width = (VideoDescription -> Maybe Int)
-> (VideoDescription -> Maybe Int -> VideoDescription)
-> Lens VideoDescription VideoDescription (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VideoDescription' {Maybe Int
width :: Maybe Int
$sel:width:VideoDescription' :: VideoDescription -> Maybe Int
width} -> Maybe Int
width) (\s :: VideoDescription
s@VideoDescription' {} Maybe Int
a -> VideoDescription
s {$sel:width:VideoDescription' :: Maybe Int
width = Maybe Int
a} :: VideoDescription)

-- | STRETCH_TO_OUTPUT configures the output position to stretch the video to
-- the specified output resolution (height and width). This option will
-- override any position value. DEFAULT may insert black boxes (pillar
-- boxes or letter boxes) around the video to provide the specified output
-- resolution.
videoDescription_scalingBehavior :: Lens.Lens' VideoDescription (Prelude.Maybe VideoDescriptionScalingBehavior)
videoDescription_scalingBehavior :: (Maybe VideoDescriptionScalingBehavior
 -> f (Maybe VideoDescriptionScalingBehavior))
-> VideoDescription -> f VideoDescription
videoDescription_scalingBehavior = (VideoDescription -> Maybe VideoDescriptionScalingBehavior)
-> (VideoDescription
    -> Maybe VideoDescriptionScalingBehavior -> VideoDescription)
-> Lens
     VideoDescription
     VideoDescription
     (Maybe VideoDescriptionScalingBehavior)
     (Maybe VideoDescriptionScalingBehavior)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VideoDescription' {Maybe VideoDescriptionScalingBehavior
scalingBehavior :: Maybe VideoDescriptionScalingBehavior
$sel:scalingBehavior:VideoDescription' :: VideoDescription -> Maybe VideoDescriptionScalingBehavior
scalingBehavior} -> Maybe VideoDescriptionScalingBehavior
scalingBehavior) (\s :: VideoDescription
s@VideoDescription' {} Maybe VideoDescriptionScalingBehavior
a -> VideoDescription
s {$sel:scalingBehavior:VideoDescription' :: Maybe VideoDescriptionScalingBehavior
scalingBehavior = Maybe VideoDescriptionScalingBehavior
a} :: VideoDescription)

-- | Indicates how MediaLive will respond to the AFD values that might be in
-- the input video. If you do not know what AFD signaling is, or if your
-- downstream system has not given you guidance, choose PASSTHROUGH.
-- RESPOND: MediaLive clips the input video using a formula that uses the
-- AFD values (configured in afdSignaling ), the input display aspect
-- ratio, and the output display aspect ratio. MediaLive also includes the
-- AFD values in the output, unless the codec for this encode is
-- FRAME_CAPTURE. PASSTHROUGH: MediaLive ignores the AFD values and does
-- not clip the video. But MediaLive does include the values in the output.
-- NONE: MediaLive does not clip the input video and does not include the
-- AFD values in the output
videoDescription_respondToAfd :: Lens.Lens' VideoDescription (Prelude.Maybe VideoDescriptionRespondToAfd)
videoDescription_respondToAfd :: (Maybe VideoDescriptionRespondToAfd
 -> f (Maybe VideoDescriptionRespondToAfd))
-> VideoDescription -> f VideoDescription
videoDescription_respondToAfd = (VideoDescription -> Maybe VideoDescriptionRespondToAfd)
-> (VideoDescription
    -> Maybe VideoDescriptionRespondToAfd -> VideoDescription)
-> Lens
     VideoDescription
     VideoDescription
     (Maybe VideoDescriptionRespondToAfd)
     (Maybe VideoDescriptionRespondToAfd)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VideoDescription' {Maybe VideoDescriptionRespondToAfd
respondToAfd :: Maybe VideoDescriptionRespondToAfd
$sel:respondToAfd:VideoDescription' :: VideoDescription -> Maybe VideoDescriptionRespondToAfd
respondToAfd} -> Maybe VideoDescriptionRespondToAfd
respondToAfd) (\s :: VideoDescription
s@VideoDescription' {} Maybe VideoDescriptionRespondToAfd
a -> VideoDescription
s {$sel:respondToAfd:VideoDescription' :: Maybe VideoDescriptionRespondToAfd
respondToAfd = Maybe VideoDescriptionRespondToAfd
a} :: VideoDescription)

-- | Video codec settings.
videoDescription_codecSettings :: Lens.Lens' VideoDescription (Prelude.Maybe VideoCodecSettings)
videoDescription_codecSettings :: (Maybe VideoCodecSettings -> f (Maybe VideoCodecSettings))
-> VideoDescription -> f VideoDescription
videoDescription_codecSettings = (VideoDescription -> Maybe VideoCodecSettings)
-> (VideoDescription
    -> Maybe VideoCodecSettings -> VideoDescription)
-> Lens
     VideoDescription
     VideoDescription
     (Maybe VideoCodecSettings)
     (Maybe VideoCodecSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VideoDescription' {Maybe VideoCodecSettings
codecSettings :: Maybe VideoCodecSettings
$sel:codecSettings:VideoDescription' :: VideoDescription -> Maybe VideoCodecSettings
codecSettings} -> Maybe VideoCodecSettings
codecSettings) (\s :: VideoDescription
s@VideoDescription' {} Maybe VideoCodecSettings
a -> VideoDescription
s {$sel:codecSettings:VideoDescription' :: Maybe VideoCodecSettings
codecSettings = Maybe VideoCodecSettings
a} :: VideoDescription)

-- | The name of this VideoDescription. Outputs will use this name to
-- uniquely identify this Description. Description names should be unique
-- within this Live Event.
videoDescription_name :: Lens.Lens' VideoDescription Prelude.Text
videoDescription_name :: (Text -> f Text) -> VideoDescription -> f VideoDescription
videoDescription_name = (VideoDescription -> Text)
-> (VideoDescription -> Text -> VideoDescription)
-> Lens VideoDescription VideoDescription Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VideoDescription' {Text
name :: Text
$sel:name:VideoDescription' :: VideoDescription -> Text
name} -> Text
name) (\s :: VideoDescription
s@VideoDescription' {} Text
a -> VideoDescription
s {$sel:name:VideoDescription' :: Text
name = Text
a} :: VideoDescription)

instance Core.FromJSON VideoDescription where
  parseJSON :: Value -> Parser VideoDescription
parseJSON =
    String
-> (Object -> Parser VideoDescription)
-> Value
-> Parser VideoDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"VideoDescription"
      ( \Object
x ->
          Maybe Int
-> Maybe Natural
-> Maybe Int
-> Maybe VideoDescriptionScalingBehavior
-> Maybe VideoDescriptionRespondToAfd
-> Maybe VideoCodecSettings
-> Text
-> VideoDescription
VideoDescription'
            (Maybe Int
 -> Maybe Natural
 -> Maybe Int
 -> Maybe VideoDescriptionScalingBehavior
 -> Maybe VideoDescriptionRespondToAfd
 -> Maybe VideoCodecSettings
 -> Text
 -> VideoDescription)
-> Parser (Maybe Int)
-> Parser
     (Maybe Natural
      -> Maybe Int
      -> Maybe VideoDescriptionScalingBehavior
      -> Maybe VideoDescriptionRespondToAfd
      -> Maybe VideoCodecSettings
      -> Text
      -> VideoDescription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"height")
            Parser
  (Maybe Natural
   -> Maybe Int
   -> Maybe VideoDescriptionScalingBehavior
   -> Maybe VideoDescriptionRespondToAfd
   -> Maybe VideoCodecSettings
   -> Text
   -> VideoDescription)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Int
      -> Maybe VideoDescriptionScalingBehavior
      -> Maybe VideoDescriptionRespondToAfd
      -> Maybe VideoCodecSettings
      -> Text
      -> VideoDescription)
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
"sharpness")
            Parser
  (Maybe Int
   -> Maybe VideoDescriptionScalingBehavior
   -> Maybe VideoDescriptionRespondToAfd
   -> Maybe VideoCodecSettings
   -> Text
   -> VideoDescription)
-> Parser (Maybe Int)
-> Parser
     (Maybe VideoDescriptionScalingBehavior
      -> Maybe VideoDescriptionRespondToAfd
      -> Maybe VideoCodecSettings
      -> Text
      -> VideoDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"width")
            Parser
  (Maybe VideoDescriptionScalingBehavior
   -> Maybe VideoDescriptionRespondToAfd
   -> Maybe VideoCodecSettings
   -> Text
   -> VideoDescription)
-> Parser (Maybe VideoDescriptionScalingBehavior)
-> Parser
     (Maybe VideoDescriptionRespondToAfd
      -> Maybe VideoCodecSettings -> Text -> VideoDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe VideoDescriptionScalingBehavior)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"scalingBehavior")
            Parser
  (Maybe VideoDescriptionRespondToAfd
   -> Maybe VideoCodecSettings -> Text -> VideoDescription)
-> Parser (Maybe VideoDescriptionRespondToAfd)
-> Parser (Maybe VideoCodecSettings -> Text -> VideoDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe VideoDescriptionRespondToAfd)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"respondToAfd")
            Parser (Maybe VideoCodecSettings -> Text -> VideoDescription)
-> Parser (Maybe VideoCodecSettings)
-> Parser (Text -> VideoDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe VideoCodecSettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"codecSettings")
            Parser (Text -> VideoDescription)
-> Parser Text -> Parser VideoDescription
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"name")
      )

instance Prelude.Hashable VideoDescription

instance Prelude.NFData VideoDescription

instance Core.ToJSON VideoDescription where
  toJSON :: VideoDescription -> Value
toJSON VideoDescription' {Maybe Int
Maybe Natural
Maybe VideoCodecSettings
Maybe VideoDescriptionRespondToAfd
Maybe VideoDescriptionScalingBehavior
Text
name :: Text
codecSettings :: Maybe VideoCodecSettings
respondToAfd :: Maybe VideoDescriptionRespondToAfd
scalingBehavior :: Maybe VideoDescriptionScalingBehavior
width :: Maybe Int
sharpness :: Maybe Natural
height :: Maybe Int
$sel:name:VideoDescription' :: VideoDescription -> Text
$sel:codecSettings:VideoDescription' :: VideoDescription -> Maybe VideoCodecSettings
$sel:respondToAfd:VideoDescription' :: VideoDescription -> Maybe VideoDescriptionRespondToAfd
$sel:scalingBehavior:VideoDescription' :: VideoDescription -> Maybe VideoDescriptionScalingBehavior
$sel:width:VideoDescription' :: VideoDescription -> Maybe Int
$sel:sharpness:VideoDescription' :: VideoDescription -> Maybe Natural
$sel:height:VideoDescription' :: VideoDescription -> Maybe Int
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"height" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
height,
            (Text
"sharpness" 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
sharpness,
            (Text
"width" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
width,
            (Text
"scalingBehavior" Text -> VideoDescriptionScalingBehavior -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (VideoDescriptionScalingBehavior -> Pair)
-> Maybe VideoDescriptionScalingBehavior -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe VideoDescriptionScalingBehavior
scalingBehavior,
            (Text
"respondToAfd" Text -> VideoDescriptionRespondToAfd -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (VideoDescriptionRespondToAfd -> Pair)
-> Maybe VideoDescriptionRespondToAfd -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe VideoDescriptionRespondToAfd
respondToAfd,
            (Text
"codecSettings" Text -> VideoCodecSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (VideoCodecSettings -> Pair)
-> Maybe VideoCodecSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe VideoCodecSettings
codecSettings,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
          ]
      )