165 lines
3.6 KiB
C++
165 lines
3.6 KiB
C++
|
|
/**
|
|||
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|||
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
#include <aws/mediaconnect/model/Transport.h>
|
|||
|
|
#include <aws/core/utils/json/JsonSerializer.h>
|
|||
|
|
|
|||
|
|
#include <utility>
|
|||
|
|
|
|||
|
|
using namespace Aws::Utils::Json;
|
|||
|
|
using namespace Aws::Utils;
|
|||
|
|
|
|||
|
|
namespace Aws
|
|||
|
|
{
|
|||
|
|
namespace MediaConnect
|
|||
|
|
{
|
|||
|
|
namespace Model
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
Transport::Transport() :
|
|||
|
|
m_cidrAllowListHasBeenSet(false),
|
|||
|
|
m_maxBitrate(0),
|
|||
|
|
m_maxBitrateHasBeenSet(false),
|
|||
|
|
m_maxLatency(0),
|
|||
|
|
m_maxLatencyHasBeenSet(false),
|
|||
|
|
m_protocol(Protocol::NOT_SET),
|
|||
|
|
m_protocolHasBeenSet(false),
|
|||
|
|
m_remoteIdHasBeenSet(false),
|
|||
|
|
m_smoothingLatency(0),
|
|||
|
|
m_smoothingLatencyHasBeenSet(false),
|
|||
|
|
m_streamIdHasBeenSet(false)
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
Transport::Transport(JsonView jsonValue) :
|
|||
|
|
m_cidrAllowListHasBeenSet(false),
|
|||
|
|
m_maxBitrate(0),
|
|||
|
|
m_maxBitrateHasBeenSet(false),
|
|||
|
|
m_maxLatency(0),
|
|||
|
|
m_maxLatencyHasBeenSet(false),
|
|||
|
|
m_protocol(Protocol::NOT_SET),
|
|||
|
|
m_protocolHasBeenSet(false),
|
|||
|
|
m_remoteIdHasBeenSet(false),
|
|||
|
|
m_smoothingLatency(0),
|
|||
|
|
m_smoothingLatencyHasBeenSet(false),
|
|||
|
|
m_streamIdHasBeenSet(false)
|
|||
|
|
{
|
|||
|
|
*this = jsonValue;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
Transport& Transport::operator =(JsonView jsonValue)
|
|||
|
|
{
|
|||
|
|
if(jsonValue.ValueExists("cidrAllowList"))
|
|||
|
|
{
|
|||
|
|
Array<JsonView> cidrAllowListJsonList = jsonValue.GetArray("cidrAllowList");
|
|||
|
|
for(unsigned cidrAllowListIndex = 0; cidrAllowListIndex < cidrAllowListJsonList.GetLength(); ++cidrAllowListIndex)
|
|||
|
|
{
|
|||
|
|
m_cidrAllowList.push_back(cidrAllowListJsonList[cidrAllowListIndex].AsString());
|
|||
|
|
}
|
|||
|
|
m_cidrAllowListHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("maxBitrate"))
|
|||
|
|
{
|
|||
|
|
m_maxBitrate = jsonValue.GetInteger("maxBitrate");
|
|||
|
|
|
|||
|
|
m_maxBitrateHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("maxLatency"))
|
|||
|
|
{
|
|||
|
|
m_maxLatency = jsonValue.GetInteger("maxLatency");
|
|||
|
|
|
|||
|
|
m_maxLatencyHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("protocol"))
|
|||
|
|
{
|
|||
|
|
m_protocol = ProtocolMapper::GetProtocolForName(jsonValue.GetString("protocol"));
|
|||
|
|
|
|||
|
|
m_protocolHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("remoteId"))
|
|||
|
|
{
|
|||
|
|
m_remoteId = jsonValue.GetString("remoteId");
|
|||
|
|
|
|||
|
|
m_remoteIdHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("smoothingLatency"))
|
|||
|
|
{
|
|||
|
|
m_smoothingLatency = jsonValue.GetInteger("smoothingLatency");
|
|||
|
|
|
|||
|
|
m_smoothingLatencyHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("streamId"))
|
|||
|
|
{
|
|||
|
|
m_streamId = jsonValue.GetString("streamId");
|
|||
|
|
|
|||
|
|
m_streamIdHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return *this;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
JsonValue Transport::Jsonize() const
|
|||
|
|
{
|
|||
|
|
JsonValue payload;
|
|||
|
|
|
|||
|
|
if(m_cidrAllowListHasBeenSet)
|
|||
|
|
{
|
|||
|
|
Array<JsonValue> cidrAllowListJsonList(m_cidrAllowList.size());
|
|||
|
|
for(unsigned cidrAllowListIndex = 0; cidrAllowListIndex < cidrAllowListJsonList.GetLength(); ++cidrAllowListIndex)
|
|||
|
|
{
|
|||
|
|
cidrAllowListJsonList[cidrAllowListIndex].AsString(m_cidrAllowList[cidrAllowListIndex]);
|
|||
|
|
}
|
|||
|
|
payload.WithArray("cidrAllowList", std::move(cidrAllowListJsonList));
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_maxBitrateHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithInteger("maxBitrate", m_maxBitrate);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_maxLatencyHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithInteger("maxLatency", m_maxLatency);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_protocolHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithString("protocol", ProtocolMapper::GetNameForProtocol(m_protocol));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_remoteIdHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithString("remoteId", m_remoteId);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_smoothingLatencyHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithInteger("smoothingLatency", m_smoothingLatency);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_streamIdHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithString("streamId", m_streamId);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return payload;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
} // namespace Model
|
|||
|
|
} // namespace MediaConnect
|
|||
|
|
} // namespace Aws
|