From 84012cdd64f451891febd36154b7226ea21a899b Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 21 Nov 2018 02:45:30 +0000 Subject: Put Film pointer into Decoder. --- src/lib/decoder.cc | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'src/lib/decoder.cc') diff --git a/src/lib/decoder.cc b/src/lib/decoder.cc index fb7663f5c..52e8c04e6 100644 --- a/src/lib/decoder.cc +++ b/src/lib/decoder.cc @@ -28,24 +28,32 @@ using std::cout; using boost::optional; using boost::shared_ptr; +using boost::weak_ptr; + +Decoder::Decoder (weak_ptr film) + : _film (film) +{ + +} /** @return Earliest time of content that the next pass() will emit */ ContentTime -Decoder::position (shared_ptr film) const +Decoder::position () const { optional pos; + shared_ptr f = film(); - if (video && !video->ignore() && (!pos || video->position(film) < *pos)) { - pos = video->position(film); + if (video && !video->ignore() && (!pos || video->position(f) < *pos)) { + pos = video->position(f); } - if (audio && !audio->ignore() && (!pos || audio->position(film) < *pos)) { - pos = audio->position(film); + if (audio && !audio->ignore() && (!pos || audio->position(f) < *pos)) { + pos = audio->position(f); } BOOST_FOREACH (shared_ptr i, text) { - if (!i->ignore() && (!pos || i->position(film) < *pos)) { - pos = i->position(film); + if (!i->ignore() && (!pos || i->position(f) < *pos)) { + pos = i->position(f); } } @@ -53,7 +61,7 @@ Decoder::position (shared_ptr film) const } void -Decoder::seek (shared_ptr, ContentTime, bool) +Decoder::seek (ContentTime, bool) { if (video) { video->seek (); @@ -75,3 +83,11 @@ Decoder::only_text () const } return text.front (); } + +shared_ptr +Decoder::film () const +{ + shared_ptr f = _film.lock (); + DCPOMATIC_ASSERT (f); + return f; +} -- cgit v1.2.3