Skip to content

Commit

Permalink
Fix typo in ffmpeg_reader, lastread -> last_read
Browse files Browse the repository at this point in the history
  • Loading branch information
bzczb committed Jan 28, 2023
1 parent ef3a16a commit ec19ceb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions moviepy/video/io/ffmpeg_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def initialize(self, start_time=0):
Sets self.pos to the appropriate value (1 if start_time == 0 because
it pre-reads the first frame).
"""
self.close(delete_lastread=False) # if any
self.close(delete_last_read=False) # if any

# self.pos represents the (0-indexed) index of the frame that is next in line
# to be read by self.read_frame().
Expand Down Expand Up @@ -145,7 +145,7 @@ def initialize(self, start_time=0):
}
)
self.proc = sp.Popen(cmd, **popen_params)
self.lastread = self.read_frame()
self.last_read = self.read_frame()

def skip_frames(self, n=1):
"""Reads and throws away n frames"""
Expand All @@ -160,7 +160,7 @@ def read_frame(self):
"""
Reads the next frame from the file.
Note that upon (re)initialization, the first frame will already have been read
and stored in ``self.lastread``.
and stored in ``self.last_read``.
"""
w, h = self.size
nbytes = self.depth * w * h
Expand Down Expand Up @@ -235,7 +235,7 @@ def get_frame(self, t):
elif (pos < self.pos) or (pos > self.pos + 100):
# We can't just skip forward to `pos` or it would take too long
self.initialize(t)
return self.lastread
return self.last_read
else:
# If pos == self.pos + 1, this line has no effect
self.skip_frames(pos - self.pos - 1)
Expand All @@ -250,7 +250,7 @@ def get_frame_number(self, t):
# are getting the nth frame by writing get_frame(n/fps).
return int(self.fps * t + 0.00001)

def close(self, delete_lastread=True):
def close(self, delete_last_read=True):
"""Closes the reader terminating the process, if is still open."""
if self.proc:
if self.proc.poll() is None:
Expand All @@ -259,7 +259,7 @@ def close(self, delete_lastread=True):
self.proc.stderr.close()
self.proc.wait()
self.proc = None
if delete_lastread and hasattr(self, "last_read"):
if delete_last_read and hasattr(self, "last_read"):
del self.last_read

def __del__(self):
Expand Down

0 comments on commit ec19ceb

Please sign in to comment.