Merge master; fix crash on new film.
[dcpomatic.git] / src / tools / servomatictest.cc
index 91ad02120950346976b6e22b19ec2d75aca965d7..af176ac18e6b02ea011cc526bd3a4a581b49e128 100644 (file)
 #include "scaler.h"
 #include "server.h"
 #include "dcp_video_frame.h"
-#include "options.h"
 #include "decoder.h"
 #include "exceptions.h"
 #include "scaler.h"
 #include "log.h"
-#include "decoder_factory.h"
 #include "video_decoder.h"
+#include "player.h"
 
 using std::cout;
 using std::cerr;
@@ -43,24 +42,24 @@ using std::pair;
 using boost::shared_ptr;
 
 static ServerDescription* server;
-static FileLog log_ ("servomatictest.log");
+static shared_ptr<FileLog> log_ (new FileLog ("servomatictest.log"));
 static int frame = 0;
 
 void
-process_video (shared_ptr<Image> image, bool, shared_ptr<Subtitle> sub)
+process_video (shared_ptr<const Image> image, bool, shared_ptr<Subtitle> sub)
 {
        shared_ptr<DCPVideoFrame> local (
                new DCPVideoFrame (
                        image, sub,
                        libdcp::Size (1024, 1024), 0, 0, 0,
-                       Scaler::from_id ("bicubic"), frame, 24, "", 0, 250000000, &log_)
+                       Scaler::from_id ("bicubic"), frame, 24, "", 0, 250000000, log_)
                );
        
        shared_ptr<DCPVideoFrame> remote (
                new DCPVideoFrame (
                        image, sub,
                        libdcp::Size (1024, 1024), 0, 0, 0,
-                       Scaler::from_id ("bicubic"), frame, 24, "", 0, 250000000, &log_)
+                       Scaler::from_id ("bicubic"), frame, 24, "", 0, 250000000, log_)
                );
 
        cout << "Frame " << frame << ": ";
@@ -146,22 +145,19 @@ main (int argc, char* argv[])
                exit (EXIT_FAILURE);
        }
 
-       dvdomatic_setup ();
+       dcpomatic_setup ();
 
        server = new ServerDescription (server_host, 1);
        shared_ptr<Film> film (new Film (film_dir, true));
 
-       DecodeOptions opt;
-       opt.decode_audio = false;
-       opt.decode_subtitles = true;
-       opt.video_sync = true;
+       shared_ptr<Player> player = film->player ();
+       player->disable_audio ();
 
-       Decoders decoders = decoder_factory (film, opt);
        try {
-               decoders.video->Video.connect (boost::bind (process_video, _1, _2, _3));
+               player->Video.connect (boost::bind (process_video, _1, _2, _3));
                bool done = false;
                while (!done) {
-                       done = decoders.video->pass ();
+                       done = player->pass ();
                }
        } catch (std::exception& e) {
                cerr << "Error: " << e.what() << "\n";