+void
+FilmEditor::film_content_changed (weak_ptr<Content> content, int property)
+{
+ if (!_film) {
+ /* We call this method ourselves (as well as using it as a signal handler)
+ so _film can be 0.
+ */
+ return;
+ }
+
+ if (property == FFmpegContentProperty::SUBTITLE_STREAMS) {
+ setup_subtitle_control_sensitivity ();
+ setup_streams ();
+ } else if (property == FFmpegContentProperty::AUDIO_STREAMS) {
+ setup_streams ();
+ setup_show_audio_sensitivity ();
+ } else if (property == VideoContentProperty::VIDEO_LENGTH) {
+ setup_length ();
+ boost::shared_ptr<Content> c = content.lock ();
+ if (c && c == selected_content()) {
+ setup_content_information ();
+ }
+ } else if (property == FFmpegContentProperty::AUDIO_STREAM) {
+ if (_film->ffmpeg_audio_stream()) {
+ checked_set (_ffmpeg_audio_stream, boost::lexical_cast<string> (_film->ffmpeg_audio_stream()->id));
+ }
+ setup_dcp_name ();
+ setup_audio_details ();
+ setup_show_audio_sensitivity ();
+ } else if (property == FFmpegContentProperty::SUBTITLE_STREAM) {
+ if (_film->ffmpeg_subtitle_stream()) {
+ checked_set (_ffmpeg_subtitle_stream, boost::lexical_cast<string> (_film->ffmpeg_subtitle_stream()->id));
+ }
+ }
+}
+
+void
+FilmEditor::setup_format ()
+{
+ int n = 0;
+ vector<Format const *>::iterator i = _formats.begin ();
+ while (i != _formats.end() && *i != _film->format ()) {
+ ++i;
+ ++n;
+ }
+
+ if (i == _formats.end()) {
+ checked_set (_format, -1);
+ } else {
+ checked_set (_format, n);
+ }
+
+ setup_dcp_name ();
+ setup_scaling_description ();
+}
+
+void
+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"));
+ }
+ _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());
+ }
+}
+
+void
+FilmEditor::setup_frame_rate_description ()
+{
+ wxString d;
+ int lines = 0;
+
+ if (_film->video_frame_rate()) {
+ d << std_to_wx (FrameRateConversion (_film->video_frame_rate(), _film->dcp_frame_rate()).description);
+ ++lines;
+#ifdef HAVE_SWRESAMPLE
+ if (_film->audio_frame_rate() && _film->audio_frame_rate() != _film->target_audio_sample_rate ()) {
+ d << wxString::Format (
+ _("Audio will be resampled from %dHz to %dHz\n"),
+ _film->audio_frame_rate(),
+ _film->target_audio_sample_rate()
+ );
+ ++lines;
+ }
+#endif
+ }
+
+ for (int i = lines; i < 2; ++i) {
+ d << wxT ("\n ");
+ }
+
+ _frame_rate_description->SetLabel (d);
+}
+