<div style="color: rgb(0, 0, 0);">From f34411981ac4233b0fbab21ebe08af50a46dce47 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..80f676f30 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 && strncasecmp(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 && strncasecmp(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..f0d6f6fbd 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 && strncasecmp(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 && strncasecmp(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.windows.1<br />
</div><div><br /></div>