Another try at sorting out the thorny question of timing.
[dcpomatic.git] / src / lib / encoder.cc
index 3152669ad46a0e083d7893781866ba9770f30a4f..c3865d2c16ebf44852cede103a97d94f93c3c022 100644 (file)
  */
 
 #include <iostream>
-#include <boost/filesystem.hpp>
-#include <boost/lexical_cast.hpp>
-#include <libdcp/picture_asset.h>
 #include "encoder.h"
 #include "util.h"
 #include "film.h"
 #include "log.h"
-#include "exceptions.h"
-#include "filter.h"
 #include "config.h"
 #include "dcp_video_frame.h"
 #include "server.h"
-#include "format.h"
 #include "cross.h"
 #include "writer.h"
-#include "player.h"
-#include "audio_mapping.h"
-#include "container.h"
 
 #include "i18n.h"
 
@@ -56,7 +47,7 @@ using boost::optional;
 int const Encoder::_history_size = 25;
 
 /** @param f Film that we are encoding */
-Encoder::Encoder (shared_ptr<Film> f, shared_ptr<Job> j)
+Encoder::Encoder (shared_ptr<const Film> f, shared_ptr<Job> j)
        : _film (f)
        , _job (j)
        , _video_frames_out (0)
@@ -178,7 +169,7 @@ Encoder::frame_done ()
 }
 
 void
-Encoder::process_video (shared_ptr<const Image> image, bool same, shared_ptr<Subtitle> sub, Time)
+Encoder::process_video (shared_ptr<const Image> image, bool same)
 {
        boost::mutex::scoped_lock lock (_mutex);
 
@@ -211,11 +202,8 @@ Encoder::process_video (shared_ptr<const Image> image, bool same, shared_ptr<Sub
                /* XXX: padding */
                _queue.push_back (shared_ptr<DCPVideoFrame> (
                                          new DCPVideoFrame (
-                                                 image, sub, _film->container()->size (_film->full_frame()), 0,
-                                                 _film->subtitle_offset(), _film->subtitle_scale(),
-                                                 _film->scaler(), _video_frames_out, _film->dcp_video_frame_rate(),
-                                                 _film->colour_lut(), _film->j2k_bandwidth(),
-                                                 _film->log()
+                                                 image, _video_frames_out, _film->dcp_video_frame_rate(),
+                                                 _film->colour_lut(), _film->j2k_bandwidth(), _film->log()
                                                  )
                                          ));
                
@@ -227,7 +215,7 @@ Encoder::process_video (shared_ptr<const Image> image, bool same, shared_ptr<Sub
 }
 
 void
-Encoder::process_audio (shared_ptr<const AudioBuffers> data, Time)
+Encoder::process_audio (shared_ptr<const AudioBuffers> data)
 {
        _writer->write (data);
 }
@@ -246,6 +234,8 @@ Encoder::terminate_threads ()
                }
                delete *i;
        }
+
+       _threads.clear ();
 }
 
 void