{-# 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.Rekognition.Types.VideoMetadata
-- 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.Rekognition.Types.VideoMetadata where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Rekognition.Types.VideoColorRange

-- | Information about a video that Amazon Rekognition analyzed.
-- @Videometadata@ is returned in every page of paginated responses from a
-- Amazon Rekognition video operation.
--
-- /See:/ 'newVideoMetadata' smart constructor.
data VideoMetadata = VideoMetadata'
  { -- | Number of frames per second in the video.
    VideoMetadata -> Maybe Double
frameRate :: Prelude.Maybe Prelude.Double,
    -- | A description of the range of luminance values in a video, either
    -- LIMITED (16 to 235) or FULL (0 to 255).
    VideoMetadata -> Maybe VideoColorRange
colorRange :: Prelude.Maybe VideoColorRange,
    -- | Format of the analyzed video. Possible values are MP4, MOV and AVI.
    VideoMetadata -> Maybe Text
format :: Prelude.Maybe Prelude.Text,
    -- | Type of compression used in the analyzed video.
    VideoMetadata -> Maybe Text
codec :: Prelude.Maybe Prelude.Text,
    -- | Vertical pixel dimension of the video.
    VideoMetadata -> Maybe Natural
frameHeight :: Prelude.Maybe Prelude.Natural,
    -- | Length of the video in milliseconds.
    VideoMetadata -> Maybe Natural
durationMillis :: Prelude.Maybe Prelude.Natural,
    -- | Horizontal pixel dimension of the video.
    VideoMetadata -> Maybe Natural
frameWidth :: Prelude.Maybe Prelude.Natural
  }
  deriving (VideoMetadata -> VideoMetadata -> Bool
(VideoMetadata -> VideoMetadata -> Bool)
-> (VideoMetadata -> VideoMetadata -> Bool) -> Eq VideoMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VideoMetadata -> VideoMetadata -> Bool
$c/= :: VideoMetadata -> VideoMetadata -> Bool
== :: VideoMetadata -> VideoMetadata -> Bool
$c== :: VideoMetadata -> VideoMetadata -> Bool
Prelude.Eq, ReadPrec [VideoMetadata]
ReadPrec VideoMetadata
Int -> ReadS VideoMetadata
ReadS [VideoMetadata]
(Int -> ReadS VideoMetadata)
-> ReadS [VideoMetadata]
-> ReadPrec VideoMetadata
-> ReadPrec [VideoMetadata]
-> Read VideoMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VideoMetadata]
$creadListPrec :: ReadPrec [VideoMetadata]
readPrec :: ReadPrec VideoMetadata
$creadPrec :: ReadPrec VideoMetadata
readList :: ReadS [VideoMetadata]
$creadList :: ReadS [VideoMetadata]
readsPrec :: Int -> ReadS VideoMetadata
$creadsPrec :: Int -> ReadS VideoMetadata
Prelude.Read, Int -> VideoMetadata -> ShowS
[VideoMetadata] -> ShowS
VideoMetadata -> String
(Int -> VideoMetadata -> ShowS)
-> (VideoMetadata -> String)
-> ([VideoMetadata] -> ShowS)
-> Show VideoMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VideoMetadata] -> ShowS
$cshowList :: [VideoMetadata] -> ShowS
show :: VideoMetadata -> String
$cshow :: VideoMetadata -> String
showsPrec :: Int -> VideoMetadata -> ShowS
$cshowsPrec :: Int -> VideoMetadata -> ShowS
Prelude.Show, (forall x. VideoMetadata -> Rep VideoMetadata x)
-> (forall x. Rep VideoMetadata x -> VideoMetadata)
-> Generic VideoMetadata
forall x. Rep VideoMetadata x -> VideoMetadata
forall x. VideoMetadata -> Rep VideoMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VideoMetadata x -> VideoMetadata
$cfrom :: forall x. VideoMetadata -> Rep VideoMetadata x
Prelude.Generic)

-- |
-- Create a value of 'VideoMetadata' 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', 'videoMetadata_frameRate' - Number of frames per second in the video.
--
-- 'colorRange', 'videoMetadata_colorRange' - A description of the range of luminance values in a video, either
-- LIMITED (16 to 235) or FULL (0 to 255).
--
-- 'format', 'videoMetadata_format' - Format of the analyzed video. Possible values are MP4, MOV and AVI.
--
-- 'codec', 'videoMetadata_codec' - Type of compression used in the analyzed video.
--
-- 'frameHeight', 'videoMetadata_frameHeight' - Vertical pixel dimension of the video.
--
-- 'durationMillis', 'videoMetadata_durationMillis' - Length of the video in milliseconds.
--
-- 'frameWidth', 'videoMetadata_frameWidth' - Horizontal pixel dimension of the video.
newVideoMetadata ::
  VideoMetadata
newVideoMetadata :: VideoMetadata
newVideoMetadata =
  VideoMetadata' :: Maybe Double
-> Maybe VideoColorRange
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> VideoMetadata
VideoMetadata'
    { $sel:frameRate:VideoMetadata' :: Maybe Double
frameRate = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:colorRange:VideoMetadata' :: Maybe VideoColorRange
colorRange = Maybe VideoColorRange
forall a. Maybe a
Prelude.Nothing,
      $sel:format:VideoMetadata' :: Maybe Text
format = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:codec:VideoMetadata' :: Maybe Text
codec = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:frameHeight:VideoMetadata' :: Maybe Natural
frameHeight = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:durationMillis:VideoMetadata' :: Maybe Natural
durationMillis = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:frameWidth:VideoMetadata' :: Maybe Natural
frameWidth = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | Number of frames per second in the video.
videoMetadata_frameRate :: Lens.Lens' VideoMetadata (Prelude.Maybe Prelude.Double)
videoMetadata_frameRate :: (Maybe Double -> f (Maybe Double))
-> VideoMetadata -> f VideoMetadata
videoMetadata_frameRate = (VideoMetadata -> Maybe Double)
-> (VideoMetadata -> Maybe Double -> VideoMetadata)
-> Lens VideoMetadata VideoMetadata (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VideoMetadata' {Maybe Double
frameRate :: Maybe Double
$sel:frameRate:VideoMetadata' :: VideoMetadata -> Maybe Double
frameRate} -> Maybe Double
frameRate) (\s :: VideoMetadata
s@VideoMetadata' {} Maybe Double
a -> VideoMetadata
s {$sel:frameRate:VideoMetadata' :: Maybe Double
frameRate = Maybe Double
a} :: VideoMetadata)

-- | A description of the range of luminance values in a video, either
-- LIMITED (16 to 235) or FULL (0 to 255).
videoMetadata_colorRange :: Lens.Lens' VideoMetadata (Prelude.Maybe VideoColorRange)
videoMetadata_colorRange :: (Maybe VideoColorRange -> f (Maybe VideoColorRange))
-> VideoMetadata -> f VideoMetadata
videoMetadata_colorRange = (VideoMetadata -> Maybe VideoColorRange)
-> (VideoMetadata -> Maybe VideoColorRange -> VideoMetadata)
-> Lens
     VideoMetadata
     VideoMetadata
     (Maybe VideoColorRange)
     (Maybe VideoColorRange)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VideoMetadata' {Maybe VideoColorRange
colorRange :: Maybe VideoColorRange
$sel:colorRange:VideoMetadata' :: VideoMetadata -> Maybe VideoColorRange
colorRange} -> Maybe VideoColorRange
colorRange) (\s :: VideoMetadata
s@VideoMetadata' {} Maybe VideoColorRange
a -> VideoMetadata
s {$sel:colorRange:VideoMetadata' :: Maybe VideoColorRange
colorRange = Maybe VideoColorRange
a} :: VideoMetadata)

-- | Format of the analyzed video. Possible values are MP4, MOV and AVI.
videoMetadata_format :: Lens.Lens' VideoMetadata (Prelude.Maybe Prelude.Text)
videoMetadata_format :: (Maybe Text -> f (Maybe Text)) -> VideoMetadata -> f VideoMetadata
videoMetadata_format = (VideoMetadata -> Maybe Text)
-> (VideoMetadata -> Maybe Text -> VideoMetadata)
-> Lens VideoMetadata VideoMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VideoMetadata' {Maybe Text
format :: Maybe Text
$sel:format:VideoMetadata' :: VideoMetadata -> Maybe Text
format} -> Maybe Text
format) (\s :: VideoMetadata
s@VideoMetadata' {} Maybe Text
a -> VideoMetadata
s {$sel:format:VideoMetadata' :: Maybe Text
format = Maybe Text
a} :: VideoMetadata)

-- | Type of compression used in the analyzed video.
videoMetadata_codec :: Lens.Lens' VideoMetadata (Prelude.Maybe Prelude.Text)
videoMetadata_codec :: (Maybe Text -> f (Maybe Text)) -> VideoMetadata -> f VideoMetadata
videoMetadata_codec = (VideoMetadata -> Maybe Text)
-> (VideoMetadata -> Maybe Text -> VideoMetadata)
-> Lens VideoMetadata VideoMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VideoMetadata' {Maybe Text
codec :: Maybe Text
$sel:codec:VideoMetadata' :: VideoMetadata -> Maybe Text
codec} -> Maybe Text
codec) (\s :: VideoMetadata
s@VideoMetadata' {} Maybe Text
a -> VideoMetadata
s {$sel:codec:VideoMetadata' :: Maybe Text
codec = Maybe Text
a} :: VideoMetadata)

-- | Vertical pixel dimension of the video.
videoMetadata_frameHeight :: Lens.Lens' VideoMetadata (Prelude.Maybe Prelude.Natural)
videoMetadata_frameHeight :: (Maybe Natural -> f (Maybe Natural))
-> VideoMetadata -> f VideoMetadata
videoMetadata_frameHeight = (VideoMetadata -> Maybe Natural)
-> (VideoMetadata -> Maybe Natural -> VideoMetadata)
-> Lens VideoMetadata VideoMetadata (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VideoMetadata' {Maybe Natural
frameHeight :: Maybe Natural
$sel:frameHeight:VideoMetadata' :: VideoMetadata -> Maybe Natural
frameHeight} -> Maybe Natural
frameHeight) (\s :: VideoMetadata
s@VideoMetadata' {} Maybe Natural
a -> VideoMetadata
s {$sel:frameHeight:VideoMetadata' :: Maybe Natural
frameHeight = Maybe Natural
a} :: VideoMetadata)

-- | Length of the video in milliseconds.
videoMetadata_durationMillis :: Lens.Lens' VideoMetadata (Prelude.Maybe Prelude.Natural)
videoMetadata_durationMillis :: (Maybe Natural -> f (Maybe Natural))
-> VideoMetadata -> f VideoMetadata
videoMetadata_durationMillis = (VideoMetadata -> Maybe Natural)
-> (VideoMetadata -> Maybe Natural -> VideoMetadata)
-> Lens VideoMetadata VideoMetadata (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VideoMetadata' {Maybe Natural
durationMillis :: Maybe Natural
$sel:durationMillis:VideoMetadata' :: VideoMetadata -> Maybe Natural
durationMillis} -> Maybe Natural
durationMillis) (\s :: VideoMetadata
s@VideoMetadata' {} Maybe Natural
a -> VideoMetadata
s {$sel:durationMillis:VideoMetadata' :: Maybe Natural
durationMillis = Maybe Natural
a} :: VideoMetadata)

-- | Horizontal pixel dimension of the video.
videoMetadata_frameWidth :: Lens.Lens' VideoMetadata (Prelude.Maybe Prelude.Natural)
videoMetadata_frameWidth :: (Maybe Natural -> f (Maybe Natural))
-> VideoMetadata -> f VideoMetadata
videoMetadata_frameWidth = (VideoMetadata -> Maybe Natural)
-> (VideoMetadata -> Maybe Natural -> VideoMetadata)
-> Lens VideoMetadata VideoMetadata (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VideoMetadata' {Maybe Natural
frameWidth :: Maybe Natural
$sel:frameWidth:VideoMetadata' :: VideoMetadata -> Maybe Natural
frameWidth} -> Maybe Natural
frameWidth) (\s :: VideoMetadata
s@VideoMetadata' {} Maybe Natural
a -> VideoMetadata
s {$sel:frameWidth:VideoMetadata' :: Maybe Natural
frameWidth = Maybe Natural
a} :: VideoMetadata)

instance Core.FromJSON VideoMetadata where
  parseJSON :: Value -> Parser VideoMetadata
parseJSON =
    String
-> (Object -> Parser VideoMetadata)
-> Value
-> Parser VideoMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"VideoMetadata"
      ( \Object
x ->
          Maybe Double
-> Maybe VideoColorRange
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> VideoMetadata
VideoMetadata'
            (Maybe Double
 -> Maybe VideoColorRange
 -> Maybe Text
 -> Maybe Text
 -> Maybe Natural
 -> Maybe Natural
 -> Maybe Natural
 -> VideoMetadata)
-> Parser (Maybe Double)
-> Parser
     (Maybe VideoColorRange
      -> Maybe Text
      -> Maybe Text
      -> Maybe Natural
      -> Maybe Natural
      -> Maybe Natural
      -> VideoMetadata)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"FrameRate")
            Parser
  (Maybe VideoColorRange
   -> Maybe Text
   -> Maybe Text
   -> Maybe Natural
   -> Maybe Natural
   -> Maybe Natural
   -> VideoMetadata)
-> Parser (Maybe VideoColorRange)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Natural
      -> Maybe Natural
      -> Maybe Natural
      -> VideoMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe VideoColorRange)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ColorRange")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Natural
   -> Maybe Natural
   -> Maybe Natural
   -> VideoMetadata)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Natural
      -> Maybe Natural
      -> Maybe Natural
      -> VideoMetadata)
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
"Format")
            Parser
  (Maybe Text
   -> Maybe Natural
   -> Maybe Natural
   -> Maybe Natural
   -> VideoMetadata)
-> Parser (Maybe Text)
-> Parser
     (Maybe Natural -> Maybe Natural -> Maybe Natural -> VideoMetadata)
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
"Codec")
            Parser
  (Maybe Natural -> Maybe Natural -> Maybe Natural -> VideoMetadata)
-> Parser (Maybe Natural)
-> Parser (Maybe Natural -> Maybe Natural -> VideoMetadata)
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
"FrameHeight")
            Parser (Maybe Natural -> Maybe Natural -> VideoMetadata)
-> Parser (Maybe Natural)
-> Parser (Maybe Natural -> VideoMetadata)
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
"DurationMillis")
            Parser (Maybe Natural -> VideoMetadata)
-> Parser (Maybe Natural) -> Parser VideoMetadata
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
"FrameWidth")
      )

instance Prelude.Hashable VideoMetadata

instance Prelude.NFData VideoMetadata