Remove make dcp job.
authorCarl Hetherington <cth@carlh.net>
Fri, 18 Jan 2013 21:56:12 +0000 (21:56 +0000)
committerCarl Hetherington <cth@carlh.net>
Fri, 18 Jan 2013 21:56:12 +0000 (21:56 +0000)
src/lib/film.cc
src/lib/make_dcp_job.cc [deleted file]
src/lib/make_dcp_job.h [deleted file]
src/lib/writer.cc
src/lib/wscript
src/tools/makedcp.cc

index 1741d49e691269e79abf7079cdfd11a67fc9a4ec..c91a8047133dc0e14a1ff0cc47f0a946ada72e9e 100644 (file)
@@ -39,7 +39,6 @@
 #include "ab_transcode_job.h"
 #include "transcode_job.h"
 #include "scp_dcp_job.h"
-#include "make_dcp_job.h"
 #include "log.h"
 #include "options.h"
 #include "exceptions.h"
@@ -305,8 +304,7 @@ Film::make_dcp (bool transcode)
                }
        }
 
-       r = JobManager::instance()->add (shared_ptr<Job> (new CheckHashesJob (shared_from_this(), od, r)));
-       JobManager::instance()->add (shared_ptr<Job> (new MakeDCPJob (shared_from_this(), r)));
+       // r = JobManager::instance()->add (shared_ptr<Job> (new CheckHashesJob (shared_from_this(), od, r)));
 }
 
 /** Start a job to examine our content file */
diff --git a/src/lib/make_dcp_job.cc b/src/lib/make_dcp_job.cc
deleted file mode 100644 (file)
index fb24fed..0000000
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
-    Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-/** @file src/make_dcp_job.cc
- *  @brief A job to create DCPs.
- */
-
-#include <iostream>
-#include <boost/filesystem.hpp>
-#include <libdcp/dcp.h>
-#include <libdcp/picture_asset.h>
-#include <libdcp/sound_asset.h>
-#include <libdcp/reel.h>
-extern "C" {
-#include <libavutil/pixdesc.h>
-}
-#include "make_dcp_job.h"
-#include "dcp_content_type.h"
-#include "exceptions.h"
-#include "options.h"
-#include "imagemagick_decoder.h"
-#include "film.h"
-#include "format.h"
-
-using std::string;
-using std::cout;
-using boost::shared_ptr;
-
-/** @param f Film we are making the DCP for.
- *  @param o Options.
- */
-MakeDCPJob::MakeDCPJob (shared_ptr<Film> f, shared_ptr<Job> req)
-       : Job (f, req)
-{
-       
-}
-
-string
-MakeDCPJob::name () const
-{
-       return String::compose ("Make DCP for %1", _film->name());
-}
-
-/** @param f DCP frame index */
-string
-MakeDCPJob::j2c_path (int f, int offset) const
-{
-       return _film->frame_out_path (f + offset, false);
-}
-
-string
-MakeDCPJob::wav_path (libdcp::Channel c) const
-{
-       return _film->multichannel_audio_out_path (int (c), false);
-}
-
-void
-MakeDCPJob::run ()
-{
-       if (!_film->dcp_intrinsic_duration()) {
-               throw EncodeError ("cannot make a DCP when its intrinsic duration is not known");
-       }
-
-       descend (0.9);
-       
-       string const dcp_path = _film->dir (_film->dcp_name());
-
-       /* Remove any old DCP */
-       boost::filesystem::remove_all (dcp_path);
-
-       int const frames = _film->dcp_intrinsic_duration().get();
-       int const duration = frames - _film->trim_start() - _film->trim_end();
-       DCPFrameRate const dfr (_film->frames_per_second ());
-
-       libdcp::DCP dcp (_film->dir (_film->dcp_name()));
-       dcp.Progress.connect (boost::bind (&MakeDCPJob::dcp_progress, this, _1));
-
-       shared_ptr<libdcp::CPL> cpl (
-               new libdcp::CPL (_film->dir (_film->dcp_name()), _film->dcp_name(), _film->dcp_content_type()->libdcp_kind (), frames, dfr.frames_per_second)
-               );
-       
-       dcp.add_cpl (cpl);
-
-       int frames_per_reel = 0;
-       if (_film->reel_size()) {
-               frames_per_reel = (_film->reel_size().get() / (_film->j2k_bandwidth() / 8)) * dfr.frames_per_second;
-       } else {
-               frames_per_reel = frames;
-       }
-
-       int frames_done = 0;
-       int reel = 0;
-
-       while (frames_done < frames) {
-
-               descend (float (frames_per_reel) / frames);
-
-               int this_time = std::min (frames_per_reel, (frames - frames_done));
-
-               descend (0.8);
-
-               shared_ptr<libdcp::MonoPictureAsset> pa (
-                       new libdcp::MonoPictureAsset (
-                               boost::bind (&MakeDCPJob::j2c_path, this, _1, frames_done),
-                               _film->dir (_film->dcp_name()),
-                               String::compose ("video_%1.mxf", reel),
-                               &dcp.Progress,
-                               dfr.frames_per_second,
-                               this_time,
-                               _film->format()->dcp_size()
-                               )
-                       );
-
-               pa->set_entry_point (_film->trim_start ());
-               pa->set_duration (duration);
-       
-               ascend ();
-               
-               shared_ptr<libdcp::SoundAsset> sa;
-               
-               if (_film->audio_channels() > 0) {
-                       descend (0.1);
-                       sa.reset (
-                               new libdcp::SoundAsset (
-                                       boost::bind (&MakeDCPJob::wav_path, this, _1),
-                                       _film->dir (_film->dcp_name()),
-                                       String::compose ("audio_%1.mxf", reel),
-                                       &dcp.Progress,
-                                       dfr.frames_per_second,
-                                       this_time,
-                                       frames_done,
-                                       dcp_audio_channels (_film->audio_channels())
-                                       )
-                               );
-
-                       sa->set_entry_point (_film->trim_start ());
-                       sa->set_duration (duration);
-                       
-                       ascend ();
-               }
-
-               descend (0.1);
-               cpl->add_reel (shared_ptr<libdcp::Reel> (new libdcp::Reel (pa, sa, shared_ptr<libdcp::SubtitleAsset> ())));
-               ascend ();
-               
-               frames_done += frames_per_reel;
-               ++reel;
-
-               ascend ();
-       }
-
-       ascend ();
-
-       descend (0.1);
-       dcp.write_xml ();
-       ascend ();
-               
-       set_progress (1);
-       set_state (FINISHED_OK);
-}
-
-void
-MakeDCPJob::dcp_progress (float p)
-{
-       set_progress (p);
-}
diff --git a/src/lib/make_dcp_job.h b/src/lib/make_dcp_job.h
deleted file mode 100644 (file)
index 4813822..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
-    Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-/** @file src/make_dcp_job.h
- *  @brief A job to create DCPs.
- */
-
-#include "job.h"
-
-/** @class MakeDCPJob
- *  @brief A job to create DCPs
- */
-class MakeDCPJob : public Job
-{
-public:
-       MakeDCPJob (boost::shared_ptr<Film>, boost::shared_ptr<Job> req);
-
-       std::string name () const;
-       void run ();
-
-private:
-       void dcp_progress (float);
-       std::string j2c_path (int, int) const;
-       std::string wav_path (libdcp::Channel) const;
-};
-
index fbd371550fd9735ad68a65b46f64cbe684ffc7e1..2cefd32fb106160d5c5f2850392e43a0bec7c29d 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <libdcp/picture_asset.h>
 #include <libdcp/sound_asset.h>
+#include <libdcp/reel.h>
 #include "writer.h"
 #include "compose.hpp"
 #include "film.h"
@@ -192,6 +193,33 @@ Writer::finish ()
 
        _picture_asset_writer->finalize ();
        _sound_asset_writer->finalize ();
+
+
+       int const frames = _film->dcp_intrinsic_duration().get();
+       int const duration = frames - _film->trim_start() - _film->trim_end();
+       
+       _picture_asset->set_entry_point (_film->trim_start ());
+       _picture_asset->set_duration (duration);
+       _sound_asset->set_entry_point (_film->trim_start ());
+       _sound_asset->set_duration (duration);
+       
+       libdcp::DCP dcp (_film->dir (_film->dcp_name()));
+       DCPFrameRate dfr (_film->frames_per_second ());
+
+       shared_ptr<libdcp::CPL> cpl (
+               new libdcp::CPL (_film->dir (_film->dcp_name()), _film->dcp_name(), _film->dcp_content_type()->libdcp_kind (), frames, dfr.frames_per_second)
+               );
+       
+       dcp.add_cpl (cpl);
+
+       cpl->add_reel (shared_ptr<libdcp::Reel> (new libdcp::Reel (
+                                                        _picture_asset,
+                                                        _sound_asset,
+                                                        shared_ptr<libdcp::SubtitleAsset> ()
+                                                        )
+                              ));
+
+       dcp.write_xml ();
 }
 
 /** Tell the writer that frame `f' should be a repeat of the frame before it */
index 6d72f6480f3e450786aef961e93896952924d6e6..02c4263735ef5972636265c7764a755f806c8be0 100644 (file)
@@ -40,7 +40,6 @@ def build(bld):
                 job_manager.cc
                 log.cc
                 lut.cc
-                make_dcp_job.cc
                  matcher.cc
                  scp_dcp_job.cc
                 scaler.cc
index 900c31bfc9fca7630bc8002ba833128be88563ff..447b0ddc0061fe93f8e11ae9dfb66d7be650e719 100644 (file)
@@ -26,7 +26,6 @@
 #include "film.h"
 #include "filter.h"
 #include "transcode_job.h"
-#include "make_dcp_job.h"
 #include "job_manager.h"
 #include "ab_transcode_job.h"
 #include "util.h"