Skip to content

Commit 471d497

Browse files
naushirdavidplowman
authored andcommitted
tests: Add encoder import test
This ensures the correct default encoder is selected for the running platform. Signed-off-by: Naushir Patuck <[email protected]>
1 parent da455e7 commit 471d497

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/encoder_import.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from picamera2 import Picamera2
2+
from picamera2.encoders import H264Encoder
3+
from picamera2.platform import Platform
4+
5+
encoder = H264Encoder(bitrate=1000000)
6+
encoder_name = encoder.__class__.__name__
7+
platform = Picamera2.platform
8+
9+
if platform == Platform.VC4:
10+
error = encoder_name != "H264Encoder"
11+
elif platform == Platform.PISP:
12+
error = encoder_name != "LibavH264Encoder"
13+
14+
if error:
15+
print("ERROR: Unexpected encoder, got", encoder_name, "for platform", platform)

0 commit comments

Comments
 (0)