diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-04-02 22:36:38 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-04-02 22:36:38 +0100 |
| commit | 2343509c75673d3fad82a5d0eab9622a4d6902e3 (patch) | |
| tree | 777097f8137cf9147a1dec783f58a133fb4235ae /src | |
| parent | 7f203e4df9ca94a44099c26158c6c81b5299567f (diff) | |
Fix a few more things.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/film.cc | 16 | ||||
| -rw-r--r-- | src/lib/film.h | 1 | ||||
| -rw-r--r-- | src/wx/film_editor.cc | 84 | ||||
| -rw-r--r-- | src/wx/film_editor.h | 1 | ||||
| -rw-r--r-- | src/wx/film_viewer.cc | 3 |
5 files changed, 61 insertions, 44 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc index 9c4e8b50e..d58f7fd53 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -951,6 +951,15 @@ Film::signal_changed (Property p) _dirty = true; } + switch (p) { + case Film::CONTENT: + _playlist->setup (content ()); + set_dcp_frame_rate (best_dcp_frame_rate (video_frame_rate ())); + break; + default: + break; + } + if (ui_signaller) { ui_signaller->emit (boost::bind (boost::ref (Changed), p)); } @@ -1031,7 +1040,6 @@ Film::add_content (shared_ptr<Content> c) boost::mutex::scoped_lock lm (_state_mutex); _content.push_back (c); _content_connections.push_back (c->Changed.connect (bind (&Film::content_changed, this, _1))); - _playlist->setup (_content); } signal_changed (CONTENT); @@ -1056,8 +1064,6 @@ Film::remove_content (shared_ptr<Content> c) for (ContentList::iterator i = _content.begin(); i != _content.end(); ++i) { _content_connections.push_back (c->Changed.connect (bind (&Film::content_changed, this, _1))); } - - _playlist->setup (_content); } signal_changed (CONTENT); @@ -1158,6 +1164,10 @@ Film::video_length () const void Film::content_changed (int p) { + if (p == VideoContentProperty::VIDEO_FRAME_RATE) { + set_dcp_frame_rate (best_dcp_frame_rate (video_frame_rate ())); + } + if (ui_signaller) { ui_signaller->emit (boost::bind (boost::ref (ContentChanged), p)); } diff --git a/src/lib/film.h b/src/lib/film.h index f0a85fbf3..63a86bc43 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -134,7 +134,6 @@ public: AB, AUDIO_GAIN, AUDIO_DELAY, - SUBTITLE_STREAM, WITH_SUBTITLES, SUBTITLE_OFFSET, SUBTITLE_SCALE, diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc index 7930d86ce..67ebf49d0 100644 --- a/src/wx/film_editor.cc +++ b/src/wx/film_editor.cc @@ -592,14 +592,6 @@ FilmEditor::film_changed (Film::Property p) case Film::TRUST_CONTENT_HEADERS: checked_set (_trust_content_headers, _film->trust_content_headers ()); break; -// case Film::SUBTITLE_STREAMS: -// setup_subtitle_control_sensitivity (); -// setup_streams (); -// break; -// case Film::CONTENT_AUDIO_STREAMS: -// setup_streams (); -// setup_show_audio_sensitivity (); -// break; case Film::FORMAT: { int n = 0; @@ -648,7 +640,7 @@ FilmEditor::film_changed (Film::Property p) // s << fixed << setprecision(2) << _film->source_frame_rate(); // _source_frame_rate->SetLabel (std_to_wx (s.str ())); // break; -// case Film::SIZE: +// case Film::VIDEO_SIZE: // if (_film->size().width == 0 && _film->size().height == 0) { // _original_size->SetLabel (wxT ("")); // } else { @@ -656,20 +648,6 @@ FilmEditor::film_changed (Film::Property p) // _original_size->SetLabel (std_to_wx (s.str ())); // } // break; -// case Film::LENGTH: -// if (_film->source_frame_rate() > 0 && _film->length()) { -// s << _film->length().get() << " " -// << wx_to_std (_("frames")) << "; " << seconds_to_hms (_film->length().get() / _film->source_frame_rate()); -// } else if (_film->length()) { -// s << _film->length().get() << " " -// << wx_to_std (_("frames")); -// } -// _length->SetLabel (std_to_wx (s.str ())); -// if (_film->length()) { -// _trim_start->SetRange (0, _film->length().get()); -// _trim_end->SetRange (0, _film->length().get()); -// } -// break; case Film::DCP_CONTENT_TYPE: checked_set (_dcp_content_type, DCPContentType::as_index (_film->dcp_content_type ())); setup_dcp_name (); @@ -729,26 +707,53 @@ FilmEditor::film_changed (Film::Property p) // checked_set (_subtitle_stream, _film->subtitle_stream()->to_string()); // } // break; -// case Film::DCP_FRAME_RATE: -// for (unsigned int i = 0; i < _dcp_frame_rate->GetCount(); ++i) { -// if (wx_to_std (_dcp_frame_rate->GetString(i)) == boost::lexical_cast<string> (_film->dcp_frame_rate())) { -// if (_dcp_frame_rate->GetSelection() != int(i)) { -// _dcp_frame_rate->SetSelection (i); -// break; -// } -// } -// } + case Film::DCP_FRAME_RATE: + for (unsigned int i = 0; i < _dcp_frame_rate->GetCount(); ++i) { + if (wx_to_std (_dcp_frame_rate->GetString(i)) == boost::lexical_cast<string> (_film->dcp_frame_rate())) { + if (_dcp_frame_rate->GetSelection() != int(i)) { + _dcp_frame_rate->SetSelection (i); + break; + } + } + } -// if (_film->source_frame_rate()) { -// _frame_rate_description->SetLabel (std_to_wx (FrameRateConversion (_film->source_frame_rate(), _film->dcp_frame_rate()).description)); -// _best_dcp_frame_rate->Enable (best_dcp_frame_rate (_film->source_frame_rate ()) != _film->dcp_frame_rate ()); -// } else { -// _frame_rate_description->SetLabel (wxT ("")); -// _best_dcp_frame_rate->Disable (); -// } + if (_film->video_frame_rate()) { + _frame_rate_description->SetLabel (std_to_wx (FrameRateConversion (_film->video_frame_rate(), _film->dcp_frame_rate()).description)); + _best_dcp_frame_rate->Enable (best_dcp_frame_rate (_film->video_frame_rate ()) != _film->dcp_frame_rate ()); + } else { + _frame_rate_description->SetLabel (wxT ("")); + _best_dcp_frame_rate->Disable (); + } } } +void +FilmEditor::film_content_changed (int p) +{ + if (p == FFmpegContentProperty::SUBTITLE_STREAMS) { + setup_subtitle_control_sensitivity (); + setup_streams (); + } else if (p == FFmpegContentProperty::AUDIO_STREAMS) { + setup_streams (); + setup_show_audio_sensitivity (); + } else if (p == VideoContentProperty::VIDEO_LENGTH) { + stringstream s; + if (_film->video_frame_rate() > 0 && _film->video_length()) { + s << _film->video_length() << " " + << wx_to_std (_("frames")) << "; " << seconds_to_hms (_film->video_length() / _film->video_frame_rate()); + } else if (_film->video_length()) { + s << _film->video_length() << " " + << wx_to_std (_("frames")); + } + _length->SetLabel (std_to_wx (s.str ())); + if (_film->video_length()) { + _trim_start->SetRange (0, _film->video_length()); + _trim_end->SetRange (0, _film->video_length()); + } + } +} + + /** Called when the format widget has been changed */ void FilmEditor::format_changed (wxCommandEvent &) @@ -788,6 +793,7 @@ FilmEditor::set_film (shared_ptr<Film> f) if (_film) { _film->Changed.connect (bind (&FilmEditor::film_changed, this, _1)); + _film->ContentChanged.connect (bind (&FilmEditor::film_content_changed, this, _1)); } if (_film) { diff --git a/src/wx/film_editor.h b/src/wx/film_editor.h index 80072d48a..e01ab8ccc 100644 --- a/src/wx/film_editor.h +++ b/src/wx/film_editor.h @@ -90,6 +90,7 @@ private: /* Handle changes to the model */ void film_changed (Film::Property); + void film_content_changed (int); /* Button clicks */ void edit_filters_clicked (wxCommandEvent &); diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index 9cf479508..0c03a9998 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -36,6 +36,7 @@ #include "lib/filter.h" #include "lib/playlist.h" #include "lib/video_content.h" +#include "lib/ffmpeg_content.h" #include "film_viewer.h" #include "wx_util.h" #include "video_decoder.h" @@ -161,7 +162,7 @@ FilmViewer::set_film (shared_ptr<Film> f) film_changed (Film::WITH_SUBTITLES); film_changed (Film::SUBTITLE_OFFSET); film_changed (Film::SUBTITLE_SCALE); - film_changed (Film::SUBTITLE_STREAM); + film_content_changed (FFmpegContentProperty::SUBTITLE_STREAM); } void |
