From 5b6b01ea778064a0b0125ea8ebd9272a534cccd2 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 30 Nov 2020 23:49:04 +0100 Subject: Give Butler a weak_ptr --- src/lib/butler.cc | 6 ++++-- src/lib/butler.h | 2 ++ src/lib/ffmpeg_encoder.cc | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src/lib') diff --git a/src/lib/butler.cc b/src/lib/butler.cc index d27778b70..4ab0092c4 100644 --- a/src/lib/butler.cc +++ b/src/lib/butler.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2016-2018 Carl Hetherington + Copyright (C) 2016-2020 Carl Hetherington This file is part of DCP-o-matic. @@ -58,6 +58,7 @@ using namespace boost::placeholders; * @param fast Same as above for the `fast' flag. */ Butler::Butler ( + weak_ptr film, shared_ptr player, AudioMapping audio_mapping, int audio_channels, @@ -66,7 +67,8 @@ Butler::Butler ( bool aligned, bool fast ) - : _player (player) + : _film (film) + , _player (player) , _prepare_work (new boost::asio::io_service::work (_prepare_service)) , _pending_seek_accurate (false) , _suspended (0) diff --git a/src/lib/butler.h b/src/lib/butler.h index 6b933be4b..1fe05742f 100644 --- a/src/lib/butler.h +++ b/src/lib/butler.h @@ -37,6 +37,7 @@ class Butler : public ExceptionStore, public boost::noncopyable { public: Butler ( + boost::weak_ptr film, boost::shared_ptr player, AudioMapping map, int audio_channels, @@ -87,6 +88,7 @@ private: void player_change (ChangeType type); void seek_unlocked (dcpomatic::DCPTime position, bool accurate); + boost::weak_ptr _film; boost::shared_ptr _player; boost::thread _thread; diff --git a/src/lib/ffmpeg_encoder.cc b/src/lib/ffmpeg_encoder.cc index 1d8feffa8..443e16939 100644 --- a/src/lib/ffmpeg_encoder.cc +++ b/src/lib/ffmpeg_encoder.cc @@ -107,7 +107,7 @@ FFmpegEncoder::FFmpegEncoder ( } _butler.reset ( - new Butler(_player, map, _output_audio_channels, bind(&PlayerVideo::force, _1, FFmpegFileEncoder::pixel_format(format)), VIDEO_RANGE_VIDEO, true, false) + new Butler(_film, _player, map, _output_audio_channels, bind(&PlayerVideo::force, _1, FFmpegFileEncoder::pixel_format(format)), VIDEO_RANGE_VIDEO, true, false) ); } -- cgit v1.2.3