<div style="font-family: -apple-system, system-ui; font-size: 14px; color: rgb(0, 0, 0);"><span style="line-height: 1.6;">From 3a73ca478689be34a8f6cffb7b7b6ea43ceea7cb Mon Sep 17 00:00:00 2001<br />
From: Mr-Z-2697 <74594146+Mr-Z-2697@users.noreply.github.com><br />
Date: Wed, 7 May 2025 23:15:57 +0800<br />
Subject: [PATCH] Fix inputs for Windows named pipe<br />
<br />
---<br />
source/input/y4m.cpp | 8 ++++++++<br />
source/input/yuv.cpp | 8 ++++++++<br />
2 files changed, 16 insertions(+)<br />
<br />
diff --git a/source/input/y4m.cpp b/source/input/y4m.cpp<br />
index 186499bd1..4b371e1ba 100644<br />
--- a/source/input/y4m.cpp<br />
+++ b/source/input/y4m.cpp<br />
@@ -109,7 +109,11 @@ Y4MInput::Y4MInput(InputFileInfo& info, bool alpha, int format)<br />
info.frameCount = -1;<br />
size_t estFrameSize = framesize + sizeof(header) + 1; /* assume basic FRAME\n headers */<br />
/* try to estimate frame count, if this is not stdin */<br />
+#if _WIN32<br />
+ if (ifs != stdin && strncmp(info.filename, "\\\\.\\pipe\\", 9))<br />
+#else<br />
if (ifs != stdin)<br />
+#endif<br />
{<br />
int64_t cur = ftello(ifs);<br />
if (cur >= 0)<br />
@@ -123,7 +127,11 @@ Y4MInput::Y4MInput(InputFileInfo& info, bool alpha, int format)<br />
}<br />
if (info.skipFrames)<br />
{<br />
+#if _WIN32<br />
+ if (ifs != stdin && strncmp(info.filename, "\\\\.\\pipe\\", 9))<br />
+#else<br />
if (ifs != stdin)<br />
+#endif<br />
fseeko(ifs, (int64_t)estFrameSize * info.skipFrames, SEEK_CUR);<br />
else<br />
for (int i = 0; i < info.skipFrames; i++)<br />
diff --git a/source/input/yuv.cpp b/source/input/yuv.cpp<br />
index c13b4f375..8afc75545 100644<br />
--- a/source/input/yuv.cpp<br />
+++ b/source/input/yuv.cpp<br />
@@ -104,7 +104,11 @@ YUVInput::YUVInput(InputFileInfo& info, bool alpha, int format)<br />
<br />
info.frameCount = -1;<br />
/* try to estimate frame count, if this is not stdin */<br />
+#if _WIN32<br />
+ if (ifs != stdin && strncmp(info.filename, "\\\\.\\pipe\\", 9))<br />
+#else<br />
if (ifs != stdin)<br />
+#endif<br />
{<br />
int64_t cur = ftello(ifs);<br />
if (cur >= 0)<br />
@@ -118,7 +122,11 @@ YUVInput::YUVInput(InputFileInfo& info, bool alpha, int format)<br />
}<br />
if (info.skipFrames)<br />
{<br />
+#if _WIN32<br />
+ if (ifs != stdin && strncmp(info.filename, "\\\\.\\pipe\\", 9))<br />
+#else<br />
if (ifs != stdin)<br />
+#endif<br />
fseeko(ifs, (int64_t)framesize * info.skipFrames, SEEK_CUR);<br />
else<br />
for (int i = 0; i < info.skipFrames; i++)<br />
-- <br />
2.49.0<br />
</span></div><div style="font-family: -apple-system, system-ui; font-size: 14px; color: rgb(0, 0, 0);"><span style="line-height: 1.6;"><br /></span></div>