Hand-apply d849d411cff28ef5453085791d0b4d7cd73bd070 from master; replace all assert...
authorCarl Hetherington <cth@carlh.net>
Sat, 20 Dec 2014 23:37:57 +0000 (23:37 +0000)
committerCarl Hetherington <cth@carlh.net>
Sat, 20 Dec 2014 23:37:57 +0000 (23:37 +0000)
48 files changed:
TO_PORT
src/lib/audio_analysis.cc
src/lib/audio_buffers.cc
src/lib/audio_content.cc
src/lib/audio_decoder.cc
src/lib/cinema_sound_processor.cc
src/lib/content.cc
src/lib/content_subtitle.cc
src/lib/dcp_content.cc
src/lib/dcp_content_type.cc
src/lib/dcp_decoder.cc
src/lib/dcp_video.h
src/lib/dcpomatic_time.h
src/lib/exceptions.cc
src/lib/exceptions.h
src/lib/ffmpeg_content.cc
src/lib/ffmpeg_decoder.cc
src/lib/ffmpeg_stream.cc
src/lib/film.cc
src/lib/film.h
src/lib/image.cc
src/lib/image_content.cc
src/lib/image_proxy.cc
src/lib/player.cc
src/lib/player_video.cc
src/lib/playlist.cc
src/lib/ratio.cc
src/lib/scaler.cc
src/lib/sndfile_content.cc
src/lib/subrip_content.cc
src/lib/subtitle_content.cc
src/lib/types.cc
src/lib/util.cc
src/lib/util.h
src/lib/video_content.cc
src/lib/video_content.h
src/lib/video_content_scale.cc
src/lib/video_decoder.cc
src/lib/writer.cc
src/wx/audio_dialog.cc
src/wx/content_menu.cc
src/wx/dcp_panel.cc
src/wx/editable_list.h
src/wx/hints_dialog.cc
src/wx/kdm_dialog.cc
src/wx/subtitle_panel.cc
src/wx/timeline.cc
src/wx/video_panel.cc

diff --git a/TO_PORT b/TO_PORT
index 494945e9629062ae426fc99117ef622d66f3b633..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
--- a/TO_PORT
+++ b/TO_PORT
@@ -1,2 +0,0 @@
-0ee1e8c65e2977638375a8f96dbea201210aac98
-f2851b7066d0e12102b0f3aabc2b827a261206a9
index 681917fcf4c80272449ae73aad0447ba4bd57fb7..597c04a222cd278ebfd95ccab5b54a2bc246c7d7 100644 (file)
@@ -18,6 +18,7 @@
 */
 
 #include "audio_analysis.h"
+#include "dcpomatic_assert.h"
 #include "cross.h"
 #include <boost/filesystem.hpp>
 #include <stdint.h>
@@ -117,14 +118,14 @@ AudioAnalysis::AudioAnalysis (boost::filesystem::path filename)
 void
 AudioAnalysis::add_point (int c, AudioPoint const & p)
 {
-       assert (c < channels ());
+       DCPOMATIC_ASSERT (c < channels ());
        _data[c].push_back (p);
 }
 
 AudioPoint
 AudioAnalysis::get_point (int c, int p) const
 {
-       assert (p < points (c));
+       DCPOMATIC_ASSERT (p < points (c));
        return _data[c][p];
 }
 
@@ -137,7 +138,7 @@ AudioAnalysis::channels () const
 int
 AudioAnalysis::points (int c) const
 {
-       assert (c < channels ());
+       DCPOMATIC_ASSERT (c < channels ());
        return _data[c].size ();
 }
 
index d1003cc8cb32a32b4c5530e99e45e90d37a0aea1..71422944decbe544473b7e8479148c0e445ae7cd 100644 (file)
@@ -18,6 +18,7 @@
 */
 
 #include "audio_buffers.h"
+#include "dcpomatic_assert.h"
 #include <cassert>
 #include <cstring>
 #include <cmath>
@@ -73,8 +74,8 @@ AudioBuffers::~AudioBuffers ()
 void
 AudioBuffers::allocate (int channels, int frames)
 {
-       assert (frames >= 0);
-       assert (channels >= 0);
+       DCPOMATIC_ASSERT (frames >= 0);
+       DCPOMATIC_ASSERT (channels >= 0);
 
        _channels = channels;
        _frames = frames;
@@ -109,7 +110,7 @@ AudioBuffers::deallocate ()
 float*
 AudioBuffers::data (int c) const
 {
-       assert (c >= 0 && c < _channels);
+       DCPOMATIC_ASSERT (c >= 0 && c < _channels);
        return _data[c];
 }
 
@@ -121,7 +122,7 @@ AudioBuffers::data (int c) const
 void
 AudioBuffers::set_frames (int f)
 {
-       assert (f <= _allocated_frames);
+       DCPOMATIC_ASSERT (f <= _allocated_frames);
 
        for (int c = 0; c < _channels; ++c) {
                for (int i = f; i < _frames; ++i) {
@@ -147,7 +148,7 @@ AudioBuffers::make_silent ()
 void
 AudioBuffers::make_silent (int c)
 {
-       assert (c >= 0 && c < _channels);
+       DCPOMATIC_ASSERT (c >= 0 && c < _channels);
        
        for (int i = 0; i < _frames; ++i) {
                _data[c][i] = 0;
@@ -157,7 +158,7 @@ AudioBuffers::make_silent (int c)
 void
 AudioBuffers::make_silent (int from, int frames)
 {
-       assert ((from + frames) <= _allocated_frames);
+       DCPOMATIC_ASSERT ((from + frames) <= _allocated_frames);
 
        for (int c = 0; c < _channels; ++c) {
                for (int i = from; i < (from + frames); ++i) {
@@ -180,11 +181,11 @@ AudioBuffers::copy_from (AudioBuffers const * from, int frames_to_copy, int read
                return;
        }
        
-       assert (from->channels() == channels());
+       DCPOMATIC_ASSERT (from->channels() == channels());
 
-       assert (from);
-       assert (read_offset >= 0 && (read_offset + frames_to_copy) <= from->_allocated_frames);
-       assert (write_offset >= 0 && (write_offset + frames_to_copy) <= _allocated_frames);
+       DCPOMATIC_ASSERT (from);
+       DCPOMATIC_ASSERT (read_offset >= 0 && (read_offset + frames_to_copy) <= from->_allocated_frames);
+       DCPOMATIC_ASSERT (write_offset >= 0 && (write_offset + frames_to_copy) <= _allocated_frames);
 
        for (int i = 0; i < _channels; ++i) {
                memcpy (_data[i] + write_offset, from->_data[i] + read_offset, frames_to_copy * sizeof(float));
@@ -204,14 +205,14 @@ AudioBuffers::move (int from, int to, int frames)
                return;
        }
        
-       assert (from >= 0);
-       assert (from < _frames);
-       assert (to >= 0);
-       assert (to < _frames);
-       assert (frames > 0);
-       assert (frames <= _frames);
-       assert ((from + frames) <= _frames);
-       assert ((to + frames) <= _allocated_frames);
+       DCPOMATIC_ASSERT (from >= 0);
+       DCPOMATIC_ASSERT (from < _frames);
+       DCPOMATIC_ASSERT (to >= 0);
+       DCPOMATIC_ASSERT (to < _frames);
+       DCPOMATIC_ASSERT (frames > 0);
+       DCPOMATIC_ASSERT (frames <= _frames);
+       DCPOMATIC_ASSERT ((from + frames) <= _frames);
+       DCPOMATIC_ASSERT ((to + frames) <= _allocated_frames);
        
        for (int i = 0; i < _channels; ++i) {
                memmove (_data[i] + to, _data[i] + from, frames * sizeof(float));
@@ -225,8 +226,8 @@ void
 AudioBuffers::accumulate_channel (AudioBuffers const * from, int from_channel, int to_channel, float gain)
 {
        int const N = frames ();
-       assert (from->frames() == N);
-       assert (to_channel <= _channels);
+       DCPOMATIC_ASSERT (from->frames() == N);
+       DCPOMATIC_ASSERT (to_channel <= _channels);
 
        float* s = from->data (from_channel);
        float* d = _data[to_channel];
@@ -262,9 +263,9 @@ AudioBuffers::ensure_size (int frames)
 void
 AudioBuffers::accumulate_frames (AudioBuffers const * from, int read_offset, int write_offset, int frames)
 {
-       assert (_channels == from->channels ());
-       assert (read_offset >= 0);
-       assert (write_offset >= 0);
+       DCPOMATIC_ASSERT (_channels == from->channels ());
+       DCPOMATIC_ASSERT (read_offset >= 0);
+       DCPOMATIC_ASSERT (write_offset >= 0);
 
        for (int i = 0; i < _channels; ++i) {
                for (int j = 0; j < frames; ++j) {
@@ -300,7 +301,7 @@ AudioBuffers::channel (int c) const
 void
 AudioBuffers::copy_channel_from (AudioBuffers const * from, int from_channel, int to_channel)
 {
-       assert (from->frames() == frames());
+       DCPOMATIC_ASSERT (from->frames() == frames());
        memcpy (data(to_channel), from->data(from_channel), frames() * sizeof (float));
 }
 
index c0e99b24cb5902ad9dbdd8d142c429f1fb7f6a7b..61357c60f48922b3637328bd1fb3eb749f6b4525 100644 (file)
@@ -90,7 +90,7 @@ AudioContent::AudioContent (shared_ptr<const Film> f, vector<shared_ptr<Content>
        : Content (f, c)
 {
        shared_ptr<AudioContent> ref = dynamic_pointer_cast<AudioContent> (c[0]);
-       assert (ref);
+       DCPOMATIC_ASSERT (ref);
        
        for (size_t i = 0; i < c.size(); ++i) {
                shared_ptr<AudioContent> ac = dynamic_pointer_cast<AudioContent> (c[i]);
@@ -163,7 +163,7 @@ boost::signals2::connection
 AudioContent::analyse_audio (boost::function<void()> finished)
 {
        shared_ptr<const Film> film = _film.lock ();
-       assert (film);
+       DCPOMATIC_ASSERT (film);
        
        shared_ptr<AnalyseAudioJob> job (new AnalyseAudioJob (film, dynamic_pointer_cast<AudioContent> (shared_from_this())));
        boost::signals2::connection c = job->Finished.connect (finished);
@@ -210,7 +210,7 @@ int
 AudioContent::resampled_audio_frame_rate () const
 {
        shared_ptr<const Film> film = _film.lock ();
-       assert (film);
+       DCPOMATIC_ASSERT (film);
        
        /* Resample to a DCI-approved sample rate */
        double t = dcp_audio_frame_rate (audio_frame_rate ());
index 31dcf2ef910289899b6776b3bfad4209698822a2..0c47b9f51a0b876650b4e7e9c8fa3ea2b3221d05 100644 (file)
@@ -166,7 +166,7 @@ AudioDecoder::audio (shared_ptr<const AudioBuffers> data, ContentTime time)
                _audio_position = time.frames (frame_rate);
        }
 
-       assert (_audio_position.get() >= (_decoded_audio.frame + _decoded_audio.audio->frames()));
+       DCPOMATIC_ASSERT (_audio_position.get() >= (_decoded_audio.frame + _decoded_audio.audio->frames()));
 
        add (data);
 }
index 485af3fd66168848ab2b50734f00d1d6dfe30079..367cea81eed4a88e745f48fd3bcab959fe1a92bf 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "cinema_sound_processor.h"
 #include "dolby_cp750.h"
+#include "dcpomatic_assert.h"
 #include <iostream>
 #include <cassert>
 
@@ -98,6 +99,6 @@ CinemaSoundProcessor::as_index (CinemaSoundProcessor const * s)
 CinemaSoundProcessor const *
 CinemaSoundProcessor::from_index (int i)
 {
-       assert (i <= int(_cinema_sound_processors.size ()));
+       DCPOMATIC_ASSERT (i <= int(_cinema_sound_processors.size ()));
        return _cinema_sound_processors[i];
 }
index ba83e262704446652f1a809bc45fed5847d14306..a8d058cc19cd2c8d3e1ef0b765520ea07777287d 100644 (file)
@@ -270,7 +270,7 @@ Content::path_summary () const
 {
        /* XXX: should handle multiple paths more gracefully */
 
-       assert (number_of_paths ());
+       DCPOMATIC_ASSERT (number_of_paths ());
 
        string s = path(0).filename().string ();
        if (number_of_paths() > 1) {
index 93e0677bb7c3c49031555af796a3425ae49ccd4c..39becf943c7dfa84053ccbba39f2b7bf82f964d8 100644 (file)
@@ -23,7 +23,7 @@ ContentTimePeriod
 ContentTextSubtitle::period () const
 {
        /* XXX: assuming we have some subs and they are all at the same time */
-       assert (!subs.empty ());
+       DCPOMATIC_ASSERT (!subs.empty ());
        return ContentTimePeriod (
                ContentTime::from_seconds (double (subs.front().in().to_ticks()) / 250),
                ContentTime::from_seconds (double (subs.front().out().to_ticks()) / 250)
index cd82ee6e9e811b54a6b7538d1a8a712d9ca22947..2bf14dcffd77074229c9d9a6cbb01aaba9a62a6f 100644 (file)
@@ -139,7 +139,7 @@ DCPTime
 DCPContent::full_length () const
 {
        shared_ptr<const Film> film = _film.lock ();
-       assert (film);
+       DCPOMATIC_ASSERT (film);
        return DCPTime (video_length (), FrameRateChange (video_frame_rate (), film->video_frame_rate ()));
 }
 
index e659a9b88a7b7ce3027b09393b317f5ce7ebcf90..b7bf8d81ad14f6b48c8165aff7163854e19b3def 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 #include "dcp_content_type.h"
+#include "dcpomatic_assert.h"
 #include <cassert>
 
 #include "i18n.h"
@@ -80,7 +81,7 @@ DCPContentType::from_isdcf_name (string n)
 DCPContentType const *
 DCPContentType::from_index (int n)
 {
-       assert (n >= 0 && n < int (_dcp_content_types.size ()));
+       DCPOMATIC_ASSERT (n >= 0 && n < int (_dcp_content_types.size ()));
        return _dcp_content_types[n];
 }
 
index 74affe857e5f058133224a0e87be24c73dd5848d..f6d632f92a4130088d27dcea78cd094452f21ccc 100644 (file)
@@ -49,7 +49,7 @@ DCPDecoder::DCPDecoder (shared_ptr<const DCPContent> c)
        if (c->kdm ()) {
                dcp.add (dcp::DecryptedKDM (c->kdm().get (), Config::instance()->decryption_private_key ()));
        }
-       assert (dcp.cpls().size() == 1);
+       DCPOMATIC_ASSERT (dcp.cpls().size() == 1);
        _reels = dcp.cpls().front()->reels ();
        _reel = _reels.begin ();
 }
index 051333c45727b11f73b29d9797cdf57079382791..9a6ae8d914b9e798d282de87e298ebac42dc231f 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "util.h"
 #include <dcp/picture_mxf_writer.h>
+#include <libcxml/cxml.h>
 
 /** @file  src/dcp_video_frame.h
  *  @brief A single frame of video destined for a DCP.
index 2408bff812991dd8da237499eeb6509c9ba76fa2..6afce554f5231796c60ccb53bd230a5fc18fa010 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "frame_rate_change.h"
 #include "safe_stringstream.h"
+#include "dcpomatic_assert.h"
 #include <stdint.h>
 #include <cmath>
 #include <ostream>
@@ -177,7 +178,7 @@ public:
 
        template <class T>
        static ContentTime from_frames (int64_t f, T r) {
-               assert (r > 0);
+               DCPOMATIC_ASSERT (r > 0);
                return ContentTime (f * HZ / r);
        }
 
@@ -281,7 +282,7 @@ public:
 
        template <class T>
        static DCPTime from_frames (int64_t f, T r) {
-               assert (r > 0);
+               DCPOMATIC_ASSERT (r > 0);
                return DCPTime (f * HZ / r);
        }
 
index 95d4c8cce3d3a7283763010af483957319b0242c..c4c3d08151773f8e184e6a45f67c705165ec2f10 100644 (file)
@@ -73,3 +73,9 @@ InvalidSignerError::InvalidSignerError ()
 {
 
 }
+
+ProgrammingError::ProgrammingError (string file, int line)
+       : StringError (String::compose (_("Programming error at %1:%2"), file, line))
+{
+
+}
index 05c66df3a66e57bc2ed3c236b1f6e637bdfd81ee..950c2f381aae0da529fc0403c75fbfa3412637a6 100644 (file)
@@ -259,6 +259,12 @@ public:
        InvalidSignerError ();
 };
 
+class ProgrammingError : public StringError
+{
+public:
+       ProgrammingError (std::string file, int line);
+};
+
 /** @class ExceptionStore
  *  @brief A parent class for classes which have a need to catch and
  *  re-throw exceptions.
index e09e710417755a2701eeb53e296c5c8323514505..740efdc299fadc9131692581b91004b5a4b1dc9e 100644 (file)
@@ -106,7 +106,7 @@ FFmpegContent::FFmpegContent (shared_ptr<const Film> f, vector<boost::shared_ptr
        , SubtitleContent (f, c)
 {
        shared_ptr<FFmpegContent> ref = dynamic_pointer_cast<FFmpegContent> (c[0]);
-       assert (ref);
+       DCPOMATIC_ASSERT (ref);
 
        for (size_t i = 0; i < c.size(); ++i) {
                shared_ptr<FFmpegContent> fc = dynamic_pointer_cast<FFmpegContent> (c[i]);
@@ -173,7 +173,7 @@ FFmpegContent::examine (shared_ptr<Job> job, bool calculate_digest)
        take_from_video_examiner (examiner);
 
        shared_ptr<const Film> film = _film.lock ();
-       assert (film);
+       DCPOMATIC_ASSERT (film);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
@@ -315,7 +315,7 @@ DCPTime
 FFmpegContent::full_length () const
 {
        shared_ptr<const Film> film = _film.lock ();
-       assert (film);
+       DCPOMATIC_ASSERT (film);
        return DCPTime (video_length_after_3d_combine(), FrameRateChange (video_frame_rate (), film->video_frame_rate ()));
 }
 
index 62a3a78c3318d449be2cd37f48d4aa3c3c9e26b9..a16799e741c24186f62bc52c1fccd4880eec77b2 100644 (file)
@@ -168,12 +168,12 @@ FFmpegDecoder::pass ()
 shared_ptr<AudioBuffers>
 FFmpegDecoder::deinterleave_audio (uint8_t** data, int size)
 {
-       assert (_ffmpeg_content->audio_channels());
-       assert (bytes_per_audio_sample());
+       DCPOMATIC_ASSERT (_ffmpeg_content->audio_channels());
+       DCPOMATIC_ASSERT (bytes_per_audio_sample());
 
        /* Deinterleave and convert to float */
 
-       assert ((size % (bytes_per_audio_sample() * _ffmpeg_content->audio_channels())) == 0);
+       DCPOMATIC_ASSERT ((size % (bytes_per_audio_sample() * _ffmpeg_content->audio_channels())) == 0);
 
        int const total_samples = size / bytes_per_audio_sample();
        int const frames = total_samples / _ffmpeg_content->audio_channels();
index 3fac3332752eda59f15816d64ba4b90d6b996dae..ad99defeef35852ca6e725965e70f6e78ac12031 100644 (file)
 
 */
 
+#include "ffmpeg_stream.h"
+#include "dcpomatic_assert.h"
+#include <dcp/raw_convert.h>
+#include <libxml++/libxml++.h>
 extern "C" {
 #include <libavformat/avformat.h>
 }
-#include <libxml++/libxml++.h>
-#include <dcp/raw_convert.h>
-#include "ffmpeg_stream.h"
 
 using std::string;
 using dcp::raw_convert;
@@ -66,6 +67,6 @@ FFmpegStream::stream (AVFormatContext const * fc) const
                ++i;
        }
 
-       assert (false);
+       DCPOMATIC_ASSERT (false);
        return 0;
 }
index d7620be8d291f476d1caccfccc13951a1e061106..18e99247800ac40274d600849a982efffb69bb51 100644 (file)
@@ -164,7 +164,7 @@ Film::Film (boost::filesystem::path dir, bool log)
 string
 Film::video_identifier () const
 {
-       assert (container ());
+       DCPOMATIC_ASSERT (container ());
 
        SafeStringStream s;
        s.imbue (std::locale::classic ());
@@ -1069,7 +1069,7 @@ Film::full_frame () const
                return dcp::Size (4096, 2160);
        }
 
-       assert (false);
+       DCPOMATIC_ASSERT (false);
        return dcp::Size ();
 }
 
index 0227f26c99a3b7882ee17c969eb9d2ae63ee4ddf..43f7bae78a2557c192dd19ed2a148ddc744a0b0f 100644 (file)
@@ -29,6 +29,7 @@
 #include "types.h"
 #include "isdcf_metadata.h"
 #include "frame_rate_change.h"
+#include "ratio.h"
 #include <dcp/key.h>
 #include <dcp/encrypted_kdm.h>
 #include <boost/signals2.hpp>
index 3c67690685d68954785fcf2a38d32faf5ea4b0fa..847ad104631c32b3c181d1fe9d41c5f8a7f0084b 100644 (file)
@@ -88,14 +88,14 @@ Image::components () const
 shared_ptr<Image>
 Image::crop_scale_window (Crop crop, dcp::Size inter_size, dcp::Size out_size, Scaler const * scaler, AVPixelFormat out_format, bool out_aligned) const
 {
-       assert (scaler);
+       DCPOMATIC_ASSERT (scaler);
        /* Empirical testing suggests that sws_scale() will crash if
           the input image is not aligned.
        */
-       assert (aligned ());
+       DCPOMATIC_ASSERT (aligned ());
 
-       assert (out_size.width >= inter_size.width);
-       assert (out_size.height >= inter_size.height);
+       DCPOMATIC_ASSERT (out_size.width >= inter_size.width);
+       DCPOMATIC_ASSERT (out_size.height >= inter_size.height);
 
        /* Here's an image of out_size */
        shared_ptr<Image> out (new Image (out_format, out_size, out_aligned));
@@ -144,11 +144,11 @@ Image::crop_scale_window (Crop crop, dcp::Size inter_size, dcp::Size out_size, S
 shared_ptr<Image>
 Image::scale (dcp::Size out_size, Scaler const * scaler, AVPixelFormat out_format, bool out_aligned) const
 {
-       assert (scaler);
+       DCPOMATIC_ASSERT (scaler);
        /* Empirical testing suggests that sws_scale() will crash if
           the input image is not aligned.
        */
-       assert (aligned ());
+       DCPOMATIC_ASSERT (aligned ());
 
        shared_ptr<Image> scaled (new Image (out_format, out_size, out_aligned));
 
@@ -361,7 +361,7 @@ Image::make_transparent ()
 void
 Image::alpha_blend (shared_ptr<const Image> other, Position<int> position)
 {
-       assert (other->pixel_format() == PIX_FMT_RGBA);
+       DCPOMATIC_ASSERT (other->pixel_format() == PIX_FMT_RGBA);
        int const other_bpp = 4;
 
        int start_tx = position.x;
@@ -439,7 +439,7 @@ Image::alpha_blend (shared_ptr<const Image> other, Position<int> position)
                break;
        }
        default:
-               assert (false);
+               DCPOMATIC_ASSERT (false);
        }
 }
        
@@ -447,8 +447,8 @@ void
 Image::copy (shared_ptr<const Image> other, Position<int> position)
 {
        /* Only implemented for RGB24 onto RGB24 so far */
-       assert (_pixel_format == PIX_FMT_RGB24 && other->pixel_format() == PIX_FMT_RGB24);
-       assert (position.x >= 0 && position.y >= 0);
+       DCPOMATIC_ASSERT (_pixel_format == PIX_FMT_RGB24 && other->pixel_format() == PIX_FMT_RGB24);
+       DCPOMATIC_ASSERT (position.x >= 0 && position.y >= 0);
 
        int const N = min (position.x + other->size().width, size().width) - position.x;
        for (int ty = position.y, oy = 0; ty < size().height && oy < other->size().height; ++ty, ++oy) {
@@ -609,7 +609,7 @@ Image::Image (shared_ptr<const Image> other, bool aligned)
        allocate ();
 
        for (int i = 0; i < components(); ++i) {
-               assert(line_size()[i] == other->line_size()[i]);
+               DCPOMATIC_ASSERT (line_size()[i] == other->line_size()[i]);
                uint8_t* p = _data[i];
                uint8_t* q = other->data()[i];
                for (int j = 0; j < lines(i); ++j) {
index 132b261446120e469207018d2a9a8ebbf3728f36..b8d2a6921c3df204e161a07835273b50a913c8fd 100644 (file)
@@ -105,7 +105,7 @@ ImageContent::examine (shared_ptr<Job> job, bool calculate_digest)
        Content::examine (job, calculate_digest);
 
        shared_ptr<const Film> film = _film.lock ();
-       assert (film);
+       DCPOMATIC_ASSERT (film);
        
        shared_ptr<ImageExaminer> examiner (new ImageExaminer (film, shared_from_this(), job));
        take_from_video_examiner (examiner);
@@ -126,7 +126,7 @@ DCPTime
 ImageContent::full_length () const
 {
        shared_ptr<const Film> film = _film.lock ();
-       assert (film);
+       DCPOMATIC_ASSERT (film);
        return DCPTime (video_length_after_3d_combine(), FrameRateChange (video_frame_rate(), film->video_frame_rate()));
 }
 
index 7013a69c9bca9520a816d2f51b83e9017365c9f7..f72a6c3e4b2cfae109eca26f30f0193241cc833d 100644 (file)
@@ -17,8 +17,6 @@
 
 */
 
-#include <dcp/util.h>
-#include <dcp/raw_convert.h>
 #include "image_proxy.h"
 #include "raw_image_proxy.h"
 #include "magick_image_proxy.h"
@@ -26,6 +24,9 @@
 #include "image.h"
 #include "exceptions.h"
 #include "cross.h"
+#include <dcp/util.h>
+#include <dcp/raw_convert.h>
+#include <libcxml/cxml.h>
 
 #include "i18n.h"
 
index 695ce00cef908ddf0c68aa1520f0a8dcca53c0c3..36b13d1059ad7fdddae719b1817392f93cf6bba3 100644 (file)
@@ -337,9 +337,9 @@ Player::get_video (DCPTime time, bool accurate)
 
                shared_ptr<Piece> piece = ov.back ();
                shared_ptr<VideoDecoder> decoder = dynamic_pointer_cast<VideoDecoder> (piece->decoder);
-               assert (decoder);
+               DCPOMATIC_ASSERT (decoder);
                shared_ptr<VideoContent> content = dynamic_pointer_cast<VideoContent> (piece->content);
-               assert (content);
+               DCPOMATIC_ASSERT (content);
 
                list<ContentVideo> content_video = decoder->get_video (dcp_to_content_video (piece, time), accurate);
                if (content_video.empty ()) {
@@ -415,9 +415,9 @@ Player::get_audio (DCPTime time, DCPTime length, bool accurate)
        for (list<shared_ptr<Piece> >::iterator i = ov.begin(); i != ov.end(); ++i) {
 
                shared_ptr<AudioContent> content = dynamic_pointer_cast<AudioContent> ((*i)->content);
-               assert (content);
+               DCPOMATIC_ASSERT (content);
                shared_ptr<AudioDecoder> decoder = dynamic_pointer_cast<AudioDecoder> ((*i)->decoder);
-               assert (decoder);
+               DCPOMATIC_ASSERT (decoder);
 
                if (content->audio_frame_rate() == 0) {
                        /* This AudioContent has no audio (e.g. if it is an FFmpegContent with no
index b7a8f86693c995606cf47a07791192c5bcb1d92e..fae66bf624aa29b0f363f3153113def9c96e705d 100644 (file)
@@ -179,7 +179,7 @@ shared_ptr<EncodedData>
 PlayerVideo::j2k () const
 {
        shared_ptr<const J2KImageProxy> j2k = dynamic_pointer_cast<const J2KImageProxy> (_in);
-       assert (j2k);
+       DCPOMATIC_ASSERT (j2k);
        return j2k->j2k ();
 }
 
index 4580e54d400e40e9fc59f7eaebec9bd806f8520d..1698da99ef25ace321b80954c8a4239a7105090b 100644 (file)
@@ -367,7 +367,7 @@ Playlist::move_earlier (shared_ptr<Content> c)
                ++i;
        }
 
-       assert (i != _content.end ());
+       DCPOMATIC_ASSERT (i != _content.end ());
        if (previous == _content.end ()) {
                return;
        }
@@ -389,7 +389,7 @@ Playlist::move_later (shared_ptr<Content> c)
                ++i;
        }
 
-       assert (i != _content.end ());
+       DCPOMATIC_ASSERT (i != _content.end ());
 
        ContentList::iterator next = i;
        ++next;
index bc83ae87c4059d0ba07b5d2d50cba70c64ec7c1c..29c22c78deadde5d6517a4574192359384f97ce5 100644 (file)
 
 */
 
-#include <dcp/types.h>
 #include "ratio.h"
 #include "util.h"
+#include <dcp/types.h>
+#include <cfloat>
 
 #include "i18n.h"
 
index 40a0f05b93e68ca5794b4e59a937f8e98dffcc13..43c1ac81cb4213ec43895e7c0412ab0c802c16d9 100644 (file)
  *  @brief A class to describe one of FFmpeg's software scalers.
  */
 
-#include <iostream>
-#include <cassert>
+#include "dcpomatic_assert.h"
+#include "scaler.h"
 extern "C" {
 #include <libswscale/swscale.h>
 }
-#include "scaler.h"
+#include <iostream>
+#include <cassert>
 
 #include "i18n.h"
 
@@ -112,6 +113,6 @@ Scaler::as_index (Scaler const * s)
 Scaler const *
 Scaler::from_index (int i)
 {
-       assert (i <= int(_scalers.size ()));
+       DCPOMATIC_ASSERT (i <= int(_scalers.size ()));
        return _scalers[i];
 }
index cdc9734bffcad0fe1d561ecdd1df6e6c68df19c7..3c377d644f488bc6f6f9f922b68ffd172b3db6b6 100644 (file)
@@ -113,7 +113,7 @@ DCPTime
 SndfileContent::full_length () const
 {
        shared_ptr<const Film> film = _film.lock ();
-       assert (film);
+       DCPOMATIC_ASSERT (film);
        return DCPTime (audio_length(), film->active_frame_rate_change (position ()));
 }
 
index 992947a2d9023c38758c14a22ed982689385ea8d..f4dd427f347f220a3b7954c32af852ddb991259c 100644 (file)
@@ -56,7 +56,7 @@ SubRipContent::examine (boost::shared_ptr<Job> job, bool calculate_digest)
        SubRip s (shared_from_this ());
 
        shared_ptr<const Film> film = _film.lock ();
-       assert (film);
+       DCPOMATIC_ASSERT (film);
        
        DCPTime len (s.length (), film->active_frame_rate_change (position ()));
 
@@ -80,7 +80,7 @@ SubRipContent::technical_summary () const
 string
 SubRipContent::information () const
 {
-
+       
 }
        
 void
index 6f9bdf3a4ebb7312bf9aa101f81eaafbfebca1c2..2bed5413c61d2b8797cae544a3a995440a5ef4c1 100644 (file)
@@ -105,7 +105,7 @@ SubtitleContent::SubtitleContent (shared_ptr<const Film> f, vector<shared_ptr<Co
        : Content (f, c)
 {
        shared_ptr<SubtitleContent> ref = dynamic_pointer_cast<SubtitleContent> (c[0]);
-       assert (ref);
+       DCPOMATIC_ASSERT (ref);
        list<shared_ptr<Font> > ref_fonts = ref->fonts ();
        
        for (size_t i = 0; i < c.size(); ++i) {
index d052b2a9a71dd3c458bc9126785a15af263e8e6c..54a8cb49202c97c93f85d5d8570cd5722eceecb2 100644 (file)
@@ -51,7 +51,7 @@ resolution_to_string (Resolution r)
                return "4K";
        }
 
-       assert (false);
+       DCPOMATIC_ASSERT (false);
        return "";
 }
 
@@ -67,7 +67,7 @@ string_to_resolution (string s)
                return RESOLUTION_4K;
        }
 
-       assert (false);
+       DCPOMATIC_ASSERT (false);
        return RESOLUTION_2K;
 }
 
index 502393094b1e6b1989ab3d853280faf465de8835..0cdfe0b0c6c59fd37eb8e3d222ad4d07ec766ebf 100644 (file)
@@ -708,7 +708,7 @@ stride_round_up (int c, int const * stride, int t)
 int
 round_to (float n, int r)
 {
-       assert (r == 1 || r == 2 || r == 4);
+       DCPOMATIC_ASSERT (r == 1 || r == 2 || r == 4);
        return int (n + float(r) / 2) &~ (r - 1);
 }
 
@@ -813,13 +813,13 @@ get_optional_int (multimap<string, string> const & kv, string k)
 void
 ensure_ui_thread ()
 {
-       assert (boost::this_thread::get_id() == ui_thread);
+       DCPOMATIC_ASSERT (boost::this_thread::get_id() == ui_thread);
 }
 
 string
 audio_channel_name (int c)
 {
-       assert (MAX_DCP_AUDIO_CHANNELS == 12);
+       DCPOMATIC_ASSERT (MAX_DCP_AUDIO_CHANNELS == 12);
 
        /// TRANSLATORS: these are the names of audio channels; Lfe (sub) is the low-frequency
        /// enhancement channel (sub-woofer).  HI is the hearing-impaired audio track and
index f5d0b3acac066cd4ef2e9283e2a360628e9f1e6b..1c122b70c9e018f4ddefc392c356d6b6d841b925 100644 (file)
@@ -27,7 +27,8 @@
 
 #include "compose.hpp"
 #include "types.h"
-#include "video_content.h"
+#include "exceptions.h"
+#include "dcpomatic_time.h"
 #include <dcp/util.h>
 extern "C" {
 #include <libavcodec/avcodec.h>
@@ -125,7 +126,7 @@ private:
        int _timeout;
 };
 
-extern int64_t video_frames_to_audio_frames (VideoContent::Frame v, float audio_sample_rate, float frames_per_second);
+extern int64_t video_frames_to_audio_frames (VideoFrame v, float audio_sample_rate, float frames_per_second);
 
 /** @class ScopedTemporary
  *  @brief A temporary file which is deleted when the ScopedTemporary object goes out of scope.
index 1da5d87c16778046c1720c972c783000ae4bd559..c50d466a1f703f083a51a01d72440d0e0642d315 100644 (file)
@@ -136,7 +136,7 @@ VideoContent::VideoContent (shared_ptr<const Film> f, vector<shared_ptr<Content>
        , _video_length (0)
 {
        shared_ptr<VideoContent> ref = dynamic_pointer_cast<VideoContent> (c[0]);
-       assert (ref);
+       DCPOMATIC_ASSERT (ref);
 
        for (size_t i = 0; i < c.size(); ++i) {
                shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> (c[i]);
@@ -240,7 +240,7 @@ VideoContent::take_from_video_examiner (shared_ptr<VideoExaminer> d)
        }
 
        shared_ptr<const Film> film = _film.lock ();
-       assert (film);
+       DCPOMATIC_ASSERT (film);
        LOG_GENERAL ("Video length obtained from header as %1 frames", _video_length.frames (_video_frame_rate));
        
        signal_changed (VideoContentProperty::VIDEO_SIZE);
@@ -413,7 +413,7 @@ VideoContent::video_size_after_3d_split () const
                return dcp::Size (s.width, s.height / 2);
        }
 
-       assert (false);
+       DCPOMATIC_ASSERT (false);
 }
 
 void
@@ -474,7 +474,7 @@ ContentTime
 VideoContent::dcp_time_to_content_time (DCPTime t) const
 {
        shared_ptr<const Film> film = _film.lock ();
-       assert (film);
+       DCPOMATIC_ASSERT (film);
        return ContentTime (t, FrameRateChange (video_frame_rate(), film->video_frame_rate()));
 }
 
@@ -482,7 +482,7 @@ void
 VideoContent::scale_and_crop_to_fit_width ()
 {
        shared_ptr<const Film> film = _film.lock ();
-       assert (film);
+       DCPOMATIC_ASSERT (film);
 
        set_scale (VideoContentScale (film->container ()));
 
@@ -495,7 +495,7 @@ void
 VideoContent::scale_and_crop_to_fit_height ()
 {
        shared_ptr<const Film> film = _film.lock ();
-       assert (film);
+       DCPOMATIC_ASSERT (film);
 
        set_scale (VideoContentScale (film->container ()));
 
@@ -522,7 +522,7 @@ VideoContent::set_video_frame_rate (float r)
 optional<float>
 VideoContent::fade (VideoFrame f) const
 {
-       assert (f >= 0);
+       DCPOMATIC_ASSERT (f >= 0);
        
        if (f < fade_in().frames (video_frame_rate ())) {
                return float (f) / _fade_in.frames (video_frame_rate ());
@@ -563,7 +563,7 @@ VideoContent::processing_description () const
        }
 
        shared_ptr<const Film> film = _film.lock ();
-       assert (film);
+       DCPOMATIC_ASSERT (film);
 
        dcp::Size const container_size = film->frame_size ();
        dcp::Size const scaled = scale().size (dynamic_pointer_cast<const VideoContent> (shared_from_this ()), container_size, container_size, 1);
index 30dcac231ffef8fe59455454a88d98b2f8792338..9e5c1362f94d73edfbe1d5d5492ad7354fbac5b1 100644 (file)
@@ -43,8 +43,6 @@ public:
 class VideoContent : public virtual Content
 {
 public:
-       typedef int Frame;
-
        VideoContent (boost::shared_ptr<const Film>);
        VideoContent (boost::shared_ptr<const Film>, DCPTime, ContentTime);
        VideoContent (boost::shared_ptr<const Film>, boost::filesystem::path);
index 9bb35189e1eeb050d1b39bf5aab6dedee74277de..aebafc8e59bedf90390d8bbbe55d92a5dc8993fa 100644 (file)
@@ -18,6 +18,7 @@
 */
 
 #include "video_content_scale.h"
+#include "video_content.h"
 #include "ratio.h"
 #include "safe_stringstream.h"
 #include "util.h"
index cab1a979fc2dc48502015e7b73940f7889f3ea16..b861f49e5657ac90ad43be6be6b53454e10a72da 100644 (file)
@@ -261,7 +261,7 @@ VideoDecoder::video (shared_ptr<const ImageProxy> image, VideoFrame frame)
                to_push.push_back (ContentVideo (image, EYES_RIGHT, PART_WHOLE, frame));
                break;
        default:
-               assert (false);
+               DCPOMATIC_ASSERT (false);
        }
 
        /* Now VideoDecoder is required never to have gaps in the frames that it presents
index 07b637d46369f3b0656f7db0af7aeeb7fc1020a5..512973f46fa4e4137a40f78d2ceb4e1911ee70d0 100644 (file)
@@ -87,7 +87,7 @@ Writer::Writer (shared_ptr<const Film> f, weak_ptr<Job> j)
        boost::filesystem::remove_all (_film->dir (_film->dcp_name ()));
 
        shared_ptr<Job> job = _job.lock ();
-       assert (job);
+       DCPOMATIC_ASSERT (job);
 
        job->sub (_("Checking existing image data"));
        check_existing_picture_mxf ();
@@ -308,7 +308,7 @@ try
                        _last_written_eyes = qi.eyes;
                        
                        shared_ptr<Job> job = _job.lock ();
-                       assert (job);
+                       DCPOMATIC_ASSERT (job);
                        int64_t total = _film->length().frames (_film->video_frame_rate ());
                        if (_film->three_d ()) {
                                /* _full_written and so on are incremented for each eye, so we need to double the total
@@ -333,7 +333,7 @@ try
                                ++i;
                        }
 
-                       assert (i != _queue.rend());
+                       DCPOMATIC_ASSERT (i != _queue.rend());
                        QueueItem qi = *i;
 
                        ++_pushed_to_disk;
@@ -483,7 +483,7 @@ Writer::finish ()
        cpl->add (reel);
 
        shared_ptr<Job> job = _job.lock ();
-       assert (job);
+       DCPOMATIC_ASSERT (job);
 
        job->sub (_("Computing image digest"));
        _picture_mxf->hash (boost::bind (&Job::set_progress, job.get(), _1, false));
@@ -571,7 +571,7 @@ Writer::check_existing_picture_mxf ()
        while (true) {
 
                shared_ptr<Job> job = _job.lock ();
-               assert (job);
+               DCPOMATIC_ASSERT (job);
 
                if (N > 0) {
                        job->set_progress (float (_first_nonexistant_frame) / N);
index 1f882e61f14ae9a5a10a47a8765f32e0d1b8437b..1d41fc1854acf23647b9d2fbdf0c85761cded4a4 100644 (file)
@@ -163,7 +163,7 @@ AudioDialog::channel_clicked (wxCommandEvent& ev)
                ++c;
        }
 
-       assert (c < MAX_DCP_AUDIO_CHANNELS);
+       DCPOMATIC_ASSERT (c < MAX_DCP_AUDIO_CHANNELS);
 
        _plot->set_channel_visible (c, _channel_checkbox[c]->GetValue ());
 }
@@ -186,7 +186,7 @@ AudioDialog::type_clicked (wxCommandEvent& ev)
                ++t;
        }
 
-       assert (t < AudioPoint::COUNT);
+       DCPOMATIC_ASSERT (t < AudioPoint::COUNT);
 
        _plot->set_type_visible (t, _type_checkbox[t]->GetValue ());
 }
index c528447ac4721298fc0c39b2744ec0ec59e797ab..15a2341848656220acd9f6dc92fbb8c1a8298797 100644 (file)
@@ -136,7 +136,7 @@ ContentMenu::join ()
                }
        }
 
-       assert (fc.size() > 1);
+       DCPOMATIC_ASSERT (fc.size() > 1);
 
        shared_ptr<Film> film = _film.lock ();
        if (!film) {
@@ -245,8 +245,8 @@ ContentMenu::maybe_found_missing (weak_ptr<Job> j, weak_ptr<Content> oc, weak_pt
 
        shared_ptr<Content> old_content = oc.lock ();
        shared_ptr<Content> new_content = nc.lock ();
-       assert (old_content);
-       assert (new_content);
+       DCPOMATIC_ASSERT (old_content);
+       DCPOMATIC_ASSERT (new_content);
 
        if (new_content->digest() != old_content->digest()) {
                error_dialog (0, _("The content file(s) you specified are not the same as those that are missing.  Either try again with the correct content file or remove the missing content."));
@@ -259,16 +259,16 @@ ContentMenu::maybe_found_missing (weak_ptr<Job> j, weak_ptr<Content> oc, weak_pt
 void
 ContentMenu::kdm ()
 {
-       assert (!_content.empty ());
+       DCPOMATIC_ASSERT (!_content.empty ());
        shared_ptr<DCPContent> dcp = dynamic_pointer_cast<DCPContent> (_content.front ());
-       assert (dcp);
+       DCPOMATIC_ASSERT (dcp);
        
        wxFileDialog* d = new wxFileDialog (_parent, _("Select KDM"));
                
        if (d->ShowModal() == wxID_OK) {
                dcp->add_kdm (dcp::EncryptedKDM (dcp::file_to_string (wx_to_std (d->GetPath ()))));
                shared_ptr<Film> film = _film.lock ();
-               assert (film);
+               DCPOMATIC_ASSERT (film);
                film->examine_content (dcp, true);
        }
        
index 18ba4ccfd330d2d19fe91f0a83a2d6b65a41afed..5b2d18f23da12e65edd02607f21ddea67893af18 100644 (file)
@@ -361,7 +361,7 @@ DCPPanel::container_changed ()
        int const n = _container->GetSelection ();
        if (n >= 0) {
                vector<Ratio const *> ratios = Ratio::all ();
-               assert (n < int (ratios.size()));
+               DCPOMATIC_ASSERT (n < int (ratios.size()));
                _film->set_container (ratios[n]);
        }
 }
index 481a147415e854aa4e6e2d03d77c8a604ef96702..4119b889eea11c7f9bd592356e1120ada1a4242e 100644 (file)
@@ -132,7 +132,7 @@ private:
                }
 
                std::vector<T> all = _get ();
-               assert (item >= 0 && item < int (all.size ()));
+               DCPOMATIC_ASSERT (item >= 0 && item < int (all.size ()));
 
                T copy (all[item]);
                add_to_control (copy);
@@ -149,7 +149,7 @@ private:
                }
 
                std::vector<T> all = _get ();
-               assert (item >= 0 && item < int (all.size ()));
+               DCPOMATIC_ASSERT (item >= 0 && item < int (all.size ()));
 
                S* dialog = new S (this);
                dialog->set (all[item]);
index 9f89569481f0d8f17cd8e570b68216d0d768a7a8..b5d5c6971dd819972b9e4a583291b109a05491b1 100644 (file)
 
 */
 
-#include <boost/algorithm/string.hpp>
-#include <wx/richtext/richtextctrl.h>
 #include "lib/film.h"
 #include "lib/ratio.h"
+#include "lib/video_content.h"
 #include "hints_dialog.h"
+#include <boost/algorithm/string.hpp>
+#include <wx/richtext/richtextctrl.h>
 
 using boost::shared_ptr;
 using boost::dynamic_pointer_cast;
index 6a1f8051f90955938ea817534e120e0c2dd1ffff..9b1d6bc98ed1e12fdc0811b26f95a4f486ad6c0b 100644 (file)
@@ -472,7 +472,7 @@ boost::filesystem::path
 KDMDialog::cpl () const
 {
        int const item = _cpl->GetSelection ();
-       assert (item >= 0);
+       DCPOMATIC_ASSERT (item >= 0);
        return _cpls[item].cpl_file;
 }
 
index 07b987a674e42fe4d0832feb34e2b3fd054ceb29..1e137f23326955484e3378f8f302c5d8d5b5ef32 100644 (file)
@@ -308,7 +308,7 @@ SubtitlePanel::subtitle_view_clicked ()
        }
 
        SubtitleContentList c = _parent->selected_subtitle ();
-       assert (c.size() == 1);
+       DCPOMATIC_ASSERT (c.size() == 1);
 
        shared_ptr<SubtitleDecoder> decoder;
        
@@ -337,7 +337,7 @@ SubtitlePanel::fonts_dialog_clicked ()
        }
 
        SubtitleContentList c = _parent->selected_subtitle ();
-       assert (c.size() == 1);
+       DCPOMATIC_ASSERT (c.size() == 1);
 
        _fonts_dialog = new FontsDialog (this, c.front ());
        _fonts_dialog->Show ();
index 556e6f1b3e08ca44c2108c27cd001a4cb02c2c29..6bce881a42013f0eba980723aca09e95e8f6505e 100644 (file)
@@ -96,7 +96,7 @@ public:
 
        dcpomatic::Rect<int> bbox () const
        {
-               assert (_track);
+               DCPOMATIC_ASSERT (_track);
 
                shared_ptr<const Film> film = _timeline.film ();
                shared_ptr<const Content> content = _content.lock ();
@@ -145,7 +145,7 @@ private:
 
        void do_paint (wxGraphicsContext* gc)
        {
-               assert (_track);
+               DCPOMATIC_ASSERT (_track);
 
                shared_ptr<const Film> film = _timeline.film ();
                shared_ptr<const Content> cont = content ();
@@ -749,7 +749,7 @@ Timeline::set_position_from_event (wxMouseEvent& ev)
        _down_view->content()->set_position (new_position);
        
        shared_ptr<Film> film = _film.lock ();
-       assert (film);
+       DCPOMATIC_ASSERT (film);
        film->set_sequence_video (false);
 }
 
index 716c29ddab7d213480f7b0c47db1c62a9c4f990a..cdd2eb5def377470577b77b9032cba5e0d825853 100644 (file)
@@ -48,8 +48,8 @@ static VideoContentScale
 index_to_scale (int n)
 {
        vector<VideoContentScale> scales = VideoContentScale::all ();
-       assert (n >= 0);
-       assert (n < int (scales.size ()));
+       DCPOMATIC_ASSERT (n >= 0);
+       DCPOMATIC_ASSERT (n < int (scales.size ()));
        return scales[n];
 }
 
@@ -63,7 +63,7 @@ scale_to_index (VideoContentScale scale)
                }
        }
 
-       assert (false);
+       DCPOMATIC_ASSERT (false);
 }
 
 VideoPanel::VideoPanel (ContentPanel* p)