summaryrefslogtreecommitdiff
path: root/src/lib/butler.h
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-05-26 20:04:33 +0200
committerCarl Hetherington <cth@carlh.net>2022-05-26 20:04:33 +0200
commit8987f133295e352c44e05ef338eacc801c61a629 (patch)
tree6325c00b2c1097bb483568ddad8b545e0e40f717 /src/lib/butler.h
parentb6fb82e5df5551497b823f20a75c7ff94ffd1b3e (diff)
Fix race between the Butler thread starting and audio (perhaps) being disabled.
This could cause Butler::audio to be called with _audio_channels = 0 and _disable_audio = false, causing an exception in AudioBuffers when remap() tried to make an AudioBuffers object with a channel count of 0.
Diffstat (limited to 'src/lib/butler.h')
-rw-r--r--src/lib/butler.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/lib/butler.h b/src/lib/butler.h
index c7e71658d..79701d370 100644
--- a/src/lib/butler.h
+++ b/src/lib/butler.h
@@ -38,6 +38,12 @@ class PlayerVideo;
class Butler : public ExceptionStore
{
public:
+ enum class Audio
+ {
+ ENABLED,
+ DISABLED
+ };
+
Butler (
std::weak_ptr<const Film> film,
std::shared_ptr<Player> player,
@@ -47,7 +53,8 @@ public:
VideoRange video_range,
Image::Alignment alignment,
bool fast,
- bool prepare_only_proxy
+ bool prepare_only_proxy,
+ Audio audio
);
~Butler ();
@@ -81,8 +88,6 @@ public:
boost::optional<dcpomatic::DCPTime> get_audio (Behaviour behaviour, float* out, Frame frames);
boost::optional<TextRingBuffers::Data> get_closed_caption ();
- void disable_audio ();
-
std::pair<size_t, std::string> memory_used () const;
private: