Use boost::signals2; fix bugs with x-thread signalling.
authorCarl Hetherington <cth@carlh.net>
Wed, 24 Oct 2012 21:13:53 +0000 (22:13 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 24 Oct 2012 21:13:53 +0000 (22:13 +0100)
40 files changed:
src/lib/ab_transcode_job.cc
src/lib/ab_transcoder.cc
src/lib/check_hashes_job.cc
src/lib/config.cc
src/lib/config.h
src/lib/copy_from_dvd_job.cc
src/lib/dcp_video_frame.cc
src/lib/decoder.cc
src/lib/decoder.h
src/lib/decoder_factory.cc
src/lib/encoder_factory.cc
src/lib/examine_content_job.cc
src/lib/ffmpeg_decoder.cc
src/lib/film.cc
src/lib/film.h
src/lib/imagemagick_encoder.cc
src/lib/j2k_still_encoder.cc
src/lib/j2k_wav_encoder.cc
src/lib/job.cc
src/lib/job.h
src/lib/job_manager.cc
src/lib/make_dcp_job.cc
src/lib/scp_dcp_job.cc
src/lib/server.cc
src/lib/transcode_job.cc
src/lib/transcoder.cc
src/lib/ui_signaller.h
src/tools/dvdomatic.cc
src/tools/makedcp.cc
src/wx/config_dialog.cc
src/wx/dcp_range_dialog.h
src/wx/film_editor.cc
src/wx/film_editor.h
src/wx/film_list.cc
src/wx/film_viewer.cc
src/wx/filter_dialog.cc
src/wx/filter_dialog.h
src/wx/filter_view.h
src/wx/job_manager_view.cc
test/test.cc

index 9e453d85dedd63e58519833da0d59c5cb161ea11..c9fd5bc977fbc9bfe0640a04d655db1588f4a01f 100644 (file)
@@ -27,8 +27,8 @@
 #include "encoder_factory.h"
 #include "config.h"
 
-using namespace std;
-using namespace boost;
+using std::string;
+using boost::shared_ptr;
 
 /** @param f Film to compare.
  *  @param o Options.
index 4f0ce0a7103ac38493f326ac5c9751dd8113e9b7..beedd478ffac18235d9d21e2e662dbad8133e799 100644 (file)
@@ -19,7 +19,6 @@
 
 #include <iostream>
 #include <boost/shared_ptr.hpp>
-#include <sigc++/bind.h>
 #include "ab_transcoder.h"
 #include "film.h"
 #include "decoder.h"
@@ -34,8 +33,8 @@
  *  for the right half (to facilitate A/B comparisons of settings)
  */
 
-using namespace std;
-using namespace boost;
+using std::string;
+using boost::shared_ptr;
 
 /** @param a Film to use for the left half of the screen.
  *  @param b Film to use for the right half of the screen.
@@ -56,9 +55,9 @@ ABTranscoder::ABTranscoder (
        _da = decoder_factory (_film_a, o, j);
        _db = decoder_factory (_film_b, o, j);
 
-       _da->Video.connect (sigc::bind (sigc::mem_fun (*this, &ABTranscoder::process_video), 0));
-       _db->Video.connect (sigc::bind (sigc::mem_fun (*this, &ABTranscoder::process_video), 1));
-       _da->Audio.connect (sigc::mem_fun (*e, &Encoder::process_audio));
+       _da->Video.connect (bind (&ABTranscoder::process_video, this, _1, _2, _3, 0));
+       _db->Video.connect (bind (&ABTranscoder::process_video, this, _1, _2, _3, 1));
+       _da->Audio.connect (bind (&Encoder::process_audio, e, _1));
 }
 
 ABTranscoder::~ABTranscoder ()
index c6460ff60940cf78909bfbcfa763f3abd8df3a0d..88233ab665805c34b60328895375ba3a67c1ae5c 100644 (file)
 #include "transcode_job.h"
 #include "film.h"
 
-using namespace std;
-using namespace boost;
+using std::string;
+using std::stringstream;
+using std::ifstream;
+using boost::shared_ptr;
 
 CheckHashesJob::CheckHashesJob (shared_ptr<Film> f, shared_ptr<const Options> o, shared_ptr<Job> req)
        : Job (f, req)
@@ -56,13 +58,13 @@ CheckHashesJob::run ()
                string const j2k_file = _opt->frame_out_path (i, false);
                string const hash_file = j2k_file + ".md5";
 
-               if (!filesystem::exists (j2k_file)) {
+               if (!boost::filesystem::exists (j2k_file)) {
                        _film->log()->log (String::compose ("Frame %1 has a missing J2K file.", i));
-                       filesystem::remove (hash_file);
+                       boost::filesystem::remove (hash_file);
                        ++_bad;
-               } else if (!filesystem::exists (hash_file)) {
+               } else if (!boost::filesystem::exists (hash_file)) {
                        _film->log()->log (String::compose ("Frame %1 has a missing hash file.", i));
-                       filesystem::remove (j2k_file);
+                       boost::filesystem::remove (j2k_file);
                        ++_bad;
                } else {
                        ifstream ref (hash_file.c_str ());
@@ -70,8 +72,8 @@ CheckHashesJob::run ()
                        ref >> hash;
                        if (hash != md5_digest (j2k_file)) {
                                _film->log()->log (String::compose ("Frame %1 has wrong hash; deleting.", i));
-                               filesystem::remove (j2k_file);
-                               filesystem::remove (hash_file);
+                               boost::filesystem::remove (j2k_file);
+                               boost::filesystem::remove (hash_file);
                                ++_bad;
                        }
                }
index 44d110689352e5b81c92305bceb078690c608182..711963a26068c78b9df207a987252932932283d2 100644 (file)
 #include "filter.h"
 #include "sound_processor.h"
 
-using namespace std;
-using namespace boost;
+using std::vector;
+using std::ifstream;
+using std::string;
+using std::ofstream;
+using boost::shared_ptr;
 
 Config* Config::_instance = 0;
 
@@ -99,7 +102,7 @@ Config::Config ()
 string
 Config::file () const
 {
-       filesystem::path p;
+       boost::filesystem::path p;
        p /= g_get_user_config_dir ();
        p /= ".dvdomatic";
        return p.string ();
index 840dcdaef7a5ebcea32f0c5bd680c6ab0de1b878..1ded015f286ab1cd2b04bc6ae9696c2d6f2db54a 100644 (file)
@@ -26,7 +26,7 @@
 
 #include <vector>
 #include <boost/shared_ptr.hpp>
-#include <sigc++/signal.h>
+#include <boost/signals2.hpp>
 
 class ServerDescription;
 class Screen;
@@ -176,7 +176,7 @@ public:
        
        void write () const;
 
-       sigc::signal0<void> Changed;
+       boost::signals2::signal<void()> Changed;
 
        static Config* instance ();
 
index 573dd7866742b0f43edeeee37147578d47dd8127..dcf53ac54e2baed566fde74bf1b2edc51ccf1e96 100644 (file)
 #include "cross.h"
 #include "film.h"
 
-using namespace std;
-using namespace boost;
+using std::string;
+using std::list;
+using std::stringstream;
+using boost::shared_ptr;
 
 /** @param f Film to write DVD data into.
  */
@@ -50,7 +52,7 @@ void
 CopyFromDVDJob::run ()
 {
        /* Remove any old DVD rips */
-       filesystem::remove_all (_film->dir ("dvd"));
+       boost::filesystem::remove_all (_film->dir ("dvd"));
 
        string const dvd = find_dvd ();
        if (dvd.empty ()) {
@@ -97,12 +99,12 @@ CopyFromDVDJob::run ()
 
        string largest_file;
        uintmax_t largest_size = 0;
-       for (filesystem::directory_iterator i = filesystem::directory_iterator (dvd_dir); i != filesystem::directory_iterator(); ++i) {
-               uintmax_t const s = filesystem::file_size (*i);
+       for (boost::filesystem::directory_iterator i = boost::filesystem::directory_iterator (dvd_dir); i != boost::filesystem::directory_iterator(); ++i) {
+               uintmax_t const s = boost::filesystem::file_size (*i);
                if (s > largest_size) {
 
 #if BOOST_FILESYSTEM_VERSION == 3              
-                       largest_file = filesystem::path(*i).generic_string();
+                       largest_file = boost::filesystem::path(*i).generic_string();
 #else
                        largest_file = i->string ();
 #endif
index 4f84a83027a209c6bc1177fecd9aa63035b71250..d9d7e7c833ed2266d469b437cd394b9e42b79c68 100644 (file)
 #include "log.h"
 #include "subtitle.h"
 
-using namespace std;
-using namespace boost;
+using std::string;
+using std::stringstream;
+using std::ofstream;
+using boost::shared_ptr;
 
 /** Construct a DCP video frame.
  *  @param input Input image.
@@ -306,10 +308,10 @@ DCPVideoFrame::encode_locally ()
 shared_ptr<EncodedData>
 DCPVideoFrame::encode_remotely (ServerDescription const * serv)
 {
-       asio::io_service io_service;
-       asio::ip::tcp::resolver resolver (io_service);
-       asio::ip::tcp::resolver::query query (serv->host_name(), boost::lexical_cast<string> (Config::instance()->server_port ()));
-       asio::ip::tcp::resolver::iterator endpoint_iterator = resolver.resolve (query);
+       boost::asio::io_service io_service;
+       boost::asio::ip::tcp::resolver resolver (io_service);
+       boost::asio::ip::tcp::resolver::query query (serv->host_name(), boost::lexical_cast<string> (Config::instance()->server_port ()));
+       boost::asio::ip::tcp::resolver::iterator endpoint_iterator = resolver.resolve (query);
 
        shared_ptr<Socket> socket (new Socket);
 
@@ -384,7 +386,7 @@ EncodedData::write (shared_ptr<const Options> opt, int frame)
        string const real_j2k = opt->frame_out_path (frame, false);
 
        /* Rename the file from foo.j2c.tmp to foo.j2c now that it is complete */
-       filesystem::rename (tmp_j2k, real_j2k);
+       boost::filesystem::rename (tmp_j2k, real_j2k);
 
        /* Write a file containing the hash */
        string const hash = real_j2k + ".md5";
index 9c339737a96b269fc449b98fc3f76a477168b74a..f6ddfbeffceb47a7841d26d3f8c7c6358d91799f 100644 (file)
@@ -49,8 +49,10 @@ extern "C" {
 #include "ffmpeg_compatibility.h"
 #include "subtitle.h"
 
-using namespace std;
-using namespace boost;
+using std::string;
+using std::stringstream;
+using std::min;
+using boost::shared_ptr;
 
 /** @param f Film.
  *  @param o Options.
index ed7eaeb17ceb1f83c6a70de306badd0a1f062e76..39eaaf48ed4c737dd2c63f43b303d19079033acf 100644 (file)
@@ -28,7 +28,7 @@
 #include <string>
 #include <stdint.h>
 #include <boost/shared_ptr.hpp>
-#include <sigc++/sigc++.h>
+#include <boost/signals2.hpp>
 #include "util.h"
 #include "stream.h"
 
@@ -92,10 +92,10 @@ public:
         *  Second parameter is its index within the content.
         *  Third parameter is either 0 or a subtitle that should be on this frame.
         */
-       sigc::signal<void, boost::shared_ptr<Image>, int, boost::shared_ptr<Subtitle> > Video;
+       boost::signals2::signal<void (boost::shared_ptr<Image>, int, boost::shared_ptr<Subtitle>)> Video;
 
        /** Emitted when some audio data is ready */
-       sigc::signal<void, boost::shared_ptr<AudioBuffers> > Audio;
+       boost::signals2::signal<void (boost::shared_ptr<AudioBuffers>)> Audio;
        
 protected:
        /** perform a single pass at our content */
index 56fb562961df38e4bcdeb090c60fc6770c2c1a43..06377e26c4cb6b476a273ccc0034d4df44dbaac5 100644 (file)
 #include "imagemagick_decoder.h"
 #include "film.h"
 
-using namespace std;
-using namespace boost;
+using std::string;
+using boost::shared_ptr;
 
 shared_ptr<Decoder>
 decoder_factory (
        shared_ptr<Film> f, shared_ptr<const Options> o, Job* j, bool minimal = false, bool ignore_length = false
        )
 {
-       if (filesystem::is_directory (f->content_path ())) {
+       if (boost::filesystem::is_directory (f->content_path ())) {
                /* Assume a directory contains TIFFs */
                return shared_ptr<Decoder> (new TIFFDecoder (f, o, j, minimal, ignore_length));
        }
index df45535cf7a27cd764efde7aa5f999aeb85e861b..2da021ad8265df36bef1beeb0fe4ef7bb8965ad9 100644 (file)
 #include "j2k_still_encoder.h"
 #include "film.h"
 
-using namespace std;
-using namespace boost;
+using boost::shared_ptr;
 
 shared_ptr<Encoder>
 encoder_factory (shared_ptr<const Film> f, shared_ptr<const Options> o)
 {
-       if (!filesystem::is_directory (f->content_path()) && f->content_type() == STILL) {
+       if (!boost::filesystem::is_directory (f->content_path()) && f->content_type() == STILL) {
                return shared_ptr<Encoder> (new J2KStillEncoder (f, o));
        }
        
index 8fadce2f66a93404b17aaafef44c31a36a99fe93..1e263ffa585f97b413bd4cbe84db6c77c65a7ad3 100644 (file)
@@ -31,8 +31,9 @@
 #include "log.h"
 #include "film.h"
 
-using namespace std;
-using namespace boost;
+using std::string;
+using std::vector;
+using boost::shared_ptr;
 
 ExamineContentJob::ExamineContentJob (shared_ptr<Film> f, shared_ptr<Job> req)
        : Job (f, req)
@@ -102,11 +103,11 @@ ExamineContentJob::run ()
        string const tdir = _film->dir ("thumbs");
        vector<int> thumbs;
 
-       for (filesystem::directory_iterator i = filesystem::directory_iterator (tdir); i != filesystem::directory_iterator(); ++i) {
+       for (boost::filesystem::directory_iterator i = boost::filesystem::directory_iterator (tdir); i != boost::filesystem::directory_iterator(); ++i) {
 
                /* Aah, the sweet smell of progress */
 #if BOOST_FILESYSTEM_VERSION == 3              
-               string const l = filesystem::path(*i).leaf().generic_string();
+               string const l = boost::filesystem::path(*i).leaf().generic_string();
 #else
                string const l = i->leaf ();
 #endif
index 30701797affc9f3f74837378b79735d19b66e08a..b6cdce0e436e53715f28076a46e5d86d3a558885 100644 (file)
@@ -49,10 +49,12 @@ extern "C" {
 #include "ffmpeg_decoder.h"
 #include "subtitle.h"
 
-using namespace std;
-using namespace boost;
+using std::string;
+using std::vector;
+using std::stringstream;
+using boost::shared_ptr;
 
-FFmpegDecoder::FFmpegDecoder (boost::shared_ptr<Film> f, boost::shared_ptr<const Options> o, Job* j, bool minimal, bool ignore_length)
+FFmpegDecoder::FFmpegDecoder (shared_ptr<Film> f, shared_ptr<const Options> o, Job* j, bool minimal, bool ignore_length)
        : Decoder (f, o, j, minimal, ignore_length)
        , _format_context (0)
        , _video_stream (-1)
index 8b7700445abd28252926502005082e085d7fcfa8..8750ab442c185018fb61c6c09421b7551f5f32b0 100644 (file)
 #include "version.h"
 #include "ui_signaller.h"
 
-using namespace std;
-using namespace boost;
+using std::string;
+using std::stringstream;
+using std::multimap;
+using std::pair;
+using std::map;
+using std::vector;
+using std::ifstream;
+using std::ofstream;
+using std::setfill;
+using boost::shared_ptr;
+using boost::lexical_cast;
+using boost::to_upper_copy;
+using boost::ends_with;
+using boost::starts_with;
 
 /** Construct a Film object in a given directory, reading any metadata
  *  file that exists in that directory.  An exception will be thrown if
- *  must_exist is true, and the specified directory does not exist.
+ *  must_exist is true and the specified directory does not exist.
  *
  *  @param d Film directory.
  *  @param must_exist true to throw an exception if does not exist.
@@ -90,11 +102,11 @@ Film::Film (string d, bool must_exist)
           (Code swiped from Adam Bowen on stackoverflow)
        */
        
-       filesystem::path p (filesystem::system_complete (d));
-       filesystem::path result;
-       for (filesystem::path::iterator i = p.begin(); i != p.end(); ++i) {
+       boost::filesystem::path p (boost::filesystem::system_complete (d));
+       boost::filesystem::path result;
+       for (boost::filesystem::path::iterator i = p.begin(); i != p.end(); ++i) {
                if (*i == "..") {
-                       if (filesystem::is_symlink (result) || result.filename() == "..") {
+                       if (boost::filesystem::is_symlink (result) || result.filename() == "..") {
                                result /= *i;
                        } else {
                                result = result.parent_path ();
@@ -106,11 +118,11 @@ Film::Film (string d, bool must_exist)
 
        set_directory (result.string ());
        
-       if (!filesystem::exists (directory())) {
+       if (!boost::filesystem::exists (directory())) {
                if (must_exist) {
                        throw OpenFileError (directory());
                } else {
-                       filesystem::create_directory (directory());
+                       boost::filesystem::create_directory (directory());
                }
        }
 
@@ -173,7 +185,7 @@ Film::j2k_dir () const
 {
        assert (format());
 
-       filesystem::path p;
+       boost::filesystem::path p;
 
        /* Start with j2c */
        p /= "j2c";
@@ -282,13 +294,13 @@ Film::examine_content ()
        }
 
        set_thumbs (vector<int> ());
-       filesystem::remove_all (dir ("thumbs"));
+       boost::filesystem::remove_all (dir ("thumbs"));
 
        /* This call will recreate the directory */
        dir ("thumbs");
        
        _examine_content_job.reset (new ExamineContentJob (shared_from_this(), shared_ptr<Job> ()));
-       _examine_content_job->Finished.connect (sigc::mem_fun (*this, &Film::examine_content_finished));
+       _examine_content_job->Finished.connect (bind (&Film::examine_content_finished, this));
        JobManager::instance()->add (_examine_content_job);
 }
 
@@ -303,7 +315,7 @@ vector<string>
 Film::audio_files () const
 {
        vector<string> f;
-       for (filesystem::directory_iterator i = filesystem::directory_iterator (dir("wavs")); i != filesystem::directory_iterator(); ++i) {
+       for (boost::filesystem::directory_iterator i = boost::filesystem::directory_iterator (dir("wavs")); i != boost::filesystem::directory_iterator(); ++i) {
                f.push_back (i->path().string ());
        }
 
@@ -336,9 +348,9 @@ Film::encoded_frames () const
        }
 
        int N = 0;
-       for (filesystem::directory_iterator i = filesystem::directory_iterator (j2k_dir ()); i != filesystem::directory_iterator(); ++i) {
+       for (boost::filesystem::directory_iterator i = boost::filesystem::directory_iterator (j2k_dir ()); i != boost::filesystem::directory_iterator(); ++i) {
                ++N;
-               this_thread::interruption_point ();
+               boost::this_thread::interruption_point ();
        }
 
        return N;
@@ -353,7 +365,7 @@ pair<Position, string>
 Film::thumb_subtitle (int n) const
 {
        string sub_file = thumb_base(n) + ".sub";
-       if (!filesystem::exists (sub_file)) {
+       if (!boost::filesystem::exists (sub_file)) {
                return pair<Position, string> ();
        }
 
@@ -379,7 +391,7 @@ Film::write_metadata () const
 {
        boost::mutex::scoped_lock lm (_state_mutex);
        
-       filesystem::create_directories (directory());
+       boost::filesystem::create_directories (directory());
 
        string const m = file_locked ("metadata");
        ofstream f (m.c_str ());
@@ -541,7 +553,7 @@ Film::read_metadata ()
                if (k == "thumb") {
                        int const n = atoi (v.c_str ());
                        /* Only add it to the list if it still exists */
-                       if (filesystem::exists (thumb_file_for_frame (n))) {
+                       if (boost::filesystem::exists (thumb_file_for_frame_locked (n))) {
                                _thumbs.push_back (n);
                        }
                } else if (k == "width") {
@@ -587,6 +599,12 @@ Film::thumb_file_for_frame (int n) const
        return thumb_base_for_frame(n) + ".png";
 }
 
+string
+Film::thumb_file_for_frame_locked (int n) const
+{
+       return thumb_base_for_frame_locked(n) + ".png";
+}
+
 string
 Film::thumb_base (int n) const
 {
@@ -595,19 +613,25 @@ Film::thumb_base (int n) const
 
 string
 Film::thumb_base_for_frame (int n) const
+{
+       boost::mutex::scoped_lock lm (_state_mutex);
+       return thumb_base_for_frame_locked (n);
+}
+
+string
+Film::thumb_base_for_frame_locked (int n) const
 {
        stringstream s;
        s.width (8);
        s << setfill('0') << n;
        
-       filesystem::path p;
-       p /= dir ("thumbs");
+       boost::filesystem::path p;
+       p /= dir_locked ("thumbs");
        p /= s.str ();
                
        return p.string ();
 }
 
-
 /** @param n A thumb index.
  *  @return The frame within the Film that it is for.
  */
@@ -635,10 +659,16 @@ string
 Film::dir (string d) const
 {
        boost::mutex::scoped_lock lm (_state_mutex);
-       filesystem::path p;
+       return dir_locked (d);
+}
+
+string
+Film::dir_locked (string d) const
+{
+       boost::filesystem::path p;
        p /= _directory;
        p /= d;
-       filesystem::create_directories (p);
+       boost::filesystem::create_directories (p);
        return p.string ();
 }
 
@@ -653,7 +683,7 @@ Film::file (string f) const
 string
 Film::file_locked (string f) const
 {
-       filesystem::path p;
+       boost::filesystem::path p;
        p /= _directory;
        p /= f;
        return p.string ();
@@ -666,7 +696,7 @@ string
 Film::content_path () const
 {
        boost::mutex::scoped_lock lm (_state_mutex);
-       if (filesystem::path(_content).has_root_directory ()) {
+       if (boost::filesystem::path(_content).has_root_directory ()) {
                return _content;
        }
 
@@ -677,7 +707,7 @@ ContentType
 Film::content_type () const
 {
 #if BOOST_FILESYSTEM_VERSION == 3
-       string ext = filesystem::path(_content).extension().string();
+       string ext = boost::filesystem::path(_content).extension().string();
 #else
        string ext = filesystem::path(_content).extension();
 #endif
@@ -788,8 +818,8 @@ Film::dci_name () const
                d << _studio << "_";
        }
 
-       gregorian::date today = gregorian::day_clock::local_day ();
-       d << gregorian::to_iso_string (today) << "_";
+       boost::gregorian::date today = boost::gregorian::day_clock::local_day ();
+       d << boost::gregorian::to_iso_string (today) << "_";
 
        if (!_facility.empty ()) {
                d << _facility << "_";
@@ -848,7 +878,7 @@ Film::set_content (string c)
        string check = directory ();
 
 #if BOOST_FILESYSTEM_VERSION == 3
-       filesystem::path slash ("/");
+       boost::filesystem::path slash ("/");
        string platform_slash = slash.make_preferred().string ();
 #else
 #ifdef DVDOMATIC_WINDOWS
@@ -862,7 +892,7 @@ Film::set_content (string c)
                check += platform_slash;
        }
        
-       if (filesystem::path(c).has_root_directory () && starts_with (c, check)) {
+       if (boost::filesystem::path(c).has_root_directory () && starts_with (c, check)) {
                c = c.substr (_directory.length() + 1);
        }
 
index 384cf85109757e73fbbad4b6cf197a3410738d9c..27be4331c6c3d3a1c60be34c57894047352b85d5 100644 (file)
@@ -30,6 +30,7 @@
 #include <inttypes.h>
 #include <boost/thread/mutex.hpp>
 #include <boost/thread.hpp>
+#include <boost/signals2.hpp>
 extern "C" {
 #include <libavcodec/avcodec.h>
 }
@@ -376,7 +377,7 @@ public:
        void set_frames_per_second (float);
 
        /** Emitted when some property has changed */
-       mutable sigc::signal1<void, Property> Changed;
+       mutable boost::signals2::signal<void (Property)> Changed;
        
 private:
        
@@ -387,9 +388,12 @@ private:
        boost::shared_ptr<ExamineContentJob> _examine_content_job;
 
        std::string thumb_file_for_frame (int) const;
+       std::string thumb_file_for_frame_locked (int) const;
        std::string thumb_base_for_frame (int) const;
+       std::string thumb_base_for_frame_locked (int) const;
        void signal_changed (Property);
        std::string file_locked (std::string) const;
+       std::string dir_locked (std::string d) const;
        void examine_content_finished ();
        
        /** Complete path to directory containing the film metadata;
index e86888c36662131d2768ee255d3182a006d21a18..8d42b3dbea1bc9728bab9838ff4ad0d08f48eba4 100644 (file)
@@ -36,8 +36,9 @@
 #include "image.h"
 #include "subtitle.h"
 
-using namespace std;
-using namespace boost;
+using std::string;
+using std::ofstream;
+using boost::shared_ptr;
 
 /** @param f Film that we are encoding.
  *  @param o Options.
@@ -58,7 +59,7 @@ ImageMagickEncoder::process_video (shared_ptr<Image> image, int frame, shared_pt
        Magick::Image thumb (compact->size().width, compact->size().height, "RGB", MagickCore::CharPixel, compact->data()[0]);
        thumb.magick ("PNG");
        thumb.write (tmp_file);
-       filesystem::rename (tmp_file, _opt->frame_out_path (frame, false));
+       boost::filesystem::rename (tmp_file, _opt->frame_out_path (frame, false));
 
        if (sub) {
                float const x_scale = float (_opt->out_size.width) / _film->size().width;
@@ -77,13 +78,13 @@ ImageMagickEncoder::process_video (shared_ptr<Image> image, int frame, shared_pt
                Magick::Image sub_thumb (compact->size().width, compact->size().height, "RGBA", MagickCore::CharPixel, compact->data()[0]);
                sub_thumb.magick ("PNG");
                sub_thumb.write (tmp_sub_file);
-               filesystem::rename (tmp_sub_file, _opt->frame_out_path (frame, false, ".sub.png"));
+               boost::filesystem::rename (tmp_sub_file, _opt->frame_out_path (frame, false, ".sub.png"));
 
                metadata << "x " << sub->position().x << "\n"
                         << "y " << sub->position().y << "\n";
 
                metadata.close ();
-               filesystem::rename (tmp_metadata_file, _opt->frame_out_path (frame, false, ".sub"));
+               boost::filesystem::rename (tmp_metadata_file, _opt->frame_out_path (frame, false, ".sub"));
        }
        
        frame_done (frame);
index 51946372f2fe6695bc96cce73aad6fcaca615176..d8970d3a13bb93b46105c194cec47989328b6abf 100644 (file)
@@ -38,8 +38,9 @@
 #include "imagemagick_decoder.h"
 #include "film.h"
 
-using namespace std;
-using namespace boost;
+using std::string;
+using std::pair;
+using boost::shared_ptr;
 
 J2KStillEncoder::J2KStillEncoder (shared_ptr<const Film> f, shared_ptr<const Options> o)
        : Encoder (f, o)
index 4dd9ce8b6adc68bf64de46154dcd655484b0fe5a..73a70910e9f9f631f3f3109e3c317bbd27694610 100644 (file)
 #include "cross.h"
 #include "film.h"
 
-using namespace std;
-using namespace boost;
+using std::string;
+using std::stringstream;
+using std::list;
+using std::vector;
+using std::pair;
+using boost::shared_ptr;
+using boost::thread;
+using boost::lexical_cast;
 
 J2KWAVEncoder::J2KWAVEncoder (shared_ptr<const Film> f, shared_ptr<const Options> o)
        : Encoder (f, o)
index a7c2430b8b30eed2a439eccdb5f1a59a8255b702..c5a254a2a60b5829f742e10cd784642108907eb2 100644 (file)
 #include "job.h"
 #include "util.h"
 
-using namespace std;
-using namespace boost;
+using std::string;
+using std::list;
+using std::stringstream;
+using boost::shared_ptr;
 
 /** @param s Film that we are operating on.
  */
@@ -64,7 +66,7 @@ Job::run_wrapper ()
                
                set_progress (1);
                set_state (FINISHED_ERROR);
-               set_error (String::compose ("%1 (%2)", e.what(), filesystem::path (e.filename()).leaf()));
+               set_error (String::compose ("%1 (%2)", e.what(), boost::filesystem::path (e.filename()).leaf()));
                
        } catch (std::exception& e) {
 
index 1ada68e1f41fa751e1ce8ce2f475a77f37b0d03d..b09964cf9223c0654d0466b53cff983edc227b93 100644 (file)
@@ -27,7 +27,7 @@
 #include <string>
 #include <boost/thread/mutex.hpp>
 #include <boost/enable_shared_from_this.hpp>
-#include <sigc++/sigc++.h>
+#include <boost/signals2.hpp>
 
 class Film;
 class Options;
@@ -68,7 +68,7 @@ public:
                return _required;
        }
 
-       sigc::signal0<void> Finished;
+       boost::signals2::signal<void()> Finished;
 
 protected:
 
index 2db91a177cc08c194644e7b35efc7095e577cddd..5cc34035710715bb447da49b7822cff8777da77a 100644 (file)
@@ -27,8 +27,9 @@
 #include "job.h"
 #include "cross.h"
 
-using namespace std;
-using namespace boost;
+using std::string;
+using std::list;
+using boost::shared_ptr;
 
 JobManager* JobManager::_instance = 0;
 
index 5a16abc1e5b122f1d12240b5813fe66240667554..e2c90a854c3e25d96253f1d72617a6ed98ef3074 100644 (file)
@@ -36,8 +36,8 @@ extern "C" {
 #include "imagemagick_decoder.h"
 #include "film.h"
 
-using namespace std;
-using namespace boost;
+using std::string;
+using boost::shared_ptr;
 
 /** @param f Film we are making the DCP for.
  *  @param o Options.
@@ -73,7 +73,7 @@ MakeDCPJob::run ()
        string const dcp_path = _film->dir (_film->dcp_name());
 
        /* Remove any old DCP */
-       filesystem::remove_all (dcp_path);
+       boost::filesystem::remove_all (dcp_path);
 
        int frames = 0;
        switch (_film->content_type ()) {
index a455c72a2f3c03a7b0002081a0a3438897564bd5..22129f56cdf05e2edadda7baedce3378e012160f 100644 (file)
 #include "log.h"
 #include "film.h"
 
-using namespace std;
-using namespace boost;
+using std::string;
+using std::stringstream;
+using std::min;
+using boost::shared_ptr;
 
 class SSHSession
 {
@@ -149,29 +151,29 @@ SCPDCPJob::run ()
        string const dcp_dir = _film->dir (_film->dcp_name());
        
        boost::uintmax_t bytes_to_transfer = 0;
-       for (filesystem::directory_iterator i = filesystem::directory_iterator (dcp_dir); i != filesystem::directory_iterator(); ++i) {
-               bytes_to_transfer += filesystem::file_size (*i);
+       for (boost::filesystem::directory_iterator i = boost::filesystem::directory_iterator (dcp_dir); i != boost::filesystem::directory_iterator(); ++i) {
+               bytes_to_transfer += boost::filesystem::file_size (*i);
        }
        
        boost::uintmax_t buffer_size = 64 * 1024;
        char buffer[buffer_size];
        boost::uintmax_t bytes_transferred = 0;
        
-       for (filesystem::directory_iterator i = filesystem::directory_iterator (dcp_dir); i != filesystem::directory_iterator(); ++i) {
+       for (boost::filesystem::directory_iterator i = boost::filesystem::directory_iterator (dcp_dir); i != boost::filesystem::directory_iterator(); ++i) {
                
                /* Aah, the sweet smell of progress */
 #if BOOST_FILESYSTEM_VERSION == 3              
-               string const leaf = filesystem::path(*i).leaf().generic_string ();
+               string const leaf = boost::filesystem::path(*i).leaf().generic_string ();
 #else
                string const leaf = i->leaf ();
 #endif
                
                set_status ("copying " + leaf);
                
-               boost::uintmax_t to_do = filesystem::file_size (*i);
+               boost::uintmax_t to_do = boost::filesystem::file_size (*i);
                ssh_scp_push_file (sc.scp, leaf.c_str(), to_do, S_IRUSR | S_IWUSR);
 
-               FILE* f = fopen (filesystem::path (*i).string().c_str(), "rb");
+               FILE* f = fopen (boost::filesystem::path (*i).string().c_str(), "rb");
                if (f == 0) {
                        throw NetworkError (String::compose ("Could not open %1 to send", *i));
                }
@@ -180,7 +182,7 @@ SCPDCPJob::run ()
                        int const t = min (to_do, buffer_size);
                        size_t const read = fread (buffer, 1, t, f);
                        if (read != size_t (t)) {
-                               throw ReadFileError (filesystem::path (*i).string());
+                               throw ReadFileError (boost::filesystem::path (*i).string());
                        }
                        
                        r = ssh_scp_write (sc.scp, buffer, t);
index 10f64b48250ee044e87128d45b7c5db8fe85e3c3..c80527567cbdd58a7c13a55a5e6f0805c37e67d6 100644 (file)
 #include "config.h"
 #include "subtitle.h"
 
-using namespace std;
-using namespace boost;
+using std::string;
+using std::stringstream;
+using std::multimap;
+using std::vector;
+using std::cerr;
+using boost::shared_ptr;
+using boost::algorithm::is_any_of;
+using boost::algorithm::split;
+using boost::thread;
+using boost::bind;
 
 /** Create a server description from a string of metadata returned from as_metadata().
  *  @param v Metadata.
@@ -132,7 +140,7 @@ void
 Server::worker_thread ()
 {
        while (1) {
-               mutex::scoped_lock lock (_worker_mutex);
+               boost::mutex::scoped_lock lock (_worker_mutex);
                while (_queue.empty ()) {
                        _worker_condition.wait (lock);
                }
@@ -176,13 +184,13 @@ Server::run (int num_threads)
                _worker_threads.push_back (new thread (bind (&Server::worker_thread, this)));
        }
 
-       asio::io_service io_service;
-       asio::ip::tcp::acceptor acceptor (io_service, asio::ip::tcp::endpoint (asio::ip::tcp::v4(), Config::instance()->server_port ()));
+       boost::asio::io_service io_service;
+       boost::asio::ip::tcp::acceptor acceptor (io_service, boost::asio::ip::tcp::endpoint (boost::asio::ip::tcp::v4(), Config::instance()->server_port ()));
        while (1) {
                shared_ptr<Socket> socket (new Socket);
                acceptor.accept (socket->socket ());
 
-               mutex::scoped_lock lock (_worker_mutex);
+               boost::mutex::scoped_lock lock (_worker_mutex);
                
                /* Wait until the queue has gone down a bit */
                while (int (_queue.size()) >= num_threads * 2) {
index a4965ba44e63a8067c83bd6a70ba03890e6229ea..cf16b8ab650982b8e65b09b4c50909af6d39f8b6 100644 (file)
 #include "log.h"
 #include "encoder_factory.h"
 
-using namespace std;
-using namespace boost;
+using std::string;
+using std::stringstream;
+using std::fixed;
+using std::setprecision;
+using boost::shared_ptr;
 
 /** @param s Film to use.
  *  @param o Options.
index 8c02b76337b258b904d478eb4b1ebaeccd4cbadf..9515a43449ba730f6bba81394d92c5f144bb8cc0 100644 (file)
  */
 
 #include <iostream>
-#include <sigc++/signal.h>
+#include <boost/signals2.hpp>
 #include "transcoder.h"
 #include "encoder.h"
 #include "decoder_factory.h"
 
-using namespace std;
-using namespace boost;
+using std::string;
+using boost::shared_ptr;
 
 /** Construct a transcoder using a Decoder that we create and a supplied Encoder.
  *  @param f Film that we are transcoding.
@@ -46,8 +46,8 @@ Transcoder::Transcoder (shared_ptr<Film> f, shared_ptr<const Options> o, Job* j,
 {
        assert (_encoder);
        
-       _decoder->Video.connect (sigc::mem_fun (*e, &Encoder::process_video));
-       _decoder->Audio.connect (sigc::mem_fun (*e, &Encoder::process_audio));
+       _decoder->Video.connect (bind (&Encoder::process_video, e, _1, _2, _3));
+       _decoder->Audio.connect (bind (&Encoder::process_audio, e, _1));
 }
 
 /** Run the decoder, passing its output to the encoder, until the decoder
index 6b0e73c601fa6e8360ab6c48904e64bae3b6671e..0797d911e7123198f02f4c0fd3c061ae4dc3d9b4 100644 (file)
@@ -30,9 +30,9 @@ public:
                : _work (_service)
        {}
        
-       template <class S>
-       void emit (S signal) {
-               _service.post (boost::bind (boost::ref (signal)));
+       template <typename T>
+       void emit (T f) {
+               _service.post (f);
        }
 
        void ui_idle () {
index 4e3006c57cd74d7a7d64fbf0c34e4cddc17ba748..add0f614482d2a319359ed9399597e7a0d3f1c6f 100644 (file)
@@ -229,7 +229,7 @@ public:
                film_editor->setup_visibility ();
                film_viewer->setup_visibility ();
                
-               film_editor->FileChanged.connect (sigc::mem_fun (*this, &Frame::file_changed));
+               film_editor->FileChanged.connect (bind (&Frame::file_changed, this, _1));
                if (film) {
                        file_changed (film->directory ());
                } else {
index 03e85e995871c1663741acab18f6b7d8f8ca2292..2d4df030c34094d0f8cefa01814d3b70bd2d97ff 100644 (file)
 #include "config.h"
 #include "log.h"
 
-using namespace std;
-using namespace boost;
+using std::string;
+using std::cerr;
+using std::cout;
+using std::vector;
+using std::pair;
+using std::list;
+using boost::shared_ptr;
 
 static void
 help (string n)
index b0bd6f2ee5514c31b332ffc650846a03b704a721..f505b4bdc55b8e8e219849292ac5c32c0676f698 100644 (file)
@@ -35,7 +35,7 @@
 #include "server_dialog.h"
 
 using namespace std;
-using namespace boost;
+using boost::bind;
 
 ConfigDialog::ConfigDialog (wxWindow* parent)
        : wxDialog (parent, wxID_ANY, _("DVD-o-matic Configuration"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
@@ -307,7 +307,7 @@ void
 ConfigDialog::edit_reference_filters_clicked (wxCommandEvent &)
 {
        FilterDialog* d = new FilterDialog (this, Config::instance()->reference_filters ());
-       d->ActiveChanged.connect (sigc::mem_fun (*this, &ConfigDialog::reference_filters_changed));
+       d->ActiveChanged.connect (boost::bind (&ConfigDialog::reference_filters_changed, this, _1));
        d->ShowModal ();
        d->Destroy ();
 }
index 706b0e43052f3434786b421298cfcbede35798d5..ea15154baa5a7234f23e91186f074fc2092e085b 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <wx/wx.h>
 #include <wx/spinctrl.h>
-#include <sigc++/sigc++.h>
+#include <boost/signals2.hpp>
 #include "lib/trim_action.h"
 
 class Film;
@@ -29,7 +29,7 @@ class DCPRangeDialog : public wxDialog
 public:
        DCPRangeDialog (wxWindow *, Film *);
 
-       sigc::signal2<void, int, TrimAction> Changed;
+       boost::signals2::signal<void (int, TrimAction)> Changed;
 
 private:
        void whole_toggled (wxCommandEvent &);
index 502f3734c233b86f7d4a85044e25d3e2c8fc3241..542cde7d7917b09c526de6860a17c882ef9db50f 100644 (file)
@@ -594,7 +594,7 @@ FilmEditor::set_film (Film* f)
        set_things_sensitive (_film != 0);
 
        if (_film) {
-               _film->Changed.connect (sigc::mem_fun (*this, &FilmEditor::film_changed));
+               _film->Changed.connect (bind (&FilmEditor::film_changed, this, _1));
        }
 
        if (_film) {
@@ -663,7 +663,7 @@ void
 FilmEditor::edit_filters_clicked (wxCommandEvent &)
 {
        FilterDialog* d = new FilterDialog (this, _film->filters());
-       d->ActiveChanged.connect (sigc::mem_fun (*_film, &Film::set_filters));
+       d->ActiveChanged.connect (bind (&Film::set_filters, _film, _1));
        d->ShowModal ();
        d->Destroy ();
 }
@@ -758,7 +758,7 @@ void
 FilmEditor::change_dcp_range_clicked (wxCommandEvent &)
 {
        DCPRangeDialog* d = new DCPRangeDialog (this, _film);
-       d->Changed.connect (sigc::mem_fun (*this, &FilmEditor::dcp_range_changed));
+       d->Changed.connect (bind (&FilmEditor::dcp_range_changed, this, _1, _2));
        d->ShowModal ();
 }
 
index 28afe7ff0f1341e6d98cb258b8556a134103a3e5..f6e180979551b8eddf36610605062ee9d8986c17 100644 (file)
@@ -25,6 +25,7 @@
 #include <wx/spinctrl.h>
 #include <wx/filepicker.h>
 #include <wx/collpane.h>
+#include <boost/signals2.hpp>
 #include "lib/trim_action.h"
 #include "lib/film.h"
 
@@ -41,7 +42,7 @@ public:
        void set_film (Film *);
        void setup_visibility ();
 
-       sigc::signal1<void, std::string> FileChanged;
+       boost::signals2::signal<void (std::string)> FileChanged;
 
 private:
        /* Handle changes to the view */
index 1a9854450fdd447bb62a6ced25a1d1f554d8a22b..05d9734f61d4b128695c085dd683efec7dc7f859 100644 (file)
@@ -43,7 +43,7 @@ FilmList::FilmList (string d)
        }
 
        _list.set_headers_visible (false);
-       _list.get_selection()->signal_changed().connect (sigc::mem_fun (*this, &FilmList::selection_changed));
+       _list.get_selection()->signal_changed().connect (bind (&FilmList::selection_changed, this));
 }
 
 Gtk::Widget&
index e2642321289b4af91574d9082ee84b08e6f5c138..2496679aa83e0325a8e40a8163741bcf3d8719c4 100644 (file)
 #include "film_viewer.h"
 #include "wx_util.h"
 
-using namespace std;
-using namespace boost;
+using std::string;
+using std::pair;
+using std::max;
+using boost::shared_ptr;
 
 class ThumbPanel : public wxPanel
 {
@@ -304,7 +306,7 @@ FilmViewer::set_film (Film* f)
                return;
        }
 
-       _film->Changed.connect (sigc::mem_fun (*this, &FilmViewer::film_changed));
+       _film->Changed.connect (bind (&FilmViewer::film_changed, this, _1));
        film_changed (Film::CROP);
        film_changed (Film::THUMBS);
        setup_visibility ();
index 028d082b4f8f6deadde30a1d84c1056e4fc6bdf2..2abe53026532aff7a42c54862132067898cdfccc 100644 (file)
@@ -26,6 +26,7 @@
 #include "filter_view.h"
 
 using namespace std;
+using boost::bind;
 
 FilterDialog::FilterDialog (wxWindow* parent, vector<Filter const *> const & f)
        : wxDialog (parent, wxID_ANY, wxString (_("Filters")))
@@ -34,7 +35,7 @@ FilterDialog::FilterDialog (wxWindow* parent, vector<Filter const *> const & f)
        wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL);
        sizer->Add (_filters, 1, wxEXPAND | wxALL, 6);
 
-       _filters->ActiveChanged.connect (sigc::mem_fun (*this, &FilterDialog::active_changed));
+       _filters->ActiveChanged.connect (bind (&FilterDialog::active_changed, this));
 
        wxSizer* buttons = CreateSeparatedButtonSizer (wxOK);
        if (buttons) {
index 882d740cb13e7935e500be1bbd741d17cfd97b83..e76f8536bfa3c17c52c6d012bf8ea2535973be2e 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 #include <wx/wx.h>
+#include <boost/signals2.hpp>
 
 class Film;
 class FilterView;
@@ -34,7 +35,7 @@ class FilterDialog : public wxDialog
 public:
        FilterDialog (wxWindow *, std::vector<Filter const *> const &);
 
-       sigc::signal1<void, std::vector<Filter const *> > ActiveChanged;
+       boost::signals2::signal<void (std::vector<Filter const *>)> ActiveChanged;
 
 private:
        void active_changed ();
index 770b55da600d24b3a6ebb756a0d811042897acc8..b8d5f644f126c9a16a749a016c5117c244b2f504 100644 (file)
@@ -21,9 +21,9 @@
  *  @brief A panel to select FFmpeg filters.
  */
 
+#include <boost/signals2.hpp>
 #include <vector>
 #include <map>
-#include <sigc++/sigc++.h>
 #include <wx/wx.h>
 
 class Filter;
@@ -38,7 +38,7 @@ public:
 
        std::vector<Filter const *> active () const;
 
-       sigc::signal0<void> ActiveChanged;
+       boost::signals2::signal<void()> ActiveChanged;
 
 private:
        void filter_toggled (wxCommandEvent &);
index a6eef6e34752d643a309069a278b669992f7d820..bd28862319aa956bb074e2523f74587d94966011 100644 (file)
@@ -28,8 +28,9 @@
 #include "job_manager_view.h"
 #include "wx_util.h"
 
-using namespace std;
-using namespace boost;
+using std::string;
+using std::list;
+using boost::shared_ptr;
 
 /** Must be called in the GUI thread */
 JobManagerView::JobManagerView (wxWindow* parent)
index 55505648df85dbd4b892263c5fdbd0d9a0916433..2eaea1624f9e5fdf1102bab5731ff78ddfa9e626 100644 (file)
 #define BOOST_TEST_MODULE dvdomatic_test
 #include <boost/test/unit_test.hpp>
 
-using namespace std;
-using namespace boost;
+using std::string;
+using std::list;
+using std::stringstream;
+using std::vector;
+using boost::shared_ptr;
+using boost::thread;
 
 void
 setup_test_config ()