diff options
| author | Carl Hetherington <cth@carlh.net> | 2018-11-21 02:45:30 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2018-11-21 02:45:30 +0000 |
| commit | 84012cdd64f451891febd36154b7226ea21a899b (patch) | |
| tree | 096fb898aa14d936dfc8f8598a6908337508233c /src/lib/decoder.cc | |
| parent | 254b3044d72de6b033d7c584f5abd2b9aa70aad5 (diff) | |
Put Film pointer into Decoder.
Diffstat (limited to 'src/lib/decoder.cc')
| -rw-r--r-- | src/lib/decoder.cc | 32 |
1 files changed, 24 insertions, 8 deletions
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<const Film> film) + : _film (film) +{ + +} /** @return Earliest time of content that the next pass() will emit */ ContentTime -Decoder::position (shared_ptr<const Film> film) const +Decoder::position () const { optional<ContentTime> pos; + shared_ptr<const Film> 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<TextDecoder> 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<const Film> film) const } void -Decoder::seek (shared_ptr<const Film>, ContentTime, bool) +Decoder::seek (ContentTime, bool) { if (video) { video->seek (); @@ -75,3 +83,11 @@ Decoder::only_text () const } return text.front (); } + +shared_ptr<const Film> +Decoder::film () const +{ + shared_ptr<const Film> f = _film.lock (); + DCPOMATIC_ASSERT (f); + return f; +} |
