diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-06-20 15:53:05 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-06-20 15:53:05 +0100 |
| commit | 4d54b053b6e9565e026554b1dba31d73a1b492ae (patch) | |
| tree | 152f5c4cb1cee20c6070c533e67b4fdb2f402944 /src | |
| parent | 194615b5f673214b1e4fc4211364f95eeb96af15 (diff) | |
Put times in subtitle view.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/frame_rate_change.cc | 6 | ||||
| -rw-r--r-- | src/lib/frame_rate_change.h | 3 | ||||
| -rw-r--r-- | src/lib/playlist.cc | 5 | ||||
| -rw-r--r-- | src/wx/subtitle_panel.cc | 2 | ||||
| -rw-r--r-- | src/wx/subtitle_view.cc | 11 | ||||
| -rw-r--r-- | src/wx/subtitle_view.h | 2 |
6 files changed, 23 insertions, 6 deletions
diff --git a/src/lib/frame_rate_change.cc b/src/lib/frame_rate_change.cc index 3e9c4b505..454938ada 100644 --- a/src/lib/frame_rate_change.cc +++ b/src/lib/frame_rate_change.cc @@ -51,8 +51,10 @@ about_equal (float a, float b) } -FrameRateChange::FrameRateChange (float source, int dcp) - : skip (false) +FrameRateChange::FrameRateChange (float source_, int dcp_) + : source (source_) + , dcp (dcp_) + , skip (false) , repeat (1) , change_speed (false) { diff --git a/src/lib/frame_rate_change.h b/src/lib/frame_rate_change.h index 92af0ec01..f53adc059 100644 --- a/src/lib/frame_rate_change.h +++ b/src/lib/frame_rate_change.h @@ -37,6 +37,9 @@ struct FrameRateChange return repeat; } + float source; + int dcp; + /** true to skip every other frame */ bool skip; /** number of times to use each frame (e.g. 1 is normal, 2 means repeat each frame once, and so on) */ diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc index 41ed00b24..e555db9ba 100644 --- a/src/lib/playlist.cc +++ b/src/lib/playlist.cc @@ -194,6 +194,11 @@ Playlist::has_subtitles () const if (fc && !fc->subtitle_streams().empty()) { return true; } + + shared_ptr<SubtitleContent> sc = dynamic_pointer_cast<SubtitleContent> (*i); + if (sc) { + return true; + } } return false; diff --git a/src/wx/subtitle_panel.cc b/src/wx/subtitle_panel.cc index aa3d3a735..b68b491d7 100644 --- a/src/wx/subtitle_panel.cc +++ b/src/wx/subtitle_panel.cc @@ -247,7 +247,7 @@ SubtitlePanel::view_clicked () assert (c.size() == 1); shared_ptr<SubRipContent> sr = dynamic_pointer_cast<SubRipContent> (c.front ()); if (sr) { - _view = new SubtitleView (this, sr); + _view = new SubtitleView (this, _editor->film(), sr); } _view->Show (); diff --git a/src/wx/subtitle_view.cc b/src/wx/subtitle_view.cc index d14f260c9..b8b62b586 100644 --- a/src/wx/subtitle_view.cc +++ b/src/wx/subtitle_view.cc @@ -19,13 +19,16 @@ #include "lib/subrip_decoder.h" #include "lib/content_subtitle.h" +#include "lib/film.h" +#include "lib/subrip_content.h" #include "subtitle_view.h" +#include "wx_util.h" using std::list; using boost::shared_ptr; using boost::dynamic_pointer_cast; -SubtitleView::SubtitleView (wxWindow* parent, shared_ptr<SubRipContent> content) +SubtitleView::SubtitleView (wxWindow* parent, shared_ptr<Film> film, shared_ptr<SubRipContent> content) : wxDialog (parent, wxID_ANY, _("Subtitles")) { _list = new wxListCtrl (this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_SINGLE_SEL); @@ -64,13 +67,17 @@ SubtitleView::SubtitleView (wxWindow* parent, shared_ptr<SubRipContent> content) shared_ptr<SubRipDecoder> decoder (new SubRipDecoder (content)); list<shared_ptr<ContentTextSubtitle> > subs = decoder->get_text_subtitles (ContentTimePeriod (ContentTime(), ContentTime::max ())); + FrameRateChange const frc = film->active_frame_rate_change (content->position ()); int n = 0; for (list<shared_ptr<ContentTextSubtitle> >::const_iterator i = subs.begin(); i != subs.end(); ++i) { for (list<dcp::SubtitleString>::const_iterator j = (*i)->subs.begin(); j != (*i)->subs.end(); ++j) { wxListItem list_item; list_item.SetId (n); _list->InsertItem (list_item); - _list->SetItem (n, 2, j->text ()); + ContentTimePeriod const p = (*i)->period (); + _list->SetItem (n, 0, std_to_wx (p.from.timecode (frc.source))); + _list->SetItem (n, 1, std_to_wx (p.to.timecode (frc.source))); + _list->SetItem (n, 2, std_to_wx (j->text ())); ++n; } } diff --git a/src/wx/subtitle_view.h b/src/wx/subtitle_view.h index 94a25b70c..2edc28c09 100644 --- a/src/wx/subtitle_view.h +++ b/src/wx/subtitle_view.h @@ -26,7 +26,7 @@ class SubRipContent; class SubtitleView : public wxDialog { public: - SubtitleView (wxWindow *, boost::shared_ptr<SubRipContent>); + SubtitleView (wxWindow *, boost::shared_ptr<Film>, boost::shared_ptr<SubRipContent>); private: wxListCtrl* _list; |
