From: Carl Hetherington Date: Tue, 1 Jan 2019 22:48:06 +0000 (+0000) Subject: Incorporate GLView; requires putting Screen into dcpomatic namespace. X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=ea32c7304055dd1c9d26ec75f79fd6c3125f9fb7 Incorporate GLView; requires putting Screen into dcpomatic namespace. --- diff --git a/src/lib/cinema.cc b/src/lib/cinema.cc index 61862fa6d..1d43d27b4 100644 --- a/src/lib/cinema.cc +++ b/src/lib/cinema.cc @@ -31,6 +31,7 @@ using std::list; using std::string; using boost::shared_ptr; using dcp::raw_convert; +using namespace dcpomatic; Cinema::Cinema (cxml::ConstNodePtr node) : name (node->string_child ("Name")) diff --git a/src/lib/cinema.h b/src/lib/cinema.h index 6a3d89845..86245953b 100644 --- a/src/lib/cinema.h +++ b/src/lib/cinema.h @@ -29,7 +29,9 @@ namespace xmlpp { class Element; } -class Screen; +namespace dcpomatic { + class Screen; +} /** @class Cinema * @brief A description of a Cinema for KDM generation. @@ -54,8 +56,8 @@ public: void as_xml (xmlpp::Element *) const; - void add_screen (boost::shared_ptr); - void remove_screen (boost::shared_ptr); + void add_screen (boost::shared_ptr); + void remove_screen (boost::shared_ptr); void set_utc_offset_hour (int h); void set_utc_offset_minute (int m); @@ -72,12 +74,12 @@ public: return _utc_offset_minute; } - std::list > screens () const { + std::list > screens () const { return _screens; } private: - std::list > _screens; + std::list > _screens; /** Offset such that the equivalent time in UTC can be determined by subtracting the offset from the local time. */ diff --git a/src/lib/film.h b/src/lib/film.h index c4f3b3154..87da8e9d9 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -45,12 +45,15 @@ namespace xmlpp { class Document; } +namespace dcpomatic { + class Screen; +} + class DCPContentType; class Log; class Content; class Playlist; class AudioContent; -class Screen; class AudioProcessor; class AudioMapping; class Ratio; @@ -140,7 +143,7 @@ public: ) const; std::list make_kdms ( - std::list > screens, + std::list > screens, boost::filesystem::path cpl_file, boost::posix_time::ptime from, boost::posix_time::ptime until, diff --git a/src/lib/font.cc b/src/lib/font.cc index 333539aa4..019c9ab07 100644 --- a/src/lib/font.cc +++ b/src/lib/font.cc @@ -24,6 +24,7 @@ #include using std::string; +using namespace dcpomatic; Font::Font (cxml::NodePtr node) : _id (node->string_child ("Id")) @@ -47,7 +48,7 @@ Font::as_xml (xmlpp::Node* node) bool -operator== (Font const & a, Font const & b) +dcpomatic::operator== (Font const & a, Font const & b) { if (a.id() != b.id()) { return false; @@ -57,7 +58,7 @@ operator== (Font const & a, Font const & b) } bool -operator!= (Font const & a, Font const & b) +dcpomatic::operator!= (Font const & a, Font const & b) { return !(a == b); } diff --git a/src/lib/font.h b/src/lib/font.h index b2ae86daf..5876bf8a4 100644 --- a/src/lib/font.h +++ b/src/lib/font.h @@ -27,6 +27,8 @@ #include #include +namespace dcpomatic { + class Font { public: @@ -61,4 +63,6 @@ private: bool operator!= (Font const & a, Font const & b); bool operator== (Font const & a, Font const & b); +} + #endif diff --git a/src/lib/player.h b/src/lib/player.h index 381aa80b7..9f3dc7e71 100644 --- a/src/lib/player.h +++ b/src/lib/player.h @@ -41,9 +41,12 @@ namespace dcp { class ReelAsset; } +namespace dcpomatic { + class Font; +} + class PlayerVideo; class Playlist; -class Font; class AudioBuffers; class ReferencedReelAsset; class Shuffler; @@ -70,7 +73,7 @@ public: bool pass (); void seek (dcpomatic::DCPTime time, bool accurate); - std::list > get_subtitle_fonts (); + std::list > get_subtitle_fonts (); std::list get_reel_assets (); dcp::Size video_container_size () const { boost::mutex::scoped_lock lm (_mutex); diff --git a/src/lib/player_text.cc b/src/lib/player_text.cc index 16e89b0f1..d31c7d024 100644 --- a/src/lib/player_text.cc +++ b/src/lib/player_text.cc @@ -24,6 +24,7 @@ using std::list; using boost::shared_ptr; +using namespace dcpomatic; void PlayerText::add_fonts (list > fonts_) diff --git a/src/lib/player_text.h b/src/lib/player_text.h index 3f5066314..fb1d846d8 100644 --- a/src/lib/player_text.h +++ b/src/lib/player_text.h @@ -25,14 +25,16 @@ #include "dcpomatic_time.h" #include "string_text.h" -class Font; +namespace dcpomatic { + class Font; +} /** A set of text (subtitle/CCAP) which span the same time period */ class PlayerText { public: - void add_fonts (std::list > fonts_); - std::list > fonts; + void add_fonts (std::list > fonts_); + std::list > fonts; /** BitmapTexts, with their rectangles transformed as specified by their content */ std::list bitmap; diff --git a/src/lib/reel_writer.h b/src/lib/reel_writer.h index 9ea576d7a..fff2e0b9e 100644 --- a/src/lib/reel_writer.h +++ b/src/lib/reel_writer.h @@ -26,9 +26,12 @@ #include #include +namespace dcpomatic { + class Font; +} + class Film; class Job; -class Font; class AudioBuffers; namespace dcp { @@ -64,7 +67,7 @@ public: void write (PlayerText text, TextType type, boost::optional track, dcpomatic::DCPTimePeriod period); void finish (); - boost::shared_ptr create_reel (std::list const & refs, std::list > const & fonts); + boost::shared_ptr create_reel (std::list const & refs, std::list > const & fonts); void calculate_digests (boost::function set_progress); Frame start () const; diff --git a/src/lib/render_text.h b/src/lib/render_text.h index f235fb459..7187ca30b 100644 --- a/src/lib/render_text.h +++ b/src/lib/render_text.h @@ -23,9 +23,11 @@ #include "string_text.h" #include -class Font; +namespace dcpomatic { + class Font; +} std::string marked_up (std::list subtitles, int target_height, float fade_factor); std::list render_text ( - std::list, std::list > fonts, dcp::Size, dcpomatic::DCPTime, int + std::list, std::list > fonts, dcp::Size, dcpomatic::DCPTime, int ); diff --git a/src/lib/screen.cc b/src/lib/screen.cc index 5ec00f9c1..fe62a5e6c 100644 --- a/src/lib/screen.cc +++ b/src/lib/screen.cc @@ -25,6 +25,7 @@ using std::string; using std::vector; +using namespace dcpomatic; Screen::Screen (cxml::ConstNodePtr node) : name (node->string_child("Name")) diff --git a/src/lib/screen.h b/src/lib/screen.h index eff2e5ffe..829df2373 100644 --- a/src/lib/screen.h +++ b/src/lib/screen.h @@ -46,6 +46,8 @@ private: boost::optional _thumbprint; }; +namespace dcpomatic { + /** @class Screen * @brief A representation of a Screen for KDM generation. * @@ -74,4 +76,6 @@ public: std::vector trusted_devices; }; +} + #endif diff --git a/src/lib/screen_kdm.h b/src/lib/screen_kdm.h index 9ab73b851..4184b07b0 100644 --- a/src/lib/screen_kdm.h +++ b/src/lib/screen_kdm.h @@ -25,13 +25,15 @@ #include #include -class Screen; +namespace dcpomatic { + class Screen; +} /** Simple class to collect a screen and an encrypted KDM */ class ScreenKDM { public: - ScreenKDM (boost::shared_ptr s, dcp::EncryptedKDM k) + ScreenKDM (boost::shared_ptr s, dcp::EncryptedKDM k) : screen (s) , kdm (k) {} @@ -42,7 +44,7 @@ public: boost::function confirm_overwrite ); - boost::shared_ptr screen; + boost::shared_ptr screen; dcp::EncryptedKDM kdm; }; diff --git a/src/lib/send_kdm_email_job.h b/src/lib/send_kdm_email_job.h index b4e007e3b..d145ea8fe 100644 --- a/src/lib/send_kdm_email_job.h +++ b/src/lib/send_kdm_email_job.h @@ -23,7 +23,10 @@ #include #include -class Screen; +namespace dcpomatic { + class Screen; +} + class CinemaKDMs; class Log; diff --git a/src/lib/text_content.h b/src/lib/text_content.h index c7d1b590d..20e80a2c3 100644 --- a/src/lib/text_content.h +++ b/src/lib/text_content.h @@ -27,7 +27,9 @@ #include #include -class Font; +namespace dcpomatic { + class Font; +} class TextContentProperty { @@ -67,7 +69,7 @@ public: std::string identifier () const; void take_settings_from (boost::shared_ptr c); - void add_font (boost::shared_ptr font); + void add_font (boost::shared_ptr font); void set_use (bool); void set_burn (bool); @@ -122,7 +124,7 @@ public: return _y_scale; } - std::list > fonts () const { + std::list > fonts () const { boost::mutex::scoped_lock lm (_mutex); return _fonts; } @@ -211,7 +213,7 @@ private: double _x_scale; /** y scale factor to apply to subtitles */ double _y_scale; - std::list > _fonts; + std::list > _fonts; boost::optional _colour; boost::optional _effect; boost::optional _effect_colour; diff --git a/src/lib/writer.h b/src/lib/writer.h index ce1d04ced..9d2089d9f 100644 --- a/src/lib/writer.h +++ b/src/lib/writer.h @@ -36,10 +36,13 @@ namespace dcp { class Data; } +namespace dcpomatic { + class Font; +} + class Film; class AudioBuffers; class Job; -class Font; class ReferencedReelAsset; class ReelWriter; @@ -106,7 +109,7 @@ public: void repeat (Frame, Eyes); void write (boost::shared_ptr, dcpomatic::DCPTime time); void write (PlayerText text, TextType type, boost::optional, dcpomatic::DCPTimePeriod period); - void write (std::list > fonts); + void write (std::list > fonts); void write (ReferencedReelAsset asset); void finish (); @@ -163,5 +166,5 @@ private: std::list _reel_assets; - std::list > _fonts; + std::list > _fonts; }; diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc index 508390a38..f6427e68e 100644 --- a/src/tools/dcpomatic.cc +++ b/src/tools/dcpomatic.cc @@ -341,7 +341,7 @@ public: JobManagerView* job_manager_view = new JobManagerView (overall_panel, false); wxBoxSizer* right_sizer = new wxBoxSizer (wxVERTICAL); - right_sizer->Add (_film_viewer->panel(), 2, wxEXPAND | wxALL, 6); + right_sizer->Add (_film_viewer->window(), 2, wxEXPAND | wxALL, 6); right_sizer->Add (_controls, 0, wxEXPAND | wxALL, 6); right_sizer->Add (job_manager_view, 1, wxEXPAND | wxALL, 6); diff --git a/src/tools/dcpomatic_kdm.cc b/src/tools/dcpomatic_kdm.cc index 8ee4c72d4..60bb54f59 100644 --- a/src/tools/dcpomatic_kdm.cc +++ b/src/tools/dcpomatic_kdm.cc @@ -74,6 +74,7 @@ using boost::bind; using boost::optional; using boost::ref; using boost::dynamic_pointer_cast; +using namespace dcpomatic; enum { ID_help_report_a_problem = 1, diff --git a/src/tools/dcpomatic_kdm_cli.cc b/src/tools/dcpomatic_kdm_cli.cc index 21f9ec734..79912a36a 100644 --- a/src/tools/dcpomatic_kdm_cli.cc +++ b/src/tools/dcpomatic_kdm_cli.cc @@ -47,6 +47,7 @@ using boost::shared_ptr; using boost::optional; using boost::bind; using boost::dynamic_pointer_cast; +using namespace dcpomatic; static void help () diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc index 3ba63379b..fd2e08021 100644 --- a/src/tools/dcpomatic_player.cc +++ b/src/tools/dcpomatic_player.cc @@ -251,7 +251,7 @@ public: { wxSizer* main_sizer = new wxBoxSizer (wxVERTICAL); if (mode != Config::PLAYER_MODE_DUAL) { - main_sizer->Add (_viewer->panel(), 1, wxEXPAND | wxALIGN_CENTER_VERTICAL); + main_sizer->Add (_viewer->window(), 1, wxEXPAND | wxALIGN_CENTER_VERTICAL); } main_sizer->Add (_controls, mode == Config::PLAYER_MODE_DUAL ? 1 : 0, wxEXPAND | wxALL, 6); main_sizer->Add (_info, 0, wxEXPAND | wxALL, 6); @@ -715,7 +715,7 @@ private: _dual_screen = new wxFrame (this, wxID_ANY, wxT("")); _dual_screen->SetBackgroundColour (wxColour(0, 0, 0)); _dual_screen->ShowFullScreen (true); - _viewer->panel()->Reparent (_dual_screen); + _viewer->window()->Reparent (_dual_screen); _dual_screen->Show (); if (wxDisplay::GetCount() > 1) { switch (Config::instance()->image_display()) { @@ -732,7 +732,7 @@ private: } } else { if (_dual_screen) { - _viewer->panel()->Reparent (_overall_panel); + _viewer->window()->Reparent (_overall_panel); _dual_screen->Destroy (); _dual_screen = 0; } diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index 48fbf9fdc..5777b9771 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -77,7 +77,7 @@ rtaudio_callback (void* out, void *, unsigned int frames, double, RtAudioStreamS } FilmViewer::FilmViewer (wxWindow* p) - : _panel (new wxPanel (p)) + : _gl_view (new GLView (p)) , _coalesce_player_changes (false) , _audio (DCPOMATIC_RTAUDIO_API) , _audio_channels (0) @@ -96,15 +96,6 @@ FilmViewer::FilmViewer (wxWindow* p) , _state_timer ("viewer") , _gets (0) { -#ifndef __WXOSX__ - _panel->SetDoubleBuffered (true); -#endif - - _panel->SetBackgroundStyle (wxBG_STYLE_PAINT); - _panel->SetBackgroundColour (*wxBLACK); - - _panel->Bind (wxEVT_PAINT, boost::bind (&FilmViewer::paint_panel, this)); - _panel->Bind (wxEVT_SIZE, boost::bind (&FilmViewer::panel_sized, this, _1)); _timer.Bind (wxEVT_TIMER, boost::bind (&FilmViewer::timer, this)); set_film (shared_ptr ()); @@ -147,8 +138,8 @@ FilmViewer::set_film (shared_ptr film) if (_dcp_decode_reduction) { _player->set_dcp_decode_reduction (_dcp_decode_reduction); } - } catch (bad_alloc &) { - error_dialog (_panel, _("There is not enough free memory to do that.")); + } catch (bad_alloc) { + error_dialog (_gl_view, _("There is not enough free memory to do that.")); _film.reset (); return; } @@ -214,10 +205,7 @@ FilmViewer::recreate_butler () void FilmViewer::refresh_panel () { - _state_timer.set ("refresh-panel"); - _panel->Refresh (); - _panel->Update (); - _state_timer.unset (); + /* XXX */ } void @@ -326,6 +314,8 @@ bool #ifdef DCPOMATIC_VARIANT_SWAROOP FilmViewer::maybe_draw_background_image (wxPaintDC& dc) { +#ifdef DCPOMATIC_VARIANT_SWAROOP + XXX optional bg = Config::instance()->player_background_image(); if (bg) { wxImage image (std_to_wx(bg->string())); @@ -343,6 +333,8 @@ FilmViewer::maybe_draw_background_image (wxPaintDC &) } #endif +#if 0 +XXX void FilmViewer::paint_panel () { @@ -417,6 +409,7 @@ FilmViewer::paint_panel () _state_timer.unset (); } +#endif void FilmViewer::set_outline_content (bool o) @@ -432,6 +425,8 @@ FilmViewer::set_eyes (Eyes e) slow_refresh (); } +#if 0 +XXX void FilmViewer::panel_sized (wxSizeEvent& ev) { @@ -444,6 +439,7 @@ FilmViewer::panel_sized (wxSizeEvent& ev) } PositionChanged (); } +#endif void FilmViewer::calculate_sizes () @@ -454,16 +450,16 @@ FilmViewer::calculate_sizes () Ratio const * container = _film->container (); - float const panel_ratio = _panel_size.ratio (); + float const view_ratio = float(_gl_view->GetSize().x) / _gl_view->GetSize().y; float const film_ratio = container ? container->ratio () : 1.78; - if (panel_ratio < film_ratio) { + if (view_ratio < film_ratio) { /* panel is less widscreen than the film; clamp width */ - _out_size.width = _panel_size.width; + _out_size.width = _gl_view->GetSize().x; _out_size.height = lrintf (_out_size.width / film_ratio); } else { /* panel is more widescreen than the film; clamp height */ - _out_size.height = _panel_size.height; + _out_size.height = _gl_view->GetSize().y; _out_size.width = lrintf (_out_size.height * film_ratio); } @@ -679,7 +675,7 @@ FilmViewer::config_changed (Config::Property p) } catch (RtAudioError& e) { #endif error_dialog ( - _panel, + _gl_view, _("Could not set up audio output. There will be no audio during the preview."), std_to_wx(e.what()) ); } diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h index 0222d31c9..b96fba34c 100644 --- a/src/wx/film_viewer.h +++ b/src/wx/film_viewer.h @@ -22,6 +22,7 @@ * @brief FilmViewer class. */ +#include "gl_view.h" #include "lib/film.h" #include "lib/config.h" #include "lib/player_text.h" @@ -47,9 +48,9 @@ public: FilmViewer (wxWindow *); ~FilmViewer (); - /** @return the panel showing the film's video */ - wxPanel* panel () const { - return _panel; + /** @return the window showing the film's video */ + wxWindow* window () const { + return _gl_view; } void show_closed_captions (); @@ -114,8 +115,8 @@ public: boost::signals2::signal PlaybackPermitted; private: - void paint_panel (); - void panel_sized (wxSizeEvent &); +// void paint_panel (); +// void panel_sized (wxSizeEvent &); void timer (); void calculate_sizes (); void player_change (ChangeType type, int, bool); @@ -136,8 +137,7 @@ private: boost::shared_ptr _film; boost::shared_ptr _player; - /** The area that we put our image in */ - wxPanel* _panel; + GLView* _gl_view; wxTimer _timer; bool _coalesce_player_changes; std::list _pending_player_changes; @@ -150,8 +150,6 @@ private: /** Size of our output (including padding if we have any) */ dcp::Size _out_size; - /** Size of the panel that we have available */ - dcp::Size _panel_size; RtAudio _audio; int _audio_channels; diff --git a/src/wx/fonts_dialog.cc b/src/wx/fonts_dialog.cc index 88fcb2dce..66f8ab0e4 100644 --- a/src/wx/fonts_dialog.cc +++ b/src/wx/fonts_dialog.cc @@ -33,6 +33,7 @@ using std::list; using std::string; using std::cout; using boost::shared_ptr; +using namespace dcpomatic; FontsDialog::FontsDialog (wxWindow* parent, shared_ptr content, shared_ptr caption) : wxDialog (parent, wxID_ANY, _("Fonts")) diff --git a/src/wx/kdm_dialog.h b/src/wx/kdm_dialog.h index 099db951b..a240ec1b6 100644 --- a/src/wx/kdm_dialog.h +++ b/src/wx/kdm_dialog.h @@ -25,8 +25,11 @@ #include #include +namespace dcpomatic { + class Screen; +} + class Cinema; -class Screen; class Film; class ScreensPanel; class KDMTimingPanel; diff --git a/src/wx/screens_panel.cc b/src/wx/screens_panel.cc index e89173eb2..7e012b522 100644 --- a/src/wx/screens_panel.cc +++ b/src/wx/screens_panel.cc @@ -36,6 +36,7 @@ using std::string; using std::make_pair; using boost::shared_ptr; using boost::optional; +using namespace dcpomatic; ScreensPanel::ScreensPanel (wxWindow* parent) : wxPanel (parent, wxID_ANY) diff --git a/src/wx/screens_panel.h b/src/wx/screens_panel.h index 3e9accde5..59746f101 100644 --- a/src/wx/screens_panel.h +++ b/src/wx/screens_panel.h @@ -27,7 +27,10 @@ #include class Cinema; -class Screen; + +namespace dcpomatic { + class Screen; +} class ScreensPanel : public wxPanel { @@ -35,7 +38,7 @@ public: explicit ScreensPanel (wxWindow* parent); ~ScreensPanel (); - std::list > screens () const; + std::list > screens () const; void setup_sensitivity (); boost::signals2::signal ScreensChanged; @@ -43,7 +46,7 @@ public: private: void add_cinemas (); void add_cinema (boost::shared_ptr); - boost::optional add_screen (boost::shared_ptr, boost::shared_ptr); + boost::optional add_screen (boost::shared_ptr, boost::shared_ptr); void add_cinema_clicked (); void edit_cinema_clicked (); void remove_cinema_clicked (); @@ -65,7 +68,7 @@ private: wxTreeItemId _root; typedef std::map > CinemaMap; - typedef std::map > ScreenMap; + typedef std::map > ScreenMap; CinemaMap _cinemas; ScreenMap _screens; diff --git a/src/wx/wscript b/src/wx/wscript index 193093e14..f3849c53b 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -70,6 +70,7 @@ sources = """ full_config_dialog.cc gain_calculator_dialog.cc gdc_certificate_panel.cc + gl_view.cc hints_dialog.cc html_dialog.cc initial_setup_dialog.cc @@ -156,7 +157,7 @@ def configure(conf): conf.check_cfg(msg='Checking for wxWidgets using gtk2-unicode-3.0', package='', path=wx_config, - args='--cppflags --cxxflags --libs %s' % wx_libs, + args='--cppflags --cxxflags --libs %s --gl-libs' % wx_libs, uselib_store='WXWIDGETS', mandatory=True) except: @@ -165,7 +166,7 @@ def configure(conf): conf.check_cfg(msg='Checking for wxWidgets using wx-config-3.0-gtk2', package='', path=wx_config, - args='--cppflags --cxxflags --libs %s' % wx_libs, + args='--cppflags --cxxflags --libs %s --gl-libs' % wx_libs, uselib_store='WXWIDGETS', mandatory=True) except: @@ -173,7 +174,7 @@ def configure(conf): conf.check_cfg(msg='Checking for wxWidgets using wx-config', package='', path=wx_config, - args='--cppflags --cxxflags --libs %s' % wx_libs, + args='--cppflags --cxxflags --libs %s --gl-libs' % wx_libs, uselib_store='WXWIDGETS', mandatory=True)