Remove old looping method.
authorCarl Hetherington <cth@carlh.net>
Fri, 19 Jul 2013 11:10:37 +0000 (12:10 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 19 Jul 2013 11:10:37 +0000 (12:10 +0100)
13 files changed:
src/lib/analyse_audio_job.cc
src/lib/film.cc
src/lib/film.h
src/lib/player.cc
src/lib/playlist.cc
src/lib/playlist.h
src/lib/transcode_job.cc
src/lib/writer.cc
src/wx/film_editor.cc
src/wx/film_editor.h
src/wx/film_viewer.cc
src/wx/properties_dialog.cc
src/wx/timeline.cc

index 9a911669095bdfba9cbb3f31262c7d01f733b6cf..2848c1ed773c16dfe5b6acbf0b3c0f6b61f65aac 100644 (file)
@@ -68,14 +68,14 @@ AnalyseAudioJob::run ()
        
        player->Audio.connect (bind (&AnalyseAudioJob::audio, this, _1, _2));
 
-       _samples_per_point = max (int64_t (1), _film->time_to_audio_frames (_film->length_without_loop()) / _num_points);
+       _samples_per_point = max (int64_t (1), _film->time_to_audio_frames (_film->length()) / _num_points);
 
        _current.resize (_film->dcp_audio_channels ());
        _analysis.reset (new AudioAnalysis (_film->dcp_audio_channels ()));
 
        _done = 0;
        while (!player->pass ()) {
-               set_progress (double (_film->audio_frames_to_time (_done)) / _film->length_without_loop ());
+               set_progress (double (_film->audio_frames_to_time (_done)) / _film->length ());
        }
 
        _analysis->write (content->audio_analysis_path ());
index 2bb8b3155cf36b145d775cf239fe31fb5d5f1d6f..172fd20abaf4ea561d9379fb168ad009a47bde2f 100644 (file)
@@ -246,7 +246,7 @@ Film::make_dcp ()
                throw MissingSettingError (_("container"));
        }
 
-       if (content_without_loop().empty()) {
+       if (content().empty()) {
                throw StringError (_("You must add some content to the DCP before creating it"));
        }
 
@@ -729,9 +729,9 @@ Film::playlist () const
 }
 
 Playlist::ContentList
-Film::content_without_loop () const
+Film::content () const
 {
-       return _playlist->content_without_loop ();
+       return _playlist->content ();
 }
 
 void
@@ -769,15 +769,9 @@ Film::remove_content (shared_ptr<Content> c)
 }
 
 Time
-Film::length_with_loop () const
+Film::length () const
 {
-       return _playlist->length_with_loop ();
-}
-
-Time
-Film::length_without_loop () const
-{
-       return _playlist->length_without_loop ();
+       return _playlist->length ();
 }
 
 bool
@@ -810,18 +804,6 @@ Film::playlist_changed ()
        signal_changed (CONTENT);
 }      
 
-int
-Film::loop () const
-{
-       return _playlist->loop ();
-}
-
-void
-Film::set_loop (int c)
-{
-       _playlist->set_loop (c);
-}
-
 OutputAudioFrame
 Film::time_to_audio_frames (Time t) const
 {
index 1f389988502f3f7dbd9a28bf321dc02a41973c97..497320c5e0bbb9c3cb8f218fff1fabc791138eab 100644 (file)
@@ -106,16 +106,12 @@ public:
 
        /* Proxies for some Playlist methods */
 
-       Playlist::ContentList content_without_loop () const;
+       Playlist::ContentList content () const;
 
-       Time length_with_loop () const;
-       Time length_without_loop () const;
+       Time length () const;
        bool has_subtitles () const;
        OutputVideoFrame best_dcp_video_frame_rate () const;
 
-       void set_loop (int);
-       int loop () const;
-
        void set_sequence_video (bool);
 
        /** Identifiers for the parts of our state;
@@ -127,7 +123,6 @@ public:
                USE_DCI_NAME,
                /** The playlist's content list has changed (i.e. content has been added, moved around or removed) */
                CONTENT,
-               LOOP,
                DCP_CONTENT_TYPE,
                CONTAINER,
                RESOLUTION,
index f5212f8d016f34e727fcc81d11c3354445884f47..ec20892effe9ec571d89e3c6cbb33bb2a68c70cd 100644 (file)
@@ -401,7 +401,7 @@ Player::setup_pieces ()
 
        _pieces.clear ();
 
-       Playlist::ContentList content = _playlist->content_with_loop ();
+       Playlist::ContentList content = _playlist->content ();
        sort (content.begin(), content.end(), ContentSorter ());
 
        for (Playlist::ContentList::iterator i = content.begin(); i != content.end(); ++i) {
index 172b6fbb96f6dbb82cdec0f0b912ae311e7747b4..c70c79972f0d44891393a7f1d49fce5cc0a67a69 100644 (file)
@@ -49,8 +49,7 @@ using boost::dynamic_pointer_cast;
 using boost::lexical_cast;
 
 Playlist::Playlist ()
-       : _loop (1)
-       , _sequence_video (true)
+       : _sequence_video (true)
        , _sequencing_video (false)
 {
 
@@ -109,8 +108,6 @@ Playlist::video_identifier () const
                }
        }
 
-       t += lexical_cast<string> (_loop);
-
        return md5_digest (t.c_str(), t.length());
 }
 
@@ -124,7 +121,6 @@ Playlist::set_from_xml (shared_ptr<const Film> film, shared_ptr<const cxml::Node
        }
 
        reconnect ();
-       _loop = node->number_child<int> ("Loop");
        _sequence_video = node->bool_child ("SequenceVideo");
 }
 
@@ -136,7 +132,6 @@ Playlist::as_xml (xmlpp::Node* node)
                (*i)->as_xml (node->add_child ("Content"));
        }
 
-       node->add_child("Loop")->add_child_text(lexical_cast<string> (_loop));
        node->add_child("SequenceVideo")->add_child_text(_sequence_video ? "1" : "0");
 }
 
@@ -162,13 +157,6 @@ Playlist::remove (shared_ptr<Content> c)
        }
 }
 
-void
-Playlist::set_loop (int l)
-{
-       _loop = l;
-       Changed ();
-}
-
 bool
 Playlist::has_subtitles () const
 {
@@ -246,7 +234,7 @@ Playlist::best_dcp_frame_rate () const
 }
 
 Time
-Playlist::length_without_loop () const
+Playlist::length () const
 {
        Time len = 0;
        for (ContentList::const_iterator i = _content.begin(); i != _content.end(); ++i) {
@@ -256,12 +244,6 @@ Playlist::length_without_loop () const
        return len;
 }
 
-Time
-Playlist::length_with_loop () const
-{
-       return length_without_loop() * _loop;
-}
-
 void
 Playlist::reconnect ()
 {
@@ -301,29 +283,9 @@ ContentSorter::operator() (shared_ptr<Content> a, shared_ptr<Content> b)
        return a->start() < b->start();
 }
 
-/** @return content in an undefined order, not taking looping into account */
+/** @return content in an undefined order */
 Playlist::ContentList
-Playlist::content_without_loop () const
+Playlist::content () const
 {
        return _content;
 }
-
-/** @return content in an undefined order, taking looping into account */
-Playlist::ContentList
-Playlist::content_with_loop () const
-{
-       ContentList looped = _content;
-       Time const length = length_without_loop ();
-
-       Time offset = length;
-       for (int i = 1; i < _loop; ++i) {
-               for (ContentList::const_iterator i = _content.begin(); i != _content.end(); ++i) {
-                       shared_ptr<Content> copy = (*i)->clone ();
-                       copy->set_start (copy->start() + offset);
-                       looped.push_back (copy);
-               }
-               offset += length;
-       }
-       
-       return looped;
-}
index 330681c560ac583b1dca3d4ed8ed788f8ba86099..735ef7a4323b313eed06d5d982fb8db905051703 100644 (file)
@@ -65,19 +65,11 @@ public:
 
        typedef std::vector<boost::shared_ptr<Content> > ContentList;
 
-       ContentList content_without_loop () const;
-       ContentList content_with_loop () const;
+       ContentList content () const;
 
        std::string video_identifier () const;
 
-       int loop () const {
-               return _loop;
-       }
-       
-       void set_loop (int l);
-
-       Time length_without_loop () const;
-       Time length_with_loop () const;
+       Time length () const;
        
        int best_dcp_frame_rate () const;
        Time video_end () const;
@@ -94,7 +86,6 @@ private:
        void reconnect ();
 
        ContentList _content;
-       int _loop;
        bool _sequence_video;
        bool _sequencing_video;
        std::list<boost::signals2::connection> _content_connections;
index f0faf7c637205ba3f46b2aa05b35af9946970f2e..6d5edd7c060c662dc404445c1e3ed1a1175d4ace 100644 (file)
@@ -111,6 +111,6 @@ TranscodeJob::remaining_time () const
        }
 
        /* Compute approximate proposed length here, as it's only here that we need it */
-       OutputVideoFrame const left = _film->time_to_video_frames (_film->length_with_loop ()) - _transcoder->video_frames_out();
+       OutputVideoFrame const left = _film->time_to_video_frames (_film->length ()) - _transcoder->video_frames_out();
        return left / fps;
 }
index b3d2fdb1c74330190f993798802abba3db4d2437..c5360a122f4e0afa277abec1cdd24a5ead2dd2ed 100644 (file)
@@ -204,9 +204,9 @@ try
                        }
                        lock.lock ();
                        
-                       if (_film->length_with_loop()) {
+                       if (_film->length()) {
                                _job->set_progress (
-                                       float (_full_written + _fake_written + _repeat_written) / _film->time_to_video_frames (_film->length_with_loop())
+                                       float (_full_written + _fake_written + _repeat_written) / _film->time_to_video_frames (_film->length())
                                        );
                        }
 
index 427afb6e807b9971fcbb9e0b50be90da23aede44..f087bf84cf2887f393e2eeaccc321e9f031b047e 100644 (file)
@@ -214,8 +214,6 @@ FilmEditor::connect_to_widgets ()
        _content_add->Connect            (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED,       wxCommandEventHandler (FilmEditor::content_add_clicked), 0, this);
        _content_remove->Connect         (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED,       wxCommandEventHandler (FilmEditor::content_remove_clicked), 0, this);
        _content_timeline->Connect       (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED,       wxCommandEventHandler (FilmEditor::content_timeline_clicked), 0, this);
-       _loop_content->Connect           (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED,     wxCommandEventHandler (FilmEditor::loop_content_toggled), 0, this);
-       _loop_count->Connect             (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED,     wxCommandEventHandler (FilmEditor::loop_count_changed), 0, this);
        _left_crop->Connect              (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED,     wxCommandEventHandler (FilmEditor::left_crop_changed), 0, this);
        _right_crop->Connect             (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED,     wxCommandEventHandler (FilmEditor::right_crop_changed), 0, this);
        _top_crop->Connect               (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED,     wxCommandEventHandler (FilmEditor::top_crop_changed), 0, this);
@@ -336,14 +334,6 @@ FilmEditor::make_content_panel ()
                _content_sizer->Add (s, 0.75, wxEXPAND | wxALL, 6);
        }
 
-       wxBoxSizer* h = new wxBoxSizer (wxHORIZONTAL);
-       _loop_content = new wxCheckBox (_content_panel, wxID_ANY, _("Loop everything"));
-       h->Add (_loop_content, 0, wxALL, 6);
-       _loop_count = new wxSpinCtrl (_content_panel, wxID_ANY);
-       h->Add (_loop_count, 0, wxALL, 6);
-       add_label_to_sizer (h, _content_panel, _("times"), false);
-       _content_sizer->Add (h, 0, wxALL, 6);
-
        _content_notebook = new wxNotebook (_content_panel, wxID_ANY);
        _content_sizer->Add (_content_notebook, 1, wxEXPAND | wxTOP, 6);
 
@@ -355,8 +345,6 @@ FilmEditor::make_content_panel ()
        _content_notebook->AddPage (_subtitle_panel, _("Subtitles"), false);
        make_timing_panel ();
        _content_notebook->AddPage (_timing_panel, _("Timing"), false);
-
-       _loop_count->SetRange (2, 1024);
 }
 
 void
@@ -622,11 +610,6 @@ FilmEditor::film_changed (Film::Property p)
                setup_subtitle_control_sensitivity ();
                setup_show_audio_sensitivity ();
                break;
-       case Film::LOOP:
-               checked_set (_loop_content, _film->loop() > 1);
-               checked_set (_loop_count, _film->loop());
-               setup_loop_sensitivity ();
-               break;
        case Film::CONTAINER:
                setup_container ();
                break;
@@ -879,7 +862,6 @@ FilmEditor::set_film (shared_ptr<Film> f)
        film_changed (Film::NAME);
        film_changed (Film::USE_DCI_NAME);
        film_changed (Film::CONTENT);
-       film_changed (Film::LOOP);
        film_changed (Film::DCP_CONTENT_TYPE);
        film_changed (Film::CONTAINER);
        film_changed (Film::RESOLUTION);
@@ -890,8 +872,8 @@ FilmEditor::set_film (shared_ptr<Film> f)
        film_changed (Film::DCP_VIDEO_FRAME_RATE);
        film_changed (Film::DCP_AUDIO_CHANNELS);
 
-       if (!_film->content_without_loop().empty ()) {
-               set_selection (_film->content_without_loop().front ());
+       if (!_film->content().empty ()) {
+               set_selection (_film->content().front ());
        }
 
        wxListEvent ev;
@@ -926,8 +908,6 @@ FilmEditor::set_things_sensitive (bool s)
        _show_audio->Enable (s);
        _audio_delay->Enable (s);
        _container->Enable (s);
-       _loop_content->Enable (s);
-       _loop_count->Enable (s);
 
        setup_subtitle_control_sensitivity ();
        setup_show_audio_sensitivity ();
@@ -1152,7 +1132,7 @@ FilmEditor::setup_content ()
        
        _content->DeleteAllItems ();
 
-       Playlist::ContentList content = _film->content_without_loop ();
+       Playlist::ContentList content = _film->content ();
        for (Playlist::ContentList::iterator i = content.begin(); i != content.end(); ++i) {
                int const t = _content->GetItemCount ();
                _content->InsertItem (t, std_to_wx ((*i)->summary ()));
@@ -1260,7 +1240,7 @@ FilmEditor::selected_content ()
                return shared_ptr<Content> ();
        }
 
-       Playlist::ContentList c = _film->content_without_loop ();
+       Playlist::ContentList c = _film->content ();
        if (s < 0 || size_t (s) >= c.size ()) {
                return shared_ptr<Content> ();
        }
@@ -1365,30 +1345,6 @@ FilmEditor::setup_scaling_description ()
        _scaling_description->SetLabel (d);
 }
 
-void
-FilmEditor::loop_content_toggled (wxCommandEvent &)
-{
-       if (_loop_content->GetValue ()) {
-               _film->set_loop (_loop_count->GetValue ());
-       } else {
-               _film->set_loop (1);
-       }
-               
-       setup_loop_sensitivity ();
-}
-
-void
-FilmEditor::loop_count_changed (wxCommandEvent &)
-{
-       _film->set_loop (_loop_count->GetValue ());
-}
-
-void
-FilmEditor::setup_loop_sensitivity ()
-{
-       _loop_count->Enable (_loop_content->GetValue ());
-}
-
 void
 FilmEditor::content_timeline_clicked (wxCommandEvent &)
 {
@@ -1510,7 +1466,7 @@ FilmEditor::length_changed ()
 void
 FilmEditor::set_selection (weak_ptr<Content> wc)
 {
-       Playlist::ContentList content = _film->content_without_loop ();
+       Playlist::ContentList content = _film->content ();
        for (size_t i = 0; i < content.size(); ++i) {
                if (content[i] == wc.lock ()) {
                        _content->SetItemState (i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
index c965a7aff546d4766c0e69609e5980c45716a093..a7e8ab197c1033c15300f123b975e4f36813de14 100644 (file)
@@ -87,8 +87,6 @@ private:
        void dcp_frame_rate_changed (wxCommandEvent &);
        void best_dcp_frame_rate_clicked (wxCommandEvent &);
        void edit_filters_clicked (wxCommandEvent &);
-       void loop_content_toggled (wxCommandEvent &);
-       void loop_count_changed (wxCommandEvent &);
        void content_timeline_clicked (wxCommandEvent &);
        void audio_stream_changed (wxCommandEvent &);
        void subtitle_stream_changed (wxCommandEvent &);
@@ -112,7 +110,6 @@ private:
        void setup_content ();
        void setup_container ();
        void setup_content_sensitivity ();
-       void setup_loop_sensitivity ();
        
        void active_jobs_changed (bool);
        boost::shared_ptr<Content> selected_content ();
@@ -143,8 +140,6 @@ private:
        wxButton* _content_earlier;
        wxButton* _content_later;
        wxButton* _content_timeline;
-       wxCheckBox* _loop_content;
-       wxSpinCtrl* _loop_count;
        wxButton* _edit_dci_button;
        wxChoice* _ratio;
        wxStaticText* _ratio_description;
index d00a582e5d0eb52f7ca1cdda2207245bd227a128..fffb64796e67e3a7d05c61af479f1841c49cee07 100644 (file)
@@ -164,7 +164,7 @@ FilmViewer::timer (wxTimerEvent &)
        
        fetch_next_frame ();
 
-       Time const len = _film->length_with_loop ();
+       Time const len = _film->length ();
 
        if (len) {
                int const new_slider_position = 4096 * _player->video_position() / len;
@@ -213,7 +213,7 @@ void
 FilmViewer::slider_moved (wxScrollEvent &)
 {
        if (_film && _player) {
-               _player->seek (_slider->GetValue() * _film->length_with_loop() / 4096, false);
+               _player->seek (_slider->GetValue() * _film->length() / 4096, false);
                fetch_next_frame ();
        }
 }
index b8d97cb59c795014ff2ecdd7d382b27365537b3c..d525fe38b115d059bd2cc2f279952540dccb456b 100644 (file)
@@ -50,8 +50,8 @@ PropertiesDialog::PropertiesDialog (wxWindow* parent, shared_ptr<Film> film)
        _encoded = new ThreadedStaticText (this, _("counting..."), boost::bind (&PropertiesDialog::frames_already_encoded, this));
        table->Add (_encoded, 1, wxALIGN_CENTER_VERTICAL);
 
-       _frames->SetLabel (std_to_wx (lexical_cast<string> (_film->time_to_video_frames (_film->length_with_loop()))));
-       double const disk = ((double) _film->j2k_bandwidth() / 8) * _film->length_with_loop() / (TIME_HZ * 1073741824.0f);
+       _frames->SetLabel (std_to_wx (lexical_cast<string> (_film->time_to_video_frames (_film->length()))));
+       double const disk = ((double) _film->j2k_bandwidth() / 8) * _film->length() / (TIME_HZ * 1073741824.0f);
        stringstream s;
        s << fixed << setprecision (1) << disk << wx_to_std (_("Gb"));
        _disk->SetLabel (std_to_wx (s.str ()));
@@ -78,9 +78,9 @@ PropertiesDialog::frames_already_encoded () const
                return "";
        }
        
-       if (_film->length_with_loop()) {
+       if (_film->length()) {
                /* XXX: encoded_frames() should check which frames have been encoded */
-               u << " (" << (_film->encoded_frames() * 100 / _film->time_to_video_frames (_film->length_with_loop())) << "%)";
+               u << " (" << (_film->encoded_frames() * 100 / _film->time_to_video_frames (_film->length())) << "%)";
        }
        return u.str ();
 }
index 3747a3dac0c44574e271d4bac6afdf95ae07648c..8d70a938132fef2c10941493be95235f3c1dbda4 100644 (file)
@@ -375,7 +375,7 @@ Timeline::playlist_changed ()
 
        _views.clear ();
 
-       Playlist::ContentList content = fl->playlist()->content_with_loop ();
+       Playlist::ContentList content = fl->playlist()->content ();
 
        for (Playlist::ContentList::iterator i = content.begin(); i != content.end(); ++i) {
                if (dynamic_pointer_cast<VideoContent> (*i)) {
@@ -460,7 +460,7 @@ Timeline::setup_pixels_per_time_unit ()
                return;
        }
 
-       _pixels_per_time_unit = static_cast<double>(width() - x_offset() * 2) / film->length_with_loop();
+       _pixels_per_time_unit = static_cast<double>(width() - x_offset() * 2) / film->length ();
 }
 
 void