Rename SafeStringStream -> locked_stringstream. Bump deps for removal of stringstream.
[dcpomatic.git] / src / lib / writer.cc
index 47c6b838142619a355cab1f0fbc298f84586df9b..efd43a25b8e52971a5baf421889d9d96bfc18626 100644 (file)
@@ -1,19 +1,20 @@
 /*
-    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2016 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/>.
 
 */
 
@@ -29,7 +30,6 @@
 #include "job.h"
 #include "cross.h"
 #include "audio_buffers.h"
-#include "md5_digester.h"
 #include "version.h"
 #include "font.h"
 #include "util.h"
@@ -95,8 +95,6 @@ Writer::Writer (shared_ptr<const Film> film, weak_ptr<Job> j)
        if (_film->is_signed() && !Config::instance()->signer_chain()->valid ()) {
                throw InvalidSignerError ();
        }
-
-       job->sub (_("Encoding image data"));
 }
 
 void
@@ -359,19 +357,6 @@ try
                        }
 
                        lock.lock ();
-
-                       shared_ptr<Job> job = _job.lock ();
-                       DCPOMATIC_ASSERT (job);
-                       int64_t total = _film->length().frames_round (_film->video_frame_rate ());
-                       if (_film->three_d ()) {
-                               /* _full_written and so on are incremented for each eye, so we need to double the total
-                                  frames to get the correct progress.
-                               */
-                               total *= 2;
-                       }
-                       if (total) {
-                               job->set_progress (float (_full_written + _fake_written + _repeat_written) / total);
-                       }
                }
 
                while (_queued_full_in_memory > _maximum_frames_in_memory) {
@@ -543,8 +528,20 @@ Writer::write (PlayerSubtitles subs)
 void
 Writer::write (list<shared_ptr<Font> > fonts)
 {
-       /* Just keep a list of fonts and we'll deal with them in ::finish */
-       copy (fonts.begin (), fonts.end (), back_inserter (_fonts));
+       /* Just keep a list of unique fonts and we'll deal with them in ::finish */
+
+       BOOST_FOREACH (shared_ptr<Font> i, fonts) {
+               bool got = false;
+               BOOST_FOREACH (shared_ptr<Font> j, _fonts) {
+                       if (*i == *j) {
+                               got = true;
+                       }
+               }
+
+               if (!got) {
+                       _fonts.push_back (i);
+               }
+       }
 }
 
 bool