diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-05-25 16:55:42 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-05-25 16:55:42 +0100 |
| commit | 48e51965d74cf2a2f2f6f4c5e9c349f1b1103e66 (patch) | |
| tree | 544effa2cf914f1bcc5b98c05cd6c9473f10ed06 /src/wx | |
| parent | f79a483c937dad8a89410b5aed97c11d8a715443 (diff) | |
Basics of Atmos content support; can be added to project and appears in timeline.
Diffstat (limited to 'src/wx')
| -rw-r--r-- | src/wx/timeline.cc | 52 | ||||
| -rw-r--r-- | src/wx/timeline_atmos_content_view.cc | 44 | ||||
| -rw-r--r-- | src/wx/timeline_atmos_content_view.h | 36 | ||||
| -rw-r--r-- | src/wx/timeline_labels_view.cc | 47 | ||||
| -rw-r--r-- | src/wx/timeline_labels_view.h | 7 | ||||
| -rw-r--r-- | src/wx/wscript | 1 |
6 files changed, 176 insertions, 11 deletions
diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc index 8ce811c28..2a0f96f05 100644 --- a/src/wx/timeline.cc +++ b/src/wx/timeline.cc @@ -25,6 +25,7 @@ #include "timeline_video_content_view.h" #include "timeline_audio_content_view.h" #include "timeline_subtitle_content_view.h" +#include "timeline_atmos_content_view.h" #include "content_panel.h" #include "wx_util.h" #include "lib/film.h" @@ -34,6 +35,7 @@ #include "lib/audio_content.h" #include "lib/subtitle_content.h" #include "lib/video_content.h" +#include "lib/atmos_mxf_content.h" #include <wx/graphics.h> #include <boost/weak_ptr.hpp> #include <boost/foreach.hpp> @@ -157,6 +159,10 @@ Timeline::recreate_views () if (i->subtitle) { _views.push_back (shared_ptr<TimelineView> (new TimelineSubtitleContentView (*this, i))); } + + if (dynamic_pointer_cast<AtmosMXFContent> (i)) { + _views.push_back (shared_ptr<TimelineView> (new TimelineAtmosContentView (*this, i))); + } } assign_tracks (); @@ -187,6 +193,36 @@ Timeline::assign_tracks () } } + /* See if we have any subtitle / atmos / right-eye views */ + bool have_3d = false; + bool have_subtitle = false; + bool have_atmos = false; + BOOST_FOREACH (shared_ptr<TimelineView> i, _views) { + shared_ptr<TimelineContentView> cv = dynamic_pointer_cast<TimelineContentView> (i); + if (!cv) { + continue; + } + + if (dynamic_pointer_cast<TimelineVideoContentView> (i)) { + if (cv->content()->video->frame_type() == VIDEO_FRAME_TYPE_3D_RIGHT) { + have_3d = true; + } + } else if (dynamic_pointer_cast<TimelineSubtitleContentView> (i)) { + have_subtitle = true; + } else if (dynamic_pointer_cast<TimelineAtmosContentView> (i)) { + have_atmos = true; + } + } + + _labels_view->set_3d (have_3d); + _labels_view->set_subtitle (have_subtitle); + _labels_view->set_atmos (have_atmos); + + /* Hence decide where to start subtitle, atmos and audio tracks */ + int const subtitle = have_3d ? 2 : 1; + int const atmos = have_subtitle ? subtitle + 1 : subtitle; + int const audio = have_atmos ? atmos + 1: atmos; + for (TimelineViewList::iterator i = _views.begin(); i != _views.end(); ++i) { shared_ptr<TimelineContentView> cv = dynamic_pointer_cast<TimelineContentView> (*i); if (!cv) { @@ -194,19 +230,21 @@ Timeline::assign_tracks () } if (dynamic_pointer_cast<TimelineVideoContentView> (*i)) { - /* Video on tracks 0 and 1 (left and right eye) */ + /* Video on tracks 0 and maybe 1 (left and right eye) */ cv->set_track (cv->content()->video->frame_type() == VIDEO_FRAME_TYPE_3D_RIGHT ? 1 : 0); - _tracks = max (_tracks, 2); + _tracks = max (_tracks, have_3d ? 2 : 1); continue; } else if (dynamic_pointer_cast<TimelineSubtitleContentView> (*i)) { - /* Subtitles on track 2 */ - cv->set_track (2); - _tracks = max (_tracks, 3); + cv->set_track (subtitle); + _tracks = max (_tracks, subtitle + 1); + continue; + } else if (dynamic_pointer_cast<TimelineAtmosContentView> (*i)) { + cv->set_track (atmos); + _tracks = max (_tracks, atmos + 1); continue; } - /* Audio on tracks 3 and up */ - int t = 3; + int t = audio; shared_ptr<Content> content = cv->content(); DCPTimePeriod content_period (content->position(), content->end()); diff --git a/src/wx/timeline_atmos_content_view.cc b/src/wx/timeline_atmos_content_view.cc new file mode 100644 index 000000000..893b57a72 --- /dev/null +++ b/src/wx/timeline_atmos_content_view.cc @@ -0,0 +1,44 @@ +/* + Copyright (C) 2016 Carl Hetherington <cth@carlh.net> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include "timeline_atmos_content_view.h" + +using boost::shared_ptr; + +/** @class TimelineAtmosContentView + * @brief Timeline view for AtmosContent. + */ + +TimelineAtmosContentView::TimelineAtmosContentView (Timeline& tl, shared_ptr<Content> c) + : TimelineContentView (tl, c) +{ + +} + +wxColour +TimelineAtmosContentView::background_colour () const +{ + return wxColour (149, 121, 232, 255); +} + +wxColour +TimelineAtmosContentView::foreground_colour () const +{ + return wxColour (0, 0, 0, 255); +} diff --git a/src/wx/timeline_atmos_content_view.h b/src/wx/timeline_atmos_content_view.h new file mode 100644 index 000000000..951dc82cc --- /dev/null +++ b/src/wx/timeline_atmos_content_view.h @@ -0,0 +1,36 @@ +/* + Copyright (C) 2016 Carl Hetherington <cth@carlh.net> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include "timeline_content_view.h" + +/** @class TimelineAtmosContentView + * @brief Timeline view for AtmosContent. + */ +class TimelineAtmosContentView : public TimelineContentView +{ +public: + TimelineAtmosContentView (Timeline& tl, boost::shared_ptr<Content> c); + +private: + bool active () const { + return true; + } + wxColour background_colour () const; + wxColour foreground_colour () const; +}; diff --git a/src/wx/timeline_labels_view.cc b/src/wx/timeline_labels_view.cc index 3a809bfff..ee1b70718 100644 --- a/src/wx/timeline_labels_view.cc +++ b/src/wx/timeline_labels_view.cc @@ -29,11 +29,15 @@ using std::max; TimelineLabelsView::TimelineLabelsView (Timeline& tl) : TimelineView (tl) + , _threed (true) + , _subtitle (true) + , _atmos (true) { wxString labels[] = { _("Video"), _("Audio"), - _("Subtitles") + _("Subtitles"), + _("Atmos") }; _width = 0; @@ -58,7 +62,42 @@ TimelineLabelsView::do_paint (wxGraphicsContext* gc, list<dcpomatic::Rect<int> > { int const h = _timeline.track_height (); gc->SetFont (gc->CreateFont(wxNORMAL_FONT->Bold(), wxColour (0, 0, 0))); - gc->DrawText (_("Video"), 0, _timeline.tracks_position().y + h - 8); - gc->DrawText (_("Subtitles"), 0, _timeline.tracks_position().y + 5 * h / 2 - 8); - gc->DrawText (_("Audio"), 0, _timeline.tracks_position().y + (3 + max (_timeline.tracks(), 3)) * h / 2 - 8); + + int fy = 0; + int ty = _threed ? 2 * h : h; + gc->DrawText (_("Video"), 0, _timeline.tracks_position().y + (ty + fy) / 2 - 8); + fy = ty; + + if (_subtitle) { + ty = fy + h; + gc->DrawText (_("Subtitles"), 0, _timeline.tracks_position().y + (ty + fy) / 2 - 8); + fy = ty; + } + + if (_atmos) { + ty = fy + h; + gc->DrawText (_("Atmos"), 0, _timeline.tracks_position().y + (ty + fy) / 2 - 8); + fy = ty; + } + + ty = _timeline.tracks() * h; + gc->DrawText (_("Audio"), 0, _timeline.tracks_position().y + (ty + fy) / 2 - 8); +} + +void +TimelineLabelsView::set_3d (bool s) +{ + _threed = s; +} + +void +TimelineLabelsView::set_subtitle (bool s) +{ + _subtitle = s; +} + +void +TimelineLabelsView::set_atmos (bool s) +{ + _atmos = s; } diff --git a/src/wx/timeline_labels_view.h b/src/wx/timeline_labels_view.h index 96dd692af..846184a92 100644 --- a/src/wx/timeline_labels_view.h +++ b/src/wx/timeline_labels_view.h @@ -28,8 +28,15 @@ public: dcpomatic::Rect<int> bbox () const; + void set_3d (bool s); + void set_subtitle (bool s); + void set_atmos (bool s); + private: void do_paint (wxGraphicsContext* gc, std::list<dcpomatic::Rect<int> > overlaps); int _width; + bool _threed; + bool _subtitle; + bool _atmos; }; diff --git a/src/wx/wscript b/src/wx/wscript index 19ff17d4e..9a6538f4d 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -83,6 +83,7 @@ sources = """ text_subtitle_appearance_dialog.cc timecode.cc timeline.cc + timeline_atmos_content_view.cc timeline_content_view.cc timeline_dialog.cc timeline_audio_content_view.cc |
