Fix finding of subtitles when clicking in the list view.
[dcpomatic.git] / src / wx / text_view.cc
index 49a98dc5e3c06f4647aa742093c50f6a5061a613..491df7b3b9693c16cca8313ea1f1a5d739bdfc79 100644 (file)
@@ -35,6 +35,10 @@ using boost::shared_ptr;
 using boost::weak_ptr;
 using boost::bind;
 using boost::dynamic_pointer_cast;
+using namespace dcpomatic;
+#if BOOST_VERSION >= 106100
+using namespace boost::placeholders;
+#endif
 
 TextView::TextView (
        wxWindow* parent, shared_ptr<Film> film, shared_ptr<Content> content, shared_ptr<TextContent> text, shared_ptr<Decoder> decoder, weak_ptr<FilmViewer> viewer
@@ -96,7 +100,7 @@ TextView::TextView (
                        i->Stop.connect (bind (&TextView::data_stop, this, _1));
                }
        }
-       while (!decoder->pass (film)) {}
+       while (!decoder->pass ()) {}
        SetSizerAndFit (sizer);
 }
 
@@ -140,5 +144,6 @@ TextView::subtitle_selected (wxListEvent& ev)
        DCPOMATIC_ASSERT (lc);
        shared_ptr<FilmViewer> fv = _film_viewer.lock ();
        DCPOMATIC_ASSERT (fv);
-       fv->seek (lc, _start_times[ev.GetIndex()], true);
+       /* Add on a frame here to work around any rounding errors and make sure land in the subtitle */
+       fv->seek (lc, _start_times[ev.GetIndex()] + ContentTime::from_frames(1, _frc->source), true);
 }