From: Carl Hetherington Date: Mon, 2 Feb 2015 22:39:43 +0000 (+0000) Subject: Changes to libdcp API. X-Git-Tag: v2.0.48~240 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=7a1bd472537fee593a3f088655324861d24e804b Changes to libdcp API. --- diff --git a/src/lib/dcp_examiner.cc b/src/lib/dcp_examiner.cc index 35be422c1..9dbac14d0 100644 --- a/src/lib/dcp_examiner.cc +++ b/src/lib/dcp_examiner.cc @@ -117,12 +117,10 @@ DCPExaminer::DCPExaminer (shared_ptr content) shared_ptr mono = dynamic_pointer_cast (mxf); shared_ptr stereo = dynamic_pointer_cast (mxf); - shared_ptr 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); } } diff --git a/src/lib/dcp_video.cc b/src/lib/dcp_video.cc index a01a72f6b..a302c43e6 100644 --- a/src/lib/dcp_video.cc +++ b/src/lib/dcp_video.cc @@ -40,7 +40,7 @@ #include "player_video.h" #include "encoded_data.h" #include -#include +#include #include #include #include @@ -109,15 +109,18 @@ DCPVideo::DCPVideo (shared_ptr frame, shared_ptr DCPVideo::encode_locally (dcp::NoteHandler note) { - shared_ptr xyz; + shared_ptr xyz; + shared_ptr 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 */ diff --git a/src/lib/image.cc b/src/lib/image.cc index 3df498c87..2085b54ee 100644 --- a/src/lib/image.cc +++ b/src/lib/image.cc @@ -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 (frame->format)) , _aligned (true) { @@ -604,7 +604,7 @@ Image::Image (AVFrame* frame) } Image::Image (shared_ptr 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) { diff --git a/src/lib/image.h b/src/lib/image.h index 814ad1c58..b929f4dfc 100644 --- a/src/lib/image.h +++ b/src/lib/image.h @@ -27,7 +27,6 @@ #include "position.h" #include "position_image.h" #include "types.h" -#include extern "C" { #include #include @@ -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) diff --git a/src/lib/image_examiner.cc b/src/lib/image_examiner.cc index 299f7f38d..1fd9cd554 100644 --- a/src/lib/image_examiner.cc +++ b/src/lib/image_examiner.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2014 Carl Hetherington + Copyright (C) 2013-2015 Carl Hetherington 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 #include +#include #include #include diff --git a/src/lib/j2k_image_proxy.cc b/src/lib/j2k_image_proxy.cc index 2c4a2db5b..c4d38e623 100644 --- a/src/lib/j2k_image_proxy.cc +++ b/src/lib/j2k_image_proxy.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014 Carl Hetherington + Copyright (C) 2014-2015 Carl Hetherington 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 @@ -17,14 +17,16 @@ */ -#include -#include -#include -#include #include "j2k_image_proxy.h" #include "dcpomatic_socket.h" #include "image.h" #include "encoded_data.h" +#include +#include +#include +#include +#include +#include #include "i18n.h" @@ -80,9 +82,9 @@ J2KImageProxy::image (optional note) const shared_ptr 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;