Remove multi-reel, for now, and sort out Size vs libdcp::Size.
authorCarl Hetherington <cth@carlh.net>
Wed, 23 Jan 2013 20:06:37 +0000 (20:06 +0000)
committerCarl Hetherington <cth@carlh.net>
Wed, 23 Jan 2013 20:06:37 +0000 (20:06 +0000)
28 files changed:
src/lib/dcp_video_frame.cc
src/lib/dcp_video_frame.h
src/lib/ffmpeg_decoder.cc
src/lib/ffmpeg_decoder.h
src/lib/film.cc
src/lib/film.h
src/lib/filter_graph.cc
src/lib/filter_graph.h
src/lib/format.cc
src/lib/format.h
src/lib/image.cc
src/lib/image.h
src/lib/imagemagick_decoder.cc
src/lib/imagemagick_decoder.h
src/lib/make_dcp_job.cc
src/lib/make_dcp_job.h
src/lib/matcher.h
src/lib/options.h
src/lib/server.cc
src/lib/subtitle.cc
src/lib/util.cc
src/lib/util.h
src/lib/video_decoder.h
src/wx/film_editor.cc
src/wx/film_editor.h
src/wx/film_viewer.cc
src/wx/film_viewer.h
test/test.cc

index c6b29ba4169a62b8d61578caf1261c50262ad70a..921a1876b5cf560fe4e95c63f6a48c6442a40299 100644 (file)
@@ -75,7 +75,7 @@ using boost::shared_ptr;
  */
 DCPVideoFrame::DCPVideoFrame (
        shared_ptr<const Image> yuv, shared_ptr<Subtitle> sub,
-       Size out, int p, int subtitle_offset, float subtitle_scale,
+       libdcp::Size out, int p, int subtitle_offset, float subtitle_scale,
        Scaler const * s, SourceFrame f, float fps, string pp, int clut, int bw, Log* l
        )
        : _input (yuv)
index 134720da8d5fdba78b80b9dd1749498bc51ebf6c..c0eff3f358a2581565266c4b37695577e1831a76 100644 (file)
@@ -40,7 +40,7 @@ class EncodedData
 {
 public:
        /** @param d Data (will not be freed by this class, but may be by subclasses)
-        *  @param s Size of data, in bytes.
+        *  @param s libdcp::Size of data, in bytes.
         */
        EncodedData (uint8_t* d, int s)
                : _data (d)
@@ -76,7 +76,7 @@ class LocallyEncodedData : public EncodedData
 {
 public:
        /** @param d Data (which will not be freed by this class)
-        *  @param s Size of data, in bytes.
+        *  @param s libdcp::Size of data, in bytes.
         */
        LocallyEncodedData (uint8_t* d, int s)
                : EncodedData (d, s)
@@ -107,7 +107,7 @@ class DCPVideoFrame
 {
 public:
        DCPVideoFrame (
-               boost::shared_ptr<const Image>, boost::shared_ptr<Subtitle>, Size,
+               boost::shared_ptr<const Image>, boost::shared_ptr<Subtitle>, libdcp::Size,
                int, int, float, Scaler const *, SourceFrame, float, std::string, int, int, Log *
                );
        
@@ -125,7 +125,7 @@ private:
 
        boost::shared_ptr<const Image> _input; ///< the input image
        boost::shared_ptr<Subtitle> _subtitle; ///< any subtitle that should be on the image
-       Size _out_size;                  ///< the required size of the output, in pixels
+       libdcp::Size _out_size;                  ///< the required size of the output, in pixels
        int _padding;
        int _subtitle_offset;
        float _subtitle_scale;
index a19f26ad79bdfde7dc66e3d795d87254e5796d43..aff3ff666d0ce38cb689565d399cec8034cdcde4 100644 (file)
@@ -468,10 +468,10 @@ FFmpegDecoder::audio_sample_format () const
        return _audio_codec_context->sample_fmt;
 }
 
-Size
+libdcp::Size
 FFmpegDecoder::native_size () const
 {
-       return Size (_video_codec_context->width, _video_codec_context->height);
+       return libdcp::Size (_video_codec_context->width, _video_codec_context->height);
 }
 
 PixelFormat
@@ -558,12 +558,12 @@ FFmpegDecoder::filter_and_emit_video (AVFrame* frame)
        shared_ptr<FilterGraph> graph;
 
        list<shared_ptr<FilterGraph> >::iterator i = _filter_graphs.begin();
-       while (i != _filter_graphs.end() && !(*i)->can_process (Size (frame->width, frame->height), (AVPixelFormat) frame->format)) {
+       while (i != _filter_graphs.end() && !(*i)->can_process (libdcp::Size (frame->width, frame->height), (AVPixelFormat) frame->format)) {
                ++i;
        }
 
        if (i == _filter_graphs.end ()) {
-               graph.reset (new FilterGraph (_film, this, Size (frame->width, frame->height), (AVPixelFormat) frame->format));
+               graph.reset (new FilterGraph (_film, this, libdcp::Size (frame->width, frame->height), (AVPixelFormat) frame->format));
                _filter_graphs.push_back (graph);
                _film->log()->log (String::compose ("New graph for %1x%2, pixel format %3", frame->width, frame->height, frame->format));
        } else {
index 2fb8675f996b243e13b097b5feba65ef8d1c9727..3b564b826fb90172b58f5121aed68197d3599ca4 100644 (file)
@@ -90,7 +90,7 @@ public:
        ~FFmpegDecoder ();
 
        float frames_per_second () const;
-       Size native_size () const;
+       libdcp::Size native_size () const;
        SourceFrame length () const;
        int time_base_numerator () const;
        int time_base_denominator () const;
index f0441c9e0b038733b86a7797cc32b3706cc5a028..5a11b0ca969ec5bfb262168158fb3be52e52514f 100644 (file)
@@ -157,7 +157,6 @@ Film::Film (Film const & o)
        , _scaler            (o._scaler)
        , _dcp_trim_start    (o._dcp_trim_start)
        , _dcp_trim_end      (o._dcp_trim_end)
-       , _reel_size         (o._reel_size)
        , _dcp_ab            (o._dcp_ab)
        , _content_audio_stream (o._content_audio_stream)
        , _external_audio    (o._external_audio)
@@ -414,9 +413,6 @@ Film::write_metadata () const
        f << "scaler " << _scaler->id () << "\n";
        f << "dcp_trim_start " << _dcp_trim_start << "\n";
        f << "dcp_trim_end " << _dcp_trim_end << "\n";
-       if (_reel_size) {
-               f << "reel_size " << _reel_size.get() << "\n";
-       }
        f << "dcp_ab " << (_dcp_ab ? "1" : "0") << "\n";
        if (_content_audio_stream) {
                f << "selected_content_audio_stream " << _content_audio_stream->to_string() << "\n";
@@ -531,8 +527,6 @@ Film::read_metadata ()
                        _dcp_trim_start = atoi (v.c_str ());
                } else if (k == "dcp_trim_end") {
                        _dcp_trim_end = atoi (v.c_str ());
-               } else if (k == "reel_size") {
-                       _reel_size = boost::lexical_cast<uint64_t> (v);
                } else if (k == "dcp_ab") {
                        _dcp_ab = (v == "1");
                } else if (k == "selected_content_audio_stream" || (!version && k == "selected_audio_stream")) {
@@ -628,8 +622,8 @@ Film::read_metadata ()
        _dirty = false;
 }
 
-Size
-Film::cropped_size (Size s) const
+libdcp::Size
+Film::cropped_size (libdcp::Size s) const
 {
        boost::mutex::scoped_lock lm (_state_mutex);
        s.width -= _crop.left + _crop.right;
@@ -1094,26 +1088,6 @@ Film::set_dcp_trim_end (int t)
        signal_changed (DCP_TRIM_END);
 }
 
-void
-Film::set_reel_size (uint64_t s)
-{
-       {
-               boost::mutex::scoped_lock lm (_state_mutex);
-               _reel_size = s;
-       }
-       signal_changed (REEL_SIZE);
-}
-
-void
-Film::unset_reel_size ()
-{
-       {
-               boost::mutex::scoped_lock lm (_state_mutex);
-               _reel_size = boost::optional<uint64_t> ();
-       }
-       signal_changed (REEL_SIZE);
-}
-
 void
 Film::set_dcp_ab (bool a)
 {
@@ -1323,7 +1297,7 @@ Film::set_package_type (string p)
 }
 
 void
-Film::set_size (Size s)
+Film::set_size (libdcp::Size s)
 {
        {
                boost::mutex::scoped_lock lm (_state_mutex);
index 3485dfaae8dd1eec33e7f9cb6527daf963390d04..d3530b81772ac43f117d2d4f2734778c9d0d28c9 100644 (file)
@@ -86,7 +86,7 @@ public:
        void write_metadata () const;
        void read_metadata ();
 
-       Size cropped_size (Size) const;
+       libdcp::Size cropped_size (libdcp::Size) const;
        boost::optional<int> dcp_length () const;
        std::string dci_name () const;
        std::string dcp_name () const;
@@ -116,7 +116,6 @@ public:
                SCALER,
                DCP_TRIM_START,
                DCP_TRIM_END,
-               REEL_SIZE,
                DCP_AB,
                CONTENT_AUDIO_STREAM,
                EXTERNAL_AUDIO,
@@ -201,11 +200,6 @@ public:
                return _dcp_trim_end;
        }
 
-       boost::optional<uint64_t> reel_size () const {
-               boost::mutex::scoped_lock lm (_state_mutex);
-               return _reel_size;
-       }
-       
        bool dcp_ab () const {
                boost::mutex::scoped_lock lm (_state_mutex);
                return _dcp_ab;
@@ -306,7 +300,7 @@ public:
                return _package_type;
        }
 
-       Size size () const {
+       libdcp::Size size () const {
                boost::mutex::scoped_lock lm (_state_mutex);
                return _size;
        }
@@ -361,8 +355,6 @@ public:
        void set_scaler (Scaler const *);
        void set_dcp_trim_start (int);
        void set_dcp_trim_end (int);
-       void set_reel_size (uint64_t);
-       void unset_reel_size ();
        void set_dcp_ab (bool);
        void set_content_audio_stream (boost::shared_ptr<AudioStream>);
        void set_external_audio (std::vector<std::string>);
@@ -383,7 +375,7 @@ public:
        void set_studio (std::string);
        void set_facility (std::string);
        void set_package_type (std::string);
-       void set_size (Size);
+       void set_size (libdcp::Size);
        void set_length (SourceFrame);
        void unset_length ();
        void set_content_digest (std::string);
@@ -445,8 +437,6 @@ private:
        int _dcp_trim_start;
        /** Frames to trim off the end of the DCP */
        int _dcp_trim_end;
-       /** Approximate target reel size in bytes; if not set, use a single reel */
-       boost::optional<uint64_t> _reel_size;
        /** true to create an A/B comparison DCP, where the left half of the image
            is the video without any filters or post-processing, and the right half
            has the specified filters and post-processing.
@@ -494,8 +484,8 @@ private:
 
        /* Data which are cached to speed things up */
 
-       /** Size, in pixels, of the source (ignoring cropping) */
-       Size _size;
+       /** libdcp::Size, in pixels, of the source (ignoring cropping) */
+       libdcp::Size _size;
        /** The length of the source, in video frames (as far as we know) */
        boost::optional<SourceFrame> _length;
        /** MD5 digest of our content file */
index 376ab404fad8e23e42944c9504bb9fbbc5df5615..6cd7dc2cbb52f38e8f9eb9db971a1f8d4bdc2d7e 100644 (file)
@@ -54,7 +54,7 @@ using boost::shared_ptr;
  *  @param s Size of the images to process.
  *  @param p Pixel format of the images to process.
  */
-FilterGraph::FilterGraph (shared_ptr<Film> film, FFmpegDecoder* decoder, Size s, AVPixelFormat p)
+FilterGraph::FilterGraph (shared_ptr<Film> film, FFmpegDecoder* decoder, libdcp::Size s, AVPixelFormat p)
        : _buffer_src_context (0)
        , _buffer_sink_context (0)
        , _size (s)
@@ -205,7 +205,7 @@ FilterGraph::process (AVFrame const * frame)
  *  @return true if this chain can process images with `s' and `p', otherwise false.
  */
 bool
-FilterGraph::can_process (Size s, AVPixelFormat p) const
+FilterGraph::can_process (libdcp::Size s, AVPixelFormat p) const
 {
        return (_size == s && _pixel_format == p);
 }
index 9e6ac62528859591acaf0af5152a5bb3e53e947f..7e4e8422b07d36236b2185c588f2a23311eab18e 100644 (file)
@@ -37,15 +37,15 @@ class FFmpegDecoder;
 class FilterGraph
 {
 public:
-       FilterGraph (boost::shared_ptr<Film> film, FFmpegDecoder* decoder, Size s, AVPixelFormat p);
+       FilterGraph (boost::shared_ptr<Film> film, FFmpegDecoder* decoder, libdcp::Size s, AVPixelFormat p);
 
-       bool can_process (Size s, AVPixelFormat p) const;
+       bool can_process (libdcp::Size s, AVPixelFormat p) const;
        std::list<boost::shared_ptr<Image> > process (AVFrame const * frame);
 
 private:
        AVFilterContext* _buffer_src_context;
        AVFilterContext* _buffer_sink_context;
-       Size _size; ///< size of the images that this chain can process
+       libdcp::Size _size; ///< size of the images that this chain can process
        AVPixelFormat _pixel_format; ///< pixel format of the images that this chain can process
 };
 
index 9758624118054ef20aedfb5430e3b6278f2521a3..088a16059d7f68ac4432f029afacd0ab0b966cb5 100644 (file)
@@ -67,19 +67,19 @@ Format::as_metadata () const
 void
 Format::setup_formats ()
 {
-       _formats.push_back (new FixedFormat (119, Size (1285, 1080), "119", "1.19", "F"));
-       _formats.push_back (new FixedFormat (133, Size (1436, 1080), "133", "1.33", "F"));
-       _formats.push_back (new FixedFormat (138, Size (1485, 1080), "138", "1.375", "F"));
-       _formats.push_back (new FixedFormat (133, Size (1998, 1080), "133-in-flat", "4:3 within Flat", "F"));
-       _formats.push_back (new FixedFormat (137, Size (1480, 1080), "137", "Academy", "F"));
-       _formats.push_back (new FixedFormat (166, Size (1793, 1080), "166", "1.66", "F"));
-       _formats.push_back (new FixedFormat (166, Size (1998, 1080), "166-in-flat", "1.66 within Flat", "F"));
-       _formats.push_back (new FixedFormat (178, Size (1998, 1080), "178-in-flat", "16:9 within Flat", "F"));
-       _formats.push_back (new FixedFormat (178, Size (1920, 1080), "178", "16:9", "F"));
-       _formats.push_back (new FixedFormat (185, Size (1998, 1080), "185", "Flat", "F"));
-       _formats.push_back (new FixedFormat (239, Size (2048, 858), "239", "Scope", "S"));
-       _formats.push_back (new VariableFormat (Size (1998, 1080), "var-185", "Flat", "F"));
-       _formats.push_back (new VariableFormat (Size (2048, 858), "var-239", "Scope", "S"));
+       _formats.push_back (new FixedFormat (119, libdcp::Size (1285, 1080), "119", "1.19", "F"));
+       _formats.push_back (new FixedFormat (133, libdcp::Size (1436, 1080), "133", "1.33", "F"));
+       _formats.push_back (new FixedFormat (138, libdcp::Size (1485, 1080), "138", "1.375", "F"));
+       _formats.push_back (new FixedFormat (133, libdcp::Size (1998, 1080), "133-in-flat", "4:3 within Flat", "F"));
+       _formats.push_back (new FixedFormat (137, libdcp::Size (1480, 1080), "137", "Academy", "F"));
+       _formats.push_back (new FixedFormat (166, libdcp::Size (1793, 1080), "166", "1.66", "F"));
+       _formats.push_back (new FixedFormat (166, libdcp::Size (1998, 1080), "166-in-flat", "1.66 within Flat", "F"));
+       _formats.push_back (new FixedFormat (178, libdcp::Size (1998, 1080), "178-in-flat", "16:9 within Flat", "F"));
+       _formats.push_back (new FixedFormat (178, libdcp::Size (1920, 1080), "178", "16:9", "F"));
+       _formats.push_back (new FixedFormat (185, libdcp::Size (1998, 1080), "185", "Flat", "F"));
+       _formats.push_back (new FixedFormat (239, libdcp::Size (2048, 858), "239", "Scope", "S"));
+       _formats.push_back (new VariableFormat (libdcp::Size (1998, 1080), "var-185", "Flat", "F"));
+       _formats.push_back (new VariableFormat (libdcp::Size (2048, 858), "var-239", "Scope", "S"));
 }
 
 /** @param n Nickname.
@@ -140,7 +140,7 @@ Format::all ()
  *  @param id ID (e.g. 185)
  *  @param n Nick name (e.g. Flat)
  */
-FixedFormat::FixedFormat (int r, Size dcp, string id, string n, string d)
+FixedFormat::FixedFormat (int r, libdcp::Size dcp, string id, string n, string d)
        : Format (dcp, id, n, d)
        , _ratio (r)
 {
@@ -160,7 +160,7 @@ Format::dcp_padding (shared_ptr<const Film> f) const
        return p;
 }
 
-VariableFormat::VariableFormat (Size dcp, string id, string n, string d)
+VariableFormat::VariableFormat (libdcp::Size dcp, string id, string n, string d)
        : Format (dcp, id, n, d)
 {
 
index 2118237a406525e99295765270d4133e3cf98e87..b4c691e56fea19e45b023782d4b255feb77b53dd 100644 (file)
@@ -31,7 +31,7 @@ class Film;
 class Format
 {
 public:
-       Format (Size dcp, std::string id, std::string n, std::string d)
+       Format (libdcp::Size dcp, std::string id, std::string n, std::string d)
                : _dcp_size (dcp)
                , _id (id)
                , _nickname (n)
@@ -52,7 +52,7 @@ public:
         *  put in a DCP for this ratio.  This size will not correspond
         *  to the ratio when we are doing things like 16:9 in a Flat frame.
         */
-       Size dcp_size () const {
+       libdcp::Size dcp_size () const {
                return _dcp_size;
        }
 
@@ -81,11 +81,11 @@ public:
        static void setup_formats ();
 
 protected:     
-       /** Size in pixels of the images that we should
+       /** libdcp::Size in pixels of the images that we should
         *  put in a DCP for this ratio.  This size will not correspond
         *  to the ratio when we are doing things like 16:9 in a Flat frame.
         */
-       Size _dcp_size;
+       libdcp::Size _dcp_size;
        /** id for use in metadata */
        std::string _id;
        /** nickname (e.g. Flat, Scope) */
@@ -104,7 +104,7 @@ private:
 class FixedFormat : public Format
 {
 public:
-       FixedFormat (int, Size, std::string, std::string, std::string);
+       FixedFormat (int, libdcp::Size, std::string, std::string, std::string);
 
        int ratio_as_integer (boost::shared_ptr<const Film>) const {
                return _ratio;
@@ -125,7 +125,7 @@ private:
 class VariableFormat : public Format
 {
 public:
-       VariableFormat (Size, std::string, std::string, std::string);
+       VariableFormat (libdcp::Size, std::string, std::string, std::string);
 
        int ratio_as_integer (boost::shared_ptr<const Film> f) const;
        float ratio_as_float (boost::shared_ptr<const Film> f) const;
index f774f476fd707c7b02ddf00b6ca099b6c3a6ca85..feda09ec578bb41baeda31f033c7b770d650a45a 100644 (file)
@@ -95,7 +95,7 @@ Image::components () const
 }
 
 shared_ptr<Image>
-Image::scale (Size out_size, Scaler const * scaler, bool aligned) const
+Image::scale (libdcp::Size out_size, Scaler const * scaler, bool aligned) const
 {
        assert (scaler);
 
@@ -124,11 +124,11 @@ Image::scale (Size out_size, Scaler const * scaler, bool aligned) const
  *  @param scaler Scaler to use.
  */
 shared_ptr<Image>
-Image::scale_and_convert_to_rgb (Size out_size, int padding, Scaler const * scaler, bool aligned) const
+Image::scale_and_convert_to_rgb (libdcp::Size out_size, int padding, Scaler const * scaler, bool aligned) const
 {
        assert (scaler);
 
-       Size content_size = out_size;
+       libdcp::Size content_size = out_size;
        content_size.width -= (padding * 2);
 
        shared_ptr<Image> rgb (new SimpleImage (PIX_FMT_RGB24, content_size, aligned));
@@ -215,7 +215,7 @@ Image::post_process (string pp, bool aligned) const
 shared_ptr<Image>
 Image::crop (Crop crop, bool aligned) const
 {
-       Size cropped_size = size ();
+       libdcp::Size cropped_size = size ();
        cropped_size.width -= crop.left + crop.right;
        cropped_size.height -= crop.top + crop.bottom;
 
@@ -368,7 +368,7 @@ Image::bytes_per_pixel (int c) const
  *  @param p Pixel format.
  *  @param s Size in pixels.
  */
-SimpleImage::SimpleImage (AVPixelFormat p, Size s, bool aligned)
+SimpleImage::SimpleImage (AVPixelFormat p, libdcp::Size s, bool aligned)
        : Image (p)
        , _size (s)
        , _aligned (aligned)
@@ -466,7 +466,7 @@ SimpleImage::stride () const
        return _stride;
 }
 
-Size
+libdcp::Size
 SimpleImage::size () const
 {
        return _size;
@@ -503,10 +503,10 @@ FilterBufferImage::stride () const
        return _buffer->linesize;
 }
 
-Size
+libdcp::Size
 FilterBufferImage::size () const
 {
-       return Size (_buffer->video->w, _buffer->video->h);
+       return libdcp::Size (_buffer->video->w, _buffer->video->h);
 }
 
 RGBPlusAlphaImage::RGBPlusAlphaImage (shared_ptr<const Image> im)
index e19c6f54b7055d916df185cdab98c102f9ea8496..adee8bc4d1e5196d9c3e086322b1e68c9c3b00c6 100644 (file)
@@ -65,14 +65,14 @@ public:
        /** @return Array of strides for each line (including any alignment padding bytes) */
        virtual int * stride () const = 0;
 
-       /** @return Size of the image, in pixels */
-       virtual Size size () const = 0;
+       /** @return libdcp::Size of the image, in pixels */
+       virtual libdcp::Size size () const = 0;
 
        int components () const;
        int lines (int) const;
 
-       boost::shared_ptr<Image> scale_and_convert_to_rgb (Size out_size, int padding, Scaler const * scaler, bool aligned) const;
-       boost::shared_ptr<Image> scale (Size, Scaler const *, bool aligned) const;
+       boost::shared_ptr<Image> scale_and_convert_to_rgb (libdcp::Size out_size, int padding, Scaler const * scaler, bool aligned) const;
+       boost::shared_ptr<Image> scale (libdcp::Size, Scaler const *, bool aligned) const;
        boost::shared_ptr<Image> post_process (std::string, bool aligned) const;
        void alpha_blend (boost::shared_ptr<const Image> image, Position pos);
        boost::shared_ptr<Image> crop (Crop c, bool aligned) const;
@@ -106,7 +106,7 @@ public:
        uint8_t ** data () const;
        int * line_size () const;
        int * stride () const;
-       Size size () const;
+       libdcp::Size size () const;
 
 private:
        /* Not allowed */
@@ -122,7 +122,7 @@ private:
 class SimpleImage : public Image
 {
 public:
-       SimpleImage (AVPixelFormat, Size, bool);
+       SimpleImage (AVPixelFormat, libdcp::Size, bool);
        SimpleImage (SimpleImage const &);
        SimpleImage& operator= (SimpleImage const &);
        ~SimpleImage ();
@@ -130,14 +130,14 @@ public:
        uint8_t ** data () const;
        int * line_size () const;
        int * stride () const;
-       Size size () const;
+       libdcp::Size size () const;
 
 protected:
        void allocate ();
        void swap (SimpleImage &);
        
 private:
-       Size _size; ///< size in pixels
+       libdcp::Size _size; ///< size in pixels
        uint8_t** _data; ///< array of pointers to components
        int* _line_size; ///< array of sizes of the data in each line, in pixels (without any alignment padding bytes)
        int* _stride; ///< array of strides for each line (including any alignment padding bytes)
index bad1fb81314e182ccbc831d19462e33e5cc3fb51..5ebd6c8e1ccaba8ba498b6d453ad127573d6c0c3 100644 (file)
@@ -50,7 +50,7 @@ ImageMagickDecoder::ImageMagickDecoder (
        _iter = _files.begin ();
 }
 
-Size
+libdcp::Size
 ImageMagickDecoder::native_size () const
 {
        if (_files.empty ()) {
@@ -60,7 +60,7 @@ ImageMagickDecoder::native_size () const
        /* Look at the first file and assume its size holds for all */
        using namespace MagickCore;
        Magick::Image* image = new Magick::Image (_film->content_path ());
-       Size const s = Size (image->columns(), image->rows());
+       libdcp::Size const s = libdcp::Size (image->columns(), image->rows());
        delete image;
 
        return s;
@@ -80,7 +80,7 @@ ImageMagickDecoder::pass ()
        
        Magick::Image* magick_image = new Magick::Image (_film->content_path ());
        
-       Size size = native_size ();
+       libdcp::Size size = native_size ();
        shared_ptr<Image> image (new SimpleImage (PIX_FMT_RGB24, size, false));
 
        using namespace MagickCore;
index 6f426f308058a403330af912baa0acdc7d58b281..c4795b003732dd3c500d5e326df6de7fbecca131 100644 (file)
@@ -33,7 +33,7 @@ public:
                return 0;
        }
 
-       Size native_size () const;
+       libdcp::Size native_size () const;
 
        SourceFrame length () const {
                /* We don't know */
index b9f0cacf3b2d9f62219fdf0eff111890f7d91ddb..70552162611d3563ffd1e6597bccfb24b3f53b1d 100644 (file)
@@ -59,9 +59,9 @@ MakeDCPJob::name () const
 
 /** @param f DCP frame index */
 string
-MakeDCPJob::j2c_path (int f, int offset) const
+MakeDCPJob::j2c_path (int f) const
 {
-       SourceFrame const s = ((f + offset) * dcp_frame_rate(_film->frames_per_second()).skip) + _film->dcp_trim_start();
+       SourceFrame const s = (f * dcp_frame_rate(_film->frames_per_second()).skip) + _film->dcp_trim_start();
        return _opt->frame_out_path (s, false);
 }
 
@@ -107,71 +107,45 @@ MakeDCPJob::run ()
        
        dcp.add_cpl (cpl);
 
-       int frames_per_reel = 0;
-       if (_film->reel_size()) {
-               frames_per_reel = (_film->reel_size().get() / (_film->j2k_bandwidth() / 8)) * dfr.frames_per_second;
-       } else {
-               frames_per_reel = frames;
-       }
-
-       int frames_done = 0;
-       int reel = 0;
-
-       while (frames_done < frames) {
-
-               descend (float (frames_per_reel) / frames);
-
-               int this_time = std::min (frames_per_reel, (frames - frames_done));
-
-               descend (0.8);
-
-               shared_ptr<libdcp::MonoPictureAsset> pa (
-                       new libdcp::MonoPictureAsset (
-                               boost::bind (&MakeDCPJob::j2c_path, this, _1, frames_done),
+       descend (0.8);
+
+       shared_ptr<libdcp::MonoPictureAsset> pa (
+               new libdcp::MonoPictureAsset (
+                       boost::bind (&MakeDCPJob::j2c_path, this, _1),
+                       _film->dir (_film->dcp_name()),
+                       "video.mxf",
+                       &dcp.Progress,
+                       dfr.frames_per_second,
+                       frames,
+                       _opt->out_size
+                       )
+               );
+       
+       ascend ();
+       
+       shared_ptr<libdcp::SoundAsset> sa;
+       
+       if (_film->audio_channels() > 0) {
+               descend (0.1);
+               sa.reset (
+                       new libdcp::SoundAsset (
+                               boost::bind (&MakeDCPJob::wav_path, this, _1),
                                _film->dir (_film->dcp_name()),
-                               String::compose ("video_%1.mxf", reel),
+                               "audio.mxf",
                                &dcp.Progress,
                                dfr.frames_per_second,
-                               this_time,
-                               _opt->out_size.width,
-                               _opt->out_size.height
+                               frames,
+                               dcp_audio_channels (_film->audio_channels())
                                )
                        );
-       
-               ascend ();
-               
-               shared_ptr<libdcp::SoundAsset> sa;
-               
-               if (_film->audio_channels() > 0) {
-                       descend (0.1);
-                       sa.reset (
-                               new libdcp::SoundAsset (
-                                       boost::bind (&MakeDCPJob::wav_path, this, _1),
-                                       _film->dir (_film->dcp_name()),
-                                       String::compose ("audio_%1.mxf", reel),
-                                       &dcp.Progress,
-                                       dfr.frames_per_second,
-                                       this_time,
-                                       frames_done,
-                                       dcp_audio_channels (_film->audio_channels())
-                                       )
-                               );
-                       ascend ();
-               }
-
-               descend (0.1);
-               cpl->add_reel (shared_ptr<libdcp::Reel> (new libdcp::Reel (pa, sa, shared_ptr<libdcp::SubtitleAsset> ())));
-               ascend ();
-               
-               frames_done += frames_per_reel;
-               ++reel;
-
                ascend ();
        }
 
+       descend (0.05);
+       cpl->add_reel (shared_ptr<libdcp::Reel> (new libdcp::Reel (pa, sa, shared_ptr<libdcp::SubtitleAsset> ())));
        ascend ();
-
-       descend (0.1);
+               
+       descend (0.05);
        dcp.write_xml ();
        ascend ();
                
index 5e4f78a2513aa858f8cbe7e851962de2040f19c3..1aa906b0adc5fd9518334ffab78e47f347d5a37b 100644 (file)
@@ -38,7 +38,7 @@ public:
 
 private:
        void dcp_progress (float);
-       std::string j2c_path (int, int) const;
+       std::string j2c_path (int) const;
        std::string wav_path (libdcp::Channel) const;
 
        boost::shared_ptr<const EncodeOptions> _opt;
index b94c28446a4d7f3b69a8ebe8c70204ecf34e3b67..60bb8743226078628adfb7246fe2a3922c83a7b3 100644 (file)
@@ -35,6 +35,6 @@ private:
        int _video_frames;
        int64_t _audio_frames;
        boost::optional<AVPixelFormat> _pixel_format;
-       boost::optional<Size> _size;
+       boost::optional<libdcp::Size> _size;
        boost::optional<int> _channels;
 };
index 55b066a2d90bb918d53b9a315b62d66fe8020a7b..2f2f44b641e26ad37644beffaa4d2789aa5f653c 100644 (file)
@@ -90,7 +90,7 @@ public:
                return s.str ();
        }
 
-       Size out_size;              ///< size of output images
+       libdcp::Size out_size;      ///< size of output images
        int padding;                ///< number of pixels of padding (in terms of the output size) each side of the image
 
        /** Range of video frames to encode (in DCP frames) */
index bea75cff8a41e80294b73cbf7d0c6783236be832..1bb8f205ed65e734606d82196cacd3cf91ae115e 100644 (file)
@@ -92,9 +92,9 @@ Server::process (shared_ptr<Socket> socket)
                return -1;
        }
 
-       Size in_size (get_required_int (kv, "input_width"), get_required_int (kv, "input_height"));
+       libdcp::Size in_size (get_required_int (kv, "input_width"), get_required_int (kv, "input_height"));
        int pixel_format_int = get_required_int (kv, "input_pixel_format");
-       Size out_size (get_required_int (kv, "output_width"), get_required_int (kv, "output_height"));
+       libdcp::Size out_size (get_required_int (kv, "output_width"), get_required_int (kv, "output_height"));
        int padding = get_required_int (kv, "padding");
        int subtitle_offset = get_required_int (kv, "subtitle_offset");
        float subtitle_scale = get_required_float (kv, "subtitle_scale");
@@ -105,7 +105,7 @@ Server::process (shared_ptr<Socket> socket)
        int colour_lut_index = get_required_int (kv, "colour_lut");
        int j2k_bandwidth = get_required_int (kv, "j2k_bandwidth");
        Position subtitle_position (get_optional_int (kv, "subtitle_x"), get_optional_int (kv, "subtitle_y"));
-       Size subtitle_size (get_optional_int (kv, "subtitle_width"), get_optional_int (kv, "subtitle_height"));
+       libdcp::Size subtitle_size (get_optional_int (kv, "subtitle_width"), get_optional_int (kv, "subtitle_height"));
 
        /* This checks that colour_lut_index is within range */
        colour_lut_index_to_name (colour_lut_index);
index c52d3ac664891576a1cced625da24bc678001f73..8a9998d6a9394501c7a5b489ae2bef755a86a099 100644 (file)
@@ -55,7 +55,7 @@ TimedSubtitle::TimedSubtitle (AVSubtitle const & sub)
                throw DecodeError ("non-bitmap subtitles not yet supported");
        }
        
-       shared_ptr<Image> image (new SimpleImage (PIX_FMT_RGBA, Size (rect->w, rect->h), true));
+       shared_ptr<Image> image (new SimpleImage (PIX_FMT_RGBA, libdcp::Size (rect->w, rect->h), true));
 
        /* Start of the first line in the subtitle */
        uint8_t* sub_p = rect->pict.data[0];
index 0fced638cc47ad8954f8fe0ad9825d348e5a3498..7f370b89647557199657f47b4d47037ec5b552c0 100644 (file)
@@ -244,7 +244,7 @@ dvdomatic_setup ()
  *  @return FFmpeg crop filter string.
  */
 string
-crop_string (Position start, Size size)
+crop_string (Position start, libdcp::Size size)
 {
        stringstream s;
        s << "crop=" << size.width << ":" << size.height << ":" << start.x << ":" << start.y;
@@ -377,17 +377,6 @@ dcp_audio_channels (int f)
        return f;
 }
 
-
-bool operator== (Size const & a, Size const & b)
-{
-       return (a.width == b.width && a.height == b.height);
-}
-
-bool operator!= (Size const & a, Size const & b)
-{
-       return !(a == b);
-}
-
 bool operator== (Crop const & a, Crop const & b)
 {
        return (a.left == b.left && a.right == b.right && a.top == b.top && a.bottom == b.bottom);
index 024c40fb555f32b4aa3045bbcb944682629fb749..77fb943e090fa8866ac7b6eb021b6bb5786c8cdb 100644 (file)
@@ -29,6 +29,7 @@
 #include <vector>
 #include <boost/shared_ptr.hpp>
 #include <boost/asio.hpp>
+#include <libdcp/util.h>
 extern "C" {
 #include <libavcodec/avcodec.h>
 #include <libavfilter/avfilter.h>
@@ -78,33 +79,6 @@ enum ContentType {
        VIDEO  ///< content is a video
 };
 
-/** @class Size
- *  @brief Representation of the size of something */
-struct Size
-{
-       /** Construct a zero Size */
-       Size ()
-               : width (0)
-               , height (0)
-       {}
-
-       /** @param w Width.
-        *  @param h Height.
-        */
-       Size (int w, int h)
-               : width (w)
-               , height (h)
-       {}
-
-       /** width */
-       int width;
-       /** height */
-       int height;
-};
-
-extern bool operator== (Size const & a, Size const & b);
-extern bool operator!= (Size const & a, Size const & b);
-
 /** @struct Crop
  *  @brief A description of the crop of an image or video.
  */
@@ -174,14 +148,14 @@ struct Rect
                return Position (x, y);
        }
 
-       Size size () const {
-               return Size (width, height);
+       libdcp::Size size () const {
+               return libdcp::Size (width, height);
        }
 
        Rect intersection (Rect const & other) const;
 };
 
-extern std::string crop_string (Position, Size);
+extern std::string crop_string (Position, libdcp::Size);
 extern int dcp_audio_sample_rate (int);
 extern DCPFrameRate dcp_frame_rate (float);
 extern int dcp_audio_channels (int);
index 7726d2057fe9b3eec7c5a20914d4b159ef4ce071..b18082c69ef0c67b2dbecd6c137964edf5647adc 100644 (file)
@@ -32,7 +32,7 @@ public:
        /** @return video frames per second, or 0 if unknown */
        virtual float frames_per_second () const = 0;
        /** @return native size in pixels */
-       virtual Size native_size () const = 0;
+       virtual libdcp::Size native_size () const = 0;
        /** @return length (in source video frames), according to our content's header */
        virtual SourceFrame length () const = 0;
 
index 17c40c83d0eb00ad21bee2c6fe412b1c8ae170d7..72f2d48071316beeec6c7c2a0fc27d7974763642 100644 (file)
@@ -149,17 +149,6 @@ FilmEditor::make_film_panel ()
                _film_sizer->Add (s);
        }
 
-       _multiple_reels = new wxCheckBox (_film_panel, wxID_ANY, wxT ("Make multiple reels"));
-       _film_sizer->Add (_multiple_reels);
-
-       {
-               wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
-               _reel_size = new wxSpinCtrl (_film_panel, wxID_ANY);
-               s->Add (_reel_size);
-               add_label_to_sizer (s, _film_panel, "Gb each");
-               _film_sizer->Add (s);
-       }
-
        _dcp_ab = new wxCheckBox (_film_panel, wxID_ANY, wxT ("A/B"));
        video_control (_dcp_ab);
        _film_sizer->Add (_dcp_ab, 1);
@@ -180,8 +169,6 @@ FilmEditor::make_film_panel ()
        for (vector<DCPContentType const *>::const_iterator i = ct.begin(); i != ct.end(); ++i) {
                _dcp_content_type->Append (std_to_wx ((*i)->pretty_name ()));
        }
-
-       _reel_size->SetRange(1, 1000);
 }
 
 void
@@ -204,8 +191,6 @@ FilmEditor::connect_to_widgets ()
        _still_duration->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::still_duration_changed), 0, this);
        _dcp_trim_start->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::dcp_trim_start_changed), 0, this);
        _dcp_trim_end->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::dcp_trim_end_changed), 0, this);
-       _multiple_reels->Connect (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler (FilmEditor::multiple_reels_toggled), 0, this);
-       _reel_size->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::reel_size_changed), 0, this);
        _with_subtitles->Connect (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler (FilmEditor::with_subtitles_toggled), 0, this);
        _subtitle_offset->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::subtitle_offset_changed), 0, this);
        _subtitle_scale->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::subtitle_scale_changed), 0, this);
@@ -478,32 +463,6 @@ FilmEditor::trust_content_header_changed (wxCommandEvent &)
        _film->set_trust_content_header (_trust_content_header->GetValue ());
 }
 
-void
-FilmEditor::multiple_reels_toggled (wxCommandEvent &)
-{
-       if (!_film) {
-               return;
-       }
-
-       if (_multiple_reels->GetValue()) {
-               _film->set_reel_size (_reel_size->GetValue() * 1e9);
-       } else {
-               _film->unset_reel_size ();
-       }
-
-       setup_reel_control_sensitivity ();
-}
-
-void
-FilmEditor::reel_size_changed (wxCommandEvent &)
-{
-       if (!_film) {
-               return;
-       }
-
-       _film->set_reel_size (static_cast<uint64_t> (_reel_size->GetValue()) * 1e9);
-}
-
 /** Called when the DCP A/B switch has been toggled */
 void
 FilmEditor::dcp_ab_toggled (wxCommandEvent &)
@@ -681,15 +640,6 @@ FilmEditor::film_changed (Film::Property p)
        case Film::DCP_TRIM_END:
                checked_set (_dcp_trim_end, _film->dcp_trim_end());
                break;
-       case Film::REEL_SIZE:
-               if (_film->reel_size()) {
-                       checked_set (_multiple_reels, true);
-                       checked_set (_reel_size, _film->reel_size().get() / 1e9);
-               } else {
-                       checked_set (_multiple_reels, false);
-               }
-               setup_reel_control_sensitivity ();
-               break;
        case Film::AUDIO_GAIN:
                checked_set (_audio_gain, _film->audio_gain ());
                break;
@@ -813,7 +763,6 @@ FilmEditor::set_film (shared_ptr<Film> f)
        film_changed (Film::SCALER);
        film_changed (Film::DCP_TRIM_START);
        film_changed (Film::DCP_TRIM_END);
-       film_changed (Film::REEL_SIZE);
        film_changed (Film::DCP_AB);
        film_changed (Film::CONTENT_AUDIO_STREAM);
        film_changed (Film::EXTERNAL_AUDIO);
@@ -858,8 +807,6 @@ FilmEditor::set_things_sensitive (bool s)
        _dcp_content_type->Enable (s);
        _dcp_trim_start->Enable (s);
        _dcp_trim_end->Enable (s);
-       _multiple_reels->Enable (s);
-       _reel_size->Enable (s);
        _dcp_ab->Enable (s);
        _colour_lut->Enable (s);
        _j2k_bandwidth->Enable (s);
@@ -870,7 +817,6 @@ FilmEditor::set_things_sensitive (bool s)
 
        setup_subtitle_control_sensitivity ();
        setup_audio_control_sensitivity ();
-       setup_reel_control_sensitivity ();
 }
 
 /** Called when the `Edit filters' button has been clicked */
@@ -1211,9 +1157,3 @@ FilmEditor::external_audio_changed (wxCommandEvent &)
 
        _film->set_external_audio (a);
 }
-
-void
-FilmEditor::setup_reel_control_sensitivity ()
-{
-       _reel_size->Enable (_multiple_reels->GetValue ());
-}
index 34e67eef13e8a7dc0e41a5d83dbc73806f4a462e..8a900f1e4bedf05bf325183739d96e0b34383ec5 100644 (file)
@@ -65,8 +65,6 @@ private:
        void format_changed (wxCommandEvent &);
        void dcp_trim_start_changed (wxCommandEvent &);
        void dcp_trim_end_changed (wxCommandEvent &);
-       void multiple_reels_toggled (wxCommandEvent &);
-       void reel_size_changed (wxCommandEvent &);
        void dcp_content_type_changed (wxCommandEvent &);
        void dcp_ab_toggled (wxCommandEvent &);
        void scaler_changed (wxCommandEvent &);
@@ -94,7 +92,6 @@ private:
        void setup_formats ();
        void setup_subtitle_control_sensitivity ();
        void setup_audio_control_sensitivity ();
-       void setup_reel_control_sensitivity ();
        void setup_streams ();
        void setup_audio_details ();
        
@@ -170,8 +167,6 @@ private:
 
        wxSpinCtrl* _dcp_trim_start;
        wxSpinCtrl* _dcp_trim_end;
-       wxCheckBox* _multiple_reels;
-       wxSpinCtrl* _reel_size;
        /** Selector to generate an A/B comparison DCP */
        wxCheckBox* _dcp_ab;
 
index 3d8198457db1a3c342290087fe938408d63a11c1..e014a8731e0a6b09b369ace8e2ff69030cd76a74 100644 (file)
@@ -257,13 +257,13 @@ FilmViewer::raw_to_display ()
                return;
        }
 
-       Size old_size;
+       libdcp::Size old_size;
        if (_display_frame) {
                old_size = _display_frame->size();
        }
 
        /* Get a compacted image as we have to feed it to wxWidgets */
-       _display_frame = _raw_frame->scale_and_convert_to_rgb (Size (_out_width, _out_height), 0, _film->scaler(), false);
+       _display_frame = _raw_frame->scale_and_convert_to_rgb (libdcp::Size (_out_width, _out_height), 0, _film->scaler(), false);
 
        if (old_size != _display_frame->size()) {
                _clear_required = true;
index 6029c04f32a7c02769f715248ae4a25bce774bb6..c6b5e7c0c5530ec871f4b04df919a48b97b83de8 100644 (file)
@@ -59,7 +59,7 @@ private:
 
        boost::shared_ptr<Film> _film;
 
-       wxBoxSizer* _v_sizer;
+       wxSizer* _v_sizer;
        wxPanel* _panel;
        wxSlider* _slider;
        wxToggleButton* _play_button;
index c393aac5e4d485c5a01e59e6410335db9ef7c013..5f6d687ac506cded67e844a386494333a580c430 100644 (file)
@@ -325,7 +325,7 @@ do_remote_encode (shared_ptr<DCPVideoFrame> frame, ServerDescription* descriptio
 
 BOOST_AUTO_TEST_CASE (client_server_test)
 {
-       shared_ptr<Image> image (new SimpleImage (PIX_FMT_RGB24, Size (1998, 1080), false));
+       shared_ptr<Image> image (new SimpleImage (PIX_FMT_RGB24, libdcp::Size (1998, 1080), false));
        uint8_t* p = image->data()[0];
        
        for (int y = 0; y < 1080; ++y) {
@@ -336,7 +336,7 @@ BOOST_AUTO_TEST_CASE (client_server_test)
                }
        }
 
-       shared_ptr<Image> sub_image (new SimpleImage (PIX_FMT_RGBA, Size (100, 200), false));
+       shared_ptr<Image> sub_image (new SimpleImage (PIX_FMT_RGBA, libdcp::Size (100, 200), false));
        p = sub_image->data()[0];
        for (int y = 0; y < 200; ++y) {
                for (int x = 0; x < 100; ++x) {
@@ -355,7 +355,7 @@ BOOST_AUTO_TEST_CASE (client_server_test)
                new DCPVideoFrame (
                        image,
                        subtitle,
-                       Size (1998, 1080),
+                       libdcp::Size (1998, 1080),
                        0,
                        0,
                        1,
@@ -531,7 +531,7 @@ BOOST_AUTO_TEST_CASE (job_manager_test)
 
 BOOST_AUTO_TEST_CASE (compact_image_test)
 {
-       SimpleImage* s = new SimpleImage (PIX_FMT_RGB24, Size (50, 50), false);
+       SimpleImage* s = new SimpleImage (PIX_FMT_RGB24, libdcp::Size (50, 50), false);
        BOOST_CHECK_EQUAL (s->components(), 1);
        BOOST_CHECK_EQUAL (s->stride()[0], 50 * 3);
        BOOST_CHECK_EQUAL (s->line_size()[0], 50 * 3);
@@ -557,7 +557,7 @@ BOOST_AUTO_TEST_CASE (compact_image_test)
        BOOST_CHECK (t->stride()[0] == s->stride()[0]);
 
        /* assignment operator */
-       SimpleImage* u = new SimpleImage (PIX_FMT_YUV422P, Size (150, 150), true);
+       SimpleImage* u = new SimpleImage (PIX_FMT_YUV422P, libdcp::Size (150, 150), true);
        *u = *s;
        BOOST_CHECK_EQUAL (u->components(), 1);
        BOOST_CHECK_EQUAL (u->stride()[0], 50 * 3);
@@ -580,7 +580,7 @@ BOOST_AUTO_TEST_CASE (compact_image_test)
 
 BOOST_AUTO_TEST_CASE (aligned_image_test)
 {
-       SimpleImage* s = new SimpleImage (PIX_FMT_RGB24, Size (50, 50), true);
+       SimpleImage* s = new SimpleImage (PIX_FMT_RGB24, libdcp::Size (50, 50), true);
        BOOST_CHECK_EQUAL (s->components(), 1);
        /* 160 is 150 aligned to the nearest 32 bytes */
        BOOST_CHECK_EQUAL (s->stride()[0], 160);
@@ -607,7 +607,7 @@ BOOST_AUTO_TEST_CASE (aligned_image_test)
        BOOST_CHECK (t->stride()[0] == s->stride()[0]);
 
        /* assignment operator */
-       SimpleImage* u = new SimpleImage (PIX_FMT_YUV422P, Size (150, 150), false);
+       SimpleImage* u = new SimpleImage (PIX_FMT_YUV422P, libdcp::Size (150, 150), false);
        *u = *s;
        BOOST_CHECK_EQUAL (u->components(), 1);
        BOOST_CHECK_EQUAL (u->stride()[0], 160);