diff --git a/av/packet.pyi b/av/packet.pyi index 91775eff7..14b4b0bce 100644 --- a/av/packet.pyi +++ b/av/packet.pyi @@ -1,5 +1,6 @@ +from collections.abc import Buffer from fractions import Fraction -from typing import Buffer, Iterator +from typing import Iterator from av.subtitles.subtitle import SubtitleSet @@ -22,3 +23,4 @@ class Packet(Buffer): def __init__(self, input: int | bytes | None = None) -> None: ... def decode(self) -> Iterator[SubtitleSet]: ... + def __buffer__(self, arg1) -> memoryview: ... diff --git a/tests/test_bitstream.py b/tests/test_bitstream.py index 937448fe5..243afd131 100644 --- a/tests/test_bitstream.py +++ b/tests/test_bitstream.py @@ -5,7 +5,10 @@ from .common import TestCase, fate_suite -def is_annexb(packet: Packet) -> bool: +def is_annexb(packet: Packet | bytes | None) -> bool: + if packet is None: + return False + data = bytes(packet) return data[:3] == b"\0\0\x01" or data[:4] == b"\0\0\0\x01"