Minor changes
This commit is contained in:
parent
6a025c1e7a
commit
0b27a6ee9e
@ -31,7 +31,7 @@ std::pair<uint32_t, std::string> get_interface_ip(
|
||||
if (fd < 0) {
|
||||
BOOST_LOG_TRIVIAL(error)
|
||||
<< "Cannot retrieve IP address for interface " << interface_name;
|
||||
return std::make_pair(0, "");
|
||||
return {0, ""};
|
||||
}
|
||||
struct ifreq ifr;
|
||||
ifr.ifr_addr.sa_family = AF_INET;
|
||||
@ -40,7 +40,7 @@ std::pair<uint32_t, std::string> get_interface_ip(
|
||||
close(fd);
|
||||
BOOST_LOG_TRIVIAL(error)
|
||||
<< "Cannot retrieve IP address for interface " << interface_name;
|
||||
return std::make_pair(0, "");
|
||||
return {0, ""};
|
||||
}
|
||||
close(fd);
|
||||
|
||||
@ -51,7 +51,7 @@ std::pair<uint32_t, std::string> get_interface_ip(
|
||||
/*BOOST_LOG_TRIVIAL(debug) << "interface " << interface_name
|
||||
<< " IP address " << str_addr;*/
|
||||
|
||||
return std::make_pair(addr, str_addr);
|
||||
return {addr, str_addr};
|
||||
}
|
||||
|
||||
std::pair<std::array<uint8_t, 6>, std::string> get_interface_mac(
|
||||
@ -61,7 +61,7 @@ std::pair<std::array<uint8_t, 6>, std::string> get_interface_mac(
|
||||
if (fd < 0) {
|
||||
BOOST_LOG_TRIVIAL(error)
|
||||
<< "Cannot retrieve MAC address for interface " << interface_name;
|
||||
return std::make_pair(mac, "");
|
||||
return {mac, ""};
|
||||
}
|
||||
|
||||
struct ifreq ifr;
|
||||
@ -71,7 +71,7 @@ std::pair<std::array<uint8_t, 6>, std::string> get_interface_mac(
|
||||
close(fd);
|
||||
BOOST_LOG_TRIVIAL(error)
|
||||
<< "Cannot retrieve MAC address for interface " << interface_name;
|
||||
return std::make_pair(mac, "");
|
||||
return {mac, ""};
|
||||
}
|
||||
close(fd);
|
||||
|
||||
@ -84,7 +84,7 @@ std::pair<std::array<uint8_t, 6>, std::string> get_interface_mac(
|
||||
/*BOOST_LOG_TRIVIAL(debug) << "interface " << interface_name
|
||||
<< " MAC address " << str_mac;*/
|
||||
|
||||
return std::make_pair(mac, str_mac);
|
||||
return {mac, str_mac};
|
||||
}
|
||||
|
||||
int get_interface_index(const std::string& interface_name) {
|
||||
|
@ -109,7 +109,7 @@ void MDNSClient::resolve_callback(AvahiServiceResolver* r,
|
||||
}
|
||||
|
||||
/* remove the resolver from the active pool */
|
||||
mdns.active_resolvers.erase(std::pair(name, domain));
|
||||
mdns.active_resolvers.erase({name, domain});
|
||||
avahi_service_resolver_free(r);
|
||||
}
|
||||
|
||||
@ -138,7 +138,7 @@ void MDNSClient::browse_callback(AvahiServiceBrowser* b,
|
||||
<< "service " << name << " of type " << type
|
||||
<< " in domain " << domain;
|
||||
/* check if a resolver is already running for this name and domain */
|
||||
if (mdns.active_resolvers.find(std::pair(name, domain)) !=
|
||||
if (mdns.active_resolvers.find({name, domain}) !=
|
||||
mdns.active_resolvers.end()) {
|
||||
/* if already running we don't run a new resolver */
|
||||
BOOST_LOG_TRIVIAL(info)
|
||||
@ -154,7 +154,7 @@ void MDNSClient::browse_callback(AvahiServiceBrowser* b,
|
||||
<< avahi_strerror(avahi_client_errno(mdns.client_.get()));
|
||||
} else {
|
||||
/* add the resolver to the active pool */
|
||||
mdns.active_resolvers.insert(std::pair(name, domain));
|
||||
mdns.active_resolvers.insert({name, domain});
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -118,7 +118,7 @@ std::pair<bool, RtspSource> RtspClient::process(
|
||||
if (!s) {
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< "rtsp_client:: unable to connect to " << address << ":" << port;
|
||||
return std::make_pair(false, rtsp_source);
|
||||
return {false, rtsp_source};
|
||||
}
|
||||
|
||||
uint16_t cseq = g_seq_number++;
|
||||
@ -143,14 +143,14 @@ std::pair<bool, RtspSource> RtspClient::process(
|
||||
if (!s || rtsp_version.substr(0, 5) != "RTSP/") {
|
||||
BOOST_LOG_TRIVIAL(error) << "rtsp_client:: invalid response from "
|
||||
<< "rtsp://" << address << ":" << port << path;
|
||||
return std::make_pair(false, rtsp_source);
|
||||
return {false, rtsp_source};
|
||||
}
|
||||
|
||||
if (status_code != 200) {
|
||||
BOOST_LOG_TRIVIAL(error) << "rtsp_client:: response with status code "
|
||||
<< status_code << " from "
|
||||
<< "rtsp://" << address << ":" << port << path;
|
||||
return std::make_pair(false, rtsp_source);
|
||||
return {false, rtsp_source};
|
||||
}
|
||||
|
||||
bool is_announce = false;
|
||||
@ -162,7 +162,7 @@ std::pair<bool, RtspSource> RtspClient::process(
|
||||
BOOST_LOG_TRIVIAL(error)
|
||||
<< "rtsp_client:: invalid response sequence " << res.cseq
|
||||
<< " from rtsp://" << address << ":" << port << path;
|
||||
return std::make_pair(false, rtsp_source);
|
||||
return {false, rtsp_source};
|
||||
}
|
||||
|
||||
if (!res.content_type.empty() &&
|
||||
@ -171,7 +171,7 @@ std::pair<bool, RtspSource> RtspClient::process(
|
||||
<< res.content_type << " from "
|
||||
<< "rtsp://" << address << ":" << port << path;
|
||||
if (is_describe) {
|
||||
return std::make_pair(false, rtsp_source);
|
||||
return {false, rtsp_source};
|
||||
}
|
||||
} else {
|
||||
std::stringstream ss;
|
||||
@ -207,9 +207,8 @@ std::pair<bool, RtspSource> RtspClient::process(
|
||||
}
|
||||
|
||||
if (wait_for_updates) {
|
||||
auto name_domain = std::make_pair(name, domain);
|
||||
g_mutex.lock();
|
||||
g_active_clients[name_domain] = &s;
|
||||
g_active_clients[{name, domain}] = &s;
|
||||
g_mutex.unlock();
|
||||
|
||||
/* we start waiting for updates */
|
||||
@ -251,19 +250,19 @@ std::pair<bool, RtspSource> RtspClient::process(
|
||||
|
||||
if (wait_for_updates) {
|
||||
std::lock_guard<std::mutex> lock(g_mutex);
|
||||
auto it = g_active_clients.find(std::make_pair(name, domain));
|
||||
auto it = g_active_clients.find({name, domain});
|
||||
if (it != g_active_clients.end() && it->second == &s) {
|
||||
g_active_clients.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
return std::make_pair(true, rtsp_source);
|
||||
return {true, rtsp_source};
|
||||
}
|
||||
|
||||
|
||||
void RtspClient::stop(const std::string& name, const std::string& domain) {
|
||||
std::lock_guard<std::mutex> lock(g_mutex);
|
||||
auto it = g_active_clients.find(std::make_pair(name, domain));
|
||||
auto it = g_active_clients.find({name, domain});
|
||||
if (it != g_active_clients.end()) {
|
||||
BOOST_LOG_TRIVIAL(info)
|
||||
<< "rtsp_client:: stopping client " << name << " " << domain;
|
||||
|
@ -43,7 +43,7 @@ parse_url(const std::string& _url) {
|
||||
size_t protocol_sep_pos = url.find_first_of("://");
|
||||
if (protocol_sep_pos == std::string::npos) {
|
||||
/* no protocol, invalid URL */
|
||||
return std::make_tuple(false, "", "", "", "");
|
||||
return {false, "", "", "", ""};
|
||||
}
|
||||
|
||||
std::string port, host, path("/");
|
||||
@ -70,7 +70,7 @@ parse_url(const std::string& _url) {
|
||||
/* port and path not specified */
|
||||
host = url_new;
|
||||
}
|
||||
return std::make_tuple(host.length() > 0, protocol, host, port, path);
|
||||
return {host.length() > 0, protocol, host, port, path};
|
||||
}
|
||||
|
||||
std::string get_node_id() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user