Build fixes related to simple/GL view.
authorCarl Hetherington <cth@carlh.net>
Mon, 13 May 2019 10:36:09 +0000 (11:36 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 13 May 2019 10:36:09 +0000 (11:36 +0100)
src/tools/dcpomatic_ecinema.cc
src/wx/film_viewer.cc
src/wx/film_viewer.h
src/wx/simple_video_view.cc
src/wx/video_view.h

index bcd0907263311999869c0d9913c8fe69a42f2e57..a3f2288e3ff1533c8cf49aee4343450de2b07abe 100644 (file)
@@ -181,6 +181,6 @@ main (int argc, char* argv[])
        avformat_free_context (output_fc);
 
        DecryptedECinemaKDM decrypted_kdm (key);
        avformat_free_context (output_fc);
 
        DecryptedECinemaKDM decrypted_kdm (key);
-       EncryptedECinemaKDM encrypted_kdm = decrypted_kdm.encrypt (Config::instance()->decryption_chain());
+       EncryptedECinemaKDM encrypted_kdm = decrypted_kdm.encrypt (Config::instance()->decryption_chain()->leaf());
        cout << encrypted_kdm.as_xml() << "\n";
 }
        cout << encrypted_kdm.as_xml() << "\n";
 }
index 973189178fb083189e1583d9c372fc98fbacd2e9..7994601ea9d823a2e4f29857b0c0b057fdcd3d21 100644 (file)
@@ -91,7 +91,6 @@ FilmViewer::FilmViewer (wxWindow* p)
        , _eyes (EYES_LEFT)
        , _pad_black (false)
 #ifdef DCPOMATIC_VARIANT_SWAROOP
        , _eyes (EYES_LEFT)
        , _pad_black (false)
 #ifdef DCPOMATIC_VARIANT_SWAROOP
-       , _in_watermark (false)
        , _background_image (false)
 #endif
        , _state_timer ("viewer")
        , _background_image (false)
 #endif
        , _state_timer ("viewer")
@@ -325,28 +324,6 @@ FilmViewer::timer ()
        }
 }
 
        }
 }
 
-bool
-#ifdef DCPOMATIC_VARIANT_SWAROOP
-XXX
-FilmViewer::maybe_draw_background_image (wxPaintDC& dc)
-{
-       optional<boost::filesystem::path> bg = Config::instance()->player_background_image();
-       if (bg) {
-               wxImage image (std_to_wx(bg->string()));
-               wxBitmap bitmap (image);
-               dc.DrawBitmap (bitmap, max(0, (_panel_size.width - image.GetSize().GetWidth()) / 2), max(0, (_panel_size.height - image.GetSize().GetHeight()) / 2));
-               return true;
-       }
-
-       return false;
-}
-#else
-FilmViewer::maybe_draw_background_image (wxPaintDC &)
-{
-       return false;
-}
-#endif
-
 void
 FilmViewer::set_outline_content (bool o)
 {
 void
 FilmViewer::set_outline_content (bool o)
 {
index 450111bc4e6b96c6b765f8841c04cd34099f6664..e9450c7e7166a7c92926099fc60577a2e0fcec66 100644 (file)
@@ -93,7 +93,11 @@ public:
 #ifdef DCPOMATIC_VARIANT_SWAROOP
        void set_background_image (bool b) {
                _background_image = b;
 #ifdef DCPOMATIC_VARIANT_SWAROOP
        void set_background_image (bool b) {
                _background_image = b;
-               refresh_panel ();
+               refresh_view ();
+       }
+
+       bool background_image () const {
+               return _background_image;
        }
 #endif
 
        }
 #endif
 
@@ -125,6 +129,9 @@ public:
        bool pad_black () const {
                return _pad_black;
        }
        bool pad_black () const {
                return _pad_black;
        }
+       dcpomatic::DCPTime video_position () const {
+               return _video_position;
+       }
 
        boost::signals2::signal<void (boost::weak_ptr<PlayerVideo>)> ImageChanged;
        boost::signals2::signal<void ()> PositionChanged;
 
        boost::signals2::signal<void (boost::weak_ptr<PlayerVideo>)> ImageChanged;
        boost::signals2::signal<void ()> PositionChanged;
@@ -145,7 +152,6 @@ private:
        void film_change (ChangeType, Film::Property);
        void recreate_butler ();
        void config_changed (Config::Property);
        void film_change (ChangeType, Film::Property);
        void recreate_butler ();
        void config_changed (Config::Property);
-       bool maybe_draw_background_image (wxPaintDC& dc);
 
        dcpomatic::DCPTime time () const;
        dcpomatic::DCPTime uncorrected_time () const;
 
        dcpomatic::DCPTime time () const;
        dcpomatic::DCPTime uncorrected_time () const;
@@ -194,9 +200,6 @@ private:
        bool _pad_black;
 
 #ifdef DCPOMATIC_VARIANT_SWAROOP
        bool _pad_black;
 
 #ifdef DCPOMATIC_VARIANT_SWAROOP
-       bool _in_watermark;
-       int _watermark_x;
-       int _watermark_y;
        bool _background_image;
 #endif
 
        bool _background_image;
 #endif
 
index 0a0fce277f9b05c05fc2d5e2e9ec2e49882e4da9..66af8f19f58b75b3b30666211977a7f000ac8f36 100644 (file)
 
 #include "simple_video_view.h"
 #include "film_viewer.h"
 
 #include "simple_video_view.h"
 #include "film_viewer.h"
+#include "wx_util.h"
 #include "lib/image.h"
 #include <dcp/util.h>
 #include <wx/wx.h>
 #include <boost/bind.hpp>
 
 using std::max;
 #include "lib/image.h"
 #include <dcp/util.h>
 #include <wx/wx.h>
 #include <boost/bind.hpp>
 
 using std::max;
+using std::string;
+using boost::optional;
+using namespace dcpomatic;
 
 SimpleVideoView::SimpleVideoView (FilmViewer* viewer, wxWindow* parent)
        : VideoView (viewer)
 
 SimpleVideoView::SimpleVideoView (FilmViewer* viewer, wxWindow* parent)
        : VideoView (viewer)
@@ -49,17 +53,22 @@ SimpleVideoView::paint ()
         _viewer->state_timer().set("paint-panel");
        wxPaintDC dc (_panel);
 
         _viewer->state_timer().set("paint-panel");
        wxPaintDC dc (_panel);
 
+       dcp::Size const out_size = _viewer->out_size ();
+       wxSize const panel_size = _panel->GetSize ();
+
 #ifdef DCPOMATIC_VARIANT_SWAROOP
 #ifdef DCPOMATIC_VARIANT_SWAROOP
-       if (viewer->background_image()) {
+       if (_viewer->background_image()) {
                dc.Clear ();
                dc.Clear ();
-               maybe_draw_background_image (dc);
+               optional<boost::filesystem::path> bg = Config::instance()->player_background_image();
+               if (bg) {
+                       wxImage image (std_to_wx(bg->string()));
+                       wxBitmap bitmap (image);
+                       dc.DrawBitmap (bitmap, max(0, (panel_size.GetWidth() - image.GetSize().GetWidth()) / 2), max(0, (panel_size.GetHeight() - image.GetSize().GetHeight()) / 2));
+               }
                return;
        }
 #endif
 
                return;
        }
 #endif
 
-       dcp::Size const out_size = _viewer->out_size ();
-       wxSize const panel_size = _panel->GetSize ();
-
        if (!out_size.width || !out_size.height || !_image || out_size != _image->size()) {
                dc.Clear ();
        } else {
        if (!out_size.width || !out_size.height || !_image || out_size != _image->size()) {
                dc.Clear ();
        } else {
@@ -69,16 +78,15 @@ SimpleVideoView::paint ()
                dc.DrawBitmap (frame_bitmap, 0, max(0, (panel_size.GetHeight() - out_size.height) / 2));
 
 #ifdef DCPOMATIC_VARIANT_SWAROOP
                dc.DrawBitmap (frame_bitmap, 0, max(0, (panel_size.GetHeight() - out_size.height) / 2));
 
 #ifdef DCPOMATIC_VARIANT_SWAROOP
-               XXX
                DCPTime const period = DCPTime::from_seconds(Config::instance()->player_watermark_period() * 60);
                DCPTime const period = DCPTime::from_seconds(Config::instance()->player_watermark_period() * 60);
-               int64_t n = _video_position.get() / period.get();
+               int64_t n = _viewer->video_position().get() / period.get();
                DCPTime from(n * period.get());
                DCPTime to = from + DCPTime::from_seconds(Config::instance()->player_watermark_duration() / 1000.0);
                DCPTime from(n * period.get());
                DCPTime to = from + DCPTime::from_seconds(Config::instance()->player_watermark_duration() / 1000.0);
-               if (from <= _video_position && _video_position <= to) {
+               if (from <= _viewer->video_position() && _viewer->video_position() <= to) {
                        if (!_in_watermark) {
                                _in_watermark = true;
                        if (!_in_watermark) {
                                _in_watermark = true;
-                               _watermark_x = rand() % _panel_size.width;
-                               _watermark_y = rand() % _panel_size.height;
+                               _watermark_x = rand() % panel_size.GetWidth();
+                               _watermark_y = rand() % panel_size.GetHeight();
                        }
                        dc.SetTextForeground(*wxWHITE);
                        string wm = Config::instance()->player_watermark_theatre();
                        }
                        dc.SetTextForeground(*wxWHITE);
                        string wm = Config::instance()->player_watermark_theatre();
index af6655ec4b9bf03481abb5dc61f3ca817d98cfeb..892ffab125d08560fed8542937d36a364322f77f 100644 (file)
@@ -33,6 +33,9 @@ class VideoView
 public:
        VideoView (FilmViewer* viewer)
                : _viewer (viewer)
 public:
        VideoView (FilmViewer* viewer)
                : _viewer (viewer)
+#ifdef DCPOMATIC_VARIANT_SWAROOP
+               , _in_watermark (false)
+#endif
        {}
 
        virtual ~VideoView () {}
        {}
 
        virtual ~VideoView () {}
@@ -45,6 +48,12 @@ public:
 
 protected:
        FilmViewer* _viewer;
 
 protected:
        FilmViewer* _viewer;
+
+#ifdef DCPOMATIC_VARIANT_SWAROOP
+       bool _in_watermark;
+       int _watermark_x;
+       int _watermark_y;
+#endif
 };
 
 #endif
 };
 
 #endif