This is an automated email from the git hooks/post-receive script.
Git pushed a commit to branch master
in repository ffmpeg.
The following commit(s) were added to refs/heads/master by this push:
new 40d7f7774a avformat/unix: add pkt_size option
40d7f7774a is described below
commit 40d7f7774a788ed9615e1558c789c6d9a8d8cead
Author: caifan3 <[email protected]>
AuthorDate: Thu Dec 4 22:15:15 2025 +0800
Commit: Marton Balint <[email protected]>
CommitDate: Sun Dec 7 19:36:03 2025 +0000
avformat/unix: add pkt_size option
Add a "pkt_size" AVOption to the Unix domain socket protocol. This option
allows the user to specify the maximum packet size for packet-oriented
sockets (SOCK_DGRAM and SOCK_SEQPACKET).
Signed-off-by: caifan3 <[email protected]>
---
doc/protocols.texi | 4 ++++
libavformat/unix.c | 5 +++++
2 files changed, 9 insertions(+)
diff --git a/doc/protocols.texi b/doc/protocols.texi
index b74383122a..dee2b845ac 100644
--- a/doc/protocols.texi
+++ b/doc/protocols.texi
@@ -2271,6 +2271,10 @@ The following parameters can be set via command line
options
Timeout in ms.
@item listen
Create the Unix socket in listening mode.
+@item pkt_size
+Maximum packet size for packet-oriented sockets (SOCK_DGRAM and
+SOCK_SEQPACKET). If greater than zero, this value is used as
+@code{max_packet_size}. Ignored for SOCK_STREAM. Default is @code{0}.
@end table
@section zmq
diff --git a/libavformat/unix.c b/libavformat/unix.c
index fed215a691..3a0caf96ed 100644
--- a/libavformat/unix.c
+++ b/libavformat/unix.c
@@ -39,6 +39,7 @@ typedef struct UnixContext {
int listen;
int type;
int fd;
+ int pkt_size;
} UnixContext;
#define OFFSET(x) offsetof(UnixContext, x)
@@ -50,6 +51,7 @@ static const AVOption unix_options[] = {
{ "stream", "Stream (reliable stream-oriented)", 0,
AV_OPT_TYPE_CONST, { .i64 = SOCK_STREAM }, INT_MIN, INT_MAX, ED, .unit =
"type" },
{ "datagram", "Datagram (unreliable packet-oriented)", 0,
AV_OPT_TYPE_CONST, { .i64 = SOCK_DGRAM }, INT_MIN, INT_MAX, ED, .unit =
"type" },
{ "seqpacket", "Seqpacket (reliable packet-oriented", 0,
AV_OPT_TYPE_CONST, { .i64 = SOCK_SEQPACKET }, INT_MIN, INT_MAX, ED, .unit =
"type" },
+ { "pkt_size", "Maximum packet size", OFFSET(pkt_size),
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, ED },
{ NULL }
};
@@ -91,6 +93,9 @@ static int unix_open(URLContext *h, const char *filename, int
flags)
s->fd = fd;
h->is_streamed = 1;
+ if ((s->type == SOCK_DGRAM || s->type == SOCK_SEQPACKET) && s->pkt_size >
0)
+ h->max_packet_size = s->pkt_size;
+
return 0;
fail:
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]