using std::setprecision;
using std::list;
using std::vector;
+using std::max;
using boost::shared_ptr;
using boost::weak_ptr;
using boost::dynamic_pointer_cast;
setup_subtitle_control_sensitivity ();
setup_streams ();
setup_show_audio_sensitivity ();
+ setup_length ();
break;
case Film::TRUST_CONTENT_HEADERS:
checked_set (_trust_content_headers, _film->trust_content_headers ());
setup_dcp_name ();
break;
case Film::DCP_FRAME_RATE:
+ {
+ bool done = false;
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;
- }
+ checked_set (_dcp_frame_rate, i);
+ done = true;
+ break;
}
}
+ if (!done) {
+ checked_set (_dcp_frame_rate, -1);
+ }
+
if (_film->video_frame_rate()) {
_best_dcp_frame_rate->Enable (best_dcp_frame_rate (_film->video_frame_rate ()) != _film->dcp_frame_rate ());
} else {
}
setup_frame_rate_description ();
break;
+ }
case Film::AUDIO_MAPPING:
_audio_mapping->set_mapping (_film->audio_mapping ());
break;
} else if (property == FFmpegContentProperty::AUDIO_STREAMS) {
setup_streams ();
setup_show_audio_sensitivity ();
- } else if (property == VideoContentProperty::VIDEO_LENGTH) {
+ } else if (property == VideoContentProperty::VIDEO_LENGTH || property == AudioContentProperty::AUDIO_LENGTH) {
setup_length ();
boost::shared_ptr<Content> c = content.lock ();
if (c && c == selected_content()) {
FilmEditor::setup_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"));
- }
+ ContentVideoFrame const frames = _film->content_length ();
+
+ if (frames && _film->video_frame_rate()) {
+ s << frames << " " << wx_to_std (_("frames")) << "; " << seconds_to_hms (frames / _film->video_frame_rate());
+ } else if (frames) {
+ s << frames << " " << 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());
+
+ if (frames) {
+ _trim_start->SetRange (0, frames);
+ _trim_end->SetRange (0, frames);
}
}
film_content_changed (boost::shared_ptr<Content> (), FFmpegContentProperty::SUBTITLE_STREAM);
film_content_changed (boost::shared_ptr<Content> (), FFmpegContentProperty::AUDIO_STREAMS);
film_content_changed (boost::shared_ptr<Content> (), FFmpegContentProperty::AUDIO_STREAM);
+
+ setup_content_information ();
}
/** Updates the sensitivity of lots of widgets to a given value.
_scaler->Enable (s);
_ffmpeg_audio_stream->Enable (s);
_dcp_content_type->Enable (s);
+ _best_dcp_frame_rate->Enable (s);
_dcp_frame_rate->Enable (s);
_trim_start->Enable (s);
_trim_end->Enable (s);