This small patch is to fix issue #324.

Please review.

# HG changeset patch
# User Ma0 <[email protected]>
# Date 1489176787 -3600
#      Fri Mar 10 21:13:07 2017 +0100
# Node ID 2b53475eb1916eceed880276b9ca368387badd4c
# Parent  88fd9082764c7d7b4668e30763a93215980efd70
CLI: fix '--seek' option for pipe input

diff -r 88fd9082764c -r 2b53475eb191 source/input/y4m.cpp
--- a/source/input/y4m.cpp    Wed Mar 08 17:15:59 2017 +0530
+++ b/source/input/y4m.cpp    Fri Mar 10 21:13:07 2017 +0100
@@ -141,7 +141,14 @@
     if (info.skipFrames)
     {
 #if X86_64
-        ifs->seekg((uint64_t)estFrameSize * info.skipFrames, ios::cur);
+        if (ifs != &cin)
+            ifs->seekg((uint64_t)estFrameSize * info.skipFrames, ios::cur);
+        else
+            for (int i = 0; i < info.skipFrames; i++)
+            {
+                ifs->read(buf[0], estFrameSize - framesize);
+                ifs->read(buf[0], framesize);
+            }
 #else
         for (int i = 0; i < info.skipFrames; i++)
             ifs->ignore(estFrameSize);
diff -r 88fd9082764c -r 2b53475eb191 source/input/yuv.cpp
--- a/source/input/yuv.cpp    Wed Mar 08 17:15:59 2017 +0530
+++ b/source/input/yuv.cpp    Fri Mar 10 21:13:07 2017 +0100
@@ -131,7 +131,11 @@
     if (info.skipFrames)
     {
 #if X86_64
-        ifs->seekg((uint64_t)framesize * info.skipFrames, ios::cur);
+        if (ifs != &cin)
+            ifs->seekg((uint64_t)framesize * info.skipFrames, ios::cur);
+        else
+            for (int i = 0; i < info.skipFrames; i++)
+                ifs->read(buf[0], framesize);
 #else
         for (int i = 0; i < info.skipFrames; i++)
             ifs->ignore(framesize);

# HG changeset patch
# User Ma0 <[email protected]>
# Date 1489176787 -3600
#      Fri Mar 10 21:13:07 2017 +0100
# Node ID 2b53475eb1916eceed880276b9ca368387badd4c
# Parent  88fd9082764c7d7b4668e30763a93215980efd70
CLI: fix '--seek' option for pipe input

diff -r 88fd9082764c -r 2b53475eb191 source/input/y4m.cpp
--- a/source/input/y4m.cpp      Wed Mar 08 17:15:59 2017 +0530
+++ b/source/input/y4m.cpp      Fri Mar 10 21:13:07 2017 +0100
@@ -141,7 +141,14 @@
     if (info.skipFrames)
     {
 #if X86_64
-        ifs->seekg((uint64_t)estFrameSize * info.skipFrames, ios::cur);
+        if (ifs != &cin)
+            ifs->seekg((uint64_t)estFrameSize * info.skipFrames, ios::cur);
+        else
+            for (int i = 0; i < info.skipFrames; i++)
+            {
+                ifs->read(buf[0], estFrameSize - framesize);
+                ifs->read(buf[0], framesize);
+            }
 #else
         for (int i = 0; i < info.skipFrames; i++)
             ifs->ignore(estFrameSize);
diff -r 88fd9082764c -r 2b53475eb191 source/input/yuv.cpp
--- a/source/input/yuv.cpp      Wed Mar 08 17:15:59 2017 +0530
+++ b/source/input/yuv.cpp      Fri Mar 10 21:13:07 2017 +0100
@@ -131,7 +131,11 @@
     if (info.skipFrames)
     {
 #if X86_64
-        ifs->seekg((uint64_t)framesize * info.skipFrames, ios::cur);
+        if (ifs != &cin)
+            ifs->seekg((uint64_t)framesize * info.skipFrames, ios::cur);
+        else
+            for (int i = 0; i < info.skipFrames; i++)
+                ifs->read(buf[0], framesize);
 #else
         for (int i = 0; i < info.skipFrames; i++)
             ifs->ignore(framesize);
_______________________________________________
x265-devel mailing list
[email protected]
https://mailman.videolan.org/listinfo/x265-devel

Reply via email to