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 v3 1/8] avformat/file: add fd option for pipe
       [not found] <20221214171014.1058709-1-quinkblack@foxmail.com>
@ 2022-12-14 17:10 ` Zhao Zhili
  2022-12-28 17:31   ` Zhao Zhili
  2022-12-14 17:10 ` [FFmpeg-devel] [PATCH v3 2/8] avformat/file: reindent after the previous commit Zhao Zhili
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 9+ messages in thread
From: Zhao Zhili @ 2022-12-14 17:10 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Zhao Zhili

From: Zhao Zhili <zhilizhao@tencent.com>

---
 doc/protocols.texi    | 4 +++-
 libavformat/file.c    | 9 +++++++--
 libavformat/version.h | 2 +-
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/doc/protocols.texi b/doc/protocols.texi
index d1c6fced7b..a686a7f0ac 100644
--- a/doc/protocols.texi
+++ b/doc/protocols.texi
@@ -687,7 +687,7 @@ The accepted syntax is:
 pipe:[@var{number}]
 @end example
 
-@var{number} is the number corresponding to the file descriptor of the
+If @option{fd} isn't specified, @var{number} is the number corresponding to the file descriptor of the
 pipe (e.g. 0 for stdin, 1 for stdout, 2 for stderr).  If @var{number}
 is not specified, by default the stdout file descriptor will be used
 for writing, stdin for reading.
@@ -714,6 +714,8 @@ Set I/O operation maximum block size, in bytes. Default value is
 @code{INT_MAX}, which results in not limiting the requested block size.
 Setting this value reasonably low improves user termination request reaction
 time, which is valuable if data transmission is slow.
+@item fd
+Set file descriptor.
 @end table
 
 Note that some formats (typically MOV), require the output protocol to
diff --git a/libavformat/file.c b/libavformat/file.c
index 6103c37b34..db619fcaac 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -92,6 +92,7 @@ static const AVOption file_options[] = {
 
 static const AVOption pipe_options[] = {
     { "blocksize", "set I/O operation maximum block size", offsetof(FileContext, blocksize), AV_OPT_TYPE_INT, { .i64 = INT_MAX }, 1, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
+    { "fd", "set file descriptor", offsetof(FileContext, fd), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
     { NULL }
 };
 
@@ -381,6 +382,8 @@ static int pipe_open(URLContext *h, const char *filename, int flags)
     FileContext *c = h->priv_data;
     int fd;
     char *final;
+
+    if (c->fd < 0) {
     av_strstart(filename, "pipe:", &filename);
 
     fd = strtol(filename, &final, 10);
@@ -391,10 +394,12 @@ static int pipe_open(URLContext *h, const char *filename, int flags)
             fd = 0;
         }
     }
+    c->fd = fd;
+    }
+
 #if HAVE_SETMODE
-    setmode(fd, O_BINARY);
+    setmode(c->fd, O_BINARY);
 #endif
-    c->fd = fd;
     h->is_streamed = 1;
     return 0;
 }
diff --git a/libavformat/version.h b/libavformat/version.h
index a7e5a9ac66..63e753a3aa 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -32,7 +32,7 @@
 #include "version_major.h"
 
 #define LIBAVFORMAT_VERSION_MINOR  34
-#define LIBAVFORMAT_VERSION_MICRO 102
+#define LIBAVFORMAT_VERSION_MICRO 103
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
                                                LIBAVFORMAT_VERSION_MINOR, \
-- 
2.25.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [FFmpeg-devel] [PATCH v3 2/8] avformat/file: reindent after the previous commit
       [not found] <20221214171014.1058709-1-quinkblack@foxmail.com>
  2022-12-14 17:10 ` [FFmpeg-devel] [PATCH v3 1/8] avformat/file: add fd option for pipe Zhao Zhili
@ 2022-12-14 17:10 ` Zhao Zhili
  2022-12-14 17:10 ` [FFmpeg-devel] [PATCH v3 3/8] avformat/file: dup file descriptor for pipe Zhao Zhili
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Zhao Zhili @ 2022-12-14 17:10 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Zhao Zhili

From: Zhao Zhili <zhilizhao@tencent.com>

---
 libavformat/file.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/libavformat/file.c b/libavformat/file.c
index db619fcaac..a56be64342 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -384,17 +384,17 @@ static int pipe_open(URLContext *h, const char *filename, int flags)
     char *final;
 
     if (c->fd < 0) {
-    av_strstart(filename, "pipe:", &filename);
-
-    fd = strtol(filename, &final, 10);
-    if((filename == final) || *final ) {/* No digits found, or something like 10ab */
-        if (flags & AVIO_FLAG_WRITE) {
-            fd = 1;
-        } else {
-            fd = 0;
+        av_strstart(filename, "pipe:", &filename);
+
+        fd = strtol(filename, &final, 10);
+        if((filename == final) || *final ) {/* No digits found, or something like 10ab */
+            if (flags & AVIO_FLAG_WRITE) {
+                fd = 1;
+            } else {
+                fd = 0;
+            }
         }
-    }
-    c->fd = fd;
+        c->fd = fd;
     }
 
 #if HAVE_SETMODE
-- 
2.25.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [FFmpeg-devel] [PATCH v3 3/8] avformat/file: dup file descriptor for pipe
       [not found] <20221214171014.1058709-1-quinkblack@foxmail.com>
  2022-12-14 17:10 ` [FFmpeg-devel] [PATCH v3 1/8] avformat/file: add fd option for pipe Zhao Zhili
  2022-12-14 17:10 ` [FFmpeg-devel] [PATCH v3 2/8] avformat/file: reindent after the previous commit Zhao Zhili
@ 2022-12-14 17:10 ` Zhao Zhili
  2022-12-14 17:10 ` [FFmpeg-devel] [PATCH v3 4/8] avformat/file: add fd protocol Zhao Zhili
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Zhao Zhili @ 2022-12-14 17:10 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Zhao Zhili

From: Zhao Zhili <zhilizhao@tencent.com>

---
 libavformat/file.c | 44 ++++++++++++++++++++++++++++++++++----------
 1 file changed, 34 insertions(+), 10 deletions(-)

diff --git a/libavformat/file.c b/libavformat/file.c
index a56be64342..878983a336 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -167,6 +167,36 @@ static int file_check(URLContext *h, int mask)
     return ret;
 }
 
+static int fd_dup(URLContext *h, int oldfd)
+{
+    int newfd;
+
+#ifdef F_DUPFD_CLOEXEC
+    newfd = fcntl(oldfd, F_DUPFD_CLOEXEC, 0);
+#else
+    newfd = dup(oldfd);
+#endif
+    if (newfd == -1)
+        return newfd;
+
+#if HAVE_FCNTL
+    if (fcntl(newfd, F_SETFD, FD_CLOEXEC) == -1)
+        av_log(h, AV_LOG_DEBUG, "Failed to set close on exec\n");
+#endif
+
+#if HAVE_SETMODE
+    setmode(newfd, O_BINARY);
+#endif
+    return newfd;
+}
+
+static int file_close(URLContext *h)
+{
+    FileContext *c = h->priv_data;
+    int ret = close(c->fd);
+    return (ret == -1) ? AVERROR(errno) : 0;
+}
+
 #if CONFIG_FILE_PROTOCOL
 
 static int file_delete(URLContext *h)
@@ -263,13 +293,6 @@ static int64_t file_seek(URLContext *h, int64_t pos, int whence)
     return ret < 0 ? AVERROR(errno) : ret;
 }
 
-static int file_close(URLContext *h)
-{
-    FileContext *c = h->priv_data;
-    int ret = close(c->fd);
-    return (ret == -1) ? AVERROR(errno) : 0;
-}
-
 static int file_open_dir(URLContext *h)
 {
 #if HAVE_LSTAT
@@ -397,9 +420,9 @@ static int pipe_open(URLContext *h, const char *filename, int flags)
         c->fd = fd;
     }
 
-#if HAVE_SETMODE
-    setmode(c->fd, O_BINARY);
-#endif
+    c->fd = fd_dup(h, c->fd);
+    if (c->fd == -1)
+        return AVERROR(errno);
     h->is_streamed = 1;
     return 0;
 }
@@ -409,6 +432,7 @@ const URLProtocol ff_pipe_protocol = {
     .url_open            = pipe_open,
     .url_read            = file_read,
     .url_write           = file_write,
+    .url_close           = file_close,
     .url_get_file_handle = file_get_handle,
     .url_check           = file_check,
     .priv_data_size      = sizeof(FileContext),
-- 
2.25.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [FFmpeg-devel] [PATCH v3 4/8] avformat/file: add fd protocol
       [not found] <20221214171014.1058709-1-quinkblack@foxmail.com>
                   ` (2 preceding siblings ...)
  2022-12-14 17:10 ` [FFmpeg-devel] [PATCH v3 3/8] avformat/file: dup file descriptor for pipe Zhao Zhili
@ 2022-12-14 17:10 ` Zhao Zhili
  2022-12-14 17:10 ` [FFmpeg-devel] [PATCH v3 5/8] fftools/ffmpeg_demux: disable stdin interaction for " Zhao Zhili
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Zhao Zhili @ 2022-12-14 17:10 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Zhao Zhili

From: Zhao Zhili <zhilizhao@tencent.com>

Unlike the pipe protocol, fd protocol has seek support if it
corresponding to a regular file.
---
 doc/protocols.texi      | 27 +++++++++++++
 libavformat/Makefile    |  1 +
 libavformat/file.c      | 87 +++++++++++++++++++++++++++++++++--------
 libavformat/protocols.c |  1 +
 libavformat/version.h   |  4 +-
 5 files changed, 101 insertions(+), 19 deletions(-)

diff --git a/doc/protocols.texi b/doc/protocols.texi
index a686a7f0ac..21ae6181a0 100644
--- a/doc/protocols.texi
+++ b/doc/protocols.texi
@@ -275,6 +275,33 @@ For example, to convert a GIF file given inline with @command{ffmpeg}:
 ffmpeg -i "data:image/gif;base64,R0lGODdhCAAIAMIEAAAAAAAA//8AAP//AP///////////////ywAAAAACAAIAAADF0gEDLojDgdGiJdJqUX02iB4E8Q9jUMkADs=" smiley.png
 @end example
 
+@section fd
+
+File descriptor access protocol.
+
+The accepted syntax is:
+@example
+fd: -fd @var{file_descriptor}
+@end example
+
+If @option{fd} is not specified, by default the stdout file descriptor will be
+used for writing, stdin for reading. Unlike the pipe protocol, fd protocol has
+seek support if it corresponding to a regular file. fd protocol doesn't support
+pass file descriptor via URL for security.
+
+This protocol accepts the following options:
+
+@table @option
+@item blocksize
+Set I/O operation maximum block size, in bytes. Default value is
+@code{INT_MAX}, which results in not limiting the requested block size.
+Setting this value reasonably low improves user termination request reaction
+time, which is valuable if data transmission is slow.
+
+@item fd
+Set file descriptor.
+@end table
+
 @section file
 
 File access protocol.
diff --git a/libavformat/Makefile b/libavformat/Makefile
index d7f198bf39..1452216e29 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -647,6 +647,7 @@ OBJS-$(CONFIG_DATA_PROTOCOL)             += data_uri.o
 OBJS-$(CONFIG_FFRTMPCRYPT_PROTOCOL)      += rtmpcrypt.o rtmpdigest.o rtmpdh.o
 OBJS-$(CONFIG_FFRTMPHTTP_PROTOCOL)       += rtmphttp.o
 OBJS-$(CONFIG_FILE_PROTOCOL)             += file.o
+OBJS-$(CONFIG_FD_PROTOCOL)               += file.o
 OBJS-$(CONFIG_FTP_PROTOCOL)              += ftp.o urldecode.o
 OBJS-$(CONFIG_GOPHER_PROTOCOL)           += gopher.o
 OBJS-$(CONFIG_GOPHERS_PROTOCOL)          += gopher.o
diff --git a/libavformat/file.c b/libavformat/file.c
index 878983a336..d20208e31f 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -110,6 +110,13 @@ static const AVClass pipe_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
+static const AVClass fd_class = {
+    .class_name = "fd",
+    .item_name  = av_default_item_name,
+    .option     = pipe_options,
+    .version    = LIBAVUTIL_VERSION_INT,
+};
+
 static int file_read(URLContext *h, unsigned char *buf, int size)
 {
     FileContext *c = h->priv_data;
@@ -197,6 +204,23 @@ static int file_close(URLContext *h)
     return (ret == -1) ? AVERROR(errno) : 0;
 }
 
+/* XXX: use llseek */
+static int64_t file_seek(URLContext *h, int64_t pos, int whence)
+{
+    FileContext *c = h->priv_data;
+    int64_t ret;
+
+    if (whence == AVSEEK_SIZE) {
+        struct stat st;
+        ret = fstat(c->fd, &st);
+        return ret < 0 ? AVERROR(errno) : (S_ISFIFO(st.st_mode) ? 0 : st.st_size);
+    }
+
+    ret = lseek(c->fd, pos, whence);
+
+    return ret < 0 ? AVERROR(errno) : ret;
+}
+
 #if CONFIG_FILE_PROTOCOL
 
 static int file_delete(URLContext *h)
@@ -276,23 +300,6 @@ static int file_open(URLContext *h, const char *filename, int flags)
     return 0;
 }
 
-/* XXX: use llseek */
-static int64_t file_seek(URLContext *h, int64_t pos, int whence)
-{
-    FileContext *c = h->priv_data;
-    int64_t ret;
-
-    if (whence == AVSEEK_SIZE) {
-        struct stat st;
-        ret = fstat(c->fd, &st);
-        return ret < 0 ? AVERROR(errno) : (S_ISFIFO(st.st_mode) ? 0 : st.st_size);
-    }
-
-    ret = lseek(c->fd, pos, whence);
-
-    return ret < 0 ? AVERROR(errno) : ret;
-}
-
 static int file_open_dir(URLContext *h)
 {
 #if HAVE_LSTAT
@@ -441,3 +448,49 @@ const URLProtocol ff_pipe_protocol = {
 };
 
 #endif /* CONFIG_PIPE_PROTOCOL */
+
+#if CONFIG_FD_PROTOCOL
+
+static int fd_open(URLContext *h, const char *filename, int flags)
+{
+    FileContext *c = h->priv_data;
+    struct stat st;
+
+    if (strcmp(filename, "fd:") != 0) {
+        av_log(h, AV_LOG_ERROR, "Doesn't support pass file descriptor via URL,"
+                                " please set it via -fd {num}\n");
+        return AVERROR(EINVAL);
+    }
+
+    if (c->fd < 0) {
+        if (flags & AVIO_FLAG_WRITE) {
+            c->fd = 1;
+        } else {
+            c->fd = 0;
+        }
+    }
+    if (fstat(c->fd, &st) < 0)
+        return AVERROR(errno);
+    h->is_streamed = !(S_ISREG(st.st_mode) || S_ISBLK(st.st_mode));
+    c->fd = fd_dup(h, c->fd);
+    if (c->fd == -1)
+        return AVERROR(errno);
+
+    return 0;
+}
+
+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_get_file_handle = file_get_handle,
+    .url_check           = file_check,
+    .priv_data_size      = sizeof(FileContext),
+    .priv_data_class     = &fd_class,
+    .default_whitelist   = "crypto,data"
+};
+
+#endif /* CONFIG_FD_PROTOCOL */
diff --git a/libavformat/protocols.c b/libavformat/protocols.c
index 8b7d1b940f..82cb1033e4 100644
--- a/libavformat/protocols.c
+++ b/libavformat/protocols.c
@@ -29,6 +29,7 @@ extern const URLProtocol ff_concat_protocol;
 extern const URLProtocol ff_concatf_protocol;
 extern const URLProtocol ff_crypto_protocol;
 extern const URLProtocol ff_data_protocol;
+extern const URLProtocol ff_fd_protocol;
 extern const URLProtocol ff_ffrtmpcrypt_protocol;
 extern const URLProtocol ff_ffrtmphttp_protocol;
 extern const URLProtocol ff_file_protocol;
diff --git a/libavformat/version.h b/libavformat/version.h
index 63e753a3aa..f5a7f579b3 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -31,8 +31,8 @@
 
 #include "version_major.h"
 
-#define LIBAVFORMAT_VERSION_MINOR  34
-#define LIBAVFORMAT_VERSION_MICRO 103
+#define LIBAVFORMAT_VERSION_MINOR  35
+#define LIBAVFORMAT_VERSION_MICRO 100
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
                                                LIBAVFORMAT_VERSION_MINOR, \
-- 
2.25.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [FFmpeg-devel] [PATCH v3 5/8] fftools/ffmpeg_demux: disable stdin interaction for fd protocol
       [not found] <20221214171014.1058709-1-quinkblack@foxmail.com>
                   ` (3 preceding siblings ...)
  2022-12-14 17:10 ` [FFmpeg-devel] [PATCH v3 4/8] avformat/file: add fd protocol Zhao Zhili
@ 2022-12-14 17:10 ` Zhao Zhili
  2022-12-14 17:10 ` [FFmpeg-devel] [PATCH v3 6/8] fftools/ffplay: prefer fd over pipe for seek support Zhao Zhili
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Zhao Zhili @ 2022-12-14 17:10 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Zhao Zhili

From: Zhao Zhili <zhilizhao@tencent.com>

---
 fftools/ffmpeg_demux.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index e845e6784d..be0e8970ba 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -886,6 +886,7 @@ int ifile_open(const OptionsContext *o, const char *filename)
         filename = "pipe:";
 
     stdin_interaction &= strncmp(filename, "pipe:", 5) &&
+                         strcmp(filename, "fd:") &&
                          strcmp(filename, "/dev/stdin");
 
     /* get default parameters from command line */
-- 
2.25.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [FFmpeg-devel] [PATCH v3 6/8] fftools/ffplay: prefer fd over pipe for seek support
       [not found] <20221214171014.1058709-1-quinkblack@foxmail.com>
                   ` (4 preceding siblings ...)
  2022-12-14 17:10 ` [FFmpeg-devel] [PATCH v3 5/8] fftools/ffmpeg_demux: disable stdin interaction for " Zhao Zhili
@ 2022-12-14 17:10 ` Zhao Zhili
  2022-12-14 17:10 ` [FFmpeg-devel] [PATCH v3 7/8] fftools/ffprobe: " Zhao Zhili
  2022-12-14 17:10 ` [FFmpeg-devel] [PATCH v3 8/8] fftools/ffmpeg_demux: " Zhao Zhili
  7 siblings, 0 replies; 9+ messages in thread
From: Zhao Zhili @ 2022-12-14 17:10 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Zhao Zhili

From: Zhao Zhili <zhilizhao@tencent.com>

---
 fftools/ffplay.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index fc7e1c2fb1..d6479aef5f 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -3537,7 +3537,7 @@ static void opt_input_file(void *optctx, const char *filename)
         exit(1);
     }
     if (!strcmp(filename, "-"))
-        filename = "pipe:";
+        filename = "fd:";
     input_filename = filename;
 }
 
-- 
2.25.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [FFmpeg-devel] [PATCH v3 7/8] fftools/ffprobe: prefer fd over pipe for seek support
       [not found] <20221214171014.1058709-1-quinkblack@foxmail.com>
                   ` (5 preceding siblings ...)
  2022-12-14 17:10 ` [FFmpeg-devel] [PATCH v3 6/8] fftools/ffplay: prefer fd over pipe for seek support Zhao Zhili
@ 2022-12-14 17:10 ` Zhao Zhili
  2022-12-14 17:10 ` [FFmpeg-devel] [PATCH v3 8/8] fftools/ffmpeg_demux: " Zhao Zhili
  7 siblings, 0 replies; 9+ messages in thread
From: Zhao Zhili @ 2022-12-14 17:10 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Zhao Zhili

From: Zhao Zhili <zhilizhao@tencent.com>

---
 fftools/ffprobe.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index d2f126d9d6..c18aee9846 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -3714,7 +3714,7 @@ static void opt_input_file(void *optctx, const char *arg)
         exit_program(1);
     }
     if (!strcmp(arg, "-"))
-        arg = "pipe:";
+        arg = "fd:";
     input_filename = arg;
 }
 
@@ -3733,7 +3733,7 @@ static void opt_output_file(void *optctx, const char *arg)
         exit_program(1);
     }
     if (!strcmp(arg, "-"))
-        arg = "pipe:";
+        arg = "fd:";
     output_filename = arg;
 }
 
-- 
2.25.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [FFmpeg-devel] [PATCH v3 8/8] fftools/ffmpeg_demux: prefer fd over pipe for seek support
       [not found] <20221214171014.1058709-1-quinkblack@foxmail.com>
                   ` (6 preceding siblings ...)
  2022-12-14 17:10 ` [FFmpeg-devel] [PATCH v3 7/8] fftools/ffprobe: " Zhao Zhili
@ 2022-12-14 17:10 ` Zhao Zhili
  7 siblings, 0 replies; 9+ messages in thread
From: Zhao Zhili @ 2022-12-14 17:10 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Zhao Zhili

From: Zhao Zhili <zhilizhao@tencent.com>

---
Because fate tests can concat multiple results to a single output, we can't
do the same for muxer, unless making a lot of modification on fate-run.sh.
Although unlikely, our users may do the same thing.

 fftools/ffmpeg_demux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index be0e8970ba..4b5c62b0d5 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -883,7 +883,7 @@ int ifile_open(const OptionsContext *o, const char *filename)
     }
 
     if (!strcmp(filename, "-"))
-        filename = "pipe:";
+        filename = "fd:";
 
     stdin_interaction &= strncmp(filename, "pipe:", 5) &&
                          strcmp(filename, "fd:") &&
-- 
2.25.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [FFmpeg-devel] [PATCH v3 1/8] avformat/file: add fd option for pipe
  2022-12-14 17:10 ` [FFmpeg-devel] [PATCH v3 1/8] avformat/file: add fd option for pipe Zhao Zhili
@ 2022-12-28 17:31   ` Zhao Zhili
  0 siblings, 0 replies; 9+ messages in thread
From: Zhao Zhili @ 2022-12-28 17:31 UTC (permalink / raw)
  To: ffmpeg-devel

On Thu, 2022-12-15 at 01:10 +0800, Zhao Zhili wrote:
> From: Zhao Zhili <zhilizhao@tencent.com>
> 
> ---
>  doc/protocols.texi    | 4 +++-
>  libavformat/file.c    | 9 +++++++--
>  libavformat/version.h | 2 +-
>  3 files changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/doc/protocols.texi b/doc/protocols.texi
> index d1c6fced7b..a686a7f0ac 100644
> --- a/doc/protocols.texi
> +++ b/doc/protocols.texi
> @@ -687,7 +687,7 @@ The accepted syntax is:
>  pipe:[@var{number}]
>  @end example
>  
> -@var{number} is the number corresponding to the file descriptor of
> the
> +If @option{fd} isn't specified, @var{number} is the number
> corresponding to the file descriptor of the
>  pipe (e.g. 0 for stdin, 1 for stdout, 2 for stderr).  If
> @var{number}
>  is not specified, by default the stdout file descriptor will be used
>  for writing, stdin for reading.
> @@ -714,6 +714,8 @@ Set I/O operation maximum block size, in bytes.
> Default value is
>  @code{INT_MAX}, which results in not limiting the requested block
> size.
>  Setting this value reasonably low improves user termination request
> reaction
>  time, which is valuable if data transmission is slow.
> +@item fd
> +Set file descriptor.
>  @end table
>  
>  Note that some formats (typically MOV), require the output protocol
> to
> diff --git a/libavformat/file.c b/libavformat/file.c
> index 6103c37b34..db619fcaac 100644
> --- a/libavformat/file.c
> +++ b/libavformat/file.c
> @@ -92,6 +92,7 @@ static const AVOption file_options[] = {
>  
>  static const AVOption pipe_options[] = {
>      { "blocksize", "set I/O operation maximum block size",
> offsetof(FileContext, blocksize), AV_OPT_TYPE_INT, { .i64 = INT_MAX
> }, 1, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
> +    { "fd", "set file descriptor", offsetof(FileContext, fd),
> AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX,
> AV_OPT_FLAG_ENCODING_PARAM },
>      { NULL }
>  };
>  
> @@ -381,6 +382,8 @@ static int pipe_open(URLContext *h, const char
> *filename, int flags)
>      FileContext *c = h->priv_data;
>      int fd;
>      char *final;
> +
> +    if (c->fd < 0) {
>      av_strstart(filename, "pipe:", &filename);
>  
>      fd = strtol(filename, &final, 10);
> @@ -391,10 +394,12 @@ static int pipe_open(URLContext *h, const char
> *filename, int flags)
>              fd = 0;
>          }
>      }
> +    c->fd = fd;
> +    }
> +
>  #if HAVE_SETMODE
> -    setmode(fd, O_BINARY);
> +    setmode(c->fd, O_BINARY);
>  #endif
> -    c->fd = fd;
>      h->is_streamed = 1;
>      return 0;
>  }
> diff --git a/libavformat/version.h b/libavformat/version.h
> index a7e5a9ac66..63e753a3aa 100644
> --- a/libavformat/version.h
> +++ b/libavformat/version.h
> @@ -32,7 +32,7 @@
>  #include "version_major.h"
>  
>  #define LIBAVFORMAT_VERSION_MINOR  34
> -#define LIBAVFORMAT_VERSION_MICRO 102
> +#define LIBAVFORMAT_VERSION_MICRO 103
>  
>  #define LIBAVFORMAT_VERSION_INT
> AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
>                                                 LIBAVFORMAT_VERSION_M
> INOR, \

Ping for the patchset.

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-12-28 17:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20221214171014.1058709-1-quinkblack@foxmail.com>
2022-12-14 17:10 ` [FFmpeg-devel] [PATCH v3 1/8] avformat/file: add fd option for pipe Zhao Zhili
2022-12-28 17:31   ` Zhao Zhili
2022-12-14 17:10 ` [FFmpeg-devel] [PATCH v3 2/8] avformat/file: reindent after the previous commit Zhao Zhili
2022-12-14 17:10 ` [FFmpeg-devel] [PATCH v3 3/8] avformat/file: dup file descriptor for pipe Zhao Zhili
2022-12-14 17:10 ` [FFmpeg-devel] [PATCH v3 4/8] avformat/file: add fd protocol Zhao Zhili
2022-12-14 17:10 ` [FFmpeg-devel] [PATCH v3 5/8] fftools/ffmpeg_demux: disable stdin interaction for " Zhao Zhili
2022-12-14 17:10 ` [FFmpeg-devel] [PATCH v3 6/8] fftools/ffplay: prefer fd over pipe for seek support Zhao Zhili
2022-12-14 17:10 ` [FFmpeg-devel] [PATCH v3 7/8] fftools/ffprobe: " Zhao Zhili
2022-12-14 17:10 ` [FFmpeg-devel] [PATCH v3 8/8] fftools/ffmpeg_demux: " Zhao Zhili

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