[x265] [PATCH] Fix inputs for Windows named pipe

Richard ccc7922 at foxmail.com
Wed May 7 15:27:47 UTC 2025


From 3a73ca478689be34a8f6cffb7b7b6ea43ceea7cb Mon Sep 17 00:00:00 2001
 From: Mr-Z-2697 <74594146+Mr-Z-2697 at users.noreply.github.com>
 Date: Wed, 7 May 2025 23:15:57 +0800
 Subject: [PATCH] Fix inputs for Windows named pipe
 
 ---
  source/input/y4m.cpp | 8 ++++++++
  source/input/yuv.cpp | 8 ++++++++
  2 files changed, 16 insertions(+)
 
 diff --git a/source/input/y4m.cpp b/source/input/y4m.cpp
 index 186499bd1..4b371e1ba 100644
 --- a/source/input/y4m.cpp
 +++ b/source/input/y4m.cpp
 @@ -109,7 +109,11 @@ Y4MInput::Y4MInput(InputFileInfo& info, bool alpha, int format)
      info.frameCount = -1;
      size_t estFrameSize = framesize + sizeof(header) + 1; /* assume basic FRAME\n headers */
      /* try to estimate frame count, if this is not stdin */
 +#if _WIN32
 +    if (ifs != stdin && strncmp(info.filename, "\\\\.\\pipe\\", 9))
 +#else
      if (ifs != stdin)
 +#endif
      {
          int64_t cur = ftello(ifs);
          if (cur >= 0)
 @@ -123,7 +127,11 @@ Y4MInput::Y4MInput(InputFileInfo& info, bool alpha, int format)
      }
      if (info.skipFrames)
      {
 +#if _WIN32
 +        if (ifs != stdin && strncmp(info.filename, "\\\\.\\pipe\\", 9))
 +#else
          if (ifs != stdin)
 +#endif
              fseeko(ifs, (int64_t)estFrameSize * info.skipFrames, SEEK_CUR);
          else
              for (int i = 0; i < info.skipFrames; i++)
 diff --git a/source/input/yuv.cpp b/source/input/yuv.cpp
 index c13b4f375..8afc75545 100644
 --- a/source/input/yuv.cpp
 +++ b/source/input/yuv.cpp
 @@ -104,7 +104,11 @@ YUVInput::YUVInput(InputFileInfo& info, bool alpha, int format)
  
      info.frameCount = -1;
      /* try to estimate frame count, if this is not stdin */
 +#if _WIN32
 +    if (ifs != stdin && strncmp(info.filename, "\\\\.\\pipe\\", 9))
 +#else
      if (ifs != stdin)
 +#endif
      {
          int64_t cur = ftello(ifs);
          if (cur >= 0)
 @@ -118,7 +122,11 @@ YUVInput::YUVInput(InputFileInfo& info, bool alpha, int format)
      }
      if (info.skipFrames)
      {
 +#if _WIN32
 +        if (ifs != stdin && strncmp(info.filename, "\\\\.\\pipe\\", 9))
 +#else
          if (ifs != stdin)
 +#endif
              fseeko(ifs, (int64_t)framesize * info.skipFrames, SEEK_CUR);
          else
              for (int i = 0; i < info.skipFrames; i++)
 -- 
 2.49.0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20250507/5fbf3a75/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-inputs-for-Windows-named-pipe.patch
Type: application/octet-stream
Size: 2239 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20250507/5fbf3a75/attachment-0001.obj>


More information about the x265-devel mailing list