asdcplib links.
authorCarl Hetherington <cth@carlh.net>
Mon, 16 Jul 2012 01:11:06 +0000 (02:11 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 16 Jul 2012 01:11:06 +0000 (02:11 +0100)
src/lib/make_mxf_job.cc
src/lib/make_mxf_job.h
src/lib/wscript

index 01fc30fc7319b56c0134c21dc9aeb729a27959be..34f115e9811367ea71b5cbc69d6259c6829220c0 100644 (file)
  */
 
 #include <iostream>
+#include <boost/filesystem.hpp>
+#include "AS_DCP.h"
 #include "make_mxf_job.h"
 #include "film.h"
 #include "film_state.h"
 #include "options.h"
+#include "exceptions.h"
 
 using namespace std;
 using namespace boost;
@@ -35,7 +38,7 @@ using namespace boost;
  */
 
 MakeMXFJob::MakeMXFJob (shared_ptr<const FilmState> s, shared_ptr<const Options> o, Log* l, Type t)
-       : ShellCommandJob (s, o, l)
+       : Job (s, o, l)
        , _type (t)
 {
 
@@ -57,6 +60,8 @@ MakeMXFJob::name () const
        return s.str ();
 }
 
+#if 0
+XXX
 void
 MakeMXFJob::run ()
 {
@@ -79,3 +84,48 @@ MakeMXFJob::run ()
        command (c.str ());
        set_progress (1);
 }
+#endif
+
+void
+MakeMXFJob::run ()
+{
+       set_progress (0);
+
+       string dir;
+       switch (_type) {
+       case VIDEO:
+               dir = _opt->frame_out_path ();
+               break;
+       case AUDIO:
+               dir = _opt->multichannel_audio_out_path ();
+               break;
+       }
+
+       std::list<std::string> files;
+        for (filesystem::directory_iterator i = filesystem::directory_iterator (dir); i != filesystem::directory_iterator(); ++i) {
+               files.push_back (filesystem::path (*i).string());
+       }
+
+       if (files.empty ()) {
+               throw EncodeError ("no input files found for MXF");
+       }
+
+       ASDCP::EssenceType_t essence_type;
+       if (ASDCP_FAILURE (ASDCP::RawEssenceType (files.front().c_str(), essence_type))) {
+               throw EncodeError ("could not work out type for MXF");
+       }
+
+       switch (essence_type) {
+       case ASDCP::ESS_JPEG_2000:
+               /* XXX */
+               break;
+       case ASDCP::ESS_PCM_24b_48k:
+       case ASDCP::ESS_PCM_24b_96k:
+               /* XXX */
+               break;
+       default:
+               throw EncodeError ("unknown essence type");
+       }
+       
+       set_progress (1);
+}
index 462381d236dd41ed46f40e2bba9ac0bc43760392..b433bdecac258936059b8ac8d2365e41f21b086f 100644 (file)
@@ -29,7 +29,7 @@ class Options;
 /** @class MakeMXFJob
  *  @brief A job that creates a MXF file from some data.
  */
-class MakeMXFJob : public ShellCommandJob
+class MakeMXFJob : public Job
 {
 public:
        enum Type {
index f60a63f85ea9a70dce847daebe80fddff377cfd3..5d8adf7fff5c9a7ef29a14dd854871ccb009ffc6 100644 (file)
@@ -8,6 +8,7 @@ def build(bld):
     obj.name = 'libdvdomatic'
     obj.export_includes = ['.']
     obj.uselib = 'AVCODEC AVUTIL AVFORMAT AVFILTER SWSCALE SWRESAMPLE SNDFILE BOOST_FILESYSTEM BOOST_THREAD OPENJPEG POSTPROC TIFF SIGC++ MAGICK SSH'
+    obj.use = 'libasdcp-dvdomatic'
     if bld.env.DEBUG_HASH:
         obj.uselib += ' MHASH'
     obj.source = """