Merge branch '2.0' of git.carlh.net:git/dcpomatic into 2.0
authorCarl Hetherington <cth@carlh.net>
Wed, 13 May 2015 22:44:54 +0000 (23:44 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 13 May 2015 22:44:54 +0000 (23:44 +0100)
29 files changed:
cscript
src/lib/audio_analysis.cc
src/lib/audio_analysis.h
src/lib/content.cc
src/lib/ffmpeg_decoder.cc
src/lib/ffmpeg_decoder.h
src/lib/job.cc
src/lib/job_manager.cc
src/lib/server_finder.cc
src/lib/signal_manager.cc [new file with mode: 0644]
src/lib/signal_manager.h [new file with mode: 0644]
src/lib/signaller.h
src/lib/ui_signaller.cc [deleted file]
src/lib/ui_signaller.h [deleted file]
src/lib/update.cc
src/lib/wscript
src/tools/dcpomatic.cc
src/tools/dcpomatic_batch.cc
src/tools/dcpomatic_cli.cc
src/tools/dcpomatic_create.cc
src/wx/audio_dialog.cc
src/wx/dolby_certificate_dialog.cc
src/wx/doremi_certificate_dialog.cc
src/wx/wscript
src/wx/wx_signal_manager.cc [new file with mode: 0644]
src/wx/wx_signal_manager.h [new file with mode: 0644]
src/wx/wx_ui_signaller.cc [deleted file]
src/wx/wx_ui_signaller.h [deleted file]
test/test.cc

diff --git a/cscript b/cscript
index 6a2f053557e2a6dc3ae515c324e78711ddd3458c..9e284a0727d9d34cb36e0ef47610552d47598e45 100644 (file)
--- a/cscript
+++ b/cscript
@@ -206,7 +206,7 @@ def make_spec(filename, version, target):
 
 def dependencies(target):
     return (('ffmpeg-cdist', 'f69bb08'),
-            ('libdcp', '8e7f9e4'),
+            ('libdcp', 'b386248'),
             ('libsub', 'f66b11f'))
 
 def configure_options(target):
index ee34b0d80b7fc2d3168f557e3947c68f85c995c9..73422a9be9ad8a2f3a6039d7487c284ddfe4f8bf 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2015 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
 */
 
 #include "audio_analysis.h"
-#include "dcpomatic_assert.h"
 #include "cross.h"
+#include "util.h"
+#include "raw_convert.h"
+#include <libxml++/libxml++.h>
 #include <boost/filesystem.hpp>
+#include <boost/foreach.hpp>
 #include <stdint.h>
-#include <inttypes.h>
 #include <cmath>
-#include <cassert>
 #include <cstdio>
 #include <iostream>
+#include <inttypes.h>
 
 using std::ostream;
 using std::istream;
@@ -35,6 +37,7 @@ using std::vector;
 using std::cout;
 using std::max;
 using std::list;
+using boost::shared_ptr;
 
 AudioPoint::AudioPoint ()
 {
@@ -43,14 +46,10 @@ AudioPoint::AudioPoint ()
        }
 }
 
-AudioPoint::AudioPoint (FILE* f)
+AudioPoint::AudioPoint (cxml::ConstNodePtr node)
 {
-       for (int i = 0; i < COUNT; ++i) {
-               int n = fscanf (f, "%f", &_data[i]);
-               if (n != 1) {
-                       _data[i] = 0;
-               }
-       }
+       _data[PEAK] = node->number_child<float> ("Peak");
+       _data[RMS] = node->number_child<float> ("RMS");
 }
 
 AudioPoint::AudioPoint (AudioPoint const & other)
@@ -75,14 +74,12 @@ AudioPoint::operator= (AudioPoint const & other)
 }
 
 void
-AudioPoint::write (FILE* f) const
+AudioPoint::as_xml (xmlpp::Element* parent) const
 {
-       for (int i = 0; i < COUNT; ++i) {
-               fprintf (f, "%f\n", _data[i]);
-       }
+       parent->add_child ("Peak")->add_child_text (raw_convert<string> (_data[PEAK]));
+       parent->add_child ("RMS")->add_child_text (raw_convert<string> (_data[RMS]));
 }
        
-
 AudioAnalysis::AudioAnalysis (int channels)
 {
        _data.resize (channels);
@@ -90,44 +87,21 @@ AudioAnalysis::AudioAnalysis (int channels)
 
 AudioAnalysis::AudioAnalysis (boost::filesystem::path filename)
 {
-       FILE* f = fopen_boost (filename, "r");
-       if (!f) {
-               throw OpenFileError (filename);
-       }
+       cxml::Document f ("AudioAnalysis");
+       f.read_file (filename);
 
-       int channels = 0;
-       fscanf (f, "%d", &channels);
-       _data.resize (channels);
+       BOOST_FOREACH (cxml::NodePtr i, f.node_children ("Channel")) {
+               vector<AudioPoint> channel;
 
-       for (int i = 0; i < channels; ++i) {
-               int points;
-               fscanf (f, "%d", &points);
-               if (feof (f)) {
-                       fclose (f);
-                       return;
-               }
-               
-               for (int j = 0; j < points; ++j) {
-                       _data[i].push_back (AudioPoint (f));
-                       if (feof (f)) {
-                               fclose (f);
-                               return;
-                       }
+               BOOST_FOREACH (cxml::NodePtr j, i->node_children ("Point")) {
+                       channel.push_back (AudioPoint (j));
                }
-       }
 
-       /* These may not exist in old analysis files, so be careful
-          about reading them.
-       */
-       
-       float peak;
-       DCPTime::Type peak_time;
-       if (fscanf (f, "%f%" SCNd64, &peak, &peak_time) == 2) {
-               _peak = peak;
-               _peak_time = DCPTime (peak_time);
+               _data.push_back (channel);
        }
-       
-       fclose (f);
+
+       _peak = f.number_child<float> ("Peak");
+       _peak_time = DCPTime (f.number_child<DCPTime::Type> ("PeakTime"));
 }
 
 void
@@ -160,26 +134,20 @@ AudioAnalysis::points (int c) const
 void
 AudioAnalysis::write (boost::filesystem::path filename)
 {
-       boost::filesystem::path tmp = filename;
-       tmp.replace_extension (".tmp");
-
-       FILE* f = fopen_boost (tmp, "w");
-       if (!f) {
-               throw OpenFileError (tmp);
-       }
+       shared_ptr<xmlpp::Document> doc (new xmlpp::Document);
+       xmlpp::Element* root = doc->create_root_node ("AudioAnalysis");
 
-       fprintf (f, "%ld\n", _data.size ());
-       for (vector<vector<AudioPoint> >::iterator i = _data.begin(); i != _data.end(); ++i) {
-               fprintf (f, "%ld\n", i->size ());
-               for (vector<AudioPoint>::iterator j = i->begin(); j != i->end(); ++j) {
-                       j->write (f);
+       BOOST_FOREACH (vector<AudioPoint>& i, _data) {
+               xmlpp::Element* channel = root->add_child ("Channel");
+               BOOST_FOREACH (AudioPoint& j, i) {
+                       j.as_xml (channel->add_child ("Point"));
                }
        }
 
        if (_peak) {
-               fprintf (f, "%f%" PRId64, _peak.get (), _peak_time.get().get ());
+               root->add_child("Peak")->add_child_text (raw_convert<string> (_peak.get ()));
+               root->add_child("PeakTime")->add_child_text (raw_convert<string> (_peak_time.get().get ()));
        }
 
-       fclose (f);
-       boost::filesystem::rename (tmp, filename);
+       doc->write_to_file_formatted (filename.string ());
 }
index 1872c57ad3c2207060c41d54378305c735492a4c..9387ec896b67b92f072a3d31b0509a4373dc03e3 100644 (file)
 
 */
 
-/** @file  src/lib/audio_analysis.h
- *  @brief AudioAnalysis and AudioPoint classes.
- */
-
 #ifndef DCPOMATIC_AUDIO_ANALYSIS_H
 #define DCPOMATIC_AUDIO_ANALYSIS_H
 
-#include "types.h"
+#include <vector>
+#include <list>
 #include <boost/filesystem.hpp>
 #include <boost/optional.hpp>
-#include <vector>
+#include <libcxml/cxml.h>
+#include "types.h"
 
-/** @class AudioPoint
- *  @brief A single point of an audio analysis for one portion of one channel.
- */
 class AudioPoint
 {
 public:
@@ -42,11 +37,11 @@ public:
        };
 
        AudioPoint ();
-       AudioPoint (FILE *);
+       AudioPoint (cxml::ConstNodePtr node);
        AudioPoint (AudioPoint const &);
        AudioPoint& operator= (AudioPoint const &);
 
-       void write (FILE *) const;
+       void as_xml (xmlpp::Element *) const;
        
        float& operator[] (int t) {
                return _data[t];
@@ -56,14 +51,6 @@ private:
        float _data[COUNT];
 };
 
-/** @class AudioAnalysis
- *  @brief An analysis of the audio data in a piece of AudioContent.
- *
- *  This is a set of AudioPoints for each channel.  The AudioPoints
- *  each represent some measurement of the audio over a portion of the
- *  content.  For example each AudioPoint may give the RMS level of
- *  a 1-minute portion of the audio.
- */
 class AudioAnalysis : public boost::noncopyable
 {
 public:
index b00ea3e5774ec02d89e2f77778892861af818bb9..b9e8367e1c3025ba0b0ea992c6a5c8830de60efb 100644 (file)
@@ -24,7 +24,6 @@
 #include "content.h"
 #include "util.h"
 #include "content_factory.h"
-#include "ui_signaller.h"
 #include "exceptions.h"
 #include "film.h"
 #include "safe_stringstream.h"
index 6122a547ed3b9f816345b0f092ccdc95c403ab88..35e15a331c2cd58c0bd7a2926b21ca340af456ab 100644 (file)
@@ -453,15 +453,43 @@ FFmpegDecoder::decode_subtitle_packet ()
        
        AVSubtitleRect const * rect = sub.rects[0];
 
-       if (rect->type != SUBTITLE_BITMAP) {
-               throw DecodeError (_("non-bitmap subtitles not yet supported"));
+       switch (rect->type) {
+       case SUBTITLE_NONE:
+               break;
+       case SUBTITLE_BITMAP:
+               decode_bitmap_subtitle (rect, period);
+               break;
+       case SUBTITLE_TEXT:
+               cout << "XXX: SUBTITLE_TEXT " << rect->text << "\n";
+               break;
+       case SUBTITLE_ASS:
+               cout << "XXX: SUBTITLE_ASS " << rect->ass << "\n";
+               break;
        }
+       
+       avsubtitle_free (&sub);
+}
+
+list<ContentTimePeriod>
+FFmpegDecoder::image_subtitles_during (ContentTimePeriod p, bool starting) const
+{
+       return _ffmpeg_content->subtitles_during (p, starting);
+}
 
+list<ContentTimePeriod>
+FFmpegDecoder::text_subtitles_during (ContentTimePeriod, bool) const
+{
+       return list<ContentTimePeriod> ();
+}
+
+void
+FFmpegDecoder::decode_bitmap_subtitle (AVSubtitleRect const * rect, ContentTimePeriod period)
+{
        /* Note RGBA is expressed little-endian, so the first byte in the word is R, second
           G, third B, fourth A.
        */
        shared_ptr<Image> image (new Image (PIX_FMT_RGBA, dcp::Size (rect->w, rect->h), true));
-
+       
        /* Start of the first line in the subtitle */
        uint8_t* sub_p = rect->pict.data[0];
        /* sub_p looks up into a BGRA palette which is here
@@ -470,7 +498,7 @@ FFmpegDecoder::decode_subtitle_packet ()
        uint32_t const * palette = (uint32_t *) rect->pict.data[1];
        /* Start of the output data */
        uint32_t* out_p = (uint32_t *) image->data()[0];
-
+       
        for (int y = 0; y < rect->h; ++y) {
                uint8_t* sub_line_p = sub_p;
                uint32_t* out_line_p = out_p;
@@ -481,7 +509,7 @@ FFmpegDecoder::decode_subtitle_packet ()
                sub_p += rect->pict.linesize[0];
                out_p += image->stride()[0] / sizeof (uint32_t);
        }
-
+       
        dcp::Size const vs = _ffmpeg_content->video_size ();
        dcpomatic::Rect<double> const scaled_rect (
                static_cast<double> (rect->x) / vs.width,
@@ -489,20 +517,7 @@ FFmpegDecoder::decode_subtitle_packet ()
                static_cast<double> (rect->w) / vs.width,
                static_cast<double> (rect->h) / vs.height
                );
-
-       image_subtitle (ContentTimePeriod (period.from, period.to), image, scaled_rect);
        
-       avsubtitle_free (&sub);
-}
-
-list<ContentTimePeriod>
-FFmpegDecoder::image_subtitles_during (ContentTimePeriod p, bool starting) const
-{
-       return _ffmpeg_content->subtitles_during (p, starting);
+       image_subtitle (period, image, scaled_rect);
 }
 
-list<ContentTimePeriod>
-FFmpegDecoder::text_subtitles_during (ContentTimePeriod, bool) const
-{
-       return list<ContentTimePeriod> ();
-}
index 616fa88dd42f3f40f3ab993785ef89fe89a0e075..6f027ce1c1ba2687df7d774aa22207883f373a27 100644 (file)
@@ -64,6 +64,8 @@ private:
        void decode_audio_packet ();
        void decode_subtitle_packet ();
 
+       void decode_bitmap_subtitle (AVSubtitleRect const * rect, ContentTimePeriod period);
+
        void maybe_add_subtitle ();
        boost::shared_ptr<AudioBuffers> deinterleave_audio (uint8_t** data, int size);
 
index f281466325f8c34a7e78d8e0ad8229910335946b..c4d93ddc14b733b5d913fa1411a3cddf0f76648d 100644 (file)
@@ -27,7 +27,6 @@
 #include "job.h"
 #include "util.h"
 #include "cross.h"
-#include "ui_signaller.h"
 #include "exceptions.h"
 #include "film.h"
 #include "log.h"
index 63db662d0f185aed9502c342d5d7dd794a75f68b..b5b64a77eccc9d9f000d8512ee3a2101142a059b 100644 (file)
@@ -26,7 +26,6 @@
 #include "job_manager.h"
 #include "job.h"
 #include "cross.h"
-#include "ui_signaller.h"
 
 using std::string;
 using std::list;
index 72a9a4ef5d9f166d3945959849cb73fa3f0fc20b..b4b400b523edb1cf0f525f40b547df7462a671ae 100644 (file)
@@ -22,7 +22,6 @@
 #include "util.h"
 #include "config.h"
 #include "cross.h"
-#include "ui_signaller.h"
 #include "dcpomatic_socket.h"
 #include "raw_convert.h"
 #include <libcxml/cxml.h>
diff --git a/src/lib/signal_manager.cc b/src/lib/signal_manager.cc
new file mode 100644 (file)
index 0000000..7c2b3e1
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+    Copyright (C) 2012-2015 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.
+
+*/
+
+#include "signal_manager.h"
+
+/** Global SignalManager instance */
+SignalManager* signal_manager = 0;
diff --git a/src/lib/signal_manager.h b/src/lib/signal_manager.h
new file mode 100644 (file)
index 0000000..ae4306e
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+    Copyright (C) 2012-2015 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.
+
+*/
+
+#ifndef DCPOMATIC_SIGNAL_MANAGER_H
+#define DCPOMATIC_SIGNAL_MANAGER_H
+
+#include <boost/bind.hpp>
+#include <boost/asio.hpp>
+#include <boost/thread.hpp>
+
+class Signaller;
+
+/** A class to allow signals to be emitted from non-UI threads and handled
+ *  by a UI thread.
+ */
+class SignalManager : public boost::noncopyable
+{
+public:
+       /** Create a SignalManager.  Must be called from the UI thread */
+       SignalManager ()
+               : _work (_service)
+       {
+               _ui_thread = boost::this_thread::get_id ();
+       }
+
+       /* Do something next time the UI is idle */
+       template <typename T>
+       void when_idle (T f) {
+               _service.post (f);
+       }
+
+       /** Call this in the UI when it is idle */
+       size_t ui_idle () {
+               /* This executes any functors that have been post()ed to _service */
+               return _service.poll ();
+       }
+
+       /** This should wake the UI and make it call ui_idle() */
+       virtual void wake_ui () {
+               /* This is only a sensible implementation when there is no GUI */
+               ui_idle ();
+       }
+
+private:
+       /** Emit a signal from any thread whose handlers will be called in the UI
+        *  thread.  Use something like:
+        *
+        *  ui_signaller->emit (boost::bind (boost::ref (SomeSignal), parameter));
+        */
+       template <typename T>
+       void emit (T f) {
+               if (boost::this_thread::get_id() == _ui_thread) {
+                       /* already in the UI thread */
+                       f ();
+               } else {
+                       /* non-UI thread; post to the service and wake up the UI */
+                       _service.post (f);
+                       wake_ui ();
+               }
+       }
+
+       friend class Signaller;
+       
+       /** A io_service which is used as the conduit for messages */
+       boost::asio::io_service _service;
+       /** Object required to keep io_service from stopping when it has nothing to do */
+       boost::asio::io_service::work _work;
+       /** The UI thread's ID */
+       boost::thread::id _ui_thread;
+};
+
+extern SignalManager* signal_manager;
+
+#endif
index 408cfcf5b41f9613213535fcda4a949ef86bf6e4..4ef9b38b36f99a304e4cbbbdf3d6204ee02102b4 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef DCPOMATIC_SIGNALLER_H
 #define DCPOMATIC_SIGNALLER_H
 
-#include "ui_signaller.h"
+#include "signal_manager.h"
 #include <boost/thread/mutex.hpp>
 #include <boost/signals2.hpp>
 
@@ -100,8 +100,8 @@ public:
        void emit (T signal)
        {
                Wrapper<T>* w = new Wrapper<T> (signal);
-               if (ui_signaller) {
-                       ui_signaller->emit (boost::bind (&Wrapper<T>::signal, w));
+               if (signal_manager) {
+                       signal_manager->emit (boost::bind (&Wrapper<T>::signal, w));
                }
                
                boost::mutex::scoped_lock lm (_mutex);
diff --git a/src/lib/ui_signaller.cc b/src/lib/ui_signaller.cc
deleted file mode 100644 (file)
index 4cb34da..0000000
+++ /dev/null
@@ -1,24 +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.
-
-*/
-
-#include "ui_signaller.h"
-
-/** Global UISignaller instance */
-UISignaller* ui_signaller = 0;
-
diff --git a/src/lib/ui_signaller.h b/src/lib/ui_signaller.h
deleted file mode 100644 (file)
index 9d4495c..0000000
+++ /dev/null
@@ -1,90 +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.
-
-*/
-
-#ifndef DCPOMATIC_UI_SIGNALLER_H
-#define DCPOMATIC_UI_SIGNALLER_H
-
-#include <boost/bind.hpp>
-#include <boost/asio.hpp>
-#include <boost/thread.hpp>
-
-class Signaller;
-
-/** A class to allow signals to be emitted from non-UI threads and handled
- *  by a UI thread.
- */
-class UISignaller : public boost::noncopyable
-{
-public:
-       /** Create a UISignaller.  Must be called from the UI thread */
-       UISignaller ()
-               : _work (_service)
-       {
-               _ui_thread = boost::this_thread::get_id ();
-       }
-
-       /* Do something next time the UI is idle */
-       template <typename T>
-       void when_idle (T f) {
-               _service.post (f);
-       }
-
-       /** Call this in the UI when it is idle */
-       size_t ui_idle () {
-               /* This executes any functors that have been post()ed to _service */
-               return _service.poll ();
-       }
-
-       /** This should wake the UI and make it call ui_idle() */
-       virtual void wake_ui () {
-               /* This is only a sensible implementation when there is no GUI... */
-               ui_idle ();
-       }
-
-private:
-       /** Emit a signal from any thread whose handlers will be called in the UI
-        *  thread.  Use something like:
-        *
-        *  ui_signaller->emit (boost::bind (boost::ref (SomeSignal), parameter));
-        */
-       template <typename T>
-       void emit (T f) {
-               if (boost::this_thread::get_id() == _ui_thread) {
-                       /* already in the UI thread */
-                       f ();
-               } else {
-                       /* non-UI thread; post to the service and wake up the UI */
-                       _service.post (f);
-                       wake_ui ();
-               }
-       }
-
-       friend class Signaller;
-       
-       /** A io_service which is used as the conduit for messages */
-       boost::asio::io_service _service;
-       /** Object required to keep io_service from stopping when it has nothing to do */
-       boost::asio::io_service::work _work;
-       /** The UI thread's ID */
-       boost::thread::id _ui_thread;
-};
-
-extern UISignaller* ui_signaller;
-
-#endif
index 26944ecc32d2bc3503d2472f91d7feff49849533..f433ff991607afa4e15b8052fbf0e185c12495ec 100644 (file)
@@ -19,7 +19,6 @@
 
 #include "update.h"
 #include "version.h"
-#include "ui_signaller.h"
 #include "safe_stringstream.h"
 #include "config.h"
 #include "util.h"
index 68897a4c4ba58755b82fb3df829e5a1206e0a807..5956c73d65c4f35ed1ef885f1529f4fefa57d9b0 100644 (file)
@@ -109,7 +109,7 @@ sources = """
           transcode_job.cc
           transcoder.cc
           types.cc
-          ui_signaller.cc
+          signal_manager.cc
           update.cc
           upmixer_a.cc
           util.cc
index e59220785b82aefb3234cedc6ac2c9c90de68fbc..904e39fdaf3a048a8a2a60d67b9322690364c962 100644 (file)
@@ -21,7 +21,7 @@
 #include "lib/config.h"
 #include "lib/util.h"
 #include "lib/version.h"
-#include "lib/ui_signaller.h"
+#include "lib/signal_manager.h"
 #include "lib/log.h"
 #include "lib/job_manager.h"
 #include "lib/transcode_job.h"
@@ -39,7 +39,7 @@
 #include "wx/wx_util.h"
 #include "wx/new_film_dialog.h"
 #include "wx/properties_dialog.h"
-#include "wx/wx_ui_signaller.h"
+#include "wx/wx_signal_manager.h"
 #include "wx/about_dialog.h"
 #include "wx/kdm_dialog.h"
 #include "wx/servers_list_dialog.h"
@@ -841,7 +841,7 @@ private:
                        }
                }
 
-               ui_signaller = new wxUISignaller (this);
+               signal_manager = new wxSignalManager (this);
                Bind (wxEVT_IDLE, boost::bind (&App::idle, this));
 
                Bind (wxEVT_TIMER, boost::bind (&App::check, this));
@@ -909,7 +909,7 @@ private:
 
        void idle ()
        {
-               ui_signaller->ui_idle ();
+               signal_manager->ui_idle ();
        }
 
        void check ()
index da8a614142ad4ad3bd5d5ca2db7e1fba9eac7ccc..ae2f3a2c59d7bf8d8e148190e5cc17477521d157 100644 (file)
@@ -29,7 +29,7 @@
 #include "lib/job_manager.h"
 #include "wx/wx_util.h"
 #include "wx/about_dialog.h"
-#include "wx/wx_ui_signaller.h"
+#include "wx/wx_signal_manager.h"
 #include "wx/job_manager_view.h"
 
 using std::exception;
@@ -225,7 +225,7 @@ class App : public wxApp
                f->Maximize ();
                f->Show ();
 
-               ui_signaller = new wxUISignaller (this);
+               signal_manager = new wxSignalManager (this);
                this->Bind (wxEVT_IDLE, boost::bind (&App::idle, this));
 
                shared_ptr<Film> film;
@@ -244,7 +244,7 @@ class App : public wxApp
 
        void idle ()
        {
-               ui_signaller->ui_idle ();
+               signal_manager->ui_idle ();
        }
 
        void OnInitCmdLine (wxCmdLineParser& parser)
index 4facdd4d1a868df0e67d9cac2e28861d3434ed21..0307cac9c9712ddb2205a2aab1aae4bedba7df80 100644 (file)
@@ -30,7 +30,7 @@
 #include "lib/cross.h"
 #include "lib/config.h"
 #include "lib/log.h"
-#include "lib/ui_signaller.h"
+#include "lib/signal_manager.h"
 #include "lib/server_finder.h"
 #include "lib/json_server.h"
 
@@ -119,7 +119,7 @@ main (int argc, char* argv[])
        film_dir = argv[optind];
                        
        dcpomatic_setup ();
-       ui_signaller = new UISignaller ();
+       signal_manager = new SignalManager ();
        
        if (no_remote) {
                ServerFinder::instance()->disable ();
index 304f4f697ab6e8a031c44dd2a74c3b896f2c448a..d121eb0ccf4caea4030a13e3ac12aa8b574c0e36 100644 (file)
@@ -28,7 +28,7 @@
 #include "lib/util.h"
 #include "lib/content_factory.h"
 #include "lib/job_manager.h"
-#include "lib/ui_signaller.h"
+#include "lib/signal_manager.h"
 #include "lib/job.h"
 #include "lib/dcp_content_type.h"
 #include "lib/ratio.h"
@@ -59,11 +59,11 @@ help (string n)
             << "  -o, --output <dir>            output directory\n";
 }
 
-class SimpleUISignaller : public UISignaller
+class SimpleSignalManager : public SignalManager
 {
 public:
        /* Do nothing in this method so that UI events happen in our thread
-          when we call UISignaller::ui_idle().
+          when we call SignalManager::ui_idle().
        */
        void wake_ui () {}
 };
@@ -161,7 +161,7 @@ main (int argc, char* argv[])
                exit (EXIT_FAILURE);
        }
 
-       ui_signaller = new SimpleUISignaller ();
+       signal_manager = new SimpleSignalManager ();
 
        try {
                shared_ptr<Film> film (new Film (output, false));
@@ -184,7 +184,7 @@ main (int argc, char* argv[])
                JobManager* jm = JobManager::instance ();
 
                while (jm->work_to_do ()) {}
-               while (ui_signaller->ui_idle() > 0) {}
+               while (signal_manager->ui_idle() > 0) {}
 
                ContentList content = film->content ();
                for (ContentList::iterator i = content.begin(); i != content.end(); ++i) {
index 286e7f49dc817332b955e48ad9c674160d1bd1a0..fcae9c30f9f85835adb0b3833d785cb5ec0cd4f7 100644 (file)
@@ -124,8 +124,15 @@ AudioDialog::try_to_load_analysis ()
                _analysis_finished_connection = _content->analyse_audio (bind (&AudioDialog::analysis_finished, this));
                return;
        }
+
+       try {
+               _analysis.reset (new AudioAnalysis (_content->audio_analysis_path ()));
+       } catch (xmlpp::exception& e) {
+               /* Probably an old-style analysis file: recreate it */
+               _analysis_finished_connection = _content->analyse_audio (bind (&AudioDialog::analysis_finished, this));
+               return;
+        }
        
-       _analysis.reset (new AudioAnalysis (_content->audio_analysis_path ()));
        _plot->set_analysis (_analysis);
        setup_peak_time ();
 
index 15551a424a6971dfa0c7419c0a8b9c561a85579d..ad43f64795fb731eb77d46b20690cd04f5a43acd 100644 (file)
@@ -21,7 +21,7 @@
 #include <curl/curl.h>
 #include "lib/compose.hpp"
 #include "lib/internet.h"
-#include "lib/ui_signaller.h"
+#include "lib/signal_manager.h"
 #include "dolby_certificate_dialog.h"
 #include "wx_util.h"
 
@@ -80,7 +80,7 @@ DolbyCertificateDialog::setup_countries ()
        /* See DoremiCertificateDialog for discussion about this daft delay */
        wxMilliSleep (200);
 #endif
-       ui_signaller->when_idle (boost::bind (&DolbyCertificateDialog::finish_setup_countries, this));
+       signal_manager->when_idle (boost::bind (&DolbyCertificateDialog::finish_setup_countries, this));
 }
 
 void
@@ -103,7 +103,7 @@ DolbyCertificateDialog::country_selected ()
 #ifdef DCPOMATIC_OSX
        wxMilliSleep (200);
 #endif 
-       ui_signaller->when_idle (boost::bind (&DolbyCertificateDialog::finish_country_selected, this));
+       signal_manager->when_idle (boost::bind (&DolbyCertificateDialog::finish_country_selected, this));
 }
 
 void
@@ -126,7 +126,7 @@ DolbyCertificateDialog::cinema_selected ()
 #ifdef DCPOMATIC_OSX
        wxMilliSleep (200);
 #endif
-       ui_signaller->when_idle (boost::bind (&DolbyCertificateDialog::finish_cinema_selected, this));
+       signal_manager->when_idle (boost::bind (&DolbyCertificateDialog::finish_cinema_selected, this));
 }
 
 void
@@ -161,7 +161,7 @@ DolbyCertificateDialog::download ()
        wxMilliSleep (200);
 #endif
 
-       ui_signaller->when_idle (boost::bind (&DolbyCertificateDialog::finish_download, this));
+       signal_manager->when_idle (boost::bind (&DolbyCertificateDialog::finish_download, this));
 }
 
 void
index 105555da986bb8f8db862dfbdaf88722d0decfeb..578a7a72da1c7d706fc92d60d5a34e6982b2b435 100644 (file)
@@ -21,7 +21,7 @@
 #include <zip.h>
 #include "lib/compose.hpp"
 #include "lib/util.h"
-#include "lib/ui_signaller.h"
+#include "lib/signal_manager.h"
 #include "lib/internet.h"
 #include "doremi_certificate_dialog.h"
 #include "wx_util.h"
@@ -59,7 +59,7 @@ DoremiCertificateDialog::download ()
        wxMilliSleep (200);
 #endif 
 
-       ui_signaller->when_idle (boost::bind (&DoremiCertificateDialog::finish_download, this, serial));
+       signal_manager->when_idle (boost::bind (&DoremiCertificateDialog::finish_download, this, serial));
 }
 
 void
index a05774cd2b7b804ba1e954d34284fff4cc71958b..370f59c621d5d3ff8ddf4f3c27db2921a2be50a6 100644 (file)
@@ -80,7 +80,7 @@ sources = """
           update_dialog.cc
           video_panel.cc
           wx_util.cc
-          wx_ui_signaller.cc
+          wx_signal_manager.cc
           """
 
 def configure(conf):
diff --git a/src/wx/wx_signal_manager.cc b/src/wx/wx_signal_manager.cc
new file mode 100644 (file)
index 0000000..3d8b999
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+    Copyright (C) 2012-2015 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.
+
+*/
+
+#include <wx/wx.h>
+#include "wx_signal_manager.h"
+
+wxSignalManager::wxSignalManager (wxEvtHandler* h)
+       : _handler (h)
+{
+
+}
+
+void
+wxSignalManager::wake_ui ()
+{
+       wxCommandEvent event (-1, -1);
+       _handler->AddPendingEvent (event);
+}
diff --git a/src/wx/wx_signal_manager.h b/src/wx/wx_signal_manager.h
new file mode 100644 (file)
index 0000000..ad18e68
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+    Copyright (C) 2012-2015 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.
+
+*/
+
+#include "lib/signal_manager.h"
+
+class wxEvtHandler;
+
+/** @class wxSignalManager
+ *  @brief SignalManager for the wxWidgets event loop
+ */
+
+class wxSignalManager : public SignalManager
+{
+public:
+       wxSignalManager (wxEvtHandler *);
+       void wake_ui ();
+
+private:
+       wxEvtHandler* _handler;
+};
diff --git a/src/wx/wx_ui_signaller.cc b/src/wx/wx_ui_signaller.cc
deleted file mode 100644 (file)
index 8fc6670..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
-    Copyright (C) 2012-2014 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.
-
-*/
-
-#include <wx/wx.h>
-#include "wx_ui_signaller.h"
-
-wxUISignaller::wxUISignaller (wxEvtHandler* h)
-       : _handler (h)
-{
-
-}
-
-void
-wxUISignaller::wake_ui ()
-{
-       wxCommandEvent event (-1, -1);
-       _handler->AddPendingEvent (event);
-}
diff --git a/src/wx/wx_ui_signaller.h b/src/wx/wx_ui_signaller.h
deleted file mode 100644 (file)
index 63f2049..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-    Copyright (C) 2012-2014 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.
-
-*/
-
-#include "lib/ui_signaller.h"
-
-class wxEvtHandler;
-
-/** @class wxUISignaller
- *  @brief UISignaller for the wxWidgets event loop
- */
-
-class wxUISignaller : public UISignaller
-{
-public:
-       wxUISignaller (wxEvtHandler *);
-       void wake_ui ();
-
-private:
-       wxEvtHandler* _handler;
-};
index 9201e5b4cfceb7beaa205ba8015ba660298e882d..32ad6ca70ae9265ca3463c00e21edcdb96fb7dc3 100644 (file)
@@ -29,7 +29,7 @@
 #include <dcp/dcp.h>
 #include "lib/config.h"
 #include "lib/util.h"
-#include "lib/ui_signaller.h"
+#include "lib/signal_manager.h"
 #include "lib/film.h"
 #include "lib/job_manager.h"
 #include "lib/job.h"
@@ -51,7 +51,7 @@ using boost::scoped_array;
 
 boost::filesystem::path private_data = boost::filesystem::path ("..") / boost::filesystem::path ("dcpomatic-test-private");
 
-class TestUISignaller : public UISignaller
+class TestSignalManager : public SignalManager
 {
 public:
        /* No wakes in tests: we call ui_idle ourselves */
@@ -77,7 +77,7 @@ struct TestConfig
 
                ServerFinder::instance()->disable ();
 
-               ui_signaller = new TestUISignaller ();
+               signal_manager = new TestSignalManager ();
        }
 
        ~TestConfig ()
@@ -285,7 +285,7 @@ wait_for_jobs ()
 {
        JobManager* jm = JobManager::instance ();
        while (jm->work_to_do ()) {
-               ui_signaller->ui_idle ();
+               signal_manager->ui_idle ();
        }
        if (jm->errors ()) {
                int N = 0;
@@ -305,7 +305,7 @@ wait_for_jobs ()
                }
        }
 
-       ui_signaller->ui_idle ();
+       signal_manager->ui_idle ();
 
        /* Discard all jobs so we lose any we just reported an error in */
        JobManager::drop ();