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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fate-suite:
rsync -vrltLW rsync://fate-suite.ffmpeg.org/fate-suite/ tests/assets/fate-suite/

lint:
$(PIP) install -U ruff isort pillow numpy mypy==1.17.1 pytest
$(PIP) install -U ruff isort pillow numpy mypy==1.19.1 pytest
ruff format --check av examples tests setup.py
isort --check-only --diff av examples tests
mypy av tests
Expand Down
12 changes: 9 additions & 3 deletions av/audio/fifo.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,20 +193,26 @@ def read_many(self, samples: cython.int, partial: cython.bint = False):
def format(self):
"""The :class:`.AudioFormat` of this FIFO."""
if not self.ptr:
raise AttributeError(f"'{__name__}.AudioFifo' object has no attribute 'format'")
raise AttributeError(
f"'{__name__}.AudioFifo' object has no attribute 'format'"
)
return self.template.format

@property
def layout(self):
"""The :class:`.AudioLayout` of this FIFO."""
if not self.ptr:
raise AttributeError(f"'{__name__}.AudioFifo' object has no attribute 'layout'")
raise AttributeError(
f"'{__name__}.AudioFifo' object has no attribute 'layout'"
)
return self.template.layout

@property
def sample_rate(self):
if not self.ptr:
raise AttributeError(f"'{__name__}.AudioFifo' object has no attribute 'sample_rate'")
raise AttributeError(
f"'{__name__}.AudioFifo' object has no attribute 'sample_rate'"
)
return self.template.sample_rate

@property
Expand Down
6 changes: 4 additions & 2 deletions tests/test_decode.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import pytest

import av
from av.sidedata.encparams import VideoEncParams
from av.subtitles.subtitle import SubtitleSet

from .common import TestCase, fate_suite

Expand Down Expand Up @@ -109,7 +111,7 @@ def test_decoded_time_base(self) -> None:

for packet in container.demux(stream):
for frame in packet.decode():
assert not isinstance(frame, av.subtitles.subtitle.SubtitleSet)
assert not isinstance(frame, SubtitleSet)
assert packet.time_base == frame.time_base
assert stream.time_base == frame.time_base
return
Expand Down Expand Up @@ -146,7 +148,7 @@ def test_decoded_video_enc_params(self) -> None:

for frame in container.decode(stream):
video_enc_params = cast(
av.sidedata.encparams.VideoEncParams,
VideoEncParams,
frame.side_data.get("VIDEO_ENC_PARAMS"),
)
assert video_enc_params is not None
Expand Down
6 changes: 3 additions & 3 deletions tests/test_subtitles.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import av
from av.codec.context import CodecContext
from av.subtitles.codeccontext import SubtitleCodecContext
from av.subtitles.subtitle import AssSubtitle, BitmapSubtitle
from av.subtitles.subtitle import AssSubtitle, BitmapSubtitle, Subtitle, SubtitleSet

from .common import TestCase, fate_suite

Expand Down Expand Up @@ -35,8 +35,8 @@ def test_subset(self) -> None:
for packet in container.demux(subs):
subset = subs.decode2(packet)
if subset is not None:
assert not isinstance(subset, av.subtitles.subtitle.Subtitle)
assert isinstance(subset, av.subtitles.subtitle.SubtitleSet)
assert not isinstance(subset, Subtitle)
assert isinstance(subset, SubtitleSet)
assert subset.format == 1
assert hasattr(subset, "pts")
assert subset.start_display_time == 0
Expand Down
Loading