From a04fc2e66109db94952a7519031f5b0960a64f19 Mon Sep 17 00:00:00 2001 From: WyattBlue Date: Thu, 14 Mar 2024 21:12:56 -0400 Subject: [PATCH] Remove whence parm in `InputContainer.seek()` --- av/container/input.pyi | 3 +-- av/container/input.pyx | 14 ++++---------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/av/container/input.pyi b/av/container/input.pyi index 2c1328943..f85eaec46 100644 --- a/av/container/input.pyi +++ b/av/container/input.pyi @@ -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 @@ -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, diff --git a/av/container/input.pyx b/av/container/input.pyx index 47cd98c4d..acf02fbab 100644 --- a/av/container/input.pyx +++ b/av/container/input.pyx @@ -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. @@ -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: