The branch, master has been updated
via 82a09aef05e5b738d6dec16a0e0080543ff30c87 (commit)
via 23cf2c5f01d3465a139c7b6ea7b3abb26e3ae080 (commit)
via b0314dc76e8ebebc627606313c3a6b5a4a9bd4af (commit)
via 3a29702cb6b8f9dcb1aa66bb65d04b392f9de98d (commit)
via f2be0e68eff7fc748a65f91ed4f28c5bffedd4e5 (commit)
via b2184a97413c8b1c1794528f7112d31ec95e1db4 (commit)
via 7d1e22b7eacd2142b23c19782d032d1f56de9f4b (commit)
via ca8cba4eac89577e281515ee51d583650d15cfa3 (commit)
via 3e7314fe30ecf356b71bf6e40223f82e4e8c138e (commit)
from 1ce3f9fdabf0c769e86b585d9da197e869e1a44e (commit)
- Log -----------------------------------------------------------------
commit 82a09aef05e5b738d6dec16a0e0080543ff30c87
Author: Marton Balint <[email protected]>
AuthorDate: Tue Aug 26 09:22:57 2025 +0200
Commit: Marton Balint <[email protected]>
CommitDate: Fri Sep 19 09:59:26 2025 +0200
avformat/urldecode: factorize core url decoding from ff_urldecode
Signed-off-by: Marton Balint <[email protected]>
diff --git a/libavformat/urldecode.c b/libavformat/urldecode.c
index 150c64c15c..e7fa27b3fa 100644
--- a/libavformat/urldecode.c
+++ b/libavformat/urldecode.c
@@ -32,20 +32,10 @@
#include "libavutil/avstring.h"
#include "urldecode.h"
-char *ff_urldecode(const char *url, int decode_plus_sign)
+static size_t urldecode(char *dest, const char *url, size_t url_len, int
decode_plus_sign)
{
- int s = 0, d = 0, url_len = 0;
+ size_t s = 0, d = 0;
char c;
- char *dest = NULL;
-
- if (!url)
- return NULL;
-
- url_len = strlen(url) + 1;
- dest = av_malloc(url_len);
-
- if (!dest)
- return NULL;
while (s < url_len) {
c = url[s++];
@@ -82,5 +72,24 @@ char *ff_urldecode(const char *url, int decode_plus_sign)
}
+ return d;
+}
+
+char *ff_urldecode(const char *url, int decode_plus_sign)
+{
+ char *dest = NULL;
+ size_t url_len;
+
+ if (!url)
+ return NULL;
+
+ url_len = strlen(url) + 1;
+ dest = av_malloc(url_len);
+
+ if (!dest)
+ return NULL;
+
+ urldecode(dest, url, url_len, decode_plus_sign);
+
return dest;
}
commit 23cf2c5f01d3465a139c7b6ea7b3abb26e3ae080
Author: Marton Balint <[email protected]>
AuthorDate: Mon Sep 1 00:21:57 2025 +0200
Commit: Marton Balint <[email protected]>
CommitDate: Fri Sep 19 09:59:26 2025 +0200
avformat/urldecode: fix decoding last char if it was percent encoded
The length check was too strict and if the end of the string was a percent
encoded sequence it did not decode correctly.
Signed-off-by: Marton Balint <[email protected]>
diff --git a/libavformat/urldecode.c b/libavformat/urldecode.c
index 5261bcd0cd..150c64c15c 100644
--- a/libavformat/urldecode.c
+++ b/libavformat/urldecode.c
@@ -50,7 +50,7 @@ char *ff_urldecode(const char *url, int decode_plus_sign)
while (s < url_len) {
c = url[s++];
- if (c == '%' && s + 2 < url_len) {
+ if (c == '%' && s + 1 < url_len) {
char c2 = url[s++];
char c3 = url[s++];
if (av_isxdigit(c2) && av_isxdigit(c3)) {
commit b0314dc76e8ebebc627606313c3a6b5a4a9bd4af
Author: Marton Balint <[email protected]>
AuthorDate: Mon Aug 25 21:40:40 2025 +0200
Commit: Marton Balint <[email protected]>
CommitDate: Fri Sep 19 09:59:26 2025 +0200
avformat/rtpproto: use proper return error codes in rtp_open
Signed-off-by: Marton Balint <[email protected]>
diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c
index a8f718114d..69879b7fa8 100644
--- a/libavformat/rtpproto.c
+++ b/libavformat/rtpproto.c
@@ -240,6 +240,7 @@ static int rtp_open(URLContext *h, const char *uri, int
flags)
const char *p;
int i, max_retry_count = 3;
int rtcpflags;
+ int ret;
av_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &rtp_port,
path, sizeof(path), uri);
@@ -296,8 +297,10 @@ static int rtp_open(URLContext *h, const char *uri, int
flags)
if (av_find_info_tag(buf, sizeof(buf), "localaddr", p)) {
av_freep(&s->localaddr);
s->localaddr = av_strdup(buf);
- if (!s->localaddr)
+ if (!s->localaddr) {
+ ret = AVERROR(ENOMEM);
goto fail;
+ }
}
}
if (s->rw_timeout >= 0)
@@ -308,10 +311,12 @@ static int rtp_open(URLContext *h, const char *uri, int
flags)
if (!(fec_protocol = av_get_token(&p, "="))) {
av_log(h, AV_LOG_ERROR, "Failed to parse the FEC protocol
value\n");
+ ret = AVERROR(EINVAL);
goto fail;
}
if (strcmp(fec_protocol, "prompeg")) {
av_log(h, AV_LOG_ERROR, "Unsupported FEC protocol %s\n",
fec_protocol);
+ ret = AVERROR(EINVAL);
goto fail;
}
@@ -320,6 +325,7 @@ static int rtp_open(URLContext *h, const char *uri, int
flags)
if (av_dict_parse_string(&fec_opts, p, "=", ":", 0) < 0) {
av_log(h, AV_LOG_ERROR, "Failed to parse the FEC options\n");
+ ret = AVERROR(EINVAL);
goto fail;
}
if (s->ttl > 0) {
@@ -331,8 +337,9 @@ static int rtp_open(URLContext *h, const char *uri, int
flags)
build_udp_url(s, buf, sizeof(buf),
hostname, s->localaddr, rtp_port, s->local_rtpport,
sources, block);
- if (ffurl_open_whitelist(&s->rtp_hd, buf, flags,
&h->interrupt_callback,
- NULL, h->protocol_whitelist,
h->protocol_blacklist, h) < 0)
+ ret = ffurl_open_whitelist(&s->rtp_hd, buf, flags,
&h->interrupt_callback,
+ NULL, h->protocol_whitelist,
h->protocol_blacklist, h);
+ if (ret < 0)
goto fail;
s->local_rtpport = ff_udp_get_local_port(s->rtp_hd);
if(s->local_rtpport == 65535) {
@@ -356,8 +363,9 @@ static int rtp_open(URLContext *h, const char *uri, int
flags)
build_udp_url(s, buf, sizeof(buf),
hostname, s->localaddr, s->rtcp_port, s->local_rtcpport,
sources, block);
- if (ffurl_open_whitelist(&s->rtcp_hd, buf, rtcpflags,
&h->interrupt_callback,
- NULL, h->protocol_whitelist,
h->protocol_blacklist, h) < 0)
+ ret = ffurl_open_whitelist(&s->rtcp_hd, buf, rtcpflags,
&h->interrupt_callback,
+ NULL, h->protocol_whitelist,
h->protocol_blacklist, h);
+ if (ret < 0)
goto fail;
break;
}
@@ -365,8 +373,9 @@ static int rtp_open(URLContext *h, const char *uri, int
flags)
s->fec_hd = NULL;
if (fec_protocol) {
ff_url_join(buf, sizeof(buf), fec_protocol, NULL, hostname, rtp_port,
NULL);
- if (ffurl_open_whitelist(&s->fec_hd, buf, flags,
&h->interrupt_callback,
- &fec_opts, h->protocol_whitelist,
h->protocol_blacklist, h) < 0)
+ ret = ffurl_open_whitelist(&s->fec_hd, buf, flags,
&h->interrupt_callback,
+ &fec_opts, h->protocol_whitelist,
h->protocol_blacklist, h);
+ if (ret < 0)
goto fail;
}
@@ -390,7 +399,7 @@ static int rtp_open(URLContext *h, const char *uri, int
flags)
ffurl_closep(&s->fec_hd);
av_free(fec_protocol);
av_dict_free(&fec_opts);
- return AVERROR(EIO);
+ return ret;
}
static int rtp_read(URLContext *h, uint8_t *buf, int size)
commit 3a29702cb6b8f9dcb1aa66bb65d04b392f9de98d
Author: Marton Balint <[email protected]>
AuthorDate: Mon Aug 25 23:00:33 2025 +0200
Commit: Marton Balint <[email protected]>
CommitDate: Fri Sep 19 09:59:26 2025 +0200
avformat/rtpproto: add some URL options as AVOption aliases
Signed-off-by: Marton Balint <[email protected]>
diff --git a/doc/protocols.texi b/doc/protocols.texi
index 130ce35f36..cd0726cc7a 100644
--- a/doc/protocols.texi
+++ b/doc/protocols.texi
@@ -1164,7 +1164,7 @@ rtp://@var{hostname}[:@var{port}][?@var{options}]
@var{options} contains a list of &-separated options of the form
@var{key}=@var{val}.
-The following URL options are supported:
+The following options are supported:
@table @option
@@ -1174,10 +1174,12 @@ Set the TTL (Time-To-Live) value (for multicast only).
@item rtcpport=@var{n}
Set the remote RTCP port to @var{n}.
-@item localrtpport=@var{n}
+@item localport, local_rtpport, localrtpport=@var{n}
Set the local RTP port to @var{n}.
-@item localrtcpport=@var{n}'
+Using the localport option name is deprecated and should not be used.
+
+@item local_rtcpport, localrtcpport=@var{n}'
Set the local RTCP port to @var{n}.
@item pkt_size=@var{n}
@@ -1200,12 +1202,6 @@ List disallowed (blocked) source IP addresses.
Send packets to the source address of the latest received packet (if
set to 1) or to a default remote address (if set to 0).
-@item localport=@var{n}
-Set the local RTP port to @var{n}.
-
-This is a deprecated option. Instead, @option{localrtpport} should be
-used.
-
@item localaddr=@var{addr}
Local IP address of a network interface used for sending packets or joining
multicast groups.
diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c
index 15d0050936..a8f718114d 100644
--- a/libavformat/rtpproto.c
+++ b/libavformat/rtpproto.c
@@ -66,12 +66,17 @@ typedef struct RTPContext {
#define OFFSET(x) offsetof(RTPContext, x)
#define D AV_OPT_FLAG_DECODING_PARAM
#define E AV_OPT_FLAG_ENCODING_PARAM
+#define DEPR AV_OPT_FLAG_DEPRECATED
static const AVOption options[] = {
{ "ttl", "Time to live (multicast only)",
OFFSET(ttl), AV_OPT_TYPE_INT, { .i64 = -1 },
-1, 255, .flags = D|E },
{ "buffer_size", "Send/Receive buffer size (in bytes)",
OFFSET(buffer_size), AV_OPT_TYPE_INT, { .i64 = -1 },
-1, INT_MAX, .flags = D|E },
{ "rtcp_port", "Custom rtcp port",
OFFSET(rtcp_port), AV_OPT_TYPE_INT, { .i64 = -1 },
-1, INT_MAX, .flags = D|E },
+ { "rtcpport", "Custom rtcp port",
OFFSET(rtcp_port), AV_OPT_TYPE_INT, { .i64 = -1 },
-1, INT_MAX, .flags = D|E },
{ "local_rtpport", "Local rtp port",
OFFSET(local_rtpport), AV_OPT_TYPE_INT, { .i64 = -1 },
-1, INT_MAX, .flags = D|E },
+ { "localrtpport", "Local rtp port",
OFFSET(local_rtpport), AV_OPT_TYPE_INT, { .i64 = -1 },
-1, INT_MAX, .flags = D|E },
+ { "localport", "Local rtp port",
OFFSET(local_rtpport), AV_OPT_TYPE_INT, { .i64 = -1 },
-1, INT_MAX, .flags = D|E|DEPR },
{ "local_rtcpport", "Local rtcp port",
OFFSET(local_rtcpport), AV_OPT_TYPE_INT, { .i64 = -1 },
-1, INT_MAX, .flags = D|E },
+ { "localrtcpport", "Local rtcp port",
OFFSET(local_rtcpport), AV_OPT_TYPE_INT, { .i64 = -1 },
-1, INT_MAX, .flags = D|E },
{ "connect", "Connect socket",
OFFSET(connect), AV_OPT_TYPE_BOOL, { .i64 = 0 },
0, 1, .flags = D|E },
{ "write_to_source", "Send packets to the source address of the latest
received packet", OFFSET(write_to_source), AV_OPT_TYPE_BOOL, { .i64 = 0 },
0, 1, .flags = D|E },
{ "pkt_size", "Maximum packet size",
OFFSET(pkt_size), AV_OPT_TYPE_INT, { .i64 = -1 },
-1, INT_MAX, .flags = D|E },
commit f2be0e68eff7fc748a65f91ed4f28c5bffedd4e5
Author: Marton Balint <[email protected]>
AuthorDate: Tue Aug 26 00:07:32 2025 +0200
Commit: Marton Balint <[email protected]>
CommitDate: Fri Sep 19 09:59:26 2025 +0200
avformat/tls: move AVClass to TLSShared
Signed-off-by: Marton Balint <[email protected]>
diff --git a/libavformat/tls.h b/libavformat/tls.h
index b72537c063..6c5f7bc15f 100644
--- a/libavformat/tls.h
+++ b/libavformat/tls.h
@@ -35,6 +35,7 @@
#define MAX_CERTIFICATE_SIZE 8192
typedef struct TLSShared {
+ const AVClass *class;
char *ca_file;
int verify;
char *cert_file;
diff --git a/libavformat/tls_gnutls.c b/libavformat/tls_gnutls.c
index 53306872a0..fe2fd53291 100644
--- a/libavformat/tls_gnutls.c
+++ b/libavformat/tls_gnutls.c
@@ -44,7 +44,6 @@ GCRY_THREAD_OPTION_PTHREAD_IMPL;
#endif
typedef struct TLSContext {
- const AVClass *class;
TLSShared tls_shared;
gnutls_session_t session;
gnutls_certificate_credentials_t cred;
diff --git a/libavformat/tls_libtls.c b/libavformat/tls_libtls.c
index 22858d4867..4f011ad67a 100644
--- a/libavformat/tls_libtls.c
+++ b/libavformat/tls_libtls.c
@@ -32,7 +32,6 @@
#include <tls.h>
typedef struct TLSContext {
- const AVClass *class;
TLSShared tls_shared;
struct tls *ctx;
} TLSContext;
diff --git a/libavformat/tls_mbedtls.c b/libavformat/tls_mbedtls.c
index e802c6b872..2bcd3cca63 100644
--- a/libavformat/tls_mbedtls.c
+++ b/libavformat/tls_mbedtls.c
@@ -40,7 +40,6 @@
#include "libavutil/avstring.h"
typedef struct TLSContext {
- const AVClass *class;
TLSShared tls_shared;
mbedtls_ssl_context ssl_context;
mbedtls_ssl_config ssl_config;
diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c
index db7147e491..edfd657a3f 100644
--- a/libavformat/tls_openssl.c
+++ b/libavformat/tls_openssl.c
@@ -418,7 +418,6 @@ static X509 *cert_from_pem_string(const char *pem_str)
typedef struct TLSContext {
- const AVClass *class;
TLSShared tls_shared;
SSL_CTX *ctx;
SSL *ssl;
diff --git a/libavformat/tls_schannel.c b/libavformat/tls_schannel.c
index b854f484fa..6708302b65 100644
--- a/libavformat/tls_schannel.c
+++ b/libavformat/tls_schannel.c
@@ -587,7 +587,6 @@ end:
}
typedef struct TLSContext {
- const AVClass *class;
TLSShared tls_shared;
char *cert_store_subject;
diff --git a/libavformat/tls_securetransport.c
b/libavformat/tls_securetransport.c
index a5a3bd87a1..f52fc97db2 100644
--- a/libavformat/tls_securetransport.c
+++ b/libavformat/tls_securetransport.c
@@ -43,7 +43,6 @@ SecIdentityRef SecIdentityCreate(CFAllocatorRef allocator,
SecCertificateRef cer
#define ioErr -36
typedef struct TLSContext {
- const AVClass *class;
TLSShared tls_shared;
SSLContextRef ssl_context;
CFArrayRef ca_array;
commit b2184a97413c8b1c1794528f7112d31ec95e1db4
Author: Marton Balint <[email protected]>
AuthorDate: Sun Aug 31 22:03:05 2025 +0200
Commit: Marton Balint <[email protected]>
CommitDate: Fri Sep 19 09:59:26 2025 +0200
avformat/tls: use AV_OPT_TYPE_BOOL for some AVOptions
Signed-off-by: Marton Balint <[email protected]>
diff --git a/libavformat/tls.h b/libavformat/tls.h
index 55361aab30..b72537c063 100644
--- a/libavformat/tls.h
+++ b/libavformat/tls.h
@@ -76,8 +76,8 @@ typedef struct TLSShared {
#define FF_TLS_CLIENT_OPTIONS(pstruct, options_field) \
{"ca_file", "Certificate Authority database file", offsetof(pstruct,
options_field . ca_file), AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
{"cafile", "Certificate Authority database file", offsetof(pstruct,
options_field . ca_file), AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
- {"tls_verify", "Verify the peer certificate", offsetof(pstruct,
options_field . verify), AV_OPT_TYPE_INT, { .i64 = TLS_VERIFY_DEFAULT }, 0,
1, .flags = TLS_OPTFL }, \
- {"verify", "Verify the peer certificate", offsetof(pstruct,
options_field . verify), AV_OPT_TYPE_INT, { .i64 = TLS_VERIFY_DEFAULT }, 0,
1, .flags = TLS_OPTFL }, \
+ {"tls_verify", "Verify the peer certificate", offsetof(pstruct,
options_field . verify), AV_OPT_TYPE_BOOL, { .i64 = TLS_VERIFY_DEFAULT }, 0,
1, .flags = TLS_OPTFL }, \
+ {"verify", "Verify the peer certificate", offsetof(pstruct,
options_field . verify), AV_OPT_TYPE_BOOL, { .i64 = TLS_VERIFY_DEFAULT }, 0,
1, .flags = TLS_OPTFL }, \
{"cert_file", "Certificate file", offsetof(pstruct,
options_field . cert_file), AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
{"cert", "Certificate file", offsetof(pstruct,
options_field . cert_file), AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
{"key_file", "Private key file", offsetof(pstruct,
options_field . key_file), AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
@@ -87,8 +87,8 @@ typedef struct TLSShared {
#define TLS_COMMON_OPTIONS(pstruct, options_field) \
{"listen", "Listen for incoming connections", offsetof(pstruct,
options_field . listen), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, .flags =
TLS_OPTFL }, \
{"http_proxy", "Set proxy to tunnel through", offsetof(pstruct,
options_field . http_proxy), AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
- {"external_sock", "Use external socket", offsetof(pstruct,
options_field . external_sock), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, .flags =
TLS_OPTFL }, \
- {"use_srtp", "Enable use_srtp DTLS extension", offsetof(pstruct,
options_field . use_srtp), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, .flags =
TLS_OPTFL }, \
+ {"external_sock", "Use external socket", offsetof(pstruct,
options_field . external_sock), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, .flags =
TLS_OPTFL }, \
+ {"use_srtp", "Enable use_srtp DTLS extension", offsetof(pstruct,
options_field . use_srtp), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, .flags =
TLS_OPTFL }, \
{"mtu", "Maximum Transmission Unit", offsetof(pstruct, options_field .
mtu), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, .flags = TLS_OPTFL}, \
{"cert_pem", "Certificate PEM string", offsetof(pstruct,
options_field . cert_buf), AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
{"key_pem", "Private key PEM string", offsetof(pstruct,
options_field . key_buf), AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
commit 7d1e22b7eacd2142b23c19782d032d1f56de9f4b
Author: Marton Balint <[email protected]>
AuthorDate: Mon Aug 25 23:13:36 2025 +0200
Commit: Marton Balint <[email protected]>
CommitDate: Fri Sep 19 09:59:26 2025 +0200
avformat/tls: add some URL options as AVOption aliases
Signed-off-by: Marton Balint <[email protected]>
diff --git a/doc/protocols.texi b/doc/protocols.texi
index 4b871dddb7..130ce35f36 100644
--- a/doc/protocols.texi
+++ b/doc/protocols.texi
@@ -1989,7 +1989,7 @@ need to be specified for verification to work, but not
all libraries and
setups have defaults built in.
The file must be in OpenSSL PEM format.
-@item tls_verify=@var{1|0}
+@item tls_verify, verify=@var{1|0}
If enabled, try to verify the peer that we are communicating with.
Note, if using OpenSSL, this currently only makes sure that the
peer certificate is signed by one of the root certificates in the CA
@@ -2055,7 +2055,7 @@ need to be specified for verification to work, but not
all libraries and
setups have defaults built in.
The file must be in OpenSSL PEM format.
-@item tls_verify=@var{1|0}
+@item tls_verify, verify=@var{1|0}
If enabled, try to verify the peer that we are communicating with.
Note, if using OpenSSL, this currently only makes sure that the
peer certificate is signed by one of the root certificates in the CA
diff --git a/libavformat/tls.h b/libavformat/tls.h
index 2afa248f4c..55361aab30 100644
--- a/libavformat/tls.h
+++ b/libavformat/tls.h
@@ -77,8 +77,11 @@ typedef struct TLSShared {
{"ca_file", "Certificate Authority database file", offsetof(pstruct,
options_field . ca_file), AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
{"cafile", "Certificate Authority database file", offsetof(pstruct,
options_field . ca_file), AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
{"tls_verify", "Verify the peer certificate", offsetof(pstruct,
options_field . verify), AV_OPT_TYPE_INT, { .i64 = TLS_VERIFY_DEFAULT }, 0,
1, .flags = TLS_OPTFL }, \
+ {"verify", "Verify the peer certificate", offsetof(pstruct,
options_field . verify), AV_OPT_TYPE_INT, { .i64 = TLS_VERIFY_DEFAULT }, 0,
1, .flags = TLS_OPTFL }, \
{"cert_file", "Certificate file", offsetof(pstruct,
options_field . cert_file), AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
+ {"cert", "Certificate file", offsetof(pstruct,
options_field . cert_file), AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
{"key_file", "Private key file", offsetof(pstruct,
options_field . key_file), AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
+ {"key", "Private key file", offsetof(pstruct,
options_field . key_file), AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
{"verifyhost", "Verify against a specific hostname", offsetof(pstruct,
options_field . host), AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }
#define TLS_COMMON_OPTIONS(pstruct, options_field) \
commit ca8cba4eac89577e281515ee51d583650d15cfa3
Author: Marton Balint <[email protected]>
AuthorDate: Mon Aug 25 21:02:54 2025 +0200
Commit: Marton Balint <[email protected]>
CommitDate: Fri Sep 19 09:59:26 2025 +0200
avformat/udp: factorize warning unsupported options for builds without
PTHREAD_CANCEL
Also fix 'circular_buffer_size' parameter name in the message and the
'fifo_size' option description.
Signed-off-by: Marton Balint <[email protected]>
diff --git a/libavformat/udp.c b/libavformat/udp.c
index ded7a1a85e..e1dec49010 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -145,7 +145,7 @@ static const AVOption options[] = {
{ "ttl", "Time to live (multicast only)",
OFFSET(ttl), AV_OPT_TYPE_INT, { .i64 = 16 }, 0, 255, E },
{ "dscp", "DSCP class for outgoing packets",
OFFSET(dscp), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 63, E },
{ "connect", "set if connect() should be called on socket",
OFFSET(is_connected), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1,
.flags = D|E },
- { "fifo_size", "set the UDP receiving circular buffer size, expressed
as a number of packets with size of 188 bytes", OFFSET(circular_buffer_size),
AV_OPT_TYPE_INT, {.i64 = 7*4096}, 0, INT_MAX, D },
+ { "fifo_size", "set the UDP circular buffer size (in 188-byte
packets)", OFFSET(circular_buffer_size), AV_OPT_TYPE_INT, {.i64 =
HAVE_PTHREAD_CANCEL ? 7*4096 : 0}, 0, INT_MAX, D },
{ "overrun_nonfatal", "survive in case of UDP receiving circular buffer
overrun", OFFSET(overrun_nonfatal), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, D },
{ "timeout", "set raise error timeout, in microseconds (only in
read mode)",OFFSET(timeout), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX,
D },
{ "sources", "Source list",
OFFSET(sources), AV_OPT_TYPE_STRING, { .str = NULL },
.flags = D|E },
@@ -733,10 +733,6 @@ static int udp_open(URLContext *h, const char *uri, int
flags)
/* assume if no digits were found it is a request to enable it */
if (buf == endptr)
s->overrun_nonfatal = 1;
- if (!HAVE_PTHREAD_CANCEL)
- av_log(h, AV_LOG_WARNING,
- "'overrun_nonfatal' option was set but it is not
supported "
- "on this build (pthread support is required)\n");
}
if (av_find_info_tag(buf, sizeof(buf), "ttl", p)) {
s->ttl = strtol(buf, NULL, 10);
@@ -766,17 +762,9 @@ static int udp_open(URLContext *h, const char *uri, int
flags)
}
if (av_find_info_tag(buf, sizeof(buf), "fifo_size", p)) {
s->circular_buffer_size = strtol(buf, NULL, 10);
- if (!HAVE_PTHREAD_CANCEL)
- av_log(h, AV_LOG_WARNING,
- "'circular_buffer_size' option was set but it is not
supported "
- "on this build (pthread support is required)\n");
}
if (av_find_info_tag(buf, sizeof(buf), "bitrate", p)) {
s->bitrate = strtoll(buf, NULL, 10);
- if (!HAVE_PTHREAD_CANCEL)
- av_log(h, AV_LOG_WARNING,
- "'bitrate' option was set but it is not supported "
- "on this build (pthread support is required)\n");
}
if (av_find_info_tag(buf, sizeof(buf), "burst_bits", p)) {
s->burst_bits = strtoll(buf, NULL, 10);
@@ -802,6 +790,16 @@ static int udp_open(URLContext *h, const char *uri, int
flags)
if (is_output && av_find_info_tag(buf, sizeof(buf), "broadcast", p))
s->is_broadcast = strtol(buf, NULL, 10);
}
+ if (!HAVE_PTHREAD_CANCEL) {
+ int64_t optvals[] = {s->overrun_nonfatal, s->bitrate,
s->circular_buffer_size};
+ const char* optnames[] = { "overrun_nonfatal", "bitrate",
"fifo_size"};
+ for (unsigned i = 0; i < FF_ARRAY_ELEMS(optvals); i++) {
+ if (optvals[i])
+ av_log(h, AV_LOG_WARNING,
+ "'%s' option was set but it is not supported "
+ "on this build (pthread support is required)\n",
optnames[i]);
+ }
+ }
/* handling needed to support options picking from both AVOption and URL */
s->circular_buffer_size *= 188;
if (flags & AVIO_FLAG_WRITE) {
commit 3e7314fe30ecf356b71bf6e40223f82e4e8c138e
Author: Marton Balint <[email protected]>
AuthorDate: Sun Aug 24 23:28:36 2025 +0200
Commit: Marton Balint <[email protected]>
CommitDate: Fri Sep 19 09:59:26 2025 +0200
avformat/udp: add DSCP as a normal AVOption
Previously this was an URL-only option.
Signed-off-by: Marton Balint <[email protected]>
diff --git a/doc/protocols.texi b/doc/protocols.texi
index 6b582fde30..4b871dddb7 100644
--- a/doc/protocols.texi
+++ b/doc/protocols.texi
@@ -2162,6 +2162,9 @@ Explicitly allow or disallow reusing UDP sockets.
@item ttl=@var{ttl}
Set the time to live value (for multicast only).
+@item dscp=@var{dscp}
+Set the 6-bit DSCP field for outgoing packets.
+
@item connect=@var{1|0}
Initialize the UDP socket with @code{connect()}. In this case, the
destination address can't be changed with ff_udp_set_remote_url later.
diff --git a/libavformat/udp.c b/libavformat/udp.c
index 84f9d3e62e..ded7a1a85e 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -118,6 +118,7 @@ typedef struct UDPContext {
int remaining_in_dg;
char *localaddr;
int timeout;
+ int dscp;
struct sockaddr_storage local_addr_storage;
char *sources;
char *block;
@@ -142,6 +143,7 @@ static const AVOption options[] = {
{ "reuse_socket", "explicitly allow reusing UDP sockets",
OFFSET(reuse_socket), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1,
.flags = D|E },
{ "broadcast", "explicitly allow or disallow broadcast destination",
OFFSET(is_broadcast), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, E },
{ "ttl", "Time to live (multicast only)",
OFFSET(ttl), AV_OPT_TYPE_INT, { .i64 = 16 }, 0, 255, E },
+ { "dscp", "DSCP class for outgoing packets",
OFFSET(dscp), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 63, E },
{ "connect", "set if connect() should be called on socket",
OFFSET(is_connected), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1,
.flags = D|E },
{ "fifo_size", "set the UDP receiving circular buffer size, expressed
as a number of packets with size of 188 bytes", OFFSET(circular_buffer_size),
AV_OPT_TYPE_INT, {.i64 = 7*4096}, 0, INT_MAX, D },
{ "overrun_nonfatal", "survive in case of UDP receiving circular buffer
overrun", OFFSET(overrun_nonfatal), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, D },
@@ -691,7 +693,7 @@ end:
static int udp_open(URLContext *h, const char *uri, int flags)
{
char hostname[1024];
- int port, udp_fd = -1, tmp, bind_ret = -1, dscp = -1;
+ int port, udp_fd = -1, tmp, bind_ret = -1;
UDPContext *s = h->priv_data;
int is_output;
const char *p;
@@ -760,7 +762,7 @@ static int udp_open(URLContext *h, const char *uri, int
flags)
s->is_connected = strtol(buf, NULL, 10);
}
if (av_find_info_tag(buf, sizeof(buf), "dscp", p)) {
- dscp = strtol(buf, NULL, 10);
+ s->dscp = strtol(buf, NULL, 10);
}
if (av_find_info_tag(buf, sizeof(buf), "fifo_size", p)) {
s->circular_buffer_size = strtol(buf, NULL, 10);
@@ -870,8 +872,8 @@ static int udp_open(URLContext *h, const char *uri, int
flags)
av_log(h, AV_LOG_WARNING, "socket option UDPLITE_RECV_CSCOV not
available");
}
- if (dscp >= 0) {
- dscp <<= 2;
+ if (s->dscp >= 0) {
+ int dscp = s->dscp << 2;
if (setsockopt (udp_fd, IPPROTO_IP, IP_TOS, &dscp, sizeof(dscp)) != 0)
{
ret = ff_neterrno();
goto fail;
-----------------------------------------------------------------------
Summary of changes:
doc/protocols.texi | 21 ++++++++++-----------
libavformat/rtpproto.c | 30 ++++++++++++++++++++++--------
libavformat/tls.h | 10 +++++++---
libavformat/tls_gnutls.c | 1 -
libavformat/tls_libtls.c | 1 -
libavformat/tls_mbedtls.c | 1 -
libavformat/tls_openssl.c | 1 -
libavformat/tls_schannel.c | 1 -
libavformat/tls_securetransport.c | 1 -
libavformat/udp.c | 34 +++++++++++++++++-----------------
libavformat/urldecode.c | 35 ++++++++++++++++++++++-------------
11 files changed, 78 insertions(+), 58 deletions(-)
hooks/post-receive
--
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]