diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-06-07 16:03:38 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-06-07 16:03:38 +0100 |
| commit | 2860640c7cf39410bfb21f69ce05e345e9078fa3 (patch) | |
| tree | 74257b09ee318c72f13c21f14e38a57388a33e62 /src/lib/transcoder.cc | |
| parent | c91561e2981e0e089f723d7d26d1ea6fccec201b (diff) | |
Replace a shared_ptr with a weak_ptr.
Diffstat (limited to 'src/lib/transcoder.cc')
| -rw-r--r-- | src/lib/transcoder.cc | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/lib/transcoder.cc b/src/lib/transcoder.cc index 8afd64709..fd44e4df7 100644 --- a/src/lib/transcoder.cc +++ b/src/lib/transcoder.cc @@ -53,7 +53,7 @@ using boost::dynamic_pointer_cast; * @param f Film that we are transcoding. * @param j Job that this transcoder is being used in. */ -Transcoder::Transcoder (shared_ptr<const Film> film, shared_ptr<Job> j) +Transcoder::Transcoder (shared_ptr<const Film> film, weak_ptr<Job> j) : _film (film) , _job (j) , _player (new Player (film, film->playlist ())) @@ -70,7 +70,11 @@ Transcoder::go () _writer->start (); _encoder->begin (); - _job->sub (_("Encoding picture and sound")); + { + shared_ptr<Job> job = _job.lock (); + DCPOMATIC_ASSERT (job); + job->sub (_("Encoding picture and sound")); + } DCPTime const frame = DCPTime::from_frames (1, _film->video_frame_rate ()); DCPTime const length = _film->length (); @@ -99,7 +103,11 @@ Transcoder::go () _writer->write (_player->get_subtitles (t, frame, true, false, true)); } - _job->set_progress (float(t.get()) / length.get()); + { + shared_ptr<Job> job = _job.lock (); + DCPOMATIC_ASSERT (job); + job->set_progress (float(t.get()) / length.get()); + } } BOOST_FOREACH (ReferencedReelAsset i, _player->get_reel_assets ()) { |
