diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-10-26 19:41:12 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-10-26 19:41:12 +0200 |
| commit | 1a43dcc9b0d4c40cb8a19f2ff475c67ace4ef6a2 (patch) | |
| tree | 9e25a824e06e0161f991ad38f9d739b228e23b44 /src/lib/player.cc | |
| parent | 1cd4002ee3c82b1d9552aaa3ef6c52e3919b47b2 (diff) | |
Allow move construction of Player.
Diffstat (limited to 'src/lib/player.cc')
| -rw-r--r-- | src/lib/player.cc | 92 |
1 files changed, 88 insertions, 4 deletions
diff --git a/src/lib/player.cc b/src/lib/player.cc index e9ca38c81..29237d93e 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -140,18 +140,102 @@ Player::construct () auto film = _film.lock(); DCPOMATIC_ASSERT(film); + connect(); + set_video_container_size(film->frame_size()); + + film_change (ChangeType::DONE, Film::Property::AUDIO_PROCESSOR); + + setup_pieces (); + seek (DCPTime (), true); +} + + +void +Player::connect() +{ + auto film = _film.lock(); + DCPOMATIC_ASSERT(film); + _film_changed_connection = film->Change.connect(bind(&Player::film_change, this, _1, _2)); /* The butler must hear about this first, so since we are proxying this through to the butler we must be first. */ _playlist_change_connection = playlist()->Change.connect (bind (&Player::playlist_change, this, _1), boost::signals2::at_front); _playlist_content_change_connection = playlist()->ContentChange.connect (bind(&Player::playlist_content_change, this, _1, _3, _4)); - set_video_container_size(film->frame_size()); +} - film_change (ChangeType::DONE, Film::Property::AUDIO_PROCESSOR); - setup_pieces (); - seek (DCPTime (), true); +Player::Player(Player&& other) + : _film(other._film) + , _playlist(std::move(other._playlist)) + , _suspended(other._suspended.load()) + , _pieces(std::move(other._pieces)) + , _video_container_size(other._video_container_size.load()) + , _black_image(std::move(other._black_image)) + , _ignore_video(other._ignore_video.load()) + , _ignore_audio(other._ignore_audio.load()) + , _ignore_text(other._ignore_text.load()) + , _always_burn_open_subtitles(other._always_burn_open_subtitles.load()) + , _fast(other._fast.load()) + , _tolerant(other._tolerant) + , _play_referenced(other._play_referenced.load()) + , _next_video_time(other._next_video_time) + , _next_audio_time(other._next_audio_time) + , _dcp_decode_reduction(other._dcp_decode_reduction.load()) + , _last_video(std::move(other._last_video)) + , _audio_merger(std::move(other._audio_merger)) + , _shuffler(std::move(other._shuffler)) + , _delay(std::move(other._delay)) + , _stream_states(std::move(other._stream_states)) + , _black(std::move(other._black)) + , _silent(std::move(other._silent)) + , _active_texts(std::move(other._active_texts)) + , _audio_processor(std::move(other._audio_processor)) + , _playback_length(other._playback_length.load()) + , _subtitle_alignment(other._subtitle_alignment) +{ + connect(); +} + + +Player& +Player::operator=(Player&& other) +{ + if (this == &other) { + return *this; + } + + _film = std::move(other._film); + _playlist = std::move(other._playlist); + _suspended = other._suspended.load(); + _pieces = std::move(other._pieces); + _video_container_size = other._video_container_size.load(); + _black_image = std::move(other._black_image); + _ignore_video = other._ignore_video.load(); + _ignore_audio = other._ignore_audio.load(); + _ignore_text = other._ignore_text.load(); + _always_burn_open_subtitles = other._always_burn_open_subtitles.load(); + _fast = other._fast.load(); + _tolerant = other._tolerant; + _play_referenced = other._play_referenced.load(); + _next_video_time = other._next_video_time; + _next_audio_time = other._next_audio_time; + _dcp_decode_reduction = other._dcp_decode_reduction.load(); + _last_video = std::move(other._last_video); + _audio_merger = std::move(other._audio_merger); + _shuffler = std::move(other._shuffler); + _delay = std::move(other._delay); + _stream_states = std::move(other._stream_states); + _black = std::move(other._black); + _silent = std::move(other._silent); + _active_texts = std::move(other._active_texts); + _audio_processor = std::move(other._audio_processor); + _playback_length = other._playback_length.load(); + _subtitle_alignment = other._subtitle_alignment; + + connect(); + + return *this; } |
