Skip to content

Commit a873136

Browse files
Responded to review comments on pull request
1 parent 9aefbc4 commit a873136

5 files changed

Lines changed: 58 additions & 46 deletions

File tree

Development/cmake/NmosCppLibraries.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,6 +1214,7 @@ set(NMOS_CPP_NMOS_HEADERS
12141214
nmos/mdns_api.h
12151215
nmos/mdns_versions.h
12161216
nmos/media_type.h
1217+
nmos/mxl.h
12171218
nmos/model.h
12181219
nmos/mutex.h
12191220
nmos/node_api.h

Development/nmos-cpp-node/config.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
// the values must be an array of unique strings identifying the kinds of 'port', like ["v", "a", "d"], see impl::ports
2525
// for MXL senders and receivers, the values must be like ["xv", "xa", "xd"]
2626
// when omitted, all ports are instantiated
27-
//"senders": ["v", "a", "d"],
28-
//"receivers": ["v", "a", "d"],
27+
//"senders": ["v", "a"],
28+
//"receivers": [],
2929

3030
// frame_rate: controls the grain_rate of video, audio and ancillary data sources and flows
3131
// and the equivalent parameter constraint on video receivers
@@ -52,10 +52,12 @@
5252
// component_depth: controls the bits per component sample of video flows
5353
//"component_depth": 10,
5454

55-
// video_type: media type of video flows, e.g. "video/raw", "video/jxsv" for ST 2110 senders and receivers
56-
// or "video/v210" for MXL senders and receivers, see nmos::media_types
55+
// video_type: media type of video flows, e.g. "video/raw", "video/jxsv" for ST 2110 senders and receivers, see nmos::media_types
5756
//"video_type": "video/raw",
5857

58+
// mxl_video_type: media type of MXL video flows and receivers, e.g. "video/v210" or "video/v210a", see nmos/mxl.h
59+
//"mxl_video_type": "video/v210",
60+
5961
// channel_count: controls the number of channels in audio sources
6062
//"channel_count": 8,
6163

Development/nmos-cpp-node/node_implementation.cpp

Lines changed: 25 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include "nmos/lldp_manager.h"
3939
#endif
4040
#include "nmos/media_type.h"
41+
#include "nmos/mxl.h"
4142
#include "nmos/model.h"
4243
#include "nmos/node_interfaces.h"
4344
#include "nmos/node_resource.h"
@@ -119,6 +120,9 @@ namespace impl
119120
// video_type: media type of video flows, e.g. "video/raw" or "video/jxsv", see nmos::media_types
120121
const web::json::field_as_string_or video_type{ U("video_type"), U("video/raw") };
121122

123+
// mxl_video_type: media type of MXL video flows and receivers, e.g. "video/v210" or "video/v210a", see nmos/mxl.h
124+
const web::json::field_as_string_or mxl_video_type{ U("mxl_video_type"), nmos::media_types::video_v210.name };
125+
122126
// channel_count: controls the number of channels in audio sources
123127
const web::json::field_as_integer_or channel_count{ U("channel_count"), 4 };
124128

@@ -412,9 +416,7 @@ void node_implementation_init(nmos::node_model& model, nmos::experimental::contr
412416
const auto seed_id = nmos::experimental::fields::seed_id(model.settings);
413417
const auto node_id = impl::make_id(seed_id, nmos::types::node);
414418
const auto device_id = impl::make_id(seed_id, nmos::types::device);
415-
const nmos::id mxl_domain_id = model.settings.has_field(impl::fields::mxl_domain_id)
416-
? impl::fields::mxl_domain_id(model.settings)
417-
: nmos::make_repeatable_id(seed_id, U("/x-nmos/mxl/domain"));
419+
const auto mxl_domain_id = impl::fields::mxl_domain_id(model.settings);
418420
const auto how_many = impl::fields::how_many(model.settings);
419421
const auto sender_ports = impl::parse_ports(impl::fields::senders(model.settings));
420422
const auto rtp_sender_ports = boost::copy_range<std::vector<impl::port>>(sender_ports | boost::adaptors::filtered(impl::is_rtp_port));
@@ -433,6 +435,7 @@ void node_implementation_init(nmos::node_model& model, nmos::experimental::contr
433435
const auto sampling = sdp::sampling{ impl::fields::color_sampling(model.settings) };
434436
const auto bit_depth = impl::fields::component_depth(model.settings);
435437
const auto video_type = nmos::media_type{ impl::fields::video_type(model.settings) };
438+
const auto mxl_video_type = nmos::media_type{ impl::fields::mxl_video_type(model.settings) };
436439
const auto channel_count = impl::fields::channel_count(model.settings);
437440
const auto smpte2022_7 = impl::fields::smpte2022_7(model.settings);
438441

@@ -960,16 +963,14 @@ void node_implementation_init(nmos::node_model& model, nmos::experimental::contr
960963
frame_rate,
961964
frame_width, frame_height, interlace_mode,
962965
colorspace, transfer_characteristic, sampling, bit_depth,
963-
video_type,
966+
mxl_video_type,
964967
model.settings
965968
);
966969
}
967970
else if (impl::ports::mxl_audio == port)
968971
{
969972
flow = nmos::make_raw_audio_flow(flow_id, source_id, device_id, 48000, 32, model.settings);
970-
flow.data[nmos::fields::media_type] = value::string(U("audio/float32"));
971-
// add optional grain_rate
972-
flow.data[nmos::fields::grain_rate] = nmos::make_rational(frame_rate);
973+
flow.data[nmos::fields::media_type] = value::string(nmos::media_types::audio_float32.name);
973974
}
974975
else if (impl::ports::mxl_data == port)
975976
{
@@ -1016,46 +1017,29 @@ void node_implementation_init(nmos::node_model& model, nmos::experimental::contr
10161017
nmos::resource receiver;
10171018
if (impl::ports::mxl_video == port)
10181019
{
1019-
receiver = nmos::make_receiver(receiver_id, device_id, nmos::transports::mxl, {}, nmos::formats::video, { video_type }, model.settings);
1020-
if (nmos::media_types::video_raw == video_type)
1021-
{
1022-
const auto interlace_modes = nmos::interlace_modes::progressive != interlace_mode
1023-
? std::vector<utility::string_t>{ nmos::interlace_modes::interlaced_bff.name, nmos::interlace_modes::interlaced_tff.name, nmos::interlace_modes::interlaced_psf.name }
1024-
: std::vector<utility::string_t>{ nmos::interlace_modes::progressive.name };
1025-
receiver.data[nmos::fields::caps][nmos::fields::constraint_sets] = value_of({
1026-
value_of({
1027-
{ nmos::caps::format::grain_rate, nmos::make_caps_rational_constraint({ frame_rate }) },
1028-
{ nmos::caps::format::frame_width, nmos::make_caps_integer_constraint({ frame_width }) },
1029-
{ nmos::caps::format::frame_height, nmos::make_caps_integer_constraint({ frame_height }) },
1030-
{ nmos::caps::format::interlace_mode, nmos::make_caps_string_constraint(interlace_modes) },
1031-
{ nmos::caps::format::color_sampling, nmos::make_caps_string_constraint({ sampling.name }) }
1032-
})
1033-
});
1034-
}
1035-
else if (nmos::media_types::video_jxsv == video_type)
1036-
{
1037-
const auto max_format_bit_rate = nmos::get_video_jxsv_bit_rate(frame_rate, frame_width, frame_height, max_bits_per_pixel);
1038-
const auto max_transport_bit_rate = uint64_t(transport_bit_rate_factor * max_format_bit_rate / 1e3 + 0.5) * 1000;
1039-
1040-
receiver.data[nmos::fields::caps][nmos::fields::constraint_sets] = value_of({
1041-
value_of({
1042-
{ nmos::caps::format::profile, nmos::make_caps_string_constraint({ profile.name }) },
1043-
{ nmos::caps::format::level, nmos::make_caps_string_constraint({ level.name }) },
1044-
{ nmos::caps::format::sublevel, nmos::make_caps_string_constraint({ nmos::sublevels::Sublev3bpp.name, nmos::sublevels::Sublev4bpp.name }) },
1045-
{ nmos::caps::format::bit_rate, nmos::make_caps_integer_constraint({}, nmos::no_minimum<int64_t>(), (int64_t)max_format_bit_rate) },
1046-
{ nmos::caps::transport::bit_rate, nmos::make_caps_integer_constraint({}, nmos::no_minimum<int64_t>(), (int64_t)max_transport_bit_rate) },
1047-
{ nmos::caps::transport::packet_transmission_mode, nmos::make_caps_string_constraint({ nmos::packet_transmission_modes::codestream.name }) }
1048-
})
1049-
});
1050-
}
1020+
receiver = nmos::make_receiver(receiver_id, device_id, nmos::transports::mxl, {}, nmos::formats::video, { mxl_video_type }, model.settings);
1021+
const auto interlace_modes = nmos::interlace_modes::progressive != interlace_mode
1022+
? std::vector<utility::string_t>{ nmos::interlace_modes::interlaced_bff.name, nmos::interlace_modes::interlaced_tff.name, nmos::interlace_modes::interlaced_psf.name }
1023+
: std::vector<utility::string_t>{ nmos::interlace_modes::progressive.name };
1024+
receiver.data[nmos::fields::caps][nmos::fields::constraint_sets] = value_of({
1025+
value_of({
1026+
{ nmos::caps::format::media_type, nmos::make_caps_string_constraint({ mxl_video_type.name }) },
1027+
{ nmos::caps::format::grain_rate, nmos::make_caps_rational_constraint({ frame_rate }) },
1028+
{ nmos::caps::format::frame_width, nmos::make_caps_integer_constraint({ frame_width }) },
1029+
{ nmos::caps::format::frame_height, nmos::make_caps_integer_constraint({ frame_height }) },
1030+
{ nmos::caps::format::interlace_mode, nmos::make_caps_string_constraint(interlace_modes) },
1031+
{ nmos::caps::format::color_sampling, nmos::make_caps_string_constraint({ sampling.name }) },
1032+
{ nmos::caps::format::component_depth, nmos::make_caps_integer_constraint({ bit_depth }) }
1033+
})
1034+
});
10511035
receiver.data[nmos::fields::version] = receiver.data[nmos::fields::caps][nmos::fields::version] = value(nmos::make_version());
10521036
}
10531037
else if (impl::ports::mxl_audio == port)
10541038
{
1055-
receiver = nmos::make_receiver(receiver_id, device_id, nmos::transports::mxl, {}, nmos::formats::audio, { nmos::media_type{ U("audio/float32") } }, model.settings);
1039+
receiver = nmos::make_receiver(receiver_id, device_id, nmos::transports::mxl, {}, nmos::formats::audio, { nmos::media_types::audio_float32 }, model.settings);
10561040
receiver.data[nmos::fields::caps][nmos::fields::constraint_sets] = value_of({
10571041
value_of({
1058-
{ nmos::caps::format::media_type, nmos::make_caps_string_constraint({ U("audio/float32") }) },
1042+
{ nmos::caps::format::media_type, nmos::make_caps_string_constraint({ nmos::media_types::audio_float32.name }) },
10591043
{ nmos::caps::format::channel_count, nmos::make_caps_integer_constraint({}, 1, channel_count) },
10601044
{ nmos::caps::format::sample_rate, nmos::make_caps_rational_constraint({ { 48000, 1 } }) },
10611045
{ nmos::caps::format::sample_depth, nmos::make_caps_integer_constraint({ 32 }) }

Development/nmos/json_fields.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ namespace nmos
174174
const web::json::field_as_value_or connection_status_broker_topic{ U("connection_status_broker_topic"), {} }; // string or null
175175
// for urn:x-nmos:transport:mxl (see AMWA BCP-007-03 NMOS With MXL)
176176
const web::json::field_as_value_or mxl_domain_id{ U("mxl_domain_id"), {} }; // UUID string, auto, or null
177-
const web::json::field_as_value_or mxl_flow_id{ U("mxl_flow_id"), {} }; // senders: UUID, auto, or null; receivers: UUID or null (BCP-007-03)
177+
const web::json::field_as_value_or mxl_flow_id{ U("mxl_flow_id"), {} }; // senders: UUID, auto, or null; receivers: UUID or null
178178

179179
// IS-07 Event & Tally
180180

Development/nmos/mxl.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#ifndef NMOS_MXL_H
2+
#define NMOS_MXL_H
3+
4+
#include "nmos/media_type.h"
5+
6+
namespace nmos
7+
{
8+
namespace media_types
9+
{
10+
// MXL video media types
11+
12+
const media_type video_v210{ U("video/v210") };
13+
const media_type video_v210a{ U("video/v210a") };
14+
15+
// MXL audio media types
16+
17+
const media_type audio_float32{ U("audio/float32") };
18+
19+
// MXL data media types
20+
21+
//const media_type video_smpte291{ U("video/smpte291") };
22+
}
23+
}
24+
25+
#endif

0 commit comments

Comments
 (0)