#include <memory>
-class Image;
+namespace dcpomatic {
+ class Image;
+}
+
class BitmapText
{
public:
- BitmapText (std::shared_ptr<const Image> i, dcpomatic::Rect<double> r)
+ BitmapText (std::shared_ptr<const dcpomatic::Image> i, dcpomatic::Rect<double> r)
: image (i)
, rectangle (r)
{}
- std::shared_ptr<const Image> image;
+ std::shared_ptr<const dcpomatic::Image> image;
/** Area that the subtitle covers on its corresponding video, expressed in
* proportions of the image size; e.g. rectangle.x = 0.5 would mean that
* the rectangle starts half-way across the video.
int audio_channels,
std::function<AVPixelFormat (AVPixelFormat)> pixel_format,
VideoRange video_range,
- Image::Alignment alignment,
+ dcpomatic::Image::Alignment alignment,
bool fast,
bool prepare_only_proxy
);
std::function<AVPixelFormat (AVPixelFormat)> _pixel_format;
VideoRange _video_range;
- Image::Alignment _alignment;
+ dcpomatic::Image::Alignment _alignment;
bool _fast;
/** true to ask PlayerVideo::prepare to only prepare the ImageProxy and not also
#include <dcp/subtitle_string.h>
#include <list>
-class Image;
+namespace dcpomatic {
+ class Image;
+}
class ContentText
{
class ContentBitmapText : public ContentText
{
public:
- ContentBitmapText (dcpomatic::ContentTime f, std::shared_ptr<const Image> im, dcpomatic::Rect<double> r)
+ ContentBitmapText (dcpomatic::ContentTime f, std::shared_ptr<const dcpomatic::Image> im, dcpomatic::Rect<double> r)
: ContentText (f)
, sub (im, r)
{}
Encoder::Encoder (std::shared_ptr<const Film> film, std::weak_ptr<Job> job)
: _film (film)
, _job (job)
- , _player (new Player(film, Image::Alignment::PADDED))
+ , _player (new Player(film, dcpomatic::Image::Alignment::PADDED))
{
}
class VideoFilterGraph;
class FFmpegAudioStream;
class AudioBuffers;
-class Image;
+namespace dcpomatic {
+ class Image;
+}
struct ffmpeg_pts_offset_test;
/** @class FFmpegDecoder
/** true if we have a subtitle which has not had emit_stop called for it yet */
bool _have_current_subtitle = false;
- std::shared_ptr<Image> _black_image;
+ std::shared_ptr<dcpomatic::Image> _black_image;
std::map<std::shared_ptr<FFmpegAudioStream>, boost::optional<dcpomatic::ContentTime>> _next_time;
};
/** Store of shared_ptr<Image> to keep them alive whilst raw pointers into
their data have been passed to FFmpeg.
*/
- std::map<uint8_t*, std::shared_ptr<const Image>> _pending_images;
+ std::map<uint8_t*, std::shared_ptr<const dcpomatic::Image>> _pending_images;
boost::mutex _pending_images_mutex;
static int _video_stream_index;
using std::cout;
-using std::make_pair;
using std::make_shared;
using std::min;
-using std::pair;
using std::shared_ptr;
using std::string;
-using boost::optional;
using std::dynamic_pointer_cast;
+using boost::optional;
using dcp::raw_convert;
+using namespace dcpomatic;
FFmpegImageProxy::FFmpegImageProxy (boost::filesystem::path path)
FFmpegImageProxy (std::shared_ptr<Socket> socket);
Result image (
- Image::Alignment alignment,
+ dcpomatic::Image::Alignment alignment,
boost::optional<dcp::Size> size = boost::optional<dcp::Size> ()
) const;
failed-decode errors can give more detail.
*/
boost::optional<boost::filesystem::path> _path;
- mutable std::shared_ptr<Image> _image;
+ mutable std::shared_ptr<dcpomatic::Image> _image;
mutable boost::mutex _mutex;
};
struct AVFilterContext;
struct AVFrame;
-class Image;
class Filter;
using std::shared_ptr;
using std::string;
using dcp::Size;
+using namespace dcpomatic;
/** The memory alignment, in bytes, used for each row of an image if Alignment::PADDED is requested */
double const b = lut_in[op[blue]];
/* RGB to XYZ, including Bradford transform and DCI companding */
- double const x = max (0.0, min (65535.0, r * fast_matrix[0] + g * fast_matrix[1] + b * fast_matrix[2]));
- double const y = max (0.0, min (65535.0, r * fast_matrix[3] + g * fast_matrix[4] + b * fast_matrix[5]));
- double const z = max (0.0, min (65535.0, r * fast_matrix[6] + g * fast_matrix[7] + b * fast_matrix[8]));
+ double const x = std::max (0.0, std::min(65535.0, r * fast_matrix[0] + g * fast_matrix[1] + b * fast_matrix[2]));
+ double const y = std::max (0.0, std::min(65535.0, r * fast_matrix[3] + g * fast_matrix[4] + b * fast_matrix[5]));
+ double const z = std::max (0.0, std::min(65535.0, r * fast_matrix[6] + g * fast_matrix[7] + b * fast_matrix[8]));
/* Out gamma LUT and blend */
tp[0] = lrint(lut_out[lrint(x)] * 65535) * alpha + tp[0] * (1 - alpha);
DCPOMATIC_ASSERT (_pixel_format == AV_PIX_FMT_RGB24 && other->pixel_format() == AV_PIX_FMT_RGB24);
DCPOMATIC_ASSERT (position.x >= 0 && position.y >= 0);
- int const N = min (position.x + other->size().width, size().width) - position.x;
+ int const N = std::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) {
uint8_t * const tp = data()[0] + ty * stride()[0] + position.x * 3;
uint8_t * const op = other->data()[0] + oy * other->stride()[0];
PositionImage
-merge (list<PositionImage> images, Image::Alignment alignment)
+dcpomatic::merge (list<PositionImage> images, Image::Alignment alignment)
{
if (images.empty ()) {
return {};
bool
-operator== (Image const & a, Image const & b)
+dcpomatic::operator== (Image const & a, Image const & b)
{
if (a.planes() != b.planes() || a.pixel_format() != b.pixel_format() || a.alignment() != b.alignment()) {
return false;
struct AVFrame;
class Socket;
+struct make_part_black_test;
+
+
+namespace dcpomatic {
+
class Image : public std::enable_shared_from_this<Image>
{
private:
friend struct pixel_formats_test;
- friend struct make_part_black_test;
+ friend struct ::make_part_black_test;
void allocate ();
void swap (Image &);
Alignment _alignment;
};
+
extern PositionImage merge (std::list<PositionImage> images, Image::Alignment alignment);
extern bool operator== (Image const & a, Image const & b);
+
+}
+
+
#endif
}
} else {
FFmpegImageProxy proxy(content->path(0));
- _video_size = proxy.image(Image::Alignment::COMPACT).image->size();
+ _video_size = proxy.image(dcpomatic::Image::Alignment::COMPACT).image->size();
}
if (content->still ()) {
#include <boost/utility.hpp>
-class Image;
+namespace dcpomatic {
+ class Image;
+}
class Socket;
namespace xmlpp {
ImageProxy& operator= (ImageProxy const&) = delete;
struct Result {
- Result (std::shared_ptr<const Image> image_, int log2_scaling_)
+ Result (std::shared_ptr<const dcpomatic::Image> image_, int log2_scaling_)
: image (image_)
, log2_scaling (log2_scaling_)
, error (false)
{}
- Result (std::shared_ptr<Image> image_, int log2_scaling_, bool error_)
+ Result (std::shared_ptr<dcpomatic::Image> image_, int log2_scaling_, bool error_)
: image (image_)
, log2_scaling (log2_scaling_)
, error (error_)
{}
- std::shared_ptr<const Image> image;
+ std::shared_ptr<const dcpomatic::Image> image;
/** log2 of any scaling down that has already been applied to the image;
* e.g. if the image is already half the size of the original, this value
* will be 1.
* can be used as an optimisation.
*/
virtual Result image (
- Image::Alignment alignment,
+ dcpomatic::Image::Alignment alignment,
boost::optional<dcp::Size> size = boost::optional<dcp::Size> ()
) const = 0;
* This method may be called in a different thread to image().
* @return log2 of any scaling down that will be applied to the image.
*/
- virtual int prepare (Image::Alignment, boost::optional<dcp::Size> = boost::optional<dcp::Size>()) const { return 0; }
+ virtual int prepare (dcpomatic::Image::Alignment, boost::optional<dcp::Size> = boost::optional<dcp::Size>()) const { return 0; }
virtual size_t memory_used () const = 0;
};
using boost::optional;
using dcp::ArrayData;
using dcp::raw_convert;
+using namespace dcpomatic;
/** Construct a J2KImageProxy from a JPEG2000 file */
J2KImageProxy (dcp::ArrayData data, dcp::Size size, AVPixelFormat pixel_format);
Result image (
- Image::Alignment alignment,
+ dcpomatic::Image::Alignment alignment,
boost::optional<dcp::Size> size = boost::optional<dcp::Size> ()
) const;
void write_to_socket (std::shared_ptr<Socket>) const;
/** @return true if our image is definitely the same as another, false if it is probably not */
bool same (std::shared_ptr<const ImageProxy>) const;
- int prepare (Image::Alignment alignment, boost::optional<dcp::Size> = boost::optional<dcp::Size>()) const;
+ int prepare (dcpomatic::Image::Alignment alignment, boost::optional<dcp::Size> = boost::optional<dcp::Size>()) const;
std::shared_ptr<const dcp::Data> j2k () const {
return _data;
std::shared_ptr<const dcp::Data> _data;
dcp::Size _size;
boost::optional<dcp::Eye> _eye;
- mutable std::shared_ptr<Image> _image;
+ mutable std::shared_ptr<dcpomatic::Image> _image;
mutable boost::optional<dcp::Size> _target_size;
mutable boost::optional<int> _reduce;
AVPixelFormat _pixel_format;
class Player : public std::enable_shared_from_this<Player>
{
public:
- Player (std::shared_ptr<const Film>, Image::Alignment subtitle_alignment);
+ Player (std::shared_ptr<const Film>, dcpomatic::Image::Alignment subtitle_alignment);
Player (std::shared_ptr<const Film>, std::shared_ptr<const Playlist> playlist);
Player (Player const& Player) = delete;
* the size of preview in a window.
*/
dcp::Size _video_container_size;
- std::shared_ptr<Image> _black_image;
+ std::shared_ptr<dcpomatic::Image> _black_image;
/** true if the player should ignore all video; i.e. never produce any */
bool _ignore_video = false;
dcpomatic::DCPTime _playback_length;
/** Alignment for subtitle images that we create */
- Image::Alignment _subtitle_alignment = Image::Alignment::PADDED;
+ dcpomatic::Image::Alignment _subtitle_alignment = dcpomatic::Image::Alignment::PADDED;
boost::signals2::scoped_connection _film_changed_connection;
boost::signals2::scoped_connection _playlist_change_connection;
*/
+
#include "content.h"
#include "film.h"
#include "image.h"
#include <libxml++/libxml++.h>
#include <iostream>
+
using std::cout;
using std::dynamic_pointer_cast;
+using std::function;
using std::make_shared;
using std::shared_ptr;
using std::string;
using std::weak_ptr;
using boost::optional;
-using std::function;
using dcp::Data;
using dcp::raw_convert;
+using namespace dcpomatic;
+
PlayerVideo::PlayerVideo (
shared_ptr<const ImageProxy> in,
}
void
-PlayerVideo::prepare (function<AVPixelFormat (AVPixelFormat)> pixel_format, VideoRange video_range, Image::Alignment alignment, bool fast, bool proxy_only)
+PlayerVideo::prepare (function<AVPixelFormat (AVPixelFormat)> pixel_format, VideoRange video_range, dcpomatic::Image::Alignment alignment, bool fast, bool proxy_only)
{
_in->prepare (alignment, _inter_size);
boost::mutex::scoped_lock lm (_mutex);
#include <boost/thread/mutex.hpp>
-class Image;
+namespace dcpomatic {
+ class Image;
+}
class ImageProxy;
class Film;
class Socket;
return _text;
}
- void prepare (std::function<AVPixelFormat (AVPixelFormat)> pixel_format, VideoRange video_range, Image::Alignment alignment, bool fast, bool proxy_only);
- std::shared_ptr<Image> image (std::function<AVPixelFormat (AVPixelFormat)> pixel_format, VideoRange video_range, bool fast) const;
- std::shared_ptr<const Image> raw_image () const;
+ void prepare (std::function<AVPixelFormat (AVPixelFormat)> pixel_format, VideoRange video_range, dcpomatic::Image::Alignment alignment, bool fast, bool proxy_only);
+ std::shared_ptr<dcpomatic::Image> image (std::function<AVPixelFormat (AVPixelFormat)> pixel_format, VideoRange video_range, bool fast) const;
+ std::shared_ptr<const dcpomatic::Image> raw_image () const;
static AVPixelFormat force (AVPixelFormat, AVPixelFormat);
static AVPixelFormat keep_xyz_or_rgb (AVPixelFormat);
boost::optional<Frame> _video_frame;
mutable boost::mutex _mutex;
- mutable std::shared_ptr<Image> _image;
+ mutable std::shared_ptr<dcpomatic::Image> _image;
/** _crop that was used to make _image */
mutable Crop _image_crop;
/** _inter_size that was used to make _image */
#include <memory>
-class Image;
+namespace dcpomatic {
+ class Image;
+}
class PositionImage
public:
PositionImage () {}
- PositionImage (std::shared_ptr<const Image> i, Position<int> p)
+ PositionImage (std::shared_ptr<const dcpomatic::Image> i, Position<int> p)
: image (i)
, position (p)
{}
- std::shared_ptr<const Image> image;
+ std::shared_ptr<const dcpomatic::Image> image;
Position<int> position;
bool same (PositionImage const & other) const;
using std::dynamic_pointer_cast;
-using std::make_pair;
using std::make_shared;
-using std::pair;
using std::shared_ptr;
using std::string;
using boost::optional;
using dcp::raw_convert;
+using namespace dcpomatic;
RawImageProxy::RawImageProxy (shared_ptr<Image> image)
class RawImageProxy : public ImageProxy
{
public:
- explicit RawImageProxy (std::shared_ptr<Image>);
+ explicit RawImageProxy (std::shared_ptr<dcpomatic::Image>);
RawImageProxy (std::shared_ptr<cxml::Node> xml, std::shared_ptr<Socket> socket);
Result image (
- Image::Alignment alignment,
+ dcpomatic::Image::Alignment alignment,
boost::optional<dcp::Size> size = boost::optional<dcp::Size> ()
) const;
size_t memory_used () const;
private:
- std::shared_ptr<Image> _image;
+ std::shared_ptr<dcpomatic::Image> _image;
};
class Subtitle;
}
-class Image;
+namespace dcpomatic {
+ class Image;
+}
class TextDecoder : public DecoderPart
return _position;
}
- void emit_bitmap_start (dcpomatic::ContentTime from, std::shared_ptr<const Image> image, dcpomatic::Rect<double> rect);
- void emit_bitmap (dcpomatic::ContentTimePeriod period, std::shared_ptr<const Image> image, dcpomatic::Rect<double> rect);
+ void emit_bitmap_start (dcpomatic::ContentTime from, std::shared_ptr<const dcpomatic::Image> image, dcpomatic::Rect<double> rect);
+ void emit_bitmap (dcpomatic::ContentTimePeriod period, std::shared_ptr<const dcpomatic::Image> image, dcpomatic::Rect<double> rect);
void emit_plain_start (dcpomatic::ContentTime from, std::list<dcp::SubtitleString> s);
void emit_plain_start (dcpomatic::ContentTime from, sub::Subtitle const & subtitle);
void emit_plain (dcpomatic::ContentTimePeriod period, std::list<dcp::SubtitleString> s);
class VideoContent;
class ImageProxy;
-class Image;
class Log;
class FrameIntervalChecker;
using std::pair;
using std::shared_ptr;
using std::string;
+using namespace dcpomatic;
VideoFilterGraph::VideoFilterGraph (dcp::Size s, AVPixelFormat p, dcp::Fraction r)
VideoFilterGraph (dcp::Size s, AVPixelFormat p, dcp::Fraction r);
bool can_process (dcp::Size s, AVPixelFormat p) const;
- std::list<std::pair<std::shared_ptr<Image>, int64_t>> process (AVFrame * frame);
+ std::list<std::pair<std::shared_ptr<dcpomatic::Image>, int64_t>> process (AVFrame * frame);
protected:
std::string src_parameters () const override;
using std::cerr;
using std::cout;
using std::make_shared;
-using std::pair;
using std::shared_ptr;
using std::string;
using boost::optional;
using namespace boost::placeholders;
#endif
using dcp::ArrayData;
+using namespace dcpomatic;
static shared_ptr<Film> film;
class wxToggleButton;
class FFmpegPlayer;
-class Image;
class RGBPlusAlphaImage;
class PlayerVideo;
class Player;
#if BOOST_VERSION >= 106100
using namespace boost::placeholders;
#endif
+using namespace dcpomatic;
static void
Texture& operator= (Texture const&) = delete;
void bind ();
- void set (std::shared_ptr<const Image> image);
+ void set (std::shared_ptr<const dcpomatic::Image> image);
private:
GLuint _name;
void timer ();
wxPanel* _panel;
- std::shared_ptr<const Image> _image;
+ std::shared_ptr<const dcpomatic::Image> _image;
wxTimer _timer;
Position<int> _inter_position;
dcp::Size _inter_size;
#include <boost/thread.hpp>
-class Image;
+namespace dcpomatic {
+ class Image;
+}
class wxWindow;
class FilmViewer;
class Player;
using namespace boost::placeholders;
#endif
using dcp::locale_convert;
+using namespace dcpomatic;
int const VideoWaveformPlot::_vertical_margin = 8;
}
class PlayerVideo;
-class Image;
+namespace dcpomatic {
+ class Image;
+}
class Film;
class FilmViewer;
std::weak_ptr<const Film> _film;
std::shared_ptr<dcp::OpenJPEGImage> _image;
- std::shared_ptr<const Image> _waveform;
+ std::shared_ptr<const dcpomatic::Image> _waveform;
bool _dirty = true;
bool _enabled = false;
int _component = 0;
using boost::thread;
using boost::optional;
using dcp::ArrayData;
+using namespace dcpomatic;
void
#include <iostream>
-using std::list;
using std::string;
using std::vector;
using std::make_shared;
-using std::shared_ptr;
+using namespace dcpomatic;
/* Check that DCPDecoder reuses old data when it should */
#if BOOST_VERSION >= 106100
using namespace boost::placeholders;
#endif
+using namespace dcpomatic;
static SNDFILE* ref = nullptr;
using std::make_shared;
using std::string;
using std::shared_ptr;
+using namespace dcpomatic;
BOOST_AUTO_TEST_CASE (ffmpeg_audio_test)
using std::list;
using std::make_shared;
using std::string;
+using namespace dcpomatic;
BOOST_AUTO_TEST_CASE (aligned_image_test)
using std::make_shared;
+using namespace dcpomatic;
BOOST_AUTO_TEST_CASE (low_bitrate_test)
using std::dynamic_pointer_cast;
using std::make_shared;
+using namespace dcpomatic;
BOOST_AUTO_TEST_CASE (overlap_video_test1)
using std::list;
using std::cout;
+using namespace dcpomatic;
/** @struct Case
#if BOOST_VERSION >= 106100
using namespace boost::placeholders;
#endif
+using namespace dcpomatic;
boost::filesystem::path
class Film;
-class Image;
+namespace dcpomatic {
+ class Image;
+}
class Log;
extern void check_ffmpeg (boost::filesystem::path, boost::filesystem::path, int audio_tolerance);
extern void check_image (boost::filesystem::path, boost::filesystem::path, double threshold = 4);
extern boost::filesystem::path test_film_dir (std::string);
-extern void write_image (std::shared_ptr<const Image> image, boost::filesystem::path file);
+extern void write_image (std::shared_ptr<const dcpomatic::Image> image, boost::filesystem::path file);
boost::filesystem::path dcp_file (std::shared_ptr<const Film> film, std::string prefix);
void check_one_frame (boost::filesystem::path dcp, int64_t index, boost::filesystem::path ref);
extern boost::filesystem::path subtitle_file (std::shared_ptr<Film> film);
#include <boost/test/unit_test.hpp>
-using std::min;
+using std::dynamic_pointer_cast;
+using std::make_shared;
using std::max;
+using std::min;
using std::pair;
+using std::shared_ptr;
using std::string;
-using std::dynamic_pointer_cast;
-using std::make_shared;
using boost::optional;
#if BOOST_VERSION >= 106100
using namespace boost::placeholders;
#endif
-using std::shared_ptr;
+using namespace dcpomatic;
static