diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-06-09 17:28:51 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-06-09 17:28:51 +0100 |
| commit | 11d0d8d07917543d6c40a6bb1fe5581ae216f5aa (patch) | |
| tree | 666bc0e50e2c872cef79ceea690f3999fef4bffc | |
| parent | 883d885dc8690519d205c8baa275385af8a39f4b (diff) | |
| parent | 0b97307b78b1d5e017e97ff90d5d05102cb70c1c (diff) | |
Merge branch '1.0' of ssh://houllier/home/carl/git/dvdomatic into 1.0
| -rw-r--r-- | src/lib/config.cc | 2 | ||||
| -rw-r--r-- | src/lib/ffmpeg_decoder.cc | 9 | ||||
| -rw-r--r-- | src/lib/video_content.cc | 4 | ||||
| -rw-r--r-- | src/lib/video_decoder.cc | 24 | ||||
| -rw-r--r-- | src/lib/video_decoder.h | 4 | ||||
| -rw-r--r-- | src/wx/film_editor.cc | 47 | ||||
| -rw-r--r-- | src/wx/film_editor.h | 1 |
7 files changed, 86 insertions, 5 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc index 6fbd34d05..e4cebdc73 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -52,7 +52,7 @@ Config::Config () , _tms_path (N_(".")) , _sound_processor (SoundProcessor::from_id (N_("dolby_cp750"))) , _default_still_length (10) - , _default_container (0) + , _default_container (Ratio::from_id ("185")) , _default_dcp_content_type (0) { _allowed_dcp_frame_rates.push_back (24); diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 1d000b62b..2f890c0cd 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -247,7 +247,9 @@ FFmpegDecoder::pass () if (_ffmpeg_content->audio_stream() && _decode_audio) { decode_audio_packet (); } - + + /* Stop us being asked for any more data */ + _next_video = _next_audio = _ffmpeg_content->length (); return; } @@ -277,6 +279,8 @@ FFmpegDecoder::pass () } avsubtitle_free (&sub); } + } else { + cout << "[ffmpeg] other packet.\n"; } av_free_packet (&_packet); @@ -443,6 +447,7 @@ void FFmpegDecoder::seek (Time t) { do_seek (t, false, false); + VideoDecoder::seek (t); } void @@ -453,6 +458,7 @@ FFmpegDecoder::seek_back () } do_seek (next() - 2.5 * TIME_HZ / video_frame_rate(), true, true); + VideoDecoder::seek_back (); } void @@ -463,6 +469,7 @@ FFmpegDecoder::seek_forward () } do_seek (next() - 0.5 * TIME_HZ / video_frame_rate(), true, true); + VideoDecoder::seek_forward (); } void diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc index 84dee81d1..99471edc1 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -40,7 +40,7 @@ VideoContent::VideoContent (shared_ptr<const Film> f, Time s, ContentVideoFrame : Content (f, s) , _video_length (len) , _video_frame_rate (0) - , _ratio (0) + , _ratio (Ratio::from_id ("185")) { } @@ -49,7 +49,7 @@ VideoContent::VideoContent (shared_ptr<const Film> f, boost::filesystem::path p) : Content (f, p) , _video_length (0) , _video_frame_rate (0) - , _ratio (0) + , _ratio (Ratio::from_id ("185")) { } diff --git a/src/lib/video_decoder.cc b/src/lib/video_decoder.cc index a5147f42e..c5e1850c0 100644 --- a/src/lib/video_decoder.cc +++ b/src/lib/video_decoder.cc @@ -121,3 +121,27 @@ VideoDecoder::video_done () const return (_video_content->length() - _next_video) < film->video_frames_to_time (1); } + +void +VideoDecoder::seek (Time t) +{ + _next_video = t; +} + +void +VideoDecoder::seek_back () +{ + shared_ptr<const Film> film = _film.lock (); + assert (film); + _next_video -= film->video_frames_to_time (1); +} + +void +VideoDecoder::seek_forward () +{ + shared_ptr<const Film> film = _film.lock (); + assert (film); + _next_video += film->video_frames_to_time (1); +} + + diff --git a/src/lib/video_decoder.h b/src/lib/video_decoder.h index 5073efead..b47d7fc3a 100644 --- a/src/lib/video_decoder.h +++ b/src/lib/video_decoder.h @@ -31,6 +31,10 @@ class VideoDecoder : public VideoSource, public virtual Decoder public: VideoDecoder (boost::shared_ptr<const Film>, boost::shared_ptr<const VideoContent>); + virtual void seek (Time); + virtual void seek_back (); + virtual void seek_forward (); + /* Calls for VideoContent to find out about itself */ /** @return video frame rate second, or 0 if unknown */ diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc index bddce18be..aab2a6147 100644 --- a/src/wx/film_editor.cc +++ b/src/wx/film_editor.cc @@ -190,7 +190,7 @@ FilmEditor::connect_to_widgets () _use_dci_name->Connect (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler (FilmEditor::use_dci_name_toggled), 0, this); _edit_dci_button->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::edit_dci_button_clicked), 0, this); _container->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (FilmEditor::container_changed), 0, this); -// _format->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (FilmEditor::format_changed), 0, this); + _ratio->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (FilmEditor::ratio_changed), 0, this); _content->Connect (wxID_ANY, wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler (FilmEditor::content_selection_changed), 0, this); _content->Connect (wxID_ANY, wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler (FilmEditor::content_selection_changed), 0, this); _content_add->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::content_add_clicked), 0, this); @@ -705,6 +705,24 @@ FilmEditor::film_content_changed (weak_ptr<Content> weak_content, int property) checked_set (_top_crop, video_content ? video_content->crop().top : 0); checked_set (_bottom_crop, video_content ? video_content->crop().bottom : 0); setup_scaling_description (); + } else if (property == VideoContentProperty::VIDEO_RATIO) { + if (video_content) { + int n = 0; + vector<Ratio const *> ratios = Ratio::all (); + vector<Ratio const *>::iterator i = ratios.begin (); + while (i != ratios.end() && *i != video_content->ratio()) { + ++i; + ++n; + } + + if (i == ratios.end()) { + checked_set (_ratio, -1); + } else { + checked_set (_ratio, n); + } + } else { + checked_set (_ratio, -1); + } } else if (property == AudioContentProperty::AUDIO_GAIN) { checked_set (_audio_gain, audio_content ? audio_content->audio_gain() : 0); } else if (property == AudioContentProperty::AUDIO_DELAY) { @@ -855,6 +873,7 @@ FilmEditor::set_film (shared_ptr<Film> f) film_content_changed (boost::shared_ptr<Content> (), ContentProperty::START); film_content_changed (boost::shared_ptr<Content> (), ContentProperty::LENGTH); film_content_changed (boost::shared_ptr<Content> (), VideoContentProperty::VIDEO_CROP); + film_content_changed (boost::shared_ptr<Content> (), VideoContentProperty::VIDEO_RATIO); film_content_changed (boost::shared_ptr<Content> (), AudioContentProperty::AUDIO_GAIN); film_content_changed (boost::shared_ptr<Content> (), AudioContentProperty::AUDIO_DELAY); film_content_changed (boost::shared_ptr<Content> (), AudioContentProperty::AUDIO_MAPPING); @@ -1182,6 +1201,7 @@ FilmEditor::content_selection_changed (wxListEvent &) film_content_changed (s, ContentProperty::START); film_content_changed (s, ContentProperty::LENGTH); film_content_changed (s, VideoContentProperty::VIDEO_CROP); + film_content_changed (s, VideoContentProperty::VIDEO_RATIO); film_content_changed (s, AudioContentProperty::AUDIO_GAIN); film_content_changed (s, AudioContentProperty::AUDIO_DELAY); film_content_changed (s, AudioContentProperty::AUDIO_MAPPING); @@ -1456,3 +1476,28 @@ FilmEditor::set_selection (weak_ptr<Content> wc) } } } + +void +FilmEditor::ratio_changed (wxCommandEvent &) +{ + if (!_film) { + return; + } + + shared_ptr<Content> c = selected_content (); + if (!c) { + return; + } + + shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> (c); + if (!vc) { + return; + } + + int const n = _ratio->GetSelection (); + if (n >= 0) { + vector<Ratio const *> ratios = Ratio::all (); + assert (n < int (ratios.size())); + vc->set_ratio (ratios[n]); + } +} diff --git a/src/wx/film_editor.h b/src/wx/film_editor.h index be1bf7c36..4b096a2e1 100644 --- a/src/wx/film_editor.h +++ b/src/wx/film_editor.h @@ -96,6 +96,7 @@ private: void audio_mapping_changed (AudioMapping); void start_changed (); void length_changed (); + void ratio_changed (wxCommandEvent &); /* Handle changes to the model */ void film_changed (Film::Property); |
