Some const correctness.
authorCarl Hetherington <cth@carlh.net>
Wed, 24 Apr 2013 00:02:25 +0000 (01:02 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 24 Apr 2013 00:02:25 +0000 (01:02 +0100)
26 files changed:
src/lib/analyse_audio_job.cc
src/lib/analyse_audio_job.h
src/lib/audio_sink.h
src/lib/audio_source.h
src/lib/combiner.cc
src/lib/combiner.h
src/lib/delay_line.cc
src/lib/delay_line.h
src/lib/encoder.cc
src/lib/encoder.h
src/lib/gain.cc
src/lib/gain.h
src/lib/image.cc
src/lib/image.h
src/lib/matcher.cc
src/lib/matcher.h
src/lib/trimmer.cc
src/lib/trimmer.h
src/lib/util.cc
src/lib/util.h
src/lib/video_sink.h
src/lib/video_source.h
src/tools/servomatictest.cc
src/wx/film_viewer.cc
src/wx/film_viewer.h
test/test.cc

index 43eecbcbd774f66d4b84e70e714171aa86304aa2..88cd65fee64f0227d24960600b6664dc46721ae1 100644 (file)
@@ -84,7 +84,7 @@ AnalyseAudioJob::run ()
 }
 
 void
-AnalyseAudioJob::audio (shared_ptr<AudioBuffers> b)
+AnalyseAudioJob::audio (shared_ptr<const AudioBuffers> b)
 {
        for (int i = 0; i < b->frames(); ++i) {
                for (int j = 0; j < b->channels(); ++j) {
index dc1e073ee15a031552dc3975572ad2c8d9f97b2b..5435e0a7cfb5401fe5efc2901ac367f7b23c1826 100644 (file)
@@ -31,7 +31,7 @@ public:
        void run ();
 
 private:
-       void audio (boost::shared_ptr<AudioBuffers>);
+       void audio (boost::shared_ptr<const AudioBuffers>);
 
        int64_t _done;
        int64_t _samples_per_point;
index f34b24f88369feef2b23729390c9ec13b7818e9a..69b3a4b7522788d9739297506c1e135bd854328b 100644 (file)
@@ -24,14 +24,14 @@ class AudioSink
 {
 public:
        /** Call with some audio data */
-       virtual void process_audio (boost::shared_ptr<AudioBuffers>) = 0;
+       virtual void process_audio (boost::shared_ptr<const AudioBuffers>) = 0;
 };
 
 class TimedAudioSink
 {
 public:
         /** Call with some audio data */
-        virtual void process_audio (boost::shared_ptr<AudioBuffers>, double t) = 0;
+        virtual void process_audio (boost::shared_ptr<const AudioBuffers>, double t) = 0;
 };
 
 #endif
index e255d566d6ac5f0c8fac47fd376ef3f5a396bfe3..c13f1636b521661055ed18eb3c5daf89aaa44948 100644 (file)
@@ -35,7 +35,7 @@ class AudioSource
 {
 public:
        /** Emitted when some audio data is ready */
-       boost::signals2::signal<void (boost::shared_ptr<AudioBuffers>)> Audio;
+       boost::signals2::signal<void (boost::shared_ptr<const AudioBuffers>)> Audio;
 
        void connect_audio (boost::shared_ptr<AudioSink>);
 };
@@ -46,7 +46,7 @@ class TimedAudioSource
 {
 public:
        /** Emitted when some audio data is ready */
-       boost::signals2::signal<void (boost::shared_ptr<AudioBuffers>, double)> Audio;
+       boost::signals2::signal<void (boost::shared_ptr<const AudioBuffers>, double)> Audio;
 
        void connect_audio (boost::shared_ptr<AudioSink>);
        void connect_audio (boost::shared_ptr<TimedAudioSink>);
index 0a9eaf6b60bf8e12d2689ade030c7f16c50f0081..250528aeb91e61d1b4bcd47a20406528e6976927 100644 (file)
@@ -33,9 +33,9 @@ Combiner::Combiner (shared_ptr<Log> log)
  *  @param image Frame image.
  */
 void
-Combiner::process_video (shared_ptr<Image> image, bool, shared_ptr<Subtitle>, double)
+Combiner::process_video (shared_ptr<const Image> image, bool, shared_ptr<Subtitle>, double)
 {
-       _image = image;
+       _image = image->clone ();
 }
 
 /** Process video for the right half of the frame.
@@ -43,7 +43,7 @@ Combiner::process_video (shared_ptr<Image> image, bool, shared_ptr<Subtitle>, do
  *  @param sub Subtitle (which will be put onto the whole frame)
  */
 void
-Combiner::process_video_b (shared_ptr<Image> image, bool, shared_ptr<Subtitle> sub, double t)
+Combiner::process_video_b (shared_ptr<const Image> image, bool, shared_ptr<Subtitle> sub, double t)
 {
        /* Copy the right half of this image into our _image */
        /* XXX: this should probably be in the Image class */
index a8f1fa804e9bd1549e4dbb727875b71e3c353bcc..7ed316e26934cd663a0ab9ae92aa64d4ddca8952 100644 (file)
@@ -33,8 +33,8 @@ class Combiner : public TimedVideoProcessor
 public:
        Combiner (boost::shared_ptr<Log> log);
 
-       void process_video (boost::shared_ptr<Image> i, bool, boost::shared_ptr<Subtitle> s, double);
-       void process_video_b (boost::shared_ptr<Image> i, bool, boost::shared_ptr<Subtitle> s, double);
+       void process_video (boost::shared_ptr<const Image> i, bool, boost::shared_ptr<Subtitle> s, double);
+       void process_video_b (boost::shared_ptr<const Image> i, bool, boost::shared_ptr<Subtitle> s, double);
 
 private:
        /** The image that we are currently working on */
index 9e6baeba8131f0ebe671f0b9d3112466bfe1e5f8..b0180800a4625795823697c2dd5c9d1bfd2fcfff 100644 (file)
@@ -37,7 +37,7 @@ DelayLine::DelayLine (shared_ptr<Log> log, double seconds)
 }
 
 void
-DelayLine::process_audio (shared_ptr<AudioBuffers> data, double t)
+DelayLine::process_audio (shared_ptr<const AudioBuffers> data, double t)
 {
        if (_seconds > 0) {
                t += _seconds;
@@ -47,7 +47,7 @@ DelayLine::process_audio (shared_ptr<AudioBuffers> data, double t)
 }
 
 void
-DelayLine::process_video (boost::shared_ptr<Image> image, bool same, boost::shared_ptr<Subtitle> sub, double t)
+DelayLine::process_video (shared_ptr<const Image> image, bool same, boost::shared_ptr<Subtitle> sub, double t)
 {
        if (_seconds < 0) {
                t += _seconds;
index 90f1dcfa7b55b56fd1c42442d3b7fa0311a2fa56..781dce88a63938f611b76179029851eee0d6715c 100644 (file)
@@ -26,8 +26,8 @@ class DelayLine : public TimedAudioVideoProcessor
 public:
        DelayLine (boost::shared_ptr<Log> log, double);
        
-       void process_video (boost::shared_ptr<Image>, bool, boost::shared_ptr<Subtitle>, double);
-       void process_audio (boost::shared_ptr<AudioBuffers>, double);
+       void process_video (boost::shared_ptr<const Image>, bool, boost::shared_ptr<Subtitle>, double);
+       void process_audio (boost::shared_ptr<const AudioBuffers>, double);
 
 private:
        double _seconds;
index 7b338407eae7765c3bd7aac7bb5fd519b45675a7..7a1eea0698df8b915471ee34ccfef67f2cc7dbcf 100644 (file)
@@ -231,7 +231,7 @@ Encoder::frame_done ()
 }
 
 void
-Encoder::process_video (shared_ptr<Image> image, bool same, boost::shared_ptr<Subtitle> sub)
+Encoder::process_video (shared_ptr<const Image> image, bool same, boost::shared_ptr<Subtitle> sub)
 {
        FrameRateConversion frc (_film->source_frame_rate(), _film->dcp_frame_rate());
        
@@ -294,7 +294,7 @@ Encoder::process_video (shared_ptr<Image> image, bool same, boost::shared_ptr<Su
 }
 
 void
-Encoder::process_audio (shared_ptr<AudioBuffers> data)
+Encoder::process_audio (shared_ptr<const AudioBuffers> data)
 {
 #if HAVE_SWRESAMPLE
        /* Maybe sample-rate convert */
index 86880bc34942561ba12a1488feb00663c2c9d6d8..70e81a7e071d483f3ae6bad45faf5b76f9c8c797 100644 (file)
@@ -73,10 +73,10 @@ public:
         *  @param same true if i is the same as the last time we were called.
         *  @param s A subtitle that should be on this frame, or 0.
         */
-       void process_video (boost::shared_ptr<Image> i, bool same, boost::shared_ptr<Subtitle> s);
+       void process_video (boost::shared_ptr<const Image> i, bool same, boost::shared_ptr<Subtitle> s);
 
        /** Call with some audio data */
-       void process_audio (boost::shared_ptr<AudioBuffers>);
+       void process_audio (boost::shared_ptr<const AudioBuffers>);
 
        /** Called when a processing run has finished */
        virtual void process_end ();
index df7011d2e8100a14e537234d9e6d6fb0e2fb8d57..ccd779d7154f1b9813fb8754ee67abacc19064cd 100644 (file)
@@ -30,7 +30,7 @@ Gain::Gain (shared_ptr<Log> log, float gain)
 }
 
 void
-Gain::process_audio (shared_ptr<AudioBuffers> b)
+Gain::process_audio (shared_ptr<const AudioBuffers> b)
 {
        if (_gain != 0) {
                float const linear_gain = pow (10, _gain / 20);
index d462e5aeee2471988d203cee7805c8c2f458c400..61fef5e85a8236eece5b94f4453b69745a781c9d 100644 (file)
@@ -24,7 +24,7 @@ class Gain : public AudioProcessor
 public:
        Gain (boost::shared_ptr<Log> log, float gain);
 
-       void process_audio (boost::shared_ptr<AudioBuffers>);
+       void process_audio (boost::shared_ptr<const AudioBuffers>);
 
 private:
        float _gain;
index 2355d22e5b959ab12af8c9f8bae144d781649315..9bcbb87ab3cc6b9d2c71a523beeb35e9be193bd0 100644 (file)
@@ -583,6 +583,12 @@ SimpleImage::aligned () const
        return _aligned;
 }
 
+shared_ptr<Image>
+SimpleImage::clone () const
+{
+       return shared_ptr<Image> (new SimpleImage (*this));
+}
+
 FilterBufferImage::FilterBufferImage (AVPixelFormat p, AVFilterBufferRef* b)
        : Image (p)
        , _buffer (b)
index 6b9ade99eefccb8b3d92e7c023300c14f9ac9601..31035d272d99a33f4791ff210d0cff23db47e991 100644 (file)
@@ -70,6 +70,8 @@ public:
 
        virtual bool aligned () const = 0;
 
+       virtual boost::shared_ptr<Image> clone () const = 0;
+
        int components () const;
        int lines (int) const;
 
@@ -118,6 +120,9 @@ private:
        /* Not allowed */
        FilterBufferImage (FilterBufferImage const &);
        FilterBufferImage& operator= (FilterBufferImage const &);
+       boost::shared_ptr<Image> clone () const {
+               assert (false);
+       }
        
        AVFilterBufferRef* _buffer;
        int* _line_size;
@@ -139,6 +144,7 @@ public:
        int * stride () const;
        libdcp::Size size () const;
        bool aligned () const;
+       boost::shared_ptr<Image> clone () const;
 
 protected:
        void allocate ();
index dd0312f6776e16672c3d080f76ae29ba2625b12b..9924c003ae5b81298ef27653e5ba015d7d312307 100644 (file)
@@ -41,7 +41,7 @@ Matcher::Matcher (shared_ptr<Log> log, int sample_rate, float frames_per_second)
 }
 
 void
-Matcher::process_video (boost::shared_ptr<Image> image, bool same, boost::shared_ptr<Subtitle> sub, double t)
+Matcher::process_video (boost::shared_ptr<const Image> image, bool same, boost::shared_ptr<Subtitle> sub, double t)
 {
        _pixel_format = image->pixel_format ();
        _size = image->size ();
@@ -90,7 +90,7 @@ Matcher::process_video (boost::shared_ptr<Image> image, bool same, boost::shared
 }
 
 void
-Matcher::process_audio (boost::shared_ptr<AudioBuffers> b, double t)
+Matcher::process_audio (boost::shared_ptr<const AudioBuffers> b, double t)
 {
        _channels = b->channels ();
 
@@ -202,8 +202,9 @@ void
 Matcher::repeat_last_video ()
 {
        if (!_last_image) {
-               _last_image.reset (new SimpleImage (_pixel_format.get(), _size.get(), true));
-               _last_image->make_black ();
+               shared_ptr<Image> im (new SimpleImage (_pixel_format.get(), _size.get(), true));
+               im->make_black ();
+               _last_image = im;
        }
 
        Video (_last_image, true, _last_subtitle);
index f54aa4b6a7c9c37815697fcd03c55b9936936353..41aa373a412cd51808dc5d7967e3c04640cc7a80 100644 (file)
@@ -25,8 +25,8 @@ class Matcher : public Processor, public TimedAudioSink, public TimedVideoSink,
 {
 public:
        Matcher (boost::shared_ptr<Log> log, int sample_rate, float frames_per_second);
-       void process_video (boost::shared_ptr<Image> i, bool, boost::shared_ptr<Subtitle> s, double);
-       void process_audio (boost::shared_ptr<AudioBuffers>, double);
+       void process_video (boost::shared_ptr<const Image> i, bool, boost::shared_ptr<Subtitle> s, double);
+       void process_audio (boost::shared_ptr<const AudioBuffers>, double);
        void process_end ();
 
 private:
@@ -43,19 +43,19 @@ private:
        boost::optional<int> _channels;
 
        struct AudioRecord {
-               AudioRecord (boost::shared_ptr<AudioBuffers> a, double t)
+               AudioRecord (boost::shared_ptr<const AudioBuffers> a, double t)
                        : audio (a)
                        , time (t)
                {}
                
-               boost::shared_ptr<AudioBuffers> audio;
+               boost::shared_ptr<const AudioBuffers> audio;
                double time;
        };
 
        std::list<AudioRecord> _pending_audio;
 
        boost::optional<double> _first_input;
-       boost::shared_ptr<Image> _last_image;
+       boost::shared_ptr<const Image> _last_image;
        boost::shared_ptr<Subtitle> _last_subtitle;
 
        bool _had_first_video;
index 68364e50ad91f8dbbbd4a8e6792b933d439bb32f..39ec44fcb630d2eb250dc4bddeefd8078f3eb524 100644 (file)
@@ -56,7 +56,7 @@ Trimmer::Trimmer (
 }
 
 void
-Trimmer::process_video (shared_ptr<Image> image, bool same, shared_ptr<Subtitle> sub)
+Trimmer::process_video (shared_ptr<const Image> image, bool same, shared_ptr<Subtitle> sub)
 {
        if (_video_in >= _video_start && _video_in <= _video_end) {
                Video (image, same, sub);
@@ -66,7 +66,7 @@ Trimmer::process_video (shared_ptr<Image> image, bool same, shared_ptr<Subtitle>
 }
 
 void
-Trimmer::process_audio (shared_ptr<AudioBuffers> audio)
+Trimmer::process_audio (shared_ptr<const AudioBuffers> audio)
 {
        int64_t offset = _audio_start - _audio_in;
        if (offset > audio->frames()) {
@@ -91,8 +91,10 @@ Trimmer::process_audio (shared_ptr<AudioBuffers> audio)
        _audio_in += audio->frames ();
        
        if (offset != 0 || length != audio->frames ()) {
-               audio->move (offset, 0, length);
-               audio->set_frames (length);
+               shared_ptr<AudioBuffers> copy (new AudioBuffers (audio));
+               copy->move (offset, 0, length);
+               copy->set_frames (length);
+               audio = copy;
        }
        
        Audio (audio);
index ff7e9514d1e1d13e5bcda9cb1a13b1e3895ed781..45b3f149a3ed770840043e422c08179c1bc97db9 100644 (file)
@@ -24,8 +24,8 @@ class Trimmer : public AudioVideoProcessor
 public:
        Trimmer (boost::shared_ptr<Log>, int, int, int, int, float, int);
 
-       void process_video (boost::shared_ptr<Image> i, bool, boost::shared_ptr<Subtitle> s);
-       void process_audio (boost::shared_ptr<AudioBuffers>);
+       void process_video (boost::shared_ptr<const Image> i, bool, boost::shared_ptr<Subtitle> s);
+       void process_audio (boost::shared_ptr<const AudioBuffers>);
 
 private:
        friend class trimmer_test;
index e43b598ab3ef3e635baac415cce0ad7f511c47fd..859aa6de7ddda8efa646ee695247023d40169a7a 100644 (file)
@@ -63,11 +63,24 @@ extern "C" {
 
 #include "i18n.h"
 
-using namespace std;
-using namespace boost;
+using std::cout;
+using std::string;
+using std::stringstream;
+using std::list;
+using std::ostream;
+using std::vector;
+using std::ifstream;
+using std::istream;
+using std::min;
+using std::max;
+using std::multimap;
+using std::pair;
+using boost::shared_ptr;
+using boost::lexical_cast;
+using boost::optional;
 using libdcp::Size;
 
-thread::id ui_thread;
+boost::thread::id ui_thread;
 
 /** Convert some number of seconds to a string representation
  *  in hours, minutes and seconds.
@@ -87,9 +100,9 @@ seconds_to_hms (int s)
        stringstream hms;
        hms << h << N_(":");
        hms.width (2);
-       hms << setfill ('0') << m << N_(":");
+       hms << std::setfill ('0') << m << N_(":");
        hms.width (2);
-       hms << setfill ('0') << s;
+       hms << std::setfill ('0') << s;
 
        return hms.str ();
 }
@@ -185,7 +198,7 @@ stacktrace (ostream& out, int levels)
      
        if (strings) {
                for (i = 0; i < size && (levels == 0 || i < size_t(levels)); i++) {
-                       out << N_("  ") << demangle (strings[i]) << endl;
+                       out << N_("  ") << demangle (strings[i]) << "\n";
                }
                
                free (strings);
@@ -243,7 +256,7 @@ dvdomatic_setup ()
        Filter::setup_filters ();
        SoundProcessor::setup_sound_processors ();
 
-       ui_thread = this_thread::get_id ();
+       ui_thread = boost::this_thread::get_id ();
 }
 
 #ifdef DVDOMATIC_WINDOWS
@@ -338,7 +351,7 @@ md5_digest (void const * data, int size)
        
        stringstream s;
        for (int i = 0; i < MD5_DIGEST_LENGTH; ++i) {
-               s << hex << setfill('0') << setw(2) << ((int) digest[i]);
+               s << std::hex << std::setfill('0') << std::setw(2) << ((int) digest[i]);
        }
 
        return s.str ();
@@ -350,14 +363,14 @@ md5_digest (void const * data, int size)
 string
 md5_digest (string file)
 {
-       ifstream f (file.c_str(), ios::binary);
+       ifstream f (file.c_str(), std::ios::binary);
        if (!f.good ()) {
                throw OpenFileError (file);
        }
        
-       f.seekg (0, ios::end);
+       f.seekg (0, std::ios::end);
        int bytes = f.tellg ();
-       f.seekg (0, ios::beg);
+       f.seekg (0, std::ios::beg);
 
        int const buffer_size = 64 * 1024;
        char buffer[buffer_size];
@@ -376,7 +389,7 @@ md5_digest (string file)
 
        stringstream s;
        for (int i = 0; i < MD5_DIGEST_LENGTH; ++i) {
-               s << hex << setfill('0') << setw(2) << ((int) digest[i]);
+               s << std::hex << std::setfill('0') << std::setw(2) << ((int) digest[i]);
        }
 
        return s.str ();
@@ -441,8 +454,8 @@ best_dcp_frame_rate (float source_fps)
        }
 
        /* Pick the best one, bailing early if we hit an exact match */
-       float error = numeric_limits<float>::max ();
-       boost::optional<FrameRateCandidate> best;
+       float error = std::numeric_limits<float>::max ();
+       optional<FrameRateCandidate> best;
        list<FrameRateCandidate>::iterator i = candidates.begin();
        while (i != candidates.end()) {
                
@@ -509,16 +522,16 @@ Socket::Socket (int timeout)
        , _socket (_io_service)
        , _timeout (timeout)
 {
-       _deadline.expires_at (posix_time::pos_infin);
+       _deadline.expires_at (boost::posix_time::pos_infin);
        check ();
 }
 
 void
 Socket::check ()
 {
-       if (_deadline.expires_at() <= asio::deadline_timer::traits_type::now ()) {
+       if (_deadline.expires_at() <= boost::asio::deadline_timer::traits_type::now ()) {
                _socket.close ();
-               _deadline.expires_at (posix_time::pos_infin);
+               _deadline.expires_at (boost::posix_time::pos_infin);
        }
 
        _deadline.async_wait (boost::bind (&Socket::check, this));
@@ -528,14 +541,14 @@ Socket::check ()
  *  @param endpoint End-point to connect to.
  */
 void
-Socket::connect (asio::ip::basic_resolver_entry<asio::ip::tcp> const & endpoint)
+Socket::connect (boost::asio::ip::basic_resolver_entry<boost::asio::ip::tcp> const & endpoint)
 {
-       _deadline.expires_from_now (posix_time::seconds (_timeout));
-       system::error_code ec = asio::error::would_block;
-       _socket.async_connect (endpoint, lambda::var(ec) = lambda::_1);
+       _deadline.expires_from_now (boost::posix_time::seconds (_timeout));
+       boost::system::error_code ec = boost::asio::error::would_block;
+       _socket.async_connect (endpoint, boost::lambda::var(ec) = boost::lambda::_1);
        do {
                _io_service.run_one();
-       } while (ec == asio::error::would_block);
+       } while (ec == boost::asio::error::would_block);
 
        if (ec || !_socket.is_open ()) {
                throw NetworkError (_("connect timed out"));
@@ -549,14 +562,14 @@ Socket::connect (asio::ip::basic_resolver_entry<asio::ip::tcp> const & endpoint)
 void
 Socket::write (uint8_t const * data, int size)
 {
-       _deadline.expires_from_now (posix_time::seconds (_timeout));
-       system::error_code ec = asio::error::would_block;
+       _deadline.expires_from_now (boost::posix_time::seconds (_timeout));
+       boost::system::error_code ec = boost::asio::error::would_block;
 
-       asio::async_write (_socket, asio::buffer (data, size), lambda::var(ec) = lambda::_1);
+       boost::asio::async_write (_socket, boost::asio::buffer (data, size), boost::lambda::var(ec) = boost::lambda::_1);
        
        do {
                _io_service.run_one ();
-       } while (ec == asio::error::would_block);
+       } while (ec == boost::asio::error::would_block);
 
        if (ec) {
                throw NetworkError (ec.message ());
@@ -577,14 +590,14 @@ Socket::write (uint32_t v)
 void
 Socket::read (uint8_t* data, int size)
 {
-       _deadline.expires_from_now (posix_time::seconds (_timeout));
-       system::error_code ec = asio::error::would_block;
+       _deadline.expires_from_now (boost::posix_time::seconds (_timeout));
+       boost::system::error_code ec = boost::asio::error::would_block;
 
-       asio::async_read (_socket, asio::buffer (data, size), lambda::var(ec) = lambda::_1);
+       boost::asio::async_read (_socket, boost::asio::buffer (data, size), boost::lambda::var(ec) = boost::lambda::_1);
 
        do {
                _io_service.run_one ();
-       } while (ec == asio::error::would_block);
+       } while (ec == boost::asio::error::would_block);
        
        if (ec) {
                throw NetworkError (ec.message ());
@@ -761,6 +774,21 @@ AudioBuffers::AudioBuffers (AudioBuffers const & other)
        }
 }
 
+/* XXX: it's a shame that this is a copy-and-paste of the above;
+   probably fixable with c++0x.
+*/
+AudioBuffers::AudioBuffers (boost::shared_ptr<const AudioBuffers> other)
+       : _channels (other->_channels)
+       , _frames (other->_frames)
+       , _allocated_frames (other->_frames)
+{
+       _data = new float*[_channels];
+       for (int i = 0; i < _channels; ++i) {
+               _data[i] = new float[_frames];
+               memcpy (_data[i], other->_data[i], _frames * sizeof (float));
+       }
+}
+
 /** AudioBuffers destructor */
 AudioBuffers::~AudioBuffers ()
 {
@@ -865,7 +893,7 @@ AudioBuffers::move (int from, int to, int frames)
 void
 ensure_ui_thread ()
 {
-       assert (this_thread::get_id() == ui_thread);
+       assert (boost::this_thread::get_id() == ui_thread);
 }
 
 /** @param v Source video frame.
index 31d0fc96707fb976759fed42e69b51225a845389..99670110edec6d4d47eaf6c4709c60d3be3e5f8c 100644 (file)
@@ -241,6 +241,7 @@ class AudioBuffers
 public:
        AudioBuffers (int channels, int frames);
        AudioBuffers (AudioBuffers const &);
+       AudioBuffers (boost::shared_ptr<const AudioBuffers>);
        ~AudioBuffers ();
 
        float** data () const {
index 32c7f3b384f145cbb1bf83ba6de63294675fa253..0170c7350c90d1f1898c9a275b7d21556fc4c2e5 100644 (file)
@@ -34,7 +34,7 @@ public:
         *  @param same true if i is the same as last time we were called.
         *  @param s A subtitle that should be on this frame, or 0.
         */
-       virtual void process_video (boost::shared_ptr<Image> i, bool same, boost::shared_ptr<Subtitle> s) = 0;
+       virtual void process_video (boost::shared_ptr<const Image> i, bool same, boost::shared_ptr<Subtitle> s) = 0;
 };
 
 class TimedVideoSink
@@ -46,7 +46,7 @@ public:
         *  @param s A subtitle that should be on this frame, or 0.
         *  @param t Source timestamp.
         */
-       virtual void process_video (boost::shared_ptr<Image> i, bool same, boost::shared_ptr<Subtitle> s, double t) = 0;
+       virtual void process_video (boost::shared_ptr<const Image> i, bool same, boost::shared_ptr<Subtitle> s, double t) = 0;
 };
 
 #endif
index e4a8ab0582535faf127481d53f7e1850821d2e1d..748cb6fe98b403cda07b939568ef8971eec7993a 100644 (file)
@@ -45,7 +45,7 @@ public:
         *  Second parameter is true if the image is the same as the last one that was emitted.
         *  Third parameter is either 0 or a subtitle that should be on this frame.
         */
-       boost::signals2::signal<void (boost::shared_ptr<Image>, bool, boost::shared_ptr<Subtitle>)> Video;
+       boost::signals2::signal<void (boost::shared_ptr<const Image>, bool, boost::shared_ptr<Subtitle>)> Video;
 
        void connect_video (boost::shared_ptr<VideoSink>);
 };
@@ -63,7 +63,7 @@ public:
         *  Third parameter is either 0 or a subtitle that should be on this frame.
         *  Fourth parameter is the source timestamp of this frame.
         */
-       boost::signals2::signal<void (boost::shared_ptr<Image>, bool, boost::shared_ptr<Subtitle>, double)> Video;
+       boost::signals2::signal<void (boost::shared_ptr<const Image>, bool, boost::shared_ptr<Subtitle>, double)> Video;
 
        void connect_video (boost::shared_ptr<VideoSink>);
        void connect_video (boost::shared_ptr<TimedVideoSink>);
index f5756c6939e7770fc12040838fc2c7b7c0030ad3..5e1cf49b4b0b1e04faff88718f58801948492173 100644 (file)
@@ -47,7 +47,7 @@ static shared_ptr<FileLog> log_ (new FileLog ("servomatictest.log"));
 static int frame = 0;
 
 void
-process_video (shared_ptr<Image> image, bool, shared_ptr<Subtitle> sub)
+process_video (shared_ptr<const Image> image, bool, shared_ptr<Subtitle> sub)
 {
        shared_ptr<DCPVideoFrame> local (
                new DCPVideoFrame (
index 8508ec2a21beec19832255432e1cc118ef18550f..4f2985a061db3677ebfb6d0ed5c89bf2fd25c9f8 100644 (file)
@@ -308,7 +308,7 @@ FilmViewer::raw_to_display ()
                return;
        }
 
-       boost::shared_ptr<Image> input = _raw_frame;
+       boost::shared_ptr<const Image> input = _raw_frame;
 
        pair<string, string> const s = Filter::ffmpeg_strings (_film->filters());
        if (!s.second.empty ()) {
@@ -400,7 +400,7 @@ FilmViewer::check_play_state ()
 }
 
 void
-FilmViewer::process_video (shared_ptr<Image> image, bool, shared_ptr<Subtitle> sub, double t)
+FilmViewer::process_video (shared_ptr<const Image> image, bool, shared_ptr<Subtitle> sub, double t)
 {
        _raw_frame = image;
        _raw_sub = sub;
index a78c772a49858570f9dd0170e6cf8dd5a752460c..ed5874fbcc6f945d6285db27bbe74801998fb893 100644 (file)
@@ -48,7 +48,7 @@ private:
        void slider_moved (wxScrollEvent &);
        void play_clicked (wxCommandEvent &);
        void timer (wxTimerEvent &);
-       void process_video (boost::shared_ptr<Image>, bool, boost::shared_ptr<Subtitle>, double);
+       void process_video (boost::shared_ptr<const Image>, bool, boost::shared_ptr<Subtitle>, double);
        void calculate_sizes ();
        void check_play_state ();
        void update_from_raw ();
@@ -72,9 +72,9 @@ private:
        wxTimer _timer;
 
        Decoders _decoders;
-       boost::shared_ptr<Image> _raw_frame;
+       boost::shared_ptr<const Image> _raw_frame;
        boost::shared_ptr<Subtitle> _raw_sub;
-       boost::shared_ptr<Image> _display_frame;
+       boost::shared_ptr<const Image> _display_frame;
        /* The x offset at which we display the actual film content; this corresponds
           to the film's padding converted to our coordinates.
        */
index 595d8fc9332f0e095ad203ce0b5c2daf05b84f86..496c915198818753036d2864656cd26aa75693e8 100644 (file)
@@ -123,17 +123,17 @@ BOOST_AUTO_TEST_CASE (make_black_test)
        }
 }
 
-shared_ptr<Image> trimmer_test_last_video;
-shared_ptr<AudioBuffers> trimmer_test_last_audio;
+shared_ptr<const Image> trimmer_test_last_video;
+shared_ptr<const AudioBuffers> trimmer_test_last_audio;
 
 void
-trimmer_test_video_helper (shared_ptr<Image> image, bool, shared_ptr<Subtitle>)
+trimmer_test_video_helper (shared_ptr<const Image> image, bool, shared_ptr<Subtitle>)
 {
        trimmer_test_last_video = image;
 }
 
 void
-trimmer_test_audio_helper (shared_ptr<AudioBuffers> audio)
+trimmer_test_audio_helper (shared_ptr<const AudioBuffers> audio)
 {
        trimmer_test_last_audio = audio;
 }