using boost::bind;
using boost::dynamic_pointer_cast;
-CaptionView::CaptionView (wxWindow* parent, shared_ptr<Film> film, shared_ptr<Content> content, shared_ptr<Decoder> decoder, FilmViewer* viewer)
+CaptionView::CaptionView (wxWindow* parent, shared_ptr<Film> film, shared_ptr<Content> content, shared_ptr<CaptionContent> caption, shared_ptr<Decoder> decoder, FilmViewer* viewer)
: wxDialog (parent, wxID_ANY, _("Captions"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
, _content (content)
, _film_viewer (viewer)
_subs = 0;
_frc = film->active_frame_rate_change (content->position());
- decoder->caption->PlainStart.connect (bind (&CaptionView::data_start, this, _1));
- decoder->caption->Stop.connect (bind (&CaptionView::data_stop, this, _1));
+
+ /* Find the decoder that is being used for our CaptionContent and attach to it */
+ BOOST_FOREACH (shared_ptr<CaptionDecoder> i, decoder->caption) {
+ if (i->content() == caption) {
+ i->PlainStart.connect (bind (&CaptionView::data_start, this, _1));
+ i->Stop.connect (bind (&CaptionView::data_stop, this, _1));
+ }
+ }
while (!decoder->pass ()) {}
SetSizerAndFit (sizer);
}