From patchwork Sun Jun 30 10:33:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Zhili X-Patchwork-Id: 50220 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:cc64:0:b0:482:c625:d099 with SMTP id k4csp1203612vqv; Sun, 30 Jun 2024 03:42:49 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUT4gCmKePAla9obCd/fkc1ZhXylHXibUx3yrocPsiIKHKp3pAdwNKz9R/P7/Xwfqk9w72bfrKh9/uct/jAlj0wrE8JKl0FS36EVA== X-Google-Smtp-Source: AGHT+IGLbVznM24tGWxLl/Mf4r/WoEp4UTlzBRusqdrcLk2IdRcXAZtNjbNzhk0x5WEFAhNf/Wme X-Received: by 2002:a05:6402:5255:b0:57c:4db6:c0fc with SMTP id 4fb4d7f45d1cf-5879f59a610mr2067421a12.10.1719744169495; Sun, 30 Jun 2024 03:42:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719744169; cv=none; d=google.com; s=arc-20160816; b=dLFQ+GjiKX2yc3ZBId2iIr1z0nnae0pEbFbZ24ZMP4NgRD+es8+M0IVLcGb6cKOveQ LdCJbvG0sY1nvUVrSoIl6f/zwRtFbFzIDKQznMv59dTnODTzka0m1aClHTEX3Lg4/hWF YdF3wP5T2U6TU3tk/cKPHpD2XCXYIs3+9VSWsjb8jEiqM/dY5/dyq2SIHIFezW6rwZa/ j13T+cDuj4ndA2EMf39NOwIAarXW/93yElxeoG3XWZRaAcOBbm5YGO00WLzpbeL681O4 7SpTjKUS5pRkzUGe1j7NKq/RUwCCvRe0h+QdMLc2iS2nOsmQ9oh3O46vvotGDIfFpnyZ fzJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:date:to:from:message-id :dkim-signature:delivered-to; bh=KYZm5kfz5Y7godc9oyByBuTWXZJqfXOG9RSVn/3QTE4=; fh=HnHYuZ9XgUo86ZRXTLWWmQxhslYEI9B9taZ5X1DLFfc=; b=CEFxiwZpKxqsMgBuDtFp/leF2h5SYaC0s8mv96+TlrTQrVOiBpe8BgsNqqOsuMUV/I 3tr/sKm6M1uNpwvuMs5/nm8e4ZyQgjeG+3XTIxju0IJONS1+pB2+fNUuOv0uYuIh4ATl rZfS1owGOxT5alaj1jsVMAI4xqpp95od1/Z87Vj+SViKjSUeNuD1U+jqCFviBQm6DOJ/ lP3W+9xDBJRkUOWZ7rrbH92BkEF+IgSxjjiEm+rPrdwKk1xQZJPUd0pJn2gpXlTe+nJz WCkSlEUaS9PPz7/WN5Y7WBh8RmbdILqatY+a6t0y9rcSf7Uv0uoIqiQBqMYyplBsgnPA deMQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=lBnbLnm3; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 4fb4d7f45d1cf-58615040f59si2623225a12.366.2024.06.30.03.42.49; Sun, 30 Jun 2024 03:42:49 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=lBnbLnm3; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id ADFCB68D673; Sun, 30 Jun 2024 13:34:50 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out162-62-57-252.mail.qq.com (out162-62-57-252.mail.qq.com [162.62.57.252]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1057D68D3A3 for ; Sun, 30 Jun 2024 13:34:41 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1719743678; bh=uLxQWFRs6hPqJJn1Hjr5OZPw4qC/QjYs3dFLwh0Y0tY=; h=From:To:Cc:Subject:Date; b=lBnbLnm3wqSH7PeiZtpfIijtK55cL6MOWDQwkupawzg8ArrAudAKkmgfLJY4b8FPp PT3600WgTIIydirMb+BlkOmmDcW5bi8vB2URJJAcBBvSZBRwpVIMn/7idSZUL5RKYi oG1NPLbrN8V6KDODeI9zHii37V+cNSYr52dxtLIs= Received: from ZHILIZHAO-MB1.tencent.com ([121.34.202.77]) by newxmesmtplogicsvrszc5-2.qq.com (NewEsmtp) with SMTP id 854A7CEE; Sun, 30 Jun 2024 18:33:20 +0800 X-QQ-mid: xmsmtpt1719743600tnwhmgn07 Message-ID: X-QQ-XMAILINFO: MmPNY57tR1XnJqt1Srw/Mxfi1Rf/U2wdiiGLYjWLR0WJ2lDI6cdR9DXW+No3O4 Lg3ZEPrR+h5UsgAYjfnhFWO1RQP/z1S+VxUA8Dz0Q514HTQG5W55jZ+E/BjPS+hLcQ0Y4GP9fkpX 75alvALW4LaQ2I7SWOBcCbnEU2oqm1wEzzy9Cv8qpSTKayo1Op6Aw1ReZHJtundQrLV2ENmlbq96 QK8t56OZ6JWfUoBxjNZL7haEu2pseNJKZqbJs18MRNGeII5+7MAsyXxwsd4P3am8pbfPccLY1pTH zUfULUsJAX6pUTsoxm6rqbrzTbT5rAwYsmpzB8Lf3j2S/xgo4UcY+/uyyhm0bN7TQorOd/viic2y ZzU58YfdasU6CjZ9WEWbM0mJE1/NeDV2OUFZnpepd8MYRINMD7BUcoH8d8U40alhbyjcZ2EQ4ATR AWjwUez1fcQ3PC9DN5Jno1Lgj1gvXtCR19nDdHkTqpk/tOSC508RkRApvq3ewp4fTh0vt51Nb3u8 Y/EuboatpofV6RudZS3rKLe6RVXjOSTU5xKVHdO+M9oWn3Oj2hegXQUKEEEuimgwKfaELJXmNqHc 4WzX9qcAL9rtjuHf4ChapySCBZdX2Ax6g8vWzFBZ2J4KYaWMg1XXgfGIDQx43t8A4A1Bgm1Utq1J gTCnmbMKs3/iRbeXmdxns2pStzgY58PKlahm3cIxkj00134Cl6BSwf7WcIwWDNT09yAFjkNQITcF PXLwYr+H7NmBiaGWg3ecff+13XVpCX5wIyKS7YO5KlR7xQw4tpWdqFHr4mG6JJF3cEJlwLC4I7f0 3e4+HggD8BJazasJywuS7bdd40iOX1ip6x9ZKUfCTPlzEzZ1ILru5S0YwS3jMJtklX5x1neGk4lj +0Q/eKAMJqYg+JEZnkYc9m6rzi04MdVWGGxDD4BK/uxQdU+TpjYXgWBM3u0AuAQQYURGUrbbr59F FhwAGjbNrLmG+MAQ1HnH7Jhu+kaucn X-QQ-XMRINFO: NI4Ajvh11aEj8Xl/2s1/T8w= From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Sun, 30 Jun 2024 18:33:18 +0800 X-OQ-MSGID: <20240630103319.94068-1-quinkblack@foxmail.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 1/2] avutil/file_open: Fix build error with wasi 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: e6012MdsO7s1 From: Zhao Zhili Don't assume tempnam is available when !HAVE_MKSTEMP. Check tempnam explicitly in configure. Signed-off-by: Zhao Zhili --- configure | 2 ++ libavutil/file_open.c | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/configure b/configure index fed4c44cd1..696a26ee74 100755 --- a/configure +++ b/configure @@ -2413,6 +2413,7 @@ SYSTEM_FUNCS=" sysconf sysctl sysctlbyname + tempnam usleep UTGetOSTypeFromString VirtualAlloc @@ -6548,6 +6549,7 @@ check_struct "sys/stat.h" "struct stat" st_mtim.tv_nsec -D_BSD_SOURCE check_func strerror_r check_func sysconf check_func sysctl +check_func tempnam check_func usleep check_func_headers conio.h kbhit diff --git a/libavutil/file_open.c b/libavutil/file_open.c index 24ef33e3da..4692035d55 100644 --- a/libavutil/file_open.c +++ b/libavutil/file_open.c @@ -112,7 +112,10 @@ int avpriv_tempfile(const char *prefix, char **filename, int log_offset, void *l { FileLogContext file_log_ctx = { &file_log_ctx_class, log_offset, log_ctx }; int fd = -1; -#if !HAVE_MKSTEMP +#if HAVE_MKSTEMP + size_t len = strlen(prefix) + 12; /* room for "/tmp/" and "XXXXXX\0" */ + *filename = av_malloc(len); +#elif HAVE_TEMPNAM void *ptr= tempnam(NULL, prefix); if(!ptr) ptr= tempnam(".", prefix); @@ -120,8 +123,7 @@ int avpriv_tempfile(const char *prefix, char **filename, int log_offset, void *l #undef free free(ptr); #else - size_t len = strlen(prefix) + 12; /* room for "/tmp/" and "XXXXXX\0" */ - *filename = av_malloc(len); + return AVERROR(ENOSYS); #endif /* -----common section-----*/ if (!*filename) { From patchwork Sun Jun 30 10:33:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Zhili X-Patchwork-Id: 50219 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:cc64:0:b0:482:c625:d099 with SMTP id k4csp1201317vqv; Sun, 30 Jun 2024 03:33:45 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVcYgzBOlRVPtUVJ7QOWtuioq+Rj57H+JP5ElfEYm4G/86k3UNC7mgxpljzkbDatn658CUtLO1FG6ISX8HD9F56PBInryA/UJpUzw== X-Google-Smtp-Source: AGHT+IFkaEkg7O/opiAA63TyvdD8ASVUNNUPZWmqaOCXptwg4LhNGDExUHj6LhbjoIcztIZzlBZi X-Received: by 2002:a05:6402:3491:b0:57a:1fef:619e with SMTP id 4fb4d7f45d1cf-5879f59bbdcmr2166837a12.18.1719743625408; Sun, 30 Jun 2024 03:33:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719743625; cv=none; d=google.com; s=arc-20160816; b=fq4N5Pr3DukOoEBlR3IXjpotzpqnloy/r64BG6iMlNqTvB8gfJtCx5HAQrbsqeWXon /irt3qk7FUlJUgh0OA/fvqSstWMN1z7lwenJhPccblwOdtVBvUBpX9ciZZtpOewX0Kev tUgUuMcO6/4GYRnGoJK3KVOtvCT6mnd4CZ5BqyafpM2QTTI9+ye/cvDZ3BpDh8pYGpFh AMSaBtAenRkoQdLe37romznrHrBp2XXmooT62tszTpKTt6JfvEbkHuZY02zwqKrZBfjw lmI152s6RmkmXgom8bwFpiZLNj4gyO+ml8vaRM/MYCbCLeiQj87dQqx35rOkuHJWm1rD +Rmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to:date :to:from:message-id:dkim-signature:delivered-to; bh=ksHJbOV7e50jsEMpmdQYyVI5hZPFKahN9+w7BVmRNaY=; fh=HnHYuZ9XgUo86ZRXTLWWmQxhslYEI9B9taZ5X1DLFfc=; b=fT3t7iLybsMeZUTCm2Do3O0OMQTV1UGbkNfenXG3HBERuF+omrxEAmMWYf/buF7GKN 7tZMDsHTMjA5TkcngqKfKRRrYMseRkFvkqrQUeZUB9THU17l8fs+gtFFYWrLHSwPPLeG L5rU0TLYpOl6fk4b045NPou73GZqwqqLs7as4cTtUWdGRAPIuFEKMAVhl2NAZo/Xqz3Z BZCZYpGsk+fOR1KofqYv0Lf57snHTmA3XHb7W7f2C94nB2/tZAdvrAPcByXoisCAiCpX bbUNmiCZs3I3MJ0ZIFco7tF5RzeIxojzCItekHAGPhAIKsObmdv3zO2nprVQ23luOFTr WWBA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b="la3VO8G/"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 4fb4d7f45d1cf-586137207f4si2608178a12.23.2024.06.30.03.33.44; Sun, 30 Jun 2024 03:33:45 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b="la3VO8G/"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D07A668D2B0; Sun, 30 Jun 2024 13:33:41 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out203-205-251-36.mail.qq.com (out203-205-251-36.mail.qq.com [203.205.251.36]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CFEB268D37F for ; Sun, 30 Jun 2024 13:33:32 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1719743603; bh=wgNr696X8qe7EuloAFSgdBsN6+kR91vqFeP4QH4gfjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=la3VO8G/XYnm5cCcctCc3i3gqf6DbAZWS0iiyNloVpzKA+KT3u39BbinNj0hi56fS Q1XKuk9cbZZaiUGWWZ2Nfz56i87PbE45bHhWFO7qRr8UfScRMZ1vnIAkWeVHzq+hpc Q6Yp9daNY6rO9K1nF9IsjE018yvzkLCoS0CAWBVY= Received: from ZHILIZHAO-MB1.tencent.com ([121.34.202.77]) by newxmesmtplogicsvrszc5-2.qq.com (NewEsmtp) with SMTP id 854A7CEE; Sun, 30 Jun 2024 18:33:20 +0800 X-QQ-mid: xmsmtpt1719743601tzbpsjejq Message-ID: X-QQ-XMAILINFO: MyirvGjpKb1jT8r64tu78GcznoMBerDumzuHLB+sUzzygWz2TxAELwp7BZbqbC 7aei1fFAYZU4DxB6n7+SCDHnzdkFI7q4/Tp0nZ9bkfwN4Kq1XIy06RbK2AfLz+KzkLN+ozgD+56t GZmpdi1RAPVt1LKyX3sa9envs/JjPW4DMXjyV56WrITmmrehJY0XgQ8va9jfl1J5Vr5Uu8nMy0WR ZRuDOZFsQ4yo83KlFTGqsWSAEa24qHfiXocLFyRnULlMMKMlJNABDivi7u5Du0OT+YlD5u8dxYFL dMH7aJm36YpxHQYfKegEvg4Gi/9zWzHq1licY15LmOafaM1LpVV1vktKzNFQu8Qr0D5dA6//LPyG mrzipaAGtydgsq3ZrS6TxURk05+SgE1ifyGQgcTfG27dUgCPlwCw45hqeUiqQdcXbYn2mY752hC2 GOqEuOPFcpJZM115Z170f/T7JWggPjSFdn5IX7KNCWOVqU721MP6EFceAKV43mx/wbEhDY4dQeF/ ROzHU4m3kfiqRwarUCydzwkwtrbod5ulEl6rYW1JBMGDCaJhWrx0S/LNoxptBkjAQtJi52Zv/TOe B+1Zoah4R5riiHdrEnRQ5o45tPfeXgsLjEChYvgtdklQ99WZ9bxF6gRgEddfoMA3iO7yZbqHkK20 EMU5PTXxpD7pvgNuRx/siI2uP35KH2OWQXLy8Nom+qmUEEMQeD+FtesS/dNRi8abomAXrOFOl10R DdqaWpm3IBgDfveYS9tDBxoCa2UqVOjJ+Y7fThROy6PFkjqpdRBsRGQ8K1v6XHuWoWWccXXHuuQo E+TjnJejdkKweoiTU8/CXSKwvLpDemCpbn9bi8caCnOfe8WOzi0TiKrwDSM48u5HilH8VQFXaLts 66RghYqXwFOMllRpj4Bu6Qv2+C4PYrbboA2J4+KscP1nWFrZq6qK1rai/NprBFiGzm4J14VVRlNt QHGY26G0qD3hW8utgCPBWYLfEE/bmOxwtztdd0oVw= X-QQ-XMRINFO: MPJ6Tf5t3I/ycC2BItcBVIA= From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Sun, 30 Jun 2024 18:33:19 +0800 X-OQ-MSGID: <20240630103319.94068-2-quinkblack@foxmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240630103319.94068-1-quinkblack@foxmail.com> References: <20240630103319.94068-1-quinkblack@foxmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 2/2] avformat/file: guard fd_dup by FD_PROTOCOL or PIPE_PROTOCOL 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: hTvV/0wVZaSw From: Zhao Zhili fd_dup is unused when fd and pipe have been disabled. This also fix build error with wasi since 'dup' isn't available. Signed-off-by: Zhao Zhili --- libavformat/file.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/file.c b/libavformat/file.c index 3fc1e741f2..6a66040b65 100644 --- a/libavformat/file.c +++ b/libavformat/file.c @@ -193,6 +193,7 @@ static int file_check(URLContext *h, int mask) return ret; } +#if CONFIG_FD_PROTOCOL || CONFIG_PIPE_PROTOCOL static int fd_dup(URLContext *h, int oldfd) { int newfd; @@ -215,6 +216,7 @@ static int fd_dup(URLContext *h, int oldfd) #endif return newfd; } +#endif static int file_close(URLContext *h) {