Skip to content
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
5 changes: 4 additions & 1 deletion av/packet.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ StreamT = TypeVar("StreamT", bound=Stream)

@final
class Packet(Buffer, Generic[StreamT]):
stream: StreamT
@property
def stream(self) -> StreamT | None: ...
@stream.setter
def stream(self, value: StreamT) -> None: ...
stream_index: int
@property
def time_base(self) -> AVRational: ...
Expand Down
8 changes: 6 additions & 2 deletions tests/test_streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,11 @@ def audio_packets(discard: Discard | None) -> int:
if discard is not None:
c.streams.audio[0].discard = discard
count = sum(
1 for p in c.demux() if p.dts is not None and p.stream.type == "audio"
1
for p in c.demux()
if p.dts is not None
and p.stream is not None
and p.stream.type == "audio"
)
c.close()
return count
Expand Down Expand Up @@ -389,7 +393,7 @@ def test_attachment_stream(self) -> None:
for packet in ic.demux(ic.streams.video):
if packet.size == 0:
continue
updated_stream = stream_map.get(packet.stream.index)
updated_stream = stream_map.get(packet.stream_index)
if isinstance(updated_stream, av.video.stream.VideoStream):
packet.stream = updated_stream
else:
Expand Down
Loading