+using boost::shared_ptr;
+
+/** @return Earliest time of content that the next pass() will emit */
+ContentTime
+Decoder::position () const
+{
+ optional<ContentTime> pos;
+
+ if (video && !video->ignore() && (!pos || video->position() < *pos)) {
+ pos = video->position();
+ }
+
+ if (audio && !audio->ignore() && (!pos || audio->position() < *pos)) {
+ pos = audio->position();
+ }
+
+ BOOST_FOREACH (shared_ptr<TextDecoder> i, text) {
+ if (!i->ignore() && (!pos || i->position() < *pos)) {
+ pos = i->position();
+ }
+ }
+
+ return pos.get_value_or(ContentTime());
+}