Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: caifan via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: caifan <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH] avformat/unix: add pkt_size option (PR #21078)
Date: Tue, 02 Dec 2025 13:43:45 -0000
Message-ID: <176468302589.39.7375485065262288998@2cb04c0e5124> (raw)

PR #21078 opened by caifan
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21078
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21078.patch

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 <caifan3@xiaomi.com>


>From a8ff0abd0a4a2c392efa9cb7162e863ea04be191 Mon Sep 17 00:00:00 2001
From: caifan3 <caifan3@xiaomi.com>
Date: Tue, 2 Dec 2025 21:37:13 +0800
Subject: [PATCH] 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 <caifan3@xiaomi.com>
---
 libavformat/unix.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavformat/unix.c b/libavformat/unix.c
index fed215a691..921e9b85ba 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 = 32768 },              1, 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)
+        h->min_packet_size = h->max_packet_size = s->pkt_size;
+
     return 0;
 
 fail:
-- 
2.49.1

_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

                 reply	other threads:[~2025-12-02 13:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=176468302589.39.7375485065262288998@2cb04c0e5124 \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=code@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git