Skip to content

Commit

Permalink
Remove whence parm in InputContainer.seek()
Browse files Browse the repository at this point in the history
  • Loading branch information
WyattBlue committed Mar 15, 2024
1 parent 6daab70 commit 4984b8d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
3 changes: 1 addition & 2 deletions av/container/input.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Iterator, Literal, overload
from typing import Any, Iterator, overload

from av.audio.frame import AudioFrame
from av.audio.stream import AudioStream
Expand Down Expand Up @@ -34,7 +34,6 @@ class InputContainer(Container):
self,
offset: int,
*,
whence: Literal["time"] = "time",
backward: bool = True,
any_frame: bool = False,
stream: Stream | VideoStream | AudioStream | None = None,
Expand Down
14 changes: 4 additions & 10 deletions av/container/input.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,10 @@ cdef class InputContainer(Container):
for frame in packet.decode():
yield frame

def seek(self, offset, *, str whence="time", bint backward=True,
bint any_frame=False, Stream stream=None,
bint unsupported_frame_offset=False,
bint unsupported_byte_offset=False):
def seek(
self, offset, *, bint backward=True, bint any_frame=False, Stream stream=None,
bint unsupported_frame_offset=False, bint unsupported_byte_offset=False
):
"""seek(offset, *, backward=True, any_frame=False, stream=None)
Seek to a (key)frame nearsest to the given timestamp.
Expand Down Expand Up @@ -252,12 +252,6 @@ cdef class InputContainer(Container):
cdef int flags = 0
cdef int ret

# We used to support whence in 'time', 'frame', and 'byte', but later
# realized that FFmpeg doens't implement the frame or byte ones.
# We don't even document this anymore, but do allow 'time' to pass through.
if whence != "time":
raise ValueError("whence != 'time' is no longer supported")

if backward:
flags |= lib.AVSEEK_FLAG_BACKWARD
if any_frame:
Expand Down

0 comments on commit 4984b8d

Please sign in to comment.