From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id CE77744C66 for ; Wed, 14 Dec 2022 17:11:09 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AA28C68BC86; Wed, 14 Dec 2022 19:10:51 +0200 (EET) Received: from out162-62-58-211.mail.qq.com (out162-62-58-211.mail.qq.com [162.62.58.211]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 508CB68B635 for ; Wed, 14 Dec 2022 19:10:43 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1671037839; bh=rex6kISFF9T83kTNO5+lnUrc0elkOB4KUMr2VJpYk3M=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=u4oihdLaklcKT1RlpfVeUK9zPnQRvPqgCzw9CEcsjs9IvF8KT5pB9FOVGMWU/vVCG PY9rVrfOP3PbC9DuZpUBpdoVJH4JVCqwdfQPIabvhFLqROemGdSgjakAp6kJTvu3D7 r7sC/6+W8p+vDa/4c7TJzguIPUa+BAxD05H9aLwA= Received: from localhost.localdomain ([113.116.29.217]) by newxmesmtplogicsvrsza12-0.qq.com (NewEsmtp) with SMTP id 2A515E8A; Thu, 15 Dec 2022 01:10:37 +0800 X-QQ-mid: xmsmtpt1671037838tvaxg0dkx Message-ID: X-QQ-XMAILINFO: Mg/0DM1Zd+nH8P/0guWe+XSm5hwmwpMrBiuPheFIhhoLp+33b2/+Zr0FC7yVw1 wE9wY/0F2imu4WMMGBcWNLNmJaNpG4YQ346U52FloQ885oLqBSqD8Bgv/QU+ovrUIRDnQu8aTS2Y Oa+urxxMuHYpJrzxHFnOtCMYz7UZjswOduoHQt6g/S1ia2zQeeXdQGjtV1dBXfksx8SWH135cypD U99M3Zmz88VuEvUHDVA5WqBcDLenG5VAT3xcU3klZWbLmDzdSOASIon16Rl8fwkUxYabbPoZl+ox HRqzbsD9utrcUu4ck2lWIKrimr221C3rZppMWe2aPWH5ZHZodTE6b3+VCGKcBzm5oZio/ksdwUTG K6v3mfOjrlKk8egVvDAQ2ZjW4k5eE610pgYuwcz5X8hl/WtkPJdqIL/u/vQpUZo5kxajHgHimCME +XHzqslC0lulx1R5mbRYma2pEkjlvFwO3pToWWOb4uTcpyippnzaVIdMzIbuKuGomgzGqoajXwa7 KjnLJajCeksG/02vFWn60EhF9CimT4HKJ5tJ5M2N0sTu0QmU022FH25LUVkkHKkQg8IYQ1xuxlxj VUs2nN1w2V6H5fax1Z0bu/NXzsZt6vQUknAKr5dr3dLzk96IQz77gzijs3sfn3jU1RKM48z9NiIe 0SNLVSjW0LN4ZKP6BwA426cWQXxRCCuOvaZJG/3gJ/SAvMj1zZqaKgVbyBR60pA2gEVFIvRljs0j mr3gId3vZtI8/7iRaEjMH60Ct1bgAdkQX9NxJv4tKIRVLxI7hC/Yi8AypGuJVHGtwC0yu7E3xZO8 +hrTPJkOKGNPm5kURPNAuHQ50vRFuSLVxGipKa9nh3RyPy3OiAAkX9hmw9cU5IGQ4sbGszoMpTrO rYkmgJx/p/Sv4NJSpFqZmeLt2UlX6gcvl4YnfFeSXSHXzWCWbx6/alJ5Pg8kVXobJlV9YKc9LA8V WUrzj6i8M1TRtUdhtmStev01+sIRW9 From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Thu, 15 Dec 2022 01:10:07 +0800 X-OQ-MSGID: <20221214171014.1058709-2-quinkblack@foxmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221214171014.1058709-1-quinkblack@foxmail.com> References: <20221214171014.1058709-1-quinkblack@foxmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 1/8] avformat/file: add fd option for pipe X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Zhao Zhili Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Zhao Zhili --- 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".