mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
avtp: Use g_strerror instead of strerror
It should avoid some implicit declaration errors (and be utf-8 friendly). Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1404>
This commit is contained in:
parent
890df7ac8c
commit
f8bf84307f
3 changed files with 19 additions and 16 deletions
|
@ -183,7 +183,7 @@ setup_socket (GstAvtpCrfBase * avtpcrfbase)
|
||||||
fd = socket (AF_PACKET, SOCK_DGRAM, htons (ETH_P_TSN));
|
fd = socket (AF_PACKET, SOCK_DGRAM, htons (ETH_P_TSN));
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
GST_ERROR_OBJECT (avtpcrfbase, "Failed to open socket: %s",
|
GST_ERROR_OBJECT (avtpcrfbase, "Failed to open socket: %s",
|
||||||
strerror (errno));
|
g_strerror (errno));
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ setup_socket (GstAvtpCrfBase * avtpcrfbase)
|
||||||
if (!ifindex) {
|
if (!ifindex) {
|
||||||
res = -1;
|
res = -1;
|
||||||
GST_ERROR_OBJECT (avtpcrfbase, "Failed to get index for interface: %s",
|
GST_ERROR_OBJECT (avtpcrfbase, "Failed to get index for interface: %s",
|
||||||
strerror (errno));
|
g_strerror (errno));
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ setup_socket (GstAvtpCrfBase * avtpcrfbase)
|
||||||
res = bind (fd, (struct sockaddr *) &sk_addr, sizeof (sk_addr));
|
res = bind (fd, (struct sockaddr *) &sk_addr, sizeof (sk_addr));
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
GST_ERROR_OBJECT (avtpcrfbase, "Failed to bind socket: %s",
|
GST_ERROR_OBJECT (avtpcrfbase, "Failed to bind socket: %s",
|
||||||
strerror (errno));
|
g_strerror (errno));
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ setup_socket (GstAvtpCrfBase * avtpcrfbase)
|
||||||
sizeof (struct packet_mreq));
|
sizeof (struct packet_mreq));
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
GST_ERROR_OBJECT (avtpcrfbase, "Failed to set multicast address: %s",
|
GST_ERROR_OBJECT (avtpcrfbase, "Failed to set multicast address: %s",
|
||||||
strerror (errno));
|
g_strerror (errno));
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ setup_socket (GstAvtpCrfBase * avtpcrfbase)
|
||||||
sizeof (struct timeval));
|
sizeof (struct timeval));
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
GST_ERROR_OBJECT (avtpcrfbase, "Failed to set receive timeout: %s",
|
GST_ERROR_OBJECT (avtpcrfbase, "Failed to set receive timeout: %s",
|
||||||
strerror (errno));
|
g_strerror (errno));
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -495,7 +495,7 @@ crf_listener_thread_func (GstAvtpCrfBase * avtpcrfbase)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
GST_ERROR_OBJECT (avtpcrfbase, "Failed to receive packet: %s",
|
GST_ERROR_OBJECT (avtpcrfbase, "Failed to receive packet: %s",
|
||||||
strerror (errno));
|
g_strerror (errno));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -224,20 +224,22 @@ gst_avtp_sink_init_socket (GstAvtpSink * avtpsink)
|
||||||
|
|
||||||
index = if_nametoindex (avtpsink->ifname);
|
index = if_nametoindex (avtpsink->ifname);
|
||||||
if (!index) {
|
if (!index) {
|
||||||
GST_ERROR_OBJECT (avtpsink, "Failed to get if_index: %s", strerror (errno));
|
GST_ERROR_OBJECT (avtpsink, "Failed to get if_index: %s",
|
||||||
|
g_strerror (errno));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
fd = socket (AF_PACKET, SOCK_DGRAM, htons (ETH_P_TSN));
|
fd = socket (AF_PACKET, SOCK_DGRAM, htons (ETH_P_TSN));
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
GST_ERROR_OBJECT (avtpsink, "Failed to open socket: %s", strerror (errno));
|
GST_ERROR_OBJECT (avtpsink, "Failed to open socket: %s",
|
||||||
|
g_strerror (errno));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
res = setsockopt (fd, SOL_SOCKET, SO_PRIORITY, &avtpsink->priority,
|
res = setsockopt (fd, SOL_SOCKET, SO_PRIORITY, &avtpsink->priority,
|
||||||
sizeof (avtpsink->priority));
|
sizeof (avtpsink->priority));
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
GST_ERROR_OBJECT (avtpsink, "Failed to socket priority: %s", strerror
|
GST_ERROR_OBJECT (avtpsink, "Failed to socket priority: %s", g_strerror
|
||||||
(errno));
|
(errno));
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
@ -247,7 +249,7 @@ gst_avtp_sink_init_socket (GstAvtpSink * avtpsink)
|
||||||
res = setsockopt (fd, SOL_SOCKET, SO_TXTIME, &txtime_cfg,
|
res = setsockopt (fd, SOL_SOCKET, SO_TXTIME, &txtime_cfg,
|
||||||
sizeof (txtime_cfg));
|
sizeof (txtime_cfg));
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
GST_ERROR_OBJECT (avtpsink, "Failed to set SO_TXTIME: %s", strerror
|
GST_ERROR_OBJECT (avtpsink, "Failed to set SO_TXTIME: %s", g_strerror
|
||||||
(errno));
|
(errno));
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
@ -445,7 +447,7 @@ gst_avtp_sink_render (GstBaseSink * basesink, GstBuffer * buffer)
|
||||||
|
|
||||||
n = sendmsg (avtpsink->sk_fd, avtpsink->msg, 0);
|
n = sendmsg (avtpsink->sk_fd, avtpsink->msg, 0);
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
GST_INFO_OBJECT (avtpsink, "Failed to send AVTPDU: %s", strerror (errno));
|
GST_INFO_OBJECT (avtpsink, "Failed to send AVTPDU: %s", g_strerror (errno));
|
||||||
|
|
||||||
if (G_LIKELY (basesink->sync))
|
if (G_LIKELY (basesink->sync))
|
||||||
gst_avtp_sink_process_error_queue (avtpsink, avtpsink->sk_fd);
|
gst_avtp_sink_process_error_queue (avtpsink, avtpsink->sk_fd);
|
||||||
|
|
|
@ -203,13 +203,14 @@ gst_avtp_src_start (GstBaseSrc * basesrc)
|
||||||
|
|
||||||
index = if_nametoindex (avtpsrc->ifname);
|
index = if_nametoindex (avtpsrc->ifname);
|
||||||
if (!index) {
|
if (!index) {
|
||||||
GST_ERROR_OBJECT (avtpsrc, "Failed to get if_index: %s", strerror (errno));
|
GST_ERROR_OBJECT (avtpsrc, "Failed to get if_index: %s",
|
||||||
|
g_strerror (errno));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
fd = socket (AF_PACKET, SOCK_DGRAM, htons (ETH_P_TSN));
|
fd = socket (AF_PACKET, SOCK_DGRAM, htons (ETH_P_TSN));
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
GST_ERROR_OBJECT (avtpsrc, "Failed to open socket: %s", strerror (errno));
|
GST_ERROR_OBJECT (avtpsrc, "Failed to open socket: %s", g_strerror (errno));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,7 +220,7 @@ gst_avtp_src_start (GstBaseSrc * basesrc)
|
||||||
|
|
||||||
res = bind (fd, (struct sockaddr *) &sk_addr, sizeof (sk_addr));
|
res = bind (fd, (struct sockaddr *) &sk_addr, sizeof (sk_addr));
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
GST_ERROR_OBJECT (avtpsrc, "Failed to bind socket: %s", strerror (errno));
|
GST_ERROR_OBJECT (avtpsrc, "Failed to bind socket: %s", g_strerror (errno));
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,7 +239,7 @@ gst_avtp_src_start (GstBaseSrc * basesrc)
|
||||||
sizeof (struct packet_mreq));
|
sizeof (struct packet_mreq));
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
GST_ERROR_OBJECT (avtpsrc, "Failed to set multicast address: %s",
|
GST_ERROR_OBJECT (avtpsrc, "Failed to set multicast address: %s",
|
||||||
strerror (errno));
|
g_strerror (errno));
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,7 +293,7 @@ retry:
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
GST_ELEMENT_ERROR (avtpsrc, RESOURCE, READ, (NULL),
|
GST_ELEMENT_ERROR (avtpsrc, RESOURCE, READ, (NULL),
|
||||||
("Failed to receive AVTPDU: %s", strerror (errno)));
|
("Failed to receive AVTPDU: %s", g_strerror (errno)));
|
||||||
gst_buffer_unmap (buffer, &map);
|
gst_buffer_unmap (buffer, &map);
|
||||||
|
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
|
|
Loading…
Reference in a new issue