Use make_shared<>.
[dcpomatic.git] / src / tools / dcpomatic_batch.cc
index 677861c3d4ae688dd58da8d759ae38c6583f3f4d..3570dda084a2dc0a257c43169db4bf03165b2281 100644 (file)
@@ -1,19 +1,20 @@
 /*
     Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
 
-    This program is free software; you can redistribute it and/or modify
+    This file is part of DCP-o-matic.
+
+    DCP-o-matic 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,
+    DCP-o-matic 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.
+    along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
 
 */
 
 #include <wx/cmdline.h>
 #include <wx/preferences.h>
 #include <wx/wx.h>
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 using std::exception;
 using std::string;
 using std::cout;
 using boost::shared_ptr;
+using boost::make_shared;
 using boost::thread;
 using boost::scoped_array;
 
@@ -127,7 +130,7 @@ public:
        void start_job (boost::filesystem::path path)
        {
                try {
-                       shared_ptr<Film> film (new Film (path));
+                       shared_ptr<Film> film = make_shared<Film> (path);
                        film->read_metadata ();
                        film->make_dcp ();
                } catch (std::exception& e) {
@@ -257,11 +260,11 @@ public:
        {
                try {
                        int const length = socket->read_uint32 ();
-                       cout << "len=" << length << "\n";
                        scoped_array<char> buffer (new char[length]);
                        socket->read (reinterpret_cast<uint8_t*> (buffer.get()), length);
                        string s (buffer.get());
                        _frame->start_job (s);
+                       socket->write (reinterpret_cast<uint8_t const *> ("OK"), 3);
                } catch (...) {
 
                }