[FFmpeg-devel] [PATCH 1/2] avformat/libsrt: add LIBSRT_SETSOCKOPT/GETSOCKOPT helper

Zhao Zhili quinkblack at foxmail.com
Sun Feb 7 13:46:11 EET 2021


To avoid duplicate between optname and optnamestr.
---
 libavformat/libsrt.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
index f73e7dbfa5..557ab9e6e3 100644
--- a/libavformat/libsrt.c
+++ b/libavformat/libsrt.c
@@ -272,6 +272,9 @@ static int libsrt_setsockopt(URLContext *h, int fd, SRT_SOCKOPT optname, const c
     return 0;
 }
 
+#define LIBSRT_SETSOCKOPT(h, fd, optname, optval, optlen) \
+    libsrt_setsockopt((h), (fd), (optname), AV_TOSTRING(optname), (optval), (optlen))
+
 static int libsrt_getsockopt(URLContext *h, int fd, SRT_SOCKOPT optname, const char * optnamestr, void * optval, int * optlen)
 {
     if (srt_getsockopt(fd, 0, optname, optval, optlen) < 0) {
@@ -281,6 +284,9 @@ static int libsrt_getsockopt(URLContext *h, int fd, SRT_SOCKOPT optname, const c
     return 0;
 }
 
+#define LIBSRT_GETSOCKOPT(h, fd, optname, optval, optlen) \
+    libsrt_getsockopt((h), (fd), (optname), AV_TOSTRING(optname), (optval), (optlen))
+
 /* - The "POST" options can be altered any time on a connected socket.
      They MAY have also some meaning when set prior to connecting; such
      option is SRTO_RCVSYN, which makes connect/accept call asynchronous.
-- 
2.28.0



More information about the ffmpeg-devel mailing list