Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove whence parm in InputContainer.seek() #1336

Merged
merged 1 commit into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading