summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-02-02 22:39:43 +0000
committerCarl Hetherington <cth@carlh.net>2015-02-02 22:39:43 +0000
commit7a1bd472537fee593a3f088655324861d24e804b (patch)
tree42319544a2413d1252c9465f29acbc0b7b5299e9 /src
parentb255fcca7f57c7068603a104adbb645fe5701c21 (diff)
Changes to libdcp API.
Diffstat (limited to 'src')
-rw-r--r--src/lib/dcp_examiner.cc6
-rw-r--r--src/lib/dcp_video.cc11
-rw-r--r--src/lib/image.cc13
-rw-r--r--src/lib/image.h6
-rw-r--r--src/lib/image_examiner.cc4
-rw-r--r--src/lib/j2k_image_proxy.cc16
6 files changed, 29 insertions, 27 deletions
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<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);
}
}
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 <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 */
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<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) {
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 <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)
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 <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>
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 <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
@@ -17,14 +17,16 @@
*/
-#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;