Skip to content

Commit be9d4da

Browse files
committed
Fix
1 parent 10bea3b commit be9d4da

3 files changed

Lines changed: 8 additions & 15 deletions

File tree

av/codec/hwaccel.pyx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import copy
21
import weakref
32
from enum import IntEnum
43

examples/basics/hw_decode.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import av
55
import av.datasets
6+
from av.codec.hwaccel import HWAccel, hwdevices_available
67

78
# What accelerator to use.
89
# Recommendations:
@@ -30,14 +31,10 @@
3031
)
3132

3233
if HW_DEVICE is None:
33-
print(
34-
f"Please set HW_DEVICE. Options are: {str(av.codec.hwaccel.hwdevices_available())}"
35-
)
34+
print(f"Please set HW_DEVICE. Options are: {hwdevices_available()}")
3635
exit()
3736

38-
assert (
39-
HW_DEVICE in av.codec.hwaccel.hwdevices_available()
40-
), f"{HW_DEVICE} not available."
37+
assert HW_DEVICE in hwdevices_available(), f"{HW_DEVICE} not available."
4138

4239
print("Decoding in software (auto threading)...")
4340

@@ -56,11 +53,12 @@
5653
assert frame_count == container.streams.video[0].frames
5754
container.close()
5855

59-
print(f"Decoded with software in {sw_time:.2f}s ({sw_fps:.2f} fps).")
60-
61-
print(f"Decoding with {HW_DEVICE}")
56+
print(
57+
f"Decoded with software in {sw_time:.2f}s ({sw_fps:.2f} fps).\n"
58+
f"Decoding with {HW_DEVICE}"
59+
)
6260

63-
hwaccel = av.codec.hwaccel.HWAccel(device_type=HW_DEVICE, allow_software_fallback=False)
61+
hwaccel = HWAccel(device_type=HW_DEVICE, allow_software_fallback=False)
6462

6563
# Note the additional argument here.
6664
container = av.open(test_file_path, hwaccel=hwaccel)

tests/test_decode.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88

99
import av
1010

11-
# This import is needed to make the test_decoded_time_base test pass when we run only this test file.
12-
# Not sure why.
13-
from av.subtitles import subtitle
14-
1511
from .common import TestCase, fate_suite
1612

1713

0 commit comments

Comments
 (0)