Put times in subtitle view.
authorCarl Hetherington <cth@carlh.net>
Fri, 20 Jun 2014 14:53:05 +0000 (15:53 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 20 Jun 2014 14:53:05 +0000 (15:53 +0100)
src/lib/frame_rate_change.cc
src/lib/frame_rate_change.h
src/lib/playlist.cc
src/wx/subtitle_panel.cc
src/wx/subtitle_view.cc
src/wx/subtitle_view.h

index 3e9c4b50528c4bf0fb3e4fe2fc786015d32c4a43..454938ada3d5043de1e983b28b40be7c2a057dd5 100644 (file)
@@ -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)
 {
index 92af0ec0174635586161726426ed0295a7e512e7..f53adc05925c1dea9fa461a491c54f2c111b6f23 100644 (file)
@@ -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) */
index 41ed00b24d6c06b341a300f40c732b357ca96a1f..e555db9ba7387d55fccf963fb5015663233a5fdc 100644 (file)
@@ -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;
index aa3d3a73547757de1ac2a01537ada723597305f5..b68b491d77749eaa80c0bbdbbf49b32e9c2c9fcf 100644 (file)
@@ -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 ();
index d14f260c9c8ba4098e39527ab960514a38ac3df0..b8b62b586f094a2f0034c327b232fbe0dacaf287 100644 (file)
 
 #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;
                }
        }
index 94a25b70cbe8e738bc57e6ac2283e7beda86cfb1..2edc28c09e9aaf5905c42c18a97f6a8f669f9959 100644 (file)
@@ -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;