Fix rebase onto master.
[dcpomatic.git] / src / wx / timing_panel.cc
index 241b0f70647e0c92c77a6e532ab78841c8f78c2b..8e253c0709742e31ca042adb6644a1d3655f3ca2 100644 (file)
@@ -210,10 +210,10 @@ TimingPanel::film_content_changed (int property)
 
        } else if (
                property == ContentProperty::LENGTH ||
-               property == VideoContentProperty::VIDEO_FRAME_RATE ||
-               property == VideoContentProperty::VIDEO_FRAME_TYPE ||
-               property == AudioContentProperty::AUDIO_VIDEO_FRAME_RATE ||
-               property == SubtitleContentProperty::SUBTITLE_VIDEO_FRAME_RATE
+               property == VideoContentProperty::FRAME_RATE ||
+               property == VideoContentProperty::FRAME_TYPE ||
+               property == AudioContentProperty::VIDEO_FRAME_RATE ||
+               property == SubtitleContentProperty::VIDEO_FRAME_RATE
                ) {
 
                update_full_length ();
@@ -249,36 +249,34 @@ TimingPanel::film_content_changed (int property)
                property == ContentProperty::LENGTH ||
                property == ContentProperty::TRIM_START ||
                property == ContentProperty::TRIM_END ||
-               property == VideoContentProperty::VIDEO_FRAME_RATE ||
-               property == VideoContentProperty::VIDEO_FRAME_TYPE ||
-               property == AudioContentProperty::AUDIO_VIDEO_FRAME_RATE ||
-               property == SubtitleContentProperty::SUBTITLE_VIDEO_FRAME_RATE
+               property == VideoContentProperty::FRAME_RATE ||
+               property == VideoContentProperty::FRAME_TYPE ||
+               property == AudioContentProperty::VIDEO_FRAME_RATE ||
+               property == SubtitleContentProperty::VIDEO_FRAME_RATE
                ) {
 
                update_play_length ();
        }
 
-       if (property == VideoContentProperty::VIDEO_FRAME_RATE || property == SubtitleContentProperty::SUBTITLE_VIDEO_FRAME_RATE) {
+       if (property == VideoContentProperty::FRAME_RATE || property == SubtitleContentProperty::VIDEO_FRAME_RATE) {
                set<double> check_vc;
                shared_ptr<const Content> vc;
                int count_ac = 0;
                shared_ptr<const Content> ac;
                int count_sc = 0;
-               shared_ptr<const SubtitleContent> sc;
+               shared_ptr<const Content> sc;
                BOOST_FOREACH (shared_ptr<const Content> i, _parent->selected ()) {
                        if (i->video) {
-                               check_vc.insert (i->video->video_frame_rate ());
+                               check_vc.insert (i->video->frame_rate ());
                                vc = i;
                        }
-                       shared_ptr<const AudioContent> at = dynamic_pointer_cast<const AudioContent> (i);
-                       if (at) {
+                       if (i->audio) {
                                ++count_ac;
-                               ac = at;
+                               ac = i;
                        }
-                       shared_ptr<const SubtitleContent> st = dynamic_pointer_cast<const SubtitleContent> (i);
-                       if (st) {
+                       if (i->subtitle) {
                                ++count_sc;
-                               sc = st;
+                               sc = i;
                        }
 
                }
@@ -287,11 +285,11 @@ TimingPanel::film_content_changed (int property)
 
                if ((check_vc.size() == 1 || count_ac == 1 || count_sc == 1) && !single_frame_image_content) {
                        if (vc) {
-                               checked_set (_video_frame_rate, raw_convert<string> (vc->video->video_frame_rate (), 5));
+                               checked_set (_video_frame_rate, raw_convert<string> (vc->video->frame_rate (), 5));
                        } else if (ac) {
-                               checked_set (_video_frame_rate, raw_convert<string> (ac->audio->audio_video_frame_rate (), 5));
+                               checked_set (_video_frame_rate, raw_convert<string> (ac->audio->video_frame_rate (), 5));
                        } else if (sc) {
-                               checked_set (_video_frame_rate, raw_convert<string> (sc->subtitle_video_frame_rate (), 5));
+                               checked_set (_video_frame_rate, raw_convert<string> (sc->subtitle->video_frame_rate (), 5));
                        }
                        _video_frame_rate->Enable (true);
                } else {
@@ -329,7 +327,7 @@ TimingPanel::full_length_changed ()
                shared_ptr<ImageContent> ic = dynamic_pointer_cast<ImageContent> (i);
                if (ic && ic->still ()) {
                        int const vfr = _parent->film()->video_frame_rate ();
-                       ic->video->set_video_length (_full_length->get (vfr).frames_round (vfr));
+                       ic->video->set_length (_full_length->get (vfr).frames_round (vfr));
                }
        }
 }
@@ -404,20 +402,18 @@ void
 TimingPanel::set_video_frame_rate ()
 {
        BOOST_FOREACH (shared_ptr<Content> i, _parent->selected ()) {
-               shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> (i);
-               shared_ptr<AudioContent> ac = dynamic_pointer_cast<AudioContent> (i);
                shared_ptr<DCPSubtitleContent> dsc = dynamic_pointer_cast<DCPSubtitleContent> (i);
                shared_ptr<TextSubtitleContent> tsc = dynamic_pointer_cast<TextSubtitleContent> (i);
                double const fr = raw_convert<double> (wx_to_std (_video_frame_rate->GetValue ()));
-               if (vc) {
-                       vc->set_video_frame_rate (fr);
-               } else if (ac) {
+               if (i->video) {
+                       i->video->set_frame_rate (fr);
+               } else if (i->audio) {
                        /* Audio but not video, i.e. SndfileContent */
-                       ac->set_audio_video_frame_rate (fr);
+                       i->audio->set_video_frame_rate (fr);
                } else if (dsc) {
-                       dsc->set_subtitle_video_frame_rate (fr);
+                       dsc->subtitle->set_video_frame_rate (fr);
                } else if (tsc) {
-                       tsc->set_subtitle_video_frame_rate (fr);
+                       tsc->subtitle->set_video_frame_rate (fr);
                }
                _set_video_frame_rate->Enable (false);
        }
@@ -432,9 +428,9 @@ TimingPanel::content_selection_changed ()
        film_content_changed (ContentProperty::LENGTH);
        film_content_changed (ContentProperty::TRIM_START);
        film_content_changed (ContentProperty::TRIM_END);
-       film_content_changed (VideoContentProperty::VIDEO_FRAME_RATE);
-       film_content_changed (SubtitleContentProperty::SUBTITLE_VIDEO_FRAME_RATE);
-       film_content_changed (AudioContentProperty::AUDIO_VIDEO_FRAME_RATE);
+       film_content_changed (VideoContentProperty::FRAME_RATE);
+       film_content_changed (SubtitleContentProperty::VIDEO_FRAME_RATE);
+       film_content_changed (AudioContentProperty::VIDEO_FRAME_RATE);
 }
 
 void