Skip to content

Commit c183d98

Browse files
committed
Merge remote-tracking branch 'origin/master' into windows-2022
2 parents d683757 + f7bd2f7 commit c183d98

File tree

13 files changed

+385
-28
lines changed

13 files changed

+385
-28
lines changed

.github/workflows/build-test.yml

+18-6
Original file line numberDiff line numberDiff line change
@@ -579,13 +579,25 @@ jobs:
579579
apt-get --allow-unauthenticated install -y curl g++ git make patch zlib1g-dev libssl-dev bsdmainutils dnsutils unzip
580580
# ubuntu-14.04 ca-certificates are out of date
581581
git config --global http.sslVerify false
582-
curl -sS https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tar.xz | tar -xJ
583-
cd Python-3.6.9
584-
./configure
582+
# build and install openssl
583+
curl -OsSk https://www.openssl.org/source/openssl-1.1.1v.tar.gz
584+
tar xzf openssl-1.1.1v.tar.gz
585+
cd openssl-1.1.1v
586+
./config --prefix=/usr/local/custom-openssl --libdir=lib --openssldir=/etc/ssl
587+
make -j1 depend
588+
make -j8
589+
make install_sw
590+
cd ..
591+
# install ffi.h, which is required for python build
592+
apt install libffi-dev
593+
# build and install python
594+
curl -sSk https://www.python.org/ftp/python/3.11.5/Python-3.11.5.tar.xz | tar -xJ
595+
cd Python-3.11.5
596+
./configure -C --with-openssl=/usr/local/custom-openssl --with-openssl-rpath=auto
585597
make -j8
586598
make install
587-
update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.6 3
588-
ln -s /usr/local/bin/python3.6 /usr/bin/python
599+
update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.11 3
600+
ln -s /usr/local/bin/python3.11 /usr/bin/python
589601
curl -sS https://bootstrap.pypa.io/pip/3.6/get-pip.py | python
590602
curl -sS https://nodejs.org/dist/v12.16.2/node-v12.16.2-linux-x64.tar.xz | tar -xJ
591603
echo "`pwd`/node-v12.16.2-linux-x64/bin" >> $GITHUB_PATH
@@ -1075,4 +1087,4 @@ jobs:
10751087
git config --global user.name 'test-results-uploader'
10761088
git config --global user.email '[email protected]'
10771089
git commit -qm "Badges for README at ${{ env.GITHUB_COMMIT }}"
1078-
git push -f `git remote` badges-${{ env.GITHUB_COMMIT }}:badges
1090+
git push -f `git remote` badges-${{ env.GITHUB_COMMIT }}:badges

.github/workflows/src/build-test.yml

+17-5
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,25 @@ jobs:
129129
apt-get --allow-unauthenticated install -y curl g++ git make patch zlib1g-dev libssl-dev bsdmainutils dnsutils unzip
130130
# ubuntu-14.04 ca-certificates are out of date
131131
git config --global http.sslVerify false
132-
curl -sS https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tar.xz | tar -xJ
133-
cd Python-3.6.9
134-
./configure
132+
# build and install openssl
133+
curl -OsSk https://www.openssl.org/source/openssl-1.1.1v.tar.gz
134+
tar xzf openssl-1.1.1v.tar.gz
135+
cd openssl-1.1.1v
136+
./config --prefix=/usr/local/custom-openssl --libdir=lib --openssldir=/etc/ssl
137+
make -j1 depend
138+
make -j8
139+
make install_sw
140+
cd ..
141+
# install ffi.h, which is required for python build
142+
apt install libffi-dev
143+
# build and install python
144+
curl -sSk https://www.python.org/ftp/python/3.11.5/Python-3.11.5.tar.xz | tar -xJ
145+
cd Python-3.11.5
146+
./configure -C --with-openssl=/usr/local/custom-openssl --with-openssl-rpath=auto
135147
make -j8
136148
make install
137-
update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.6 3
138-
ln -s /usr/local/bin/python3.6 /usr/bin/python
149+
update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.11 3
150+
ln -s /usr/local/bin/python3.11 /usr/bin/python
139151
curl -sS https://bootstrap.pypa.io/pip/3.6/get-pip.py | python
140152
curl -sS https://nodejs.org/dist/v12.16.2/node-v12.16.2-linux-x64.tar.xz | tar -xJ
141153
echo "`pwd`/node-v12.16.2-linux-x64/bin" >> $GITHUB_PATH

Development/cmake/NmosCppLibraries.cmake

+2
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,7 @@ set(NMOS_CPP_NMOS_SOURCES
795795
nmos/resource.cpp
796796
nmos/resources.cpp
797797
nmos/schemas_api.cpp
798+
nmos/sdp_attributes.cpp
798799
nmos/sdp_utils.cpp
799800
nmos/server.cpp
800801
nmos/server_utils.cpp
@@ -887,6 +888,7 @@ set(NMOS_CPP_NMOS_HEADERS
887888
nmos/resource.h
888889
nmos/resources.h
889890
nmos/schemas_api.h
891+
nmos/sdp_attributes.h
890892
nmos/sdp_utils.h
891893
nmos/server.h
892894
nmos/server_utils.h

Development/nmos-cpp-node/config.json

+3
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@
114114
//"discovery_backoff_max": 30,
115115
//"discovery_backoff_factor": 1.5,
116116

117+
// service_name_prefix [registry, node]: used as a prefix in the advertised service names ("<prefix>_<api>_<host>:<port>", e.g. "nmos-cpp_node_127-0-0-1:3212")
118+
//"service_name_prefix": "nmos-cpp"
119+
117120
// registry_address [node]: IP address or host name used to construct request URLs for registry APIs (if not discovered via DNS-SD)
118121
//"registry_address": ip-address-string,
119122

Development/nmos-cpp-registry/config.json

+3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
//"discovery_backoff_max": 30,
4444
//"discovery_backoff_factor": 1.5,
4545

46+
// service_name_prefix [registry, node]: used as a prefix in the advertised service names ("<prefix>_<api>_<host>:<port>", e.g. "nmos-cpp_node_127-0-0-1:3212")
47+
//"service_name_prefix": "nmos-cpp"
48+
4649
// port numbers [registry, node]: ports to which clients should connect for each API
4750

4851
// http_port [registry, node]: if specified, this becomes the default port for each HTTP API and the next higher port becomes the default for each WebSocket API

Development/nmos/mdns.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ namespace nmos
110110
// IS-09 System API does not use authorization
111111
// See https://github.com/AMWA-TV/is-09/issues/21
112112
if (nmos::service_types::system == service) return false;
113-
113+
114114
const auto client_authorization = false;
115115
return client_authorization;
116116
}
@@ -294,9 +294,9 @@ namespace nmos
294294
return{};
295295
}
296296

297-
inline std::string service_base_name(const nmos::service_type& service)
297+
inline std::string service_base_name(const nmos::service_type& service, const nmos::settings& settings)
298298
{
299-
return "nmos-cpp_" + service_api(service);
299+
return utility::us2s(nmos::fields::service_name_prefix(settings)) + "_" + service_api(service);
300300
}
301301

302302
inline std::set<nmos::api_version> service_versions(const nmos::service_type& service, const nmos::settings& settings)
@@ -312,7 +312,7 @@ namespace nmos
312312
{
313313
// this just serves as an example of a possible service naming strategy
314314
// replacing '.' with '-', since although '.' is legal in service names, some DNS-SD implementations just don't like it
315-
return boost::algorithm::replace_all_copy(details::service_base_name(service) + "_" + utility::us2s(nmos::get_host(settings)) + ":" + utility::us2s(utility::ostringstreamed(details::service_port(service, settings))), ".", "-");
315+
return boost::algorithm::replace_all_copy(details::service_base_name(service, settings) + "_" + utility::us2s(nmos::get_host(settings)) + ":" + utility::us2s(utility::ostringstreamed(details::service_port(service, settings))), ".", "-");
316316
}
317317

318318
// helper function for registering addresses when the host name is explicitly configured
@@ -695,7 +695,7 @@ namespace nmos
695695
// use a short timeout that's long enough to ensure the daemon's cache is exhausted
696696
// when no cancellation token is specified
697697
const auto timeout = token.is_cancelable() ? nmos::fields::discovery_backoff_max(settings) : 1;
698-
698+
699699
return resolve_service(discovery, mode, service, browse_domain, versions, priorities, protocols, authorization, true, std::chrono::seconds(timeout), token);
700700
}
701701
}

Development/nmos/sdp_attributes.cpp

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#include "nmos/sdp_attributes.h"
2+
3+
#include "cpprest/json_utils.h"
4+
5+
namespace nmos
6+
{
7+
namespace details
8+
{
9+
// hm, forward declaration for function in nmos/sdp_utils.cpp
10+
std::pair<sdp::address_type, bool> get_address_type_multicast(const utility::string_t& address);
11+
}
12+
13+
namespace sdp_attributes
14+
{
15+
web::json::value make_extmap(const extmap& extmap)
16+
{
17+
using web::json::value_of;
18+
19+
const bool keep_order = true;
20+
21+
return value_of({
22+
{ sdp::fields::name, sdp::attributes::extmap },
23+
{ sdp::fields::value, value_of({
24+
{ sdp::fields::local_id, extmap.local_id },
25+
{ extmap.direction != sdp::direction{} ? sdp::fields::direction.key : U(""), extmap.direction.name },
26+
{ sdp::fields::uri, extmap.uri },
27+
{ !extmap.ext_attributes.empty() ? sdp::fields::extensionattributes.key : U(""), extmap.ext_attributes },
28+
}, keep_order) }
29+
}, keep_order);
30+
}
31+
32+
extmap parse_extmap(const web::json::value& extmap)
33+
{
34+
return{ sdp::fields::local_id(extmap), sdp::direction(sdp::fields::direction(extmap)), sdp::fields::uri(extmap), sdp::fields::extensionattributes(extmap) };
35+
}
36+
37+
web::json::value make_hkep(const hkep& hkep)
38+
{
39+
using web::json::value_of;
40+
41+
const bool keep_order = true;
42+
43+
return value_of({
44+
{ sdp::fields::name, sdp::attributes::hkep },
45+
{ sdp::fields::value, value_of({
46+
{ sdp::fields::port, hkep.port },
47+
{ sdp::fields::network_type, sdp::network_types::internet.name },
48+
{ sdp::fields::address_type, details::get_address_type_multicast(hkep.unicast_address).first.name },
49+
{ sdp::fields::unicast_address, hkep.unicast_address },
50+
{ sdp::fields::node_id, hkep.node_id },
51+
{ sdp::fields::port_id, hkep.port_id },
52+
}, keep_order) }
53+
}, keep_order);
54+
}
55+
56+
hkep parse_hkep(const web::json::value& hkep)
57+
{
58+
return{ sdp::fields::port(hkep), sdp::fields::unicast_address(hkep), sdp::fields::node_id(hkep), sdp::fields::port_id(hkep) };
59+
}
60+
}
61+
}

Development/nmos/sdp_attributes.h

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#ifndef NMOS_SDP_ATTRIBUTES_H
2+
#define NMOS_SDP_ATTRIBUTES_H
3+
4+
#include "sdp/json.h"
5+
6+
namespace nmos
7+
{
8+
namespace sdp_attributes
9+
{
10+
// RTP Header Extensions
11+
// See https://tools.ietf.org/html/rfc5285#section-5
12+
struct extmap
13+
{
14+
uint64_t local_id;
15+
sdp::direction direction;
16+
utility::string_t uri;
17+
utility::string_t ext_attributes;
18+
19+
extmap() : local_id() {}
20+
extmap(uint64_t local_id, const utility::string_t& uri) : local_id(local_id), uri(uri) {}
21+
extmap(uint64_t local_id, const sdp::direction& direction, const utility::string_t& uri) : local_id(local_id), direction(direction), uri(uri) {}
22+
extmap(uint64_t local_id, const utility::string_t& uri, const utility::string_t& ext_attributes) : local_id(local_id), uri(uri), ext_attributes(ext_attributes) {}
23+
extmap(uint64_t local_id, const sdp::direction& direction, const utility::string_t& uri, const utility::string_t& ext_attributes) : local_id(local_id), direction(direction), uri(uri), ext_attributes(ext_attributes) {}
24+
};
25+
26+
web::json::value make_extmap(const extmap& extmap);
27+
extmap parse_extmap(const web::json::value& extmap);
28+
29+
// HDCP Key Exchange Protocol (HKEP) Signalling
30+
// See VSF TR-10-5:2022 Internet Protocol Media Experience (IPMX): HDCP Key Exchange Protocol, Section 10
31+
// at https://videoservicesforum.com/download/technical_recommendations/VSF_TR-10-5_2022-03-22.pdf
32+
struct hkep
33+
{
34+
uint64_t port;
35+
utility::string_t unicast_address;
36+
utility::string_t node_id;
37+
utility::string_t port_id;
38+
39+
hkep() : port() {}
40+
hkep(uint64_t port, const utility::string_t& unicast_address, const utility::string_t& node_id, const utility::string_t& port_id) : port(port), unicast_address(unicast_address), node_id(node_id), port_id(port_id) {}
41+
};
42+
43+
web::json::value make_hkep(const hkep& hkep);
44+
hkep parse_hkep(const web::json::value& hkep);
45+
}
46+
}
47+
48+
#endif

Development/nmos/sdp_utils.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ namespace nmos
190190

191191
// For now, only the default payload format is covered.
192192
//std::vector<std::pair<rtpmap_t, fmtp_t>> alternative_rtpmap_fmtp;
193-
193+
194194
// Timestamp Reference Clock Source Signalling ("a=ts-refclk:")
195195
// See https://tools.ietf.org/html/rfc7273#section-4
196196
struct ts_refclk_t

Development/nmos/settings.h

+3
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ namespace nmos
114114
const web::json::field_as_integer_or discovery_backoff_max{ U("discovery_backoff_max"), 30 };
115115
const web::json::field_with_default<double> discovery_backoff_factor{ U("discovery_backoff_factor"), 1.5 };
116116

117+
// service_name_prefix [registry, node]: used as a prefix in the advertised service names ("<prefix>_<api>_<host>:<port>", e.g. "nmos-cpp_node_127-0-0-1:3212")
118+
const web::json::field_as_string_or service_name_prefix{ U("service_name_prefix"), U("nmos-cpp") };
119+
117120
// registry_address [node]: IP address or host name used to construct request URLs for registry APIs (if not discovered via DNS-SD)
118121
const web::json::field_as_string registry_address{ U("registry_address") };
119122

Development/sdp/json.h

+31-1
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,13 @@ namespace sdp
143143
// See https://tools.ietf.org/html/rfc7273
144144
const utility::string_t ts_refclk{ U("ts-refclk") };
145145
const utility::string_t mediaclk{ U("mediaclk") };
146+
147+
// See VSF TR-10-5:2022 Internet Protocol Media Experience (IPMX): HDCP Key Exchange Protocol, Section 10
148+
// at https://videoservicesforum.com/download/technical_recommendations/VSF_TR-10-5_2022-03-22.pdf
149+
const utility::string_t hkep{ U("hkep") };
150+
151+
// See https://tools.ietf.org/html/rfc5285#section-5
152+
const utility::string_t extmap{ U("extmap") };
146153
}
147154

148155
namespace fields
@@ -195,6 +202,18 @@ namespace sdp
195202

196203
// a=mediaclk:[id=<clock id> ]<clock source>[=<clock parameters>]
197204
// See https://tools.ietf.org/html/rfc7273#section-5
205+
206+
// a=hkep:<port> <nettype> <addrtype> <unicast-address> <node-id> <port-id>
207+
// See VSF TR-10-5:2022 Internet Protocol Media Experience (IPMX): HDCP Key Exchange Protocol, Section 10
208+
// at https://videoservicesforum.com/download/technical_recommendations/VSF_TR-10-5_2022-03-22.pdf
209+
const web::json::field_as_string node_id{ U("node_id") };
210+
const web::json::field_as_string port_id{ U("port_id") };
211+
212+
// a=extmap:<value>["/"<direction>] <URI> <extensionattributes>
213+
// See https://tools.ietf.org/html/rfc5285#section-5
214+
const web::json::field<uint64_t> local_id{ U("local_id") };
215+
const web::json::field_as_string_or direction{ U("direction"), {} }; // see sdp::direction
216+
const web::json::field_as_string_or extensionattributes{ U("extensionattributes"), {} };
198217
}
199218

200219
// make a named value (useful for attributes)
@@ -299,6 +318,16 @@ namespace sdp
299318
// IPv6
300319
const address_type IP6{ U("IP6") };
301320
}
321+
322+
// Direction
323+
DEFINE_STRING_ENUM(direction)
324+
namespace directions
325+
{
326+
const direction recvonly{ U("recvonly") };
327+
const direction sendrecv{ U("sendrecv") };
328+
const direction sendonly{ U("sendonly") };
329+
const direction inactive{ U("inactive") };
330+
}
302331
}
303332

304333
// Session Description Protocol (SDP) Source Filters
@@ -424,7 +453,8 @@ namespace sdp
424453

425454
// See https://tools.ietf.org/html/rfc4175
426455
// and SMPTE ST 2110-20:2022 Section 7 Session Description Protocol (SDP) Considerations
427-
// and VSF TR-05:2018
456+
// and VSF TR-05:2018 Essential Formats and Descriptions for Interoperability of SMPTE ST 2110-20 Video Signals
457+
// at https://videoservicesforum.net/download/technical_recommendations/VSF_TR-05_2018-06-23.pdf
428458

429459
// ST 2110-20:2022 Section 7.2 Required Media Type Parameters
430460
const web::json::field_as_string sampling{ U("sampling") }; // see sdp::sampling

0 commit comments

Comments
 (0)