Move Image::as_png() out to image_as_png().
[dcpomatic.git] / src / tools / dcpomatic_player.cc
index 8c9f016d4b71a65f16b8a871a0b74b5befd1423e..5d5e2e825d45c9d87a8e19e283440c11bc716c56 100644 (file)
 
 */
 
-#include "wx/wx_signal_manager.h"
-#include "wx/wx_util.h"
 #include "wx/about_dialog.h"
-#include "wx/report_problem_dialog.h"
 #include "wx/film_viewer.h"
-#include "wx/player_information.h"
-#include "wx/update_dialog.h"
+#include "wx/nag_dialog.h"
 #include "wx/player_config_dialog.h"
-#include "wx/verify_dcp_dialog.h"
-#include "wx/standard_controls.h"
+#include "wx/player_information.h"
+#include "wx/player_stress_tester.h"
 #include "wx/playlist_controls.h"
-#include "wx/timer_display.h"
+#include "wx/report_problem_dialog.h"
+#include "wx/standard_controls.h"
 #include "wx/system_information_dialog.h"
-#include "wx/player_stress_tester.h"
+#include "wx/timer_display.h"
+#include "wx/update_dialog.h"
+#include "wx/verify_dcp_dialog.h"
 #include "wx/verify_dcp_progress_dialog.h"
-#include "wx/nag_dialog.h"
-#include "lib/cross.h"
-#include "lib/config.h"
-#include "lib/util.h"
-#include "lib/internet.h"
-#include "lib/update_checker.h"
+#include "wx/wx_signal_manager.h"
+#include "wx/wx_util.h"
 #include "lib/compose.hpp"
+#include "lib/config.h"
+#include "lib/cross.h"
 #include "lib/dcp_content.h"
-#include "lib/job_manager.h"
-#include "lib/job.h"
-#include "lib/film.h"
-#include "lib/null_log.h"
-#include "lib/video_content.h"
-#include "lib/text_content.h"
-#include "lib/ratio.h"
-#include "lib/verify_dcp_job.h"
 #include "lib/dcp_examiner.h"
-#include "lib/examine_content_job.h"
-#include "lib/server.h"
+#include "lib/dcpomatic_log.h"
 #include "lib/dcpomatic_socket.h"
-#include "lib/scoped_temporary.h"
+#include "lib/examine_content_job.h"
 #include "lib/ffmpeg_content.h"
-#include "lib/dcpomatic_log.h"
 #include "lib/file_log.h"
+#include "lib/film.h"
+#include "lib/image.h"
+#include "lib/image_png.h"
+#include "lib/internet.h"
+#include "lib/job.h"
+#include "lib/job_manager.h"
+#include "lib/null_log.h"
+#include "lib/ratio.h"
+#include "lib/scoped_temporary.h"
+#include "lib/server.h"
+#include "lib/text_content.h"
+#include "lib/update_checker.h"
+#include "lib/util.h"
+#include "lib/verify_dcp_job.h"
+#include "lib/video_content.h"
 #include <dcp/cpl.h>
 #include <dcp/dcp.h>
-#include <dcp/raw_convert.h>
 #include <dcp/exceptions.h>
-#include <wx/wx.h>
-#include <wx/stdpaths.h>
-#include <wx/splash.h>
+#include <dcp/raw_convert.h>
+#include <dcp/search.h>
+#include <dcp/warnings.h>
+LIBDCP_DISABLE_WARNINGS
 #include <wx/cmdline.h>
+#include <wx/display.h>
 #include <wx/preferences.h>
 #include <wx/progdlg.h>
-#include <wx/display.h>
+#include <wx/splash.h>
+#include <wx/stdpaths.h>
+#include <wx/wx.h>
+LIBDCP_ENABLE_WARNINGS
 #ifdef __WXGTK__
 #include <X11/Xlib.h>
 #endif
-#include <boost/bind/bind.hpp>
 #include <boost/algorithm/string.hpp>
+#include <boost/bind/bind.hpp>
 #include <iostream>
 
 #ifdef check
 #undef check
 #endif
 
+
 #define MAX_CPLS 32
 
+
 using std::cout;
 using std::dynamic_pointer_cast;
 using std::exception;
@@ -90,16 +98,17 @@ using std::shared_ptr;
 using std::string;
 using std::vector;
 using std::weak_ptr;
-using boost::scoped_array;
+using boost::bind;
 using boost::optional;
+using boost::scoped_array;
 using boost::thread;
-using boost::bind;
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
 #endif
 using dcp::raw_convert;
 using namespace dcpomatic;
 
+
 enum {
        ID_file_open = 1,
        ID_file_add_ov,
@@ -434,9 +443,8 @@ public:
                        /* Offer a CPL menu */
                        auto first = dynamic_pointer_cast<DCPContent>(_film->content().front());
                        if (first) {
-                               DCPExaminer ex (first, true);
                                int id = ID_view_cpl;
-                               for (auto i: ex.cpls()) {
+                               for (auto i: dcp::find_and_resolve_cpls(first->directories(), true)) {
                                        auto j = _cpl_menu->AppendRadioItem(
                                                id,
                                                wxString::Format("%s (%s)", std_to_wx(i->annotation_text().get_value_or("")).data(), std_to_wx(i->id()).data())
@@ -691,11 +699,10 @@ private:
        {
                auto dcp = std::dynamic_pointer_cast<DCPContent>(_film->content().front());
                DCPOMATIC_ASSERT (dcp);
-               DCPExaminer ex (dcp, true);
+               auto cpls = dcp::find_and_resolve_cpls (dcp->directories(), true);
                int id = ev.GetId() - ID_view_cpl;
                DCPOMATIC_ASSERT (id >= 0);
-               DCPOMATIC_ASSERT (id < int(ex.cpls().size()));
-               auto cpls = ex.cpls();
+               DCPOMATIC_ASSERT (id < int(cpls.size()));
                auto i = cpls.begin();
                while (id > 0) {
                        ++i;
@@ -1023,7 +1030,7 @@ public:
                , _frame (frame)
        {}
 
-       void handle (shared_ptr<Socket> socket)
+       void handle (shared_ptr<Socket> socket) override
        {
                try {
                        int const length = socket->read_uint32 ();
@@ -1057,7 +1064,7 @@ public:
 
 private:
 
-       bool OnInit ()
+       bool OnInit () override
        {
                wxSplashScreen* splash = nullptr;
                try {
@@ -1156,13 +1163,13 @@ private:
                return true;
        }
 
-       void OnInitCmdLine (wxCmdLineParser& parser)
+       void OnInitCmdLine (wxCmdLineParser& parser) override
        {
                parser.SetDesc (command_line_description);
                parser.SetSwitchChars (wxT ("-"));
        }
 
-       bool OnCmdLineParsed (wxCmdLineParser& parser)
+       bool OnCmdLineParsed (wxCmdLineParser& parser) override
        {
                if (parser.GetParamCount() > 0) {
                        _dcp_to_load = wx_to_std (parser.GetParam (0));
@@ -1207,14 +1214,14 @@ private:
        }
 
        /* An unhandled exception has occurred inside the main event loop */
-       bool OnExceptionInMainLoop ()
+       bool OnExceptionInMainLoop () override
        {
                report_exception ();
                /* This will terminate the program */
                return false;
        }
 
-       void OnUnhandledException ()
+       void OnUnhandledException () override
        {
                report_exception ();
        }