Changes to libdcp API.
authorCarl Hetherington <cth@carlh.net>
Mon, 2 Feb 2015 22:39:43 +0000 (22:39 +0000)
committerCarl Hetherington <cth@carlh.net>
Mon, 2 Feb 2015 22:39:43 +0000 (22:39 +0000)
src/lib/dcp_examiner.cc
src/lib/dcp_video.cc
src/lib/image.cc
src/lib/image.h
src/lib/image_examiner.cc
src/lib/j2k_image_proxy.cc

index 35be422c1685722ef43bda20cd467721af41b9e9..9dbac14d0240bda279a826d25e4ef20bb82c5c64 100644 (file)
@@ -117,12 +117,10 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content)
                        shared_ptr<dcp::MonoPictureMXF> mono = dynamic_pointer_cast<dcp::MonoPictureMXF> (mxf);
                        shared_ptr<dcp::StereoPictureMXF> stereo = dynamic_pointer_cast<dcp::StereoPictureMXF> (mxf);
                        
-                       shared_ptr<Image> image (new Image (PIX_FMT_RGB48LE, _video_size.get(), false));
-                       
                        if (mono) {
-                               mono->get_frame(0)->rgb_frame (image);
+                               mono->get_frame(0)->xyz_image ();
                        } else {
-                               stereo->get_frame(0)->rgb_frame (dcp::EYE_LEFT, image);
+                               stereo->get_frame(0)->xyz_image (dcp::EYE_LEFT);
                        }
                        
                }
index a01a72f6b83aebb0a698a957549ea8a37019cbc7..a302c43e657e79cba5b367be962c4464707473bb 100644 (file)
@@ -40,7 +40,7 @@
 #include "player_video.h"
 #include "encoded_data.h"
 #include <libcxml/cxml.h>
-#include <dcp/xyz_frame.h>
+#include <dcp/xyz_image.h>
 #include <dcp/rgb_xyz.h>
 #include <dcp/colour_matrix.h>
 #include <dcp/raw_convert.h>
@@ -109,15 +109,18 @@ DCPVideo::DCPVideo (shared_ptr<const PlayerVideo> frame, shared_ptr<const cxml::
 shared_ptr<EncodedData>
 DCPVideo::encode_locally (dcp::NoteHandler note)
 {
-       shared_ptr<dcp::XYZFrame> xyz;
+       shared_ptr<dcp::XYZImage> xyz;
 
+       shared_ptr<Image> image = _frame->image (AV_PIX_FMT_RGB48LE, _burn_subtitles, note);
        if (_frame->colour_conversion()) {
                xyz = dcp::rgb_to_xyz (
-                       _frame->image (AV_PIX_FMT_RGB48LE, _burn_subtitles, note),
+                       image->data()[0],
+                       image->size(),
+                       image->stride()[0],
                        _frame->colour_conversion().get()
                        );
        } else {
-               xyz = dcp::xyz_to_xyz (_frame->image (AV_PIX_FMT_RGB48LE, _burn_subtitles, note));
+               xyz = dcp::xyz_to_xyz (image->data()[0], image->size(), image->stride()[0]);
        }
 
        /* Set the max image and component sizes based on frame_rate */
index 3df498c874efa6ac02885a88f7a101c6bb1deb4e..2085b54eeeb14a44e611bdd6d77b1cf501db697f 100644 (file)
@@ -525,7 +525,7 @@ Image::bytes_per_pixel (int c) const
  *  @param s Size in pixels.
  */
 Image::Image (AVPixelFormat p, dcp::Size s, bool aligned)
-       : dcp::Image (s)
+       : _size (s)
        , _pixel_format (p)
        , _aligned (aligned)
 {
@@ -567,8 +567,8 @@ Image::allocate ()
 }
 
 Image::Image (Image const & other)
-       : dcp::Image (other)
-       ,  _pixel_format (other._pixel_format)
+       : _size (other._size)
+       , _pixel_format (other._pixel_format)
        , _aligned (other._aligned)
 {
        allocate ();
@@ -585,7 +585,7 @@ Image::Image (Image const & other)
 }
 
 Image::Image (AVFrame* frame)
-       : dcp::Image (dcp::Size (frame->width, frame->height))
+       : _size (frame->width, frame->height)
        , _pixel_format (static_cast<AVPixelFormat> (frame->format))
        , _aligned (true)
 {
@@ -604,7 +604,7 @@ Image::Image (AVFrame* frame)
 }
 
 Image::Image (shared_ptr<const Image> other, bool aligned)
-       : dcp::Image (other)
+       : _size (other->_size)
        , _pixel_format (other->_pixel_format)
        , _aligned (aligned)
 {
@@ -637,8 +637,7 @@ Image::operator= (Image const & other)
 void
 Image::swap (Image & other)
 {
-       dcp::Image::swap (other);
-       
+       std::swap (_size, other._size);
        std::swap (_pixel_format, other._pixel_format);
 
        for (int i = 0; i < 4; ++i) {
index 814ad1c5895a8c7d6edd8f5ed7563c4479c306cd..b929f4dfcbba78f8dbec7b8ac245c1a9ff7f2a05 100644 (file)
@@ -27,7 +27,6 @@
 #include "position.h"
 #include "position_image.h"
 #include "types.h"
-#include <dcp/image.h>
 extern "C" {
 #include <libavcodec/avcodec.h>
 #include <libavfilter/avfilter.h>
@@ -39,7 +38,7 @@ extern "C" {
 class Scaler;
 class Socket;
 
-class Image : public dcp::Image
+class Image
 {
 public:
        Image (AVPixelFormat, dcp::Size, bool);
@@ -87,7 +86,8 @@ private:
        float bytes_per_pixel (int) const;
        void yuv_16_black (uint16_t, bool);
        static uint16_t swap_16 (uint16_t);
-       
+
+       dcp::Size _size;
        AVPixelFormat _pixel_format; ///< FFmpeg's way of describing the pixel format of this Image
        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)
index 299f7f38d04f713aa185f45dae7119db7910bac4..1fd9cd554a6880140ef0caa0bcab081a93f56ff4 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -24,8 +24,8 @@
 #include "exceptions.h"
 #include "config.h"
 #include "cross.h"
-#include <dcp/xyz_frame.h>
 #include <dcp/exceptions.h>
+#include <dcp/xyz_image.h>
 #include <Magick++.h>
 #include <iostream>
 
index 2c4a2db5b1763e89611d1c6d3bcc9242bb6b1711..c4d38e6235225bea1b5d43c6420471888ef94e4b 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 
 */
 
-#include <libcxml/cxml.h>
-#include <dcp/raw_convert.h>
-#include <dcp/mono_picture_frame.h>
-#include <dcp/stereo_picture_frame.h>
 #include "j2k_image_proxy.h"
 #include "dcpomatic_socket.h"
 #include "image.h"
 #include "encoded_data.h"
+#include <dcp/raw_convert.h>
+#include <dcp/mono_picture_frame.h>
+#include <dcp/stereo_picture_frame.h>
+#include <dcp/colour_conversion.h>
+#include <dcp/rgb_xyz.h>
+#include <libcxml/cxml.h>
 
 #include "i18n.h"
 
@@ -80,9 +82,9 @@ J2KImageProxy::image (optional<dcp::NoteHandler> note) const
        shared_ptr<Image> image (new Image (PIX_FMT_RGB48LE, _size, true));
 
        if (_mono) {
-               _mono->rgb_frame (image, note);
+               dcp::xyz_to_rgb (_mono->xyz_image (), dcp::ColourConversion::xyz_to_srgb(), image->data()[0], image->stride()[0], note);
        } else {
-               _stereo->rgb_frame (_eye, image);
+               dcp::xyz_to_rgb (_stereo->xyz_image (_eye), dcp::ColourConversion::xyz_to_srgb(), image->data()[0], image->stride()[0], note);
        }
 
        return image;