{-# 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.MediaConnect.Types.MediaStreamSourceConfiguration
-- 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.MediaConnect.Types.MediaStreamSourceConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConnect.Types.EncodingName
import Amazonka.MediaConnect.Types.InputConfiguration
import qualified Amazonka.Prelude as Prelude

-- | The media stream that is associated with the source, and the parameters
-- for that association.
--
-- /See:/ 'newMediaStreamSourceConfiguration' smart constructor.
data MediaStreamSourceConfiguration = MediaStreamSourceConfiguration'
  { -- | The transport parameters that are associated with an incoming media
    -- stream.
    MediaStreamSourceConfiguration -> Maybe [InputConfiguration]
inputConfigurations :: Prelude.Maybe [InputConfiguration],
    -- | The name of the media stream.
    MediaStreamSourceConfiguration -> Text
mediaStreamName :: Prelude.Text,
    -- | The format that was used to encode the data. For ancillary data streams,
    -- set the encoding name to smpte291. For audio streams, set the encoding
    -- name to pcm. For video, 2110 streams, set the encoding name to raw. For
    -- video, JPEG XS streams, set the encoding name to jxsv.
    MediaStreamSourceConfiguration -> EncodingName
encodingName :: EncodingName
  }
  deriving (MediaStreamSourceConfiguration
-> MediaStreamSourceConfiguration -> Bool
(MediaStreamSourceConfiguration
 -> MediaStreamSourceConfiguration -> Bool)
-> (MediaStreamSourceConfiguration
    -> MediaStreamSourceConfiguration -> Bool)
-> Eq MediaStreamSourceConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MediaStreamSourceConfiguration
-> MediaStreamSourceConfiguration -> Bool
$c/= :: MediaStreamSourceConfiguration
-> MediaStreamSourceConfiguration -> Bool
== :: MediaStreamSourceConfiguration
-> MediaStreamSourceConfiguration -> Bool
$c== :: MediaStreamSourceConfiguration
-> MediaStreamSourceConfiguration -> Bool
Prelude.Eq, ReadPrec [MediaStreamSourceConfiguration]
ReadPrec MediaStreamSourceConfiguration
Int -> ReadS MediaStreamSourceConfiguration
ReadS [MediaStreamSourceConfiguration]
(Int -> ReadS MediaStreamSourceConfiguration)
-> ReadS [MediaStreamSourceConfiguration]
-> ReadPrec MediaStreamSourceConfiguration
-> ReadPrec [MediaStreamSourceConfiguration]
-> Read MediaStreamSourceConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MediaStreamSourceConfiguration]
$creadListPrec :: ReadPrec [MediaStreamSourceConfiguration]
readPrec :: ReadPrec MediaStreamSourceConfiguration
$creadPrec :: ReadPrec MediaStreamSourceConfiguration
readList :: ReadS [MediaStreamSourceConfiguration]
$creadList :: ReadS [MediaStreamSourceConfiguration]
readsPrec :: Int -> ReadS MediaStreamSourceConfiguration
$creadsPrec :: Int -> ReadS MediaStreamSourceConfiguration
Prelude.Read, Int -> MediaStreamSourceConfiguration -> ShowS
[MediaStreamSourceConfiguration] -> ShowS
MediaStreamSourceConfiguration -> String
(Int -> MediaStreamSourceConfiguration -> ShowS)
-> (MediaStreamSourceConfiguration -> String)
-> ([MediaStreamSourceConfiguration] -> ShowS)
-> Show MediaStreamSourceConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MediaStreamSourceConfiguration] -> ShowS
$cshowList :: [MediaStreamSourceConfiguration] -> ShowS
show :: MediaStreamSourceConfiguration -> String
$cshow :: MediaStreamSourceConfiguration -> String
showsPrec :: Int -> MediaStreamSourceConfiguration -> ShowS
$cshowsPrec :: Int -> MediaStreamSourceConfiguration -> ShowS
Prelude.Show, (forall x.
 MediaStreamSourceConfiguration
 -> Rep MediaStreamSourceConfiguration x)
-> (forall x.
    Rep MediaStreamSourceConfiguration x
    -> MediaStreamSourceConfiguration)
-> Generic MediaStreamSourceConfiguration
forall x.
Rep MediaStreamSourceConfiguration x
-> MediaStreamSourceConfiguration
forall x.
MediaStreamSourceConfiguration
-> Rep MediaStreamSourceConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MediaStreamSourceConfiguration x
-> MediaStreamSourceConfiguration
$cfrom :: forall x.
MediaStreamSourceConfiguration
-> Rep MediaStreamSourceConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'MediaStreamSourceConfiguration' 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:
--
-- 'inputConfigurations', 'mediaStreamSourceConfiguration_inputConfigurations' - The transport parameters that are associated with an incoming media
-- stream.
--
-- 'mediaStreamName', 'mediaStreamSourceConfiguration_mediaStreamName' - The name of the media stream.
--
-- 'encodingName', 'mediaStreamSourceConfiguration_encodingName' - The format that was used to encode the data. For ancillary data streams,
-- set the encoding name to smpte291. For audio streams, set the encoding
-- name to pcm. For video, 2110 streams, set the encoding name to raw. For
-- video, JPEG XS streams, set the encoding name to jxsv.
newMediaStreamSourceConfiguration ::
  -- | 'mediaStreamName'
  Prelude.Text ->
  -- | 'encodingName'
  EncodingName ->
  MediaStreamSourceConfiguration
newMediaStreamSourceConfiguration :: Text -> EncodingName -> MediaStreamSourceConfiguration
newMediaStreamSourceConfiguration
  Text
pMediaStreamName_
  EncodingName
pEncodingName_ =
    MediaStreamSourceConfiguration' :: Maybe [InputConfiguration]
-> Text -> EncodingName -> MediaStreamSourceConfiguration
MediaStreamSourceConfiguration'
      { $sel:inputConfigurations:MediaStreamSourceConfiguration' :: Maybe [InputConfiguration]
inputConfigurations =
          Maybe [InputConfiguration]
forall a. Maybe a
Prelude.Nothing,
        $sel:mediaStreamName:MediaStreamSourceConfiguration' :: Text
mediaStreamName = Text
pMediaStreamName_,
        $sel:encodingName:MediaStreamSourceConfiguration' :: EncodingName
encodingName = EncodingName
pEncodingName_
      }

-- | The transport parameters that are associated with an incoming media
-- stream.
mediaStreamSourceConfiguration_inputConfigurations :: Lens.Lens' MediaStreamSourceConfiguration (Prelude.Maybe [InputConfiguration])
mediaStreamSourceConfiguration_inputConfigurations :: (Maybe [InputConfiguration] -> f (Maybe [InputConfiguration]))
-> MediaStreamSourceConfiguration
-> f MediaStreamSourceConfiguration
mediaStreamSourceConfiguration_inputConfigurations = (MediaStreamSourceConfiguration -> Maybe [InputConfiguration])
-> (MediaStreamSourceConfiguration
    -> Maybe [InputConfiguration] -> MediaStreamSourceConfiguration)
-> Lens
     MediaStreamSourceConfiguration
     MediaStreamSourceConfiguration
     (Maybe [InputConfiguration])
     (Maybe [InputConfiguration])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MediaStreamSourceConfiguration' {Maybe [InputConfiguration]
inputConfigurations :: Maybe [InputConfiguration]
$sel:inputConfigurations:MediaStreamSourceConfiguration' :: MediaStreamSourceConfiguration -> Maybe [InputConfiguration]
inputConfigurations} -> Maybe [InputConfiguration]
inputConfigurations) (\s :: MediaStreamSourceConfiguration
s@MediaStreamSourceConfiguration' {} Maybe [InputConfiguration]
a -> MediaStreamSourceConfiguration
s {$sel:inputConfigurations:MediaStreamSourceConfiguration' :: Maybe [InputConfiguration]
inputConfigurations = Maybe [InputConfiguration]
a} :: MediaStreamSourceConfiguration) ((Maybe [InputConfiguration] -> f (Maybe [InputConfiguration]))
 -> MediaStreamSourceConfiguration
 -> f MediaStreamSourceConfiguration)
-> ((Maybe [InputConfiguration] -> f (Maybe [InputConfiguration]))
    -> Maybe [InputConfiguration] -> f (Maybe [InputConfiguration]))
-> (Maybe [InputConfiguration] -> f (Maybe [InputConfiguration]))
-> MediaStreamSourceConfiguration
-> f MediaStreamSourceConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [InputConfiguration]
  [InputConfiguration]
  [InputConfiguration]
  [InputConfiguration]
-> Iso
     (Maybe [InputConfiguration])
     (Maybe [InputConfiguration])
     (Maybe [InputConfiguration])
     (Maybe [InputConfiguration])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [InputConfiguration]
  [InputConfiguration]
  [InputConfiguration]
  [InputConfiguration]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the media stream.
mediaStreamSourceConfiguration_mediaStreamName :: Lens.Lens' MediaStreamSourceConfiguration Prelude.Text
mediaStreamSourceConfiguration_mediaStreamName :: (Text -> f Text)
-> MediaStreamSourceConfiguration
-> f MediaStreamSourceConfiguration
mediaStreamSourceConfiguration_mediaStreamName = (MediaStreamSourceConfiguration -> Text)
-> (MediaStreamSourceConfiguration
    -> Text -> MediaStreamSourceConfiguration)
-> Lens
     MediaStreamSourceConfiguration
     MediaStreamSourceConfiguration
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MediaStreamSourceConfiguration' {Text
mediaStreamName :: Text
$sel:mediaStreamName:MediaStreamSourceConfiguration' :: MediaStreamSourceConfiguration -> Text
mediaStreamName} -> Text
mediaStreamName) (\s :: MediaStreamSourceConfiguration
s@MediaStreamSourceConfiguration' {} Text
a -> MediaStreamSourceConfiguration
s {$sel:mediaStreamName:MediaStreamSourceConfiguration' :: Text
mediaStreamName = Text
a} :: MediaStreamSourceConfiguration)

-- | The format that was used to encode the data. For ancillary data streams,
-- set the encoding name to smpte291. For audio streams, set the encoding
-- name to pcm. For video, 2110 streams, set the encoding name to raw. For
-- video, JPEG XS streams, set the encoding name to jxsv.
mediaStreamSourceConfiguration_encodingName :: Lens.Lens' MediaStreamSourceConfiguration EncodingName
mediaStreamSourceConfiguration_encodingName :: (EncodingName -> f EncodingName)
-> MediaStreamSourceConfiguration
-> f MediaStreamSourceConfiguration
mediaStreamSourceConfiguration_encodingName = (MediaStreamSourceConfiguration -> EncodingName)
-> (MediaStreamSourceConfiguration
    -> EncodingName -> MediaStreamSourceConfiguration)
-> Lens
     MediaStreamSourceConfiguration
     MediaStreamSourceConfiguration
     EncodingName
     EncodingName
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MediaStreamSourceConfiguration' {EncodingName
encodingName :: EncodingName
$sel:encodingName:MediaStreamSourceConfiguration' :: MediaStreamSourceConfiguration -> EncodingName
encodingName} -> EncodingName
encodingName) (\s :: MediaStreamSourceConfiguration
s@MediaStreamSourceConfiguration' {} EncodingName
a -> MediaStreamSourceConfiguration
s {$sel:encodingName:MediaStreamSourceConfiguration' :: EncodingName
encodingName = EncodingName
a} :: MediaStreamSourceConfiguration)

instance Core.FromJSON MediaStreamSourceConfiguration where
  parseJSON :: Value -> Parser MediaStreamSourceConfiguration
parseJSON =
    String
-> (Object -> Parser MediaStreamSourceConfiguration)
-> Value
-> Parser MediaStreamSourceConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MediaStreamSourceConfiguration"
      ( \Object
x ->
          Maybe [InputConfiguration]
-> Text -> EncodingName -> MediaStreamSourceConfiguration
MediaStreamSourceConfiguration'
            (Maybe [InputConfiguration]
 -> Text -> EncodingName -> MediaStreamSourceConfiguration)
-> Parser (Maybe [InputConfiguration])
-> Parser (Text -> EncodingName -> MediaStreamSourceConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [InputConfiguration]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"inputConfigurations"
                            Parser (Maybe (Maybe [InputConfiguration]))
-> Maybe [InputConfiguration]
-> Parser (Maybe [InputConfiguration])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [InputConfiguration]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Text -> EncodingName -> MediaStreamSourceConfiguration)
-> Parser Text
-> Parser (EncodingName -> MediaStreamSourceConfiguration)
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
"mediaStreamName")
            Parser (EncodingName -> MediaStreamSourceConfiguration)
-> Parser EncodingName -> Parser MediaStreamSourceConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser EncodingName
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"encodingName")
      )

instance
  Prelude.Hashable
    MediaStreamSourceConfiguration

instance
  Prelude.NFData
    MediaStreamSourceConfiguration