summaryrefslogtreecommitdiff
path: root/src/wx
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-03-22 16:51:05 +0000
committerCarl Hetherington <cth@carlh.net>2014-03-22 16:51:05 +0000
commit6e7a497e9802635de713e350593b12c783a0f64c (patch)
treefbf1f0652ca173644d557c45a889f380cf66f6ce /src/wx
parent604ef9902b6b2256adea97a20195cdb68b3a4aa6 (diff)
Give SndfileContent a video frame rate so that it can be specified by the user.
Diffstat (limited to 'src/wx')
-rw-r--r--src/wx/timing_panel.cc32
1 files changed, 22 insertions, 10 deletions
diff --git a/src/wx/timing_panel.cc b/src/wx/timing_panel.cc
index 2321fd0df..5cefe318a 100644
--- a/src/wx/timing_panel.cc
+++ b/src/wx/timing_panel.cc
@@ -19,6 +19,7 @@
#include "lib/content.h"
#include "lib/image_content.h"
+#include "lib/sndfile_content.h"
#include "timing_panel.h"
#include "wx_util.h"
#include "timecode.h"
@@ -80,37 +81,40 @@ TimingPanel::film_content_changed (int property)
if (cl.size() == 1) {
content = cl.front ();
}
+
+ int const film_video_frame_rate = _editor->film()->video_frame_rate ();
if (property == ContentProperty::POSITION) {
if (content) {
- _position->set (content->position (), _editor->film()->video_frame_rate ());
+ _position->set (content->position (), film_video_frame_rate);
} else {
_position->set (0, 24);
}
} else if (
property == ContentProperty::LENGTH ||
property == VideoContentProperty::VIDEO_FRAME_RATE ||
- property == VideoContentProperty::VIDEO_FRAME_TYPE
+ property == VideoContentProperty::VIDEO_FRAME_TYPE ||
+ property == SndfileContentProperty::VIDEO_FRAME_RATE
) {
if (content) {
- _full_length->set (content->full_length (), _editor->film()->video_frame_rate ());
- _play_length->set (content->length_after_trim (), _editor->film()->video_frame_rate ());
+ _full_length->set (content->full_length (), film_video_frame_rate);
+ _play_length->set (content->length_after_trim (), film_video_frame_rate);
} else {
_full_length->set (0, 24);
_play_length->set (0, 24);
}
} else if (property == ContentProperty::TRIM_START) {
if (content) {
- _trim_start->set (content->trim_start (), _editor->film()->video_frame_rate ());
- _play_length->set (content->length_after_trim (), _editor->film()->video_frame_rate ());
+ _trim_start->set (content->trim_start (), film_video_frame_rate);
+ _play_length->set (content->length_after_trim (), film_video_frame_rate);
} else {
_trim_start->set (0, 24);
_play_length->set (0, 24);
}
} else if (property == ContentProperty::TRIM_END) {
if (content) {
- _trim_end->set (content->trim_end (), _editor->film()->video_frame_rate ());
- _play_length->set (content->length_after_trim (), _editor->film()->video_frame_rate ());
+ _trim_end->set (content->trim_end (), film_video_frame_rate);
+ _play_length->set (content->length_after_trim (), film_video_frame_rate);
} else {
_trim_end->set (0, 24);
_play_length->set (0, 24);
@@ -120,8 +124,11 @@ TimingPanel::film_content_changed (int property)
if (property == VideoContentProperty::VIDEO_FRAME_RATE) {
if (content) {
shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> (content);
+ shared_ptr<SndfileContent> sc = dynamic_pointer_cast<SndfileContent> (content);
if (vc) {
_video_frame_rate->SetValue (std_to_wx (lexical_cast<string> (vc->video_frame_rate ())));
+ } else if (sc) {
+ _video_frame_rate->SetValue (std_to_wx (lexical_cast<string> (sc->video_frame_rate ())));
} else {
_video_frame_rate->SetValue ("24");
}
@@ -131,9 +138,10 @@ TimingPanel::film_content_changed (int property)
}
shared_ptr<ImageContent> ic = dynamic_pointer_cast<ImageContent> (content);
+ shared_ptr<SndfileContent> sc = dynamic_pointer_cast<SndfileContent> (content);
_full_length->set_editable (ic && ic->still ());
_play_length->set_editable (!ic || !ic->still ());
- _video_frame_rate->Enable (ic && !ic->still ());
+ _video_frame_rate->Enable ((ic && !ic->still ()) || sc);
_set_video_frame_rate->Enable (false);
}
@@ -200,8 +208,12 @@ TimingPanel::set_video_frame_rate ()
shared_ptr<ImageContent> ic = dynamic_pointer_cast<ImageContent> (c.front ());
if (ic) {
ic->set_video_frame_rate (lexical_cast<float> (wx_to_std (_video_frame_rate->GetValue ())));
- _set_video_frame_rate->Enable (false);
}
+ shared_ptr<SndfileContent> sc = dynamic_pointer_cast<SndfileContent> (c.front ());
+ if (sc) {
+ sc->set_video_frame_rate (lexical_cast<float> (wx_to_std (_video_frame_rate->GetValue ())));
+ }
+ _set_video_frame_rate->Enable (false);
}
}