Skip to content

Commit 494d34a

Browse files
committed
Fix video context...
1 parent 47cfdb2 commit 494d34a

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Added
1111

1212
- bindings/python : expose video recorder settings
13+
- bindings/python : add function `hasFfmpegSupport()` to check if... library was built with FFmpeg support
1314
- pixi : separate `pinocchio` and `ffmpeg` features, add to CI build matrix
1415

1516
### Changed

bindings/python/candlewick/video_context.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
11
from contextlib import contextmanager
2-
from . import Visualizer
2+
from . import Visualizer, hasFfmpegSupport
33
import warnings
44

5-
try:
6-
import importlib
7-
8-
importlib.import_module("VideoRecorderSettings", package=".")
9-
CANDLEWICK_HAS_VIDEO_RECORDER = True
10-
except ImportError:
11-
CANDLEWICK_HAS_VIDEO_RECORDER = False
12-
135
_DEFAULT_VIDEO_SETTINGS = {"fps": 30, "bitRate": 3_000_000}
146

157
__all__ = ["create_recorder_context"]
@@ -23,7 +15,7 @@ def create_recorder_context(
2315
fps: int = _DEFAULT_VIDEO_SETTINGS["fps"],
2416
bitRate: int = _DEFAULT_VIDEO_SETTINGS["bitRate"],
2517
):
26-
if not CANDLEWICK_HAS_VIDEO_RECORDER:
18+
if not hasFfmpegSupport():
2719
warnings.warn(
2820
"This context will do nothing, as Candlewick was built without video recording support."
2921
)

bindings/python/src/module.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ BOOST_PYTHON_MODULE(pycandlewick) {
2626
}
2727
bp::def("setShadersDirectory", &setShadersDirectory, ("path"_a));
2828
bp::def("currentShaderDirectory", &currentShaderDirectory);
29+
bp::def(
30+
"hasFfmpegSupport", +[] {
31+
#ifdef CANDLEWICK_WITH_FFMPEG_SUPPORT
32+
return true;
33+
#else
34+
return false;
35+
#endif
36+
});
2937

3038
// Register SDL_Quit() as a function to call when interpreter exits.
3139
Py_AtExit(SDL_Quit);

0 commit comments

Comments
 (0)