Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] WIP:Fix function file_open,file_read,file_write,file_close,file_seek conflict with Nuttx (PR #20435)
@ 2025-09-04 13:08 caifan via ffmpeg-devel
  0 siblings, 0 replies; only message in thread
From: caifan via ffmpeg-devel @ 2025-09-04 13:08 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: caifan

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


>From 9a657b6a0700f22d98d5f7d755e8a103fdc9d288 Mon Sep 17 00:00:00 2001
From: caifan3 <caifan3@xiaomi.com>
Date: Thu, 4 Sep 2025 20:58:24 +0800
Subject: [PATCH 1/2] FFMPEG/libavformat: fix function
 file_open,file_read,file_write,file_close,file_seek conflict with nuttx

Signed-off-by: caifan3 <caifan3@xiaomi.com>
---
 libavformat/file.c | 42 +++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/libavformat/file.c b/libavformat/file.c
index 97f5955f93..cca5b52d6c 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -138,7 +138,7 @@ static const AVClass fd_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-static int file_read(URLContext *h, unsigned char *buf, int size)
+static int ff_file_read(URLContext *h, unsigned char *buf, int size)
 {
     FileContext *c = h->priv_data;
     int ret;
@@ -151,7 +151,7 @@ static int file_read(URLContext *h, unsigned char *buf, int size)
     return (ret == -1) ? AVERROR(errno) : ret;
 }
 
-static int file_write(URLContext *h, const unsigned char *buf, int size)
+static int ff_file_write(URLContext *h, const unsigned char *buf, int size)
 {
     FileContext *c = h->priv_data;
     int ret;
@@ -220,7 +220,7 @@ static int fd_dup(URLContext *h, int oldfd)
 }
 #endif
 
-static int file_close(URLContext *h)
+static int ff_file_close(URLContext *h)
 {
     FileContext *c = h->priv_data;
     int ret = close(c->fd);
@@ -228,7 +228,7 @@ static int file_close(URLContext *h)
 }
 
 /* XXX: use llseek */
-static int64_t file_seek(URLContext *h, int64_t pos, int whence)
+static int64_t ff_file_seek(URLContext *h, int64_t pos, int whence)
 {
     FileContext *c = h->priv_data;
     int64_t ret;
@@ -282,7 +282,7 @@ static int file_move(URLContext *h_src, URLContext *h_dst)
     return 0;
 }
 
-static int file_open(URLContext *h, const char *filename, int flags)
+static int ff_file_open(URLContext *h, const char *filename, int flags)
 {
     FileContext *c = h->priv_data;
     int access;
@@ -409,11 +409,11 @@ static int file_close_dir(URLContext *h)
 
 const URLProtocol ff_file_protocol = {
     .name                = "file",
-    .url_open            = file_open,
-    .url_read            = file_read,
-    .url_write           = file_write,
-    .url_seek            = file_seek,
-    .url_close           = file_close,
+    .url_open            = ff_file_open,
+    .url_read            = ff_file_read,
+    .url_write           = ff_file_write,
+    .url_seek            = ff_file_seek,
+    .url_close           = ff_file_close,
     .url_get_file_handle = file_get_handle,
     .url_check           = file_check,
     .url_delete          = file_delete,
@@ -463,9 +463,9 @@ static int pipe_open(URLContext *h, const char *filename, int flags)
 const URLProtocol ff_pipe_protocol = {
     .name                = "pipe",
     .url_open            = pipe_open,
-    .url_read            = file_read,
-    .url_write           = file_write,
-    .url_close           = file_close,
+    .url_read            = ff_file_read,
+    .url_write           = ff_file_write,
+    .url_close           = ff_file_close,
     .url_get_file_handle = file_get_handle,
     .url_check           = file_check,
     .priv_data_size      = sizeof(FileContext),
@@ -508,10 +508,10 @@ static int fd_open(URLContext *h, const char *filename, int flags)
 const URLProtocol ff_fd_protocol = {
     .name                = "fd",
     .url_open            = fd_open,
-    .url_read            = file_read,
-    .url_write           = file_write,
-    .url_seek            = file_seek,
-    .url_close           = file_close,
+    .url_read            = ff_file_read,
+    .url_write           = ff_file_write,
+    .url_seek            = ff_file_seek,
+    .url_close           = ff_file_close,
     .url_get_file_handle = file_get_handle,
     .url_check           = file_check,
     .priv_data_size      = sizeof(FileContext),
@@ -668,10 +668,10 @@ static const AVClass android_content_class = {
 const URLProtocol ff_android_content_protocol = {
     .name                = "content",
     .url_open            = android_content_open,
-    .url_read            = file_read,
-    .url_write           = file_write,
-    .url_seek            = file_seek,
-    .url_close           = file_close,
+    .url_read            = ff_file_read,
+    .url_write           = ff_file_write,
+    .url_seek            = ff_file_seek,
+    .url_close           = ff_file_close,
     .url_get_file_handle = file_get_handle,
     .url_check           = NULL,
     .priv_data_size      = sizeof(FileContext),
-- 
2.49.1


>From 690f9575f619346be11ae1f9cc3e2d07abc197e4 Mon Sep 17 00:00:00 2001
From: caifan3 <caifan3@xiaomi.com>
Date: Thu, 4 Sep 2025 21:03:52 +0800
Subject: [PATCH 2/2] FFMPEG/fftools: fix function
 file_open,file_read,file_write,file_close,file_seek conflict with nuttx

Signed-off-by: caifan3 <caifan3@xiaomi.com>
---
 fftools/cmdutils.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fftools/cmdutils.h b/fftools/cmdutils.h
index ad020f893a..0348bf7762 100644
--- a/fftools/cmdutils.h
+++ b/fftools/cmdutils.h
@@ -534,6 +534,7 @@ void *allocate_array_elem(void *array, size_t elem_size, int *nb_elems);
 
 double get_rotation(const int32_t *displaymatrix);
 
+#define file_read ff_file_read
 /* read file contents into a string */
 char *file_read(const char *filename);
 
-- 
2.49.1

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-09-04 13:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-04 13:08 [FFmpeg-devel] [PATCH] WIP:Fix function file_open,file_read,file_write,file_close,file_seek conflict with Nuttx (PR #20435) caifan via ffmpeg-devel

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