From c28b3d6f168607aca9995282b96647eb64a26dc9 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 11 Feb 2014 15:39:30 +0000 Subject: [PATCH] Partial hacks to use of libdcp 1.0. --- src/lib/audio_mapping.cc | 14 +++++------ src/lib/audio_mapping.h | 4 +-- src/lib/cinema.cc | 2 +- src/lib/cinema.h | 4 +-- src/lib/colour_conversion.cc | 2 +- src/lib/config.cc | 8 +++--- src/lib/config.h | 6 ++--- src/lib/dcp_content_type.cc | 22 ++++++++--------- src/lib/dcp_content_type.h | 6 ++--- src/lib/dcp_video_frame.cc | 18 +++++--------- src/lib/dcp_video_frame.h | 8 +++--- src/lib/decoded.h | 6 ++--- src/lib/ffmpeg_decoder.cc | 10 ++++---- src/lib/ffmpeg_examiner.cc | 4 +-- src/lib/ffmpeg_examiner.h | 2 +- src/lib/film.cc | 32 ++++++++++++------------ src/lib/film.h | 12 ++++----- src/lib/filter_graph.cc | 6 ++--- src/lib/filter_graph.h | 6 ++--- src/lib/image.cc | 24 +++++++++--------- src/lib/image.h | 10 ++++---- src/lib/image_decoder.cc | 4 +-- src/lib/image_examiner.cc | 4 +-- src/lib/image_examiner.h | 4 +-- src/lib/job.cc | 2 +- src/lib/kdm.cc | 8 +++--- src/lib/player.cc | 16 ++++++------ src/lib/player.h | 11 ++++----- src/lib/render_subtitles.cc | 32 ++++++++++++------------ src/lib/render_subtitles.h | 4 +-- src/lib/server.cc | 4 +-- src/lib/subrip_decoder.cc | 13 +++++----- src/lib/subrip_subtitle.h | 2 +- src/lib/subtitle_decoder.cc | 2 +- src/lib/subtitle_decoder.h | 4 +-- src/lib/types.h | 2 +- src/lib/util.cc | 28 ++++++++++----------- src/lib/util.h | 5 ++-- src/lib/video_content.cc | 14 +++++------ src/lib/video_content.h | 8 +++--- src/lib/video_examiner.h | 2 +- src/lib/writer.cc | 48 +++++++++++++++++------------------- src/lib/writer.h | 26 +++++++++---------- src/tools/dcpomatic_kdm.cc | 4 +-- src/wx/audio_mapping_view.cc | 14 +++++------ src/wx/config_dialog.cc | 4 +-- src/wx/film_viewer.cc | 2 +- src/wx/film_viewer.h | 4 +-- src/wx/screen_dialog.cc | 8 +++--- src/wx/screen_dialog.h | 6 ++--- src/wx/video_panel.cc | 8 +++--- 51 files changed, 245 insertions(+), 254 deletions(-) diff --git a/src/lib/audio_mapping.cc b/src/lib/audio_mapping.cc index ae7702998..1db827046 100644 --- a/src/lib/audio_mapping.cc +++ b/src/lib/audio_mapping.cc @@ -68,11 +68,11 @@ AudioMapping::make_default () if (_content_channels == 1) { /* Mono -> Centre */ - set (0, libdcp::CENTRE, 1); + set (0, dcp::CENTRE, 1); } else { /* 1:1 mapping */ for (int i = 0; i < _content_channels; ++i) { - set (i, static_cast (i), 1); + set (i, static_cast (i), 1); } } } @@ -85,14 +85,14 @@ AudioMapping::AudioMapping (shared_ptr node, int state_version /* Old-style: on/off mapping */ list const c = node->node_children ("Map"); for (list::const_iterator i = c.begin(); i != c.end(); ++i) { - set ((*i)->number_child ("ContentIndex"), static_cast ((*i)->number_child ("DCP")), 1); + set ((*i)->number_child ("ContentIndex"), static_cast ((*i)->number_child ("DCP")), 1); } } else { list const c = node->node_children ("Gain"); for (list::const_iterator i = c.begin(); i != c.end(); ++i) { set ( (*i)->number_attribute ("Content"), - static_cast ((*i)->number_attribute ("DCP")), + static_cast ((*i)->number_attribute ("DCP")), lexical_cast ((*i)->content ()) ); } @@ -100,13 +100,13 @@ AudioMapping::AudioMapping (shared_ptr node, int state_version } void -AudioMapping::set (int c, libdcp::Channel d, float g) +AudioMapping::set (int c, dcp::Channel d, float g) { _gain[c][d] = g; } float -AudioMapping::get (int c, libdcp::Channel d) const +AudioMapping::get (int c, dcp::Channel d) const { return _gain[c][d]; } @@ -121,7 +121,7 @@ AudioMapping::as_xml (xmlpp::Node* node) const xmlpp::Element* t = node->add_child ("Gain"); t->set_attribute ("Content", lexical_cast (c)); t->set_attribute ("DCP", lexical_cast (d)); - t->add_child_text (lexical_cast (get (c, static_cast (d)))); + t->add_child_text (lexical_cast (get (c, static_cast (d)))); } } } diff --git a/src/lib/audio_mapping.h b/src/lib/audio_mapping.h index 26087bfff..d3f4c74ab 100644 --- a/src/lib/audio_mapping.h +++ b/src/lib/audio_mapping.h @@ -50,8 +50,8 @@ public: void make_default (); - void set (int, libdcp::Channel, float); - float get (int, libdcp::Channel) const; + void set (int, dcp::Channel, float); + float get (int, dcp::Channel) const; int content_channels () const { return _content_channels; diff --git a/src/lib/cinema.cc b/src/lib/cinema.cc index fca6b6afd..43a432239 100644 --- a/src/lib/cinema.cc +++ b/src/lib/cinema.cc @@ -70,7 +70,7 @@ Cinema::remove_screen (shared_ptr s) Screen::Screen (shared_ptr node) { name = node->string_child ("Name"); - certificate = shared_ptr (new libdcp::Certificate (node->string_child ("Certificate"))); + certificate = shared_ptr (new dcp::Certificate (node->string_child ("Certificate"))); } void diff --git a/src/lib/cinema.h b/src/lib/cinema.h index 40dc15ae0..b4a4551b0 100644 --- a/src/lib/cinema.h +++ b/src/lib/cinema.h @@ -29,7 +29,7 @@ namespace cxml { class Screen { public: - Screen (std::string const & n, boost::shared_ptr cert) + Screen (std::string const & n, boost::shared_ptr cert) : name (n) , certificate (cert) {} @@ -40,7 +40,7 @@ public: boost::shared_ptr cinema; std::string name; - boost::shared_ptr certificate; + boost::shared_ptr certificate; }; class Cinema : public boost::enable_shared_from_this diff --git a/src/lib/colour_conversion.cc b/src/lib/colour_conversion.cc index c3fa05426..88c4d635a 100644 --- a/src/lib/colour_conversion.cc +++ b/src/lib/colour_conversion.cc @@ -43,7 +43,7 @@ ColourConversion::ColourConversion () { for (int i = 0; i < 3; ++i) { for (int j = 0; j < 3; ++j) { - matrix (i, j) = libdcp::colour_matrix::srgb_to_xyz[i][j]; + matrix (i, j) = dcp::colour_matrix::srgb_to_xyz[i][j]; } } } diff --git a/src/lib/config.cc b/src/lib/config.cc index 30f85850d..2b30c0d80 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -78,9 +78,9 @@ Config::Config () _allowed_dcp_frame_rates.push_back (50); _allowed_dcp_frame_rates.push_back (60); - _colour_conversions.push_back (PresetColourConversion (_("sRGB"), 2.4, true, libdcp::colour_matrix::srgb_to_xyz, 2.6)); - _colour_conversions.push_back (PresetColourConversion (_("sRGB non-linearised"), 2.4, false, libdcp::colour_matrix::srgb_to_xyz, 2.6)); - _colour_conversions.push_back (PresetColourConversion (_("Rec. 709"), 2.2, false, libdcp::colour_matrix::rec709_to_xyz, 2.6)); + _colour_conversions.push_back (PresetColourConversion (_("sRGB"), 2.4, true, dcp::colour_matrix::srgb_to_xyz, 2.6)); + _colour_conversions.push_back (PresetColourConversion (_("sRGB non-linearised"), 2.4, false, dcp::colour_matrix::srgb_to_xyz, 2.6)); + _colour_conversions.push_back (PresetColourConversion (_("Rec. 709"), 2.2, false, dcp::colour_matrix::rec709_to_xyz, 2.6)); } void @@ -164,7 +164,7 @@ Config::read () /* Loading version 0 (before Rec. 709 was added as a preset). Add it in. */ - _colour_conversions.push_back (PresetColourConversion (_("Rec. 709"), 2.2, false, libdcp::colour_matrix::rec709_to_xyz, 2.6)); + _colour_conversions.push_back (PresetColourConversion (_("Rec. 709"), 2.2, false, dcp::colour_matrix::rec709_to_xyz, 2.6)); } list cin = f.node_children ("Cinema"); diff --git a/src/lib/config.h b/src/lib/config.h index d77969b3e..f5e7687bb 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -135,7 +135,7 @@ public: return _default_dcp_content_type; } - libdcp::XMLMetadata dcp_metadata () const { + dcp::XMLMetadata dcp_metadata () const { return _dcp_metadata; } @@ -249,7 +249,7 @@ public: _default_dcp_content_type = t; } - void set_dcp_metadata (libdcp::XMLMetadata m) { + void set_dcp_metadata (dcp::XMLMetadata m) { _dcp_metadata = m; } @@ -335,7 +335,7 @@ private: int _default_still_length; Ratio const * _default_container; DCPContentType const * _default_dcp_content_type; - libdcp::XMLMetadata _dcp_metadata; + dcp::XMLMetadata _dcp_metadata; int _default_j2k_bandwidth; int _default_audio_delay; std::vector _colour_conversions; diff --git a/src/lib/dcp_content_type.cc b/src/lib/dcp_content_type.cc index 82bd5fa01..b3a45e40e 100644 --- a/src/lib/dcp_content_type.cc +++ b/src/lib/dcp_content_type.cc @@ -30,7 +30,7 @@ using namespace std; vector DCPContentType::_dcp_content_types; -DCPContentType::DCPContentType (string p, libdcp::ContentKind k, string d) +DCPContentType::DCPContentType (string p, dcp::ContentKind k, string d) : _pretty_name (p) , _libdcp_kind (k) , _dci_name (d) @@ -41,16 +41,16 @@ DCPContentType::DCPContentType (string p, libdcp::ContentKind k, string d) void DCPContentType::setup_dcp_content_types () { - _dcp_content_types.push_back (new DCPContentType (_("Feature"), libdcp::FEATURE, N_("FTR"))); - _dcp_content_types.push_back (new DCPContentType (_("Short"), libdcp::SHORT, N_("SHR"))); - _dcp_content_types.push_back (new DCPContentType (_("Trailer"), libdcp::TRAILER, N_("TLR"))); - _dcp_content_types.push_back (new DCPContentType (_("Test"), libdcp::TEST, N_("TST"))); - _dcp_content_types.push_back (new DCPContentType (_("Transitional"), libdcp::TRANSITIONAL, N_("XSN"))); - _dcp_content_types.push_back (new DCPContentType (_("Rating"), libdcp::RATING, N_("RTG"))); - _dcp_content_types.push_back (new DCPContentType (_("Teaser"), libdcp::TEASER, N_("TSR"))); - _dcp_content_types.push_back (new DCPContentType (_("Policy"), libdcp::POLICY, N_("POL"))); - _dcp_content_types.push_back (new DCPContentType (_("Public Service Announcement"), libdcp::PUBLIC_SERVICE_ANNOUNCEMENT, N_("PSA"))); - _dcp_content_types.push_back (new DCPContentType (_("Advertisement"), libdcp::ADVERTISEMENT, N_("ADV"))); + _dcp_content_types.push_back (new DCPContentType (_("Feature"), dcp::FEATURE, N_("FTR"))); + _dcp_content_types.push_back (new DCPContentType (_("Short"), dcp::SHORT, N_("SHR"))); + _dcp_content_types.push_back (new DCPContentType (_("Trailer"), dcp::TRAILER, N_("TLR"))); + _dcp_content_types.push_back (new DCPContentType (_("Test"), dcp::TEST, N_("TST"))); + _dcp_content_types.push_back (new DCPContentType (_("Transitional"), dcp::TRANSITIONAL, N_("XSN"))); + _dcp_content_types.push_back (new DCPContentType (_("Rating"), dcp::RATING, N_("RTG"))); + _dcp_content_types.push_back (new DCPContentType (_("Teaser"), dcp::TEASER, N_("TSR"))); + _dcp_content_types.push_back (new DCPContentType (_("Policy"), dcp::POLICY, N_("POL"))); + _dcp_content_types.push_back (new DCPContentType (_("Public Service Announcement"), dcp::PUBLIC_SERVICE_ANNOUNCEMENT, N_("PSA"))); + _dcp_content_types.push_back (new DCPContentType (_("Advertisement"), dcp::ADVERTISEMENT, N_("ADV"))); } DCPContentType const * diff --git a/src/lib/dcp_content_type.h b/src/lib/dcp_content_type.h index 965c16347..09d22b8f7 100644 --- a/src/lib/dcp_content_type.h +++ b/src/lib/dcp_content_type.h @@ -34,14 +34,14 @@ class DCPContentType : public boost::noncopyable { public: - DCPContentType (std::string, libdcp::ContentKind, std::string); + DCPContentType (std::string, dcp::ContentKind, std::string); /** @return user-visible `pretty' name */ std::string pretty_name () const { return _pretty_name; } - libdcp::ContentKind libdcp_kind () const { + dcp::ContentKind libdcp_kind () const { return _libdcp_kind; } @@ -58,7 +58,7 @@ public: private: std::string _pretty_name; - libdcp::ContentKind _libdcp_kind; + dcp::ContentKind _libdcp_kind; std::string _dci_name; /** All available DCP content types */ diff --git a/src/lib/dcp_video_frame.cc b/src/lib/dcp_video_frame.cc index 78d73ad00..2842b6325 100644 --- a/src/lib/dcp_video_frame.cc +++ b/src/lib/dcp_video_frame.cc @@ -43,8 +43,6 @@ #include #include #include -#include -#include #include #include #include @@ -68,7 +66,7 @@ using std::stringstream; using std::cout; using boost::shared_ptr; using boost::lexical_cast; -using libdcp::Size; +using dcp::Size; #define DCI_COEFFICENT (48.0 / 52.37) @@ -120,12 +118,8 @@ DCPVideoFrame::DCPVideoFrame (shared_ptr image, shared_ptr DCPVideoFrame::encode_locally () { - shared_ptr in_lut; - if (_conversion.input_gamma_linearised) { - in_lut = libdcp::SRGBLinearisedGammaLUT::cache.get (12, _conversion.input_gamma); - } else { - in_lut = libdcp::GammaLUT::cache.get (12, _conversion.input_gamma); - } + shared_ptr in_lut; + in_lut = dcp::GammaLUT::cache.get (12, _conversion.input_gamma, _conversion.input_gamma_linearised); /* XXX: libdcp should probably use boost */ @@ -136,10 +130,10 @@ DCPVideoFrame::encode_locally () } } - shared_ptr xyz = libdcp::rgb_to_xyz ( + shared_ptr xyz = dcp::rgb_to_xyz ( _image, in_lut, - libdcp::GammaLUT::cache.get (16, 1 / _conversion.output_gamma), + dcp::GammaLUT::cache.get (16, 1 / _conversion.output_gamma, false), matrix ); @@ -397,7 +391,7 @@ EncodedData::write (shared_ptr film, int frame, Eyes eyes) const } void -EncodedData::write_info (shared_ptr film, int frame, Eyes eyes, libdcp::FrameInfo fin) const +EncodedData::write_info (shared_ptr film, int frame, Eyes eyes, dcp::FrameInfo fin) const { boost::filesystem::path const info = film->info_path (frame, eyes); FILE* h = fopen_boost (info, "w"); diff --git a/src/lib/dcp_video_frame.h b/src/lib/dcp_video_frame.h index 40f758c74..44cb23e1e 100644 --- a/src/lib/dcp_video_frame.h +++ b/src/lib/dcp_video_frame.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012 Carl Hetherington + Copyright (C) 2012-2014 Carl Hetherington Taken from code Copyright (C) 2010-2011 Terrence Meiczinger This program is free software; you can redistribute it and/or modify @@ -18,9 +18,7 @@ */ -#include -#include -#include +#include #include "util.h" /** @file src/dcp_video_frame.h @@ -49,7 +47,7 @@ public: void send (boost::shared_ptr socket); void write (boost::shared_ptr, int, Eyes) const; - void write_info (boost::shared_ptr, int, Eyes, libdcp::FrameInfo) const; + void write_info (boost::shared_ptr, int, Eyes, dcp::FrameInfo) const; /** @return data */ uint8_t* data () const { diff --git a/src/lib/decoded.h b/src/lib/decoded.h index f4ebe0dbd..db62dfbe1 100644 --- a/src/lib/decoded.h +++ b/src/lib/decoded.h @@ -20,7 +20,7 @@ #ifndef DCPOMATIC_LIB_DECODED_H #define DCPOMATIC_LIB_DECODED_H -#include +#include #include "types.h" #include "rect.h" #include "util.h" @@ -123,7 +123,7 @@ public: : dcp_time_to (0) {} - DecodedTextSubtitle (std::list s) + DecodedTextSubtitle (std::list s) : subs (s) {} @@ -138,7 +138,7 @@ public: dcp_time_to = rint (subs.front().out().to_ticks() * 4 * TIME_HZ / frc.speed_up) + offset; } - std::list subs; + std::list subs; DCPTime dcp_time_to; }; diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 55f4eb5c6..fff982489 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -56,7 +56,7 @@ using std::pair; using boost::shared_ptr; using boost::optional; using boost::dynamic_pointer_cast; -using libdcp::Size; +using dcp::Size; FFmpegDecoder::FFmpegDecoder (shared_ptr f, shared_ptr c, bool video, bool audio) : Decoder (f) @@ -474,7 +474,7 @@ FFmpegDecoder::decode_video_packet () shared_ptr graph; list >::iterator i = _filter_graphs.begin(); - while (i != _filter_graphs.end() && !(*i)->can_process (libdcp::Size (_frame->width, _frame->height), (AVPixelFormat) _frame->format)) { + while (i != _filter_graphs.end() && !(*i)->can_process (dcp::Size (_frame->width, _frame->height), (AVPixelFormat) _frame->format)) { ++i; } @@ -482,7 +482,7 @@ FFmpegDecoder::decode_video_packet () shared_ptr film = _film.lock (); assert (film); - graph.reset (new FilterGraph (_ffmpeg_content, libdcp::Size (_frame->width, _frame->height), (AVPixelFormat) _frame->format)); + graph.reset (new FilterGraph (_ffmpeg_content, dcp::Size (_frame->width, _frame->height), (AVPixelFormat) _frame->format)); _filter_graphs.push_back (graph); film->log()->log (String::compose (N_("New graph for %1x%2, pixel format %3"), _frame->width, _frame->height, _frame->format)); @@ -574,7 +574,7 @@ FFmpegDecoder::decode_subtitle_packet () /* Note RGBA is expressed little-endian, so the first byte in the word is R, second G, third B, fourth A. */ - shared_ptr image (new Image (PIX_FMT_RGBA, libdcp::Size (rect->w, rect->h), true)); + shared_ptr image (new Image (PIX_FMT_RGBA, dcp::Size (rect->w, rect->h), true)); /* Start of the first line in the subtitle */ uint8_t* sub_p = rect->pict.data[0]; @@ -596,7 +596,7 @@ FFmpegDecoder::decode_subtitle_packet () out_p += image->stride()[0] / sizeof (uint32_t); } - libdcp::Size const vs = _ffmpeg_content->video_size (); + dcp::Size const vs = _ffmpeg_content->video_size (); image_subtitle ( image, diff --git a/src/lib/ffmpeg_examiner.cc b/src/lib/ffmpeg_examiner.cc index 38dd678bb..86dec9a8f 100644 --- a/src/lib/ffmpeg_examiner.cc +++ b/src/lib/ffmpeg_examiner.cc @@ -127,10 +127,10 @@ FFmpegExaminer::video_frame_rate () const return av_q2d (s->r_frame_rate); } -libdcp::Size +dcp::Size FFmpegExaminer::video_size () const { - return libdcp::Size (video_codec_context()->width, video_codec_context()->height); + return dcp::Size (video_codec_context()->width, video_codec_context()->height); } /** @return Length (in video frames) according to our content's header */ diff --git a/src/lib/ffmpeg_examiner.h b/src/lib/ffmpeg_examiner.h index 2dd8b2e34..40d7dbf1d 100644 --- a/src/lib/ffmpeg_examiner.h +++ b/src/lib/ffmpeg_examiner.h @@ -30,7 +30,7 @@ public: FFmpegExaminer (boost::shared_ptr); float video_frame_rate () const; - libdcp::Size video_size () const; + dcp::Size video_size () const; VideoFrame video_length () const; std::vector > subtitle_streams () const { diff --git a/src/lib/film.cc b/src/lib/film.cc index 67f795a6c..774c1b392 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -78,8 +78,8 @@ using boost::to_upper_copy; using boost::ends_with; using boost::starts_with; using boost::optional; -using libdcp::Size; -using libdcp::Signer; +using dcp::Size; +using dcp::Signer; /* 5 -> 6 * AudioMapping XML changed. @@ -420,7 +420,7 @@ Film::read_metadata () _sequence_video = f.bool_child ("SequenceVideo"); _three_d = f.bool_child ("ThreeD"); _interop = f.bool_child ("Interop"); - _key = libdcp::Key (f.string_child ("Key")); + _key = dcp::Key (f.string_child ("Key")); _playlist->set_from_xml (shared_from_this(), f.node_child ("Playlist"), version); _dirty = false; @@ -746,7 +746,7 @@ Film::j2c_path (int f, Eyes e, bool t) const return file (p); } -/** @return List of subdirectories (not full paths) containing DCPs that can be successfully libdcp::DCP::read() */ +/** @return List of subdirectories (not full paths) containing DCPs that can be successfully dcp::DCP::read() */ list Film::dcps () const { @@ -760,7 +760,7 @@ Film::dcps () const ) { try { - libdcp::DCP dcp (*i); + dcp::DCP dcp (*i); dcp.read (); out.push_back (i->path().leaf ()); } catch (...) { @@ -936,23 +936,23 @@ Film::set_sequence_video (bool s) signal_changed (SEQUENCE_VIDEO); } -libdcp::Size +dcp::Size Film::full_frame () const { switch (_resolution) { case RESOLUTION_2K: - return libdcp::Size (2048, 1080); + return dcp::Size (2048, 1080); case RESOLUTION_4K: - return libdcp::Size (4096, 2160); + return dcp::Size (4096, 2160); } assert (false); - return libdcp::Size (); + return dcp::Size (); } -libdcp::KDM +dcp::KDM Film::make_kdm ( - shared_ptr target, + shared_ptr target, boost::filesystem::path dcp_dir, boost::posix_time::ptime from, boost::posix_time::ptime until @@ -960,7 +960,7 @@ Film::make_kdm ( { shared_ptr signer = make_signer (); - libdcp::DCP dcp (dir (dcp_dir.string ())); + dcp::DCP dcp (dir (dcp_dir.string ())); try { dcp.read (); @@ -970,14 +970,14 @@ Film::make_kdm ( time_t now = time (0); struct tm* tm = localtime (&now); - string const issue_date = libdcp::tm_to_string (tm); + string const issue_date = dcp::tm_to_string (tm); dcp.cpls().front()->set_mxf_keys (key ()); - return libdcp::KDM (dcp.cpls().front(), signer, target, from, until, "DCP-o-matic", issue_date); + return dcp::KDM (dcp.cpls().front(), signer, target, from, until, "DCP-o-matic", issue_date); } -list +list Film::make_kdms ( list > screens, boost::filesystem::path dcp, @@ -985,7 +985,7 @@ Film::make_kdms ( boost::posix_time::ptime until ) const { - list kdms; + list kdms; for (list >::iterator i = screens.begin(); i != screens.end(); ++i) { kdms.push_back (make_kdm ((*i)->certificate, dcp, from, until)); diff --git a/src/lib/film.h b/src/lib/film.h index 5d83ec6ed..68916c7b0 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -94,7 +94,7 @@ public: return _dirty; } - libdcp::Size full_frame () const; + dcp::Size full_frame () const; std::list dcps () const; @@ -119,22 +119,22 @@ public: VideoFrame best_video_frame_rate () const; FrameRateChange active_frame_rate_change (DCPTime) const; - libdcp::KDM + dcp::KDM make_kdm ( - boost::shared_ptr target, + boost::shared_ptr target, boost::filesystem::path dcp, boost::posix_time::ptime from, boost::posix_time::ptime until ) const; - std::list make_kdms ( + std::list make_kdms ( std::list >, boost::filesystem::path dcp, boost::posix_time::ptime from, boost::posix_time::ptime until ) const; - libdcp::Key key () const { + dcp::Key key () const { return _key; } @@ -323,7 +323,7 @@ private: bool _three_d; bool _sequence_video; bool _interop; - libdcp::Key _key; + dcp::Key _key; /** true if our state has changed since we last saved it */ mutable bool _dirty; diff --git a/src/lib/filter_graph.cc b/src/lib/filter_graph.cc index 7c006aa58..48d94e175 100644 --- a/src/lib/filter_graph.cc +++ b/src/lib/filter_graph.cc @@ -45,14 +45,14 @@ using std::make_pair; using std::cout; using boost::shared_ptr; using boost::weak_ptr; -using libdcp::Size; +using dcp::Size; /** Construct a FilterGraph for the settings in a piece of content. * @param content Content. * @param s Size of the images to process. * @param p Pixel format of the images to process. */ -FilterGraph::FilterGraph (shared_ptr content, libdcp::Size s, AVPixelFormat p) +FilterGraph::FilterGraph (shared_ptr content, dcp::Size s, AVPixelFormat p) : _buffer_src_context (0) , _buffer_sink_context (0) , _size (s) @@ -160,7 +160,7 @@ FilterGraph::process (AVFrame* frame) * @return true if this chain can process images with `s' and `p', otherwise false. */ bool -FilterGraph::can_process (libdcp::Size s, AVPixelFormat p) const +FilterGraph::can_process (dcp::Size s, AVPixelFormat p) const { return (_size == s && _pixel_format == p); } diff --git a/src/lib/filter_graph.h b/src/lib/filter_graph.h index 9b403c2bc..45ad5d998 100644 --- a/src/lib/filter_graph.h +++ b/src/lib/filter_graph.h @@ -36,16 +36,16 @@ class FFmpegContent; class FilterGraph : public boost::noncopyable { public: - FilterGraph (boost::shared_ptr content, libdcp::Size s, AVPixelFormat p); + FilterGraph (boost::shared_ptr content, dcp::Size s, AVPixelFormat p); ~FilterGraph (); - bool can_process (libdcp::Size s, AVPixelFormat p) const; + bool can_process (dcp::Size s, AVPixelFormat p) const; std::list, int64_t> > process (AVFrame * frame); private: AVFilterContext* _buffer_src_context; AVFilterContext* _buffer_sink_context; - libdcp::Size _size; ///< size of the images that this chain can process + dcp::Size _size; ///< size of the images that this chain can process AVPixelFormat _pixel_format; ///< pixel format of the images that this chain can process AVFrame* _frame; }; diff --git a/src/lib/image.cc b/src/lib/image.cc index 78e8bbb2a..b706f7fdc 100644 --- a/src/lib/image.cc +++ b/src/lib/image.cc @@ -37,7 +37,7 @@ using std::string; using std::min; using std::cout; using boost::shared_ptr; -using libdcp::Size; +using dcp::Size; int Image::line_factor (int n) const @@ -81,7 +81,7 @@ Image::components () const /** Crop this image, scale it to `inter_size' and then place it in a black frame of `out_size' */ shared_ptr -Image::crop_scale_window (Crop crop, libdcp::Size inter_size, libdcp::Size out_size, Scaler const * scaler, AVPixelFormat out_format, bool out_aligned) const +Image::crop_scale_window (Crop crop, dcp::Size inter_size, dcp::Size out_size, Scaler const * scaler, AVPixelFormat out_format, bool out_aligned) const { assert (scaler); /* Empirical testing suggests that sws_scale() will crash if @@ -92,7 +92,7 @@ Image::crop_scale_window (Crop crop, libdcp::Size inter_size, libdcp::Size out_s shared_ptr out (new Image (out_format, out_size, out_aligned)); out->make_black (); - libdcp::Size cropped_size = crop.apply (size ()); + dcp::Size cropped_size = crop.apply (size ()); struct SwsContext* scale_context = sws_getContext ( cropped_size.width, cropped_size.height, pixel_format(), @@ -125,7 +125,7 @@ Image::crop_scale_window (Crop crop, libdcp::Size inter_size, libdcp::Size out_s } shared_ptr -Image::scale (libdcp::Size out_size, Scaler const * scaler, AVPixelFormat out_format, bool out_aligned) const +Image::scale (dcp::Size out_size, Scaler const * scaler, AVPixelFormat out_format, bool out_aligned) const { assert (scaler); /* Empirical testing suggests that sws_scale() will crash if @@ -201,7 +201,7 @@ Image::post_process (string pp, bool aligned) const shared_ptr Image::crop (Crop crop, bool aligned) const { - libdcp::Size cropped_size = crop.apply (size ()); + dcp::Size cropped_size = crop.apply (size ()); shared_ptr out (new Image (pixel_format(), cropped_size, aligned)); for (int c = 0; c < components(); ++c) { @@ -498,8 +498,8 @@ Image::bytes_per_pixel (int c) const * @param p Pixel format. * @param s Size in pixels. */ -Image::Image (AVPixelFormat p, libdcp::Size s, bool aligned) - : libdcp::Image (s) +Image::Image (AVPixelFormat p, dcp::Size s, bool aligned) + : dcp::Image (s) , _pixel_format (p) , _aligned (aligned) { @@ -536,7 +536,7 @@ Image::allocate () } Image::Image (Image const & other) - : libdcp::Image (other) + : dcp::Image (other) , _pixel_format (other._pixel_format) , _aligned (other._aligned) { @@ -554,7 +554,7 @@ Image::Image (Image const & other) } Image::Image (AVFrame* frame) - : libdcp::Image (libdcp::Size (frame->width, frame->height)) + : dcp::Image (dcp::Size (frame->width, frame->height)) , _pixel_format (static_cast (frame->format)) , _aligned (true) { @@ -573,7 +573,7 @@ Image::Image (AVFrame* frame) } Image::Image (shared_ptr other, bool aligned) - : libdcp::Image (other) + : dcp::Image (other) , _pixel_format (other->_pixel_format) , _aligned (aligned) { @@ -606,7 +606,7 @@ Image::operator= (Image const & other) void Image::swap (Image & other) { - libdcp::Image::swap (other); + dcp::Image::swap (other); std::swap (_pixel_format, other._pixel_format); @@ -649,7 +649,7 @@ Image::stride () const return _stride; } -libdcp::Size +dcp::Size Image::size () const { return _size; diff --git a/src/lib/image.h b/src/lib/image.h index b12db3a14..1c096be71 100644 --- a/src/lib/image.h +++ b/src/lib/image.h @@ -37,10 +37,10 @@ extern "C" { class Scaler; -class Image : public libdcp::Image +class Image : public dcp::Image { public: - Image (AVPixelFormat, libdcp::Size, bool); + Image (AVPixelFormat, dcp::Size, bool); Image (AVFrame *); Image (Image const &); Image (boost::shared_ptr, bool); @@ -50,18 +50,18 @@ public: uint8_t ** data () const; int * line_size () const; int * stride () const; - libdcp::Size size () const; + dcp::Size size () const; bool aligned () const; int components () const; int line_factor (int) const; int lines (int) const; - boost::shared_ptr scale (libdcp::Size, Scaler const *, AVPixelFormat, bool aligned) const; + boost::shared_ptr scale (dcp::Size, Scaler const *, AVPixelFormat, bool aligned) const; boost::shared_ptr post_process (std::string, bool aligned) const; boost::shared_ptr crop (Crop c, bool aligned) const; - boost::shared_ptr crop_scale_window (Crop c, libdcp::Size, libdcp::Size, Scaler const *, AVPixelFormat, bool aligned) const; + boost::shared_ptr crop_scale_window (Crop c, dcp::Size, dcp::Size, Scaler const *, AVPixelFormat, bool aligned) const; void make_black (); void alpha_blend (boost::shared_ptr image, Position pos); diff --git a/src/lib/image_decoder.cc b/src/lib/image_decoder.cc index 204849ecf..d8d551ef7 100644 --- a/src/lib/image_decoder.cc +++ b/src/lib/image_decoder.cc @@ -30,7 +30,7 @@ using std::cout; using boost::shared_ptr; -using libdcp::Size; +using dcp::Size; ImageDecoder::ImageDecoder (shared_ptr f, shared_ptr c) : Decoder (f) @@ -62,7 +62,7 @@ ImageDecoder::pass () throw OpenFileError (path); } - libdcp::Size size (magick_image->columns(), magick_image->rows()); + dcp::Size size (magick_image->columns(), magick_image->rows()); _image.reset (new Image (PIX_FMT_RGB24, size, true)); diff --git a/src/lib/image_examiner.cc b/src/lib/image_examiner.cc index 12fe2b8a6..47b220da7 100644 --- a/src/lib/image_examiner.cc +++ b/src/lib/image_examiner.cc @@ -43,7 +43,7 @@ ImageExaminer::ImageExaminer (shared_ptr film, shared_ptrpath(0).string()); - _video_size = libdcp::Size (image->columns(), image->rows()); + _video_size = dcp::Size (image->columns(), image->rows()); delete image; if (content->still ()) { @@ -53,7 +53,7 @@ ImageExaminer::ImageExaminer (shared_ptr film, shared_ptr, boost::shared_ptr, boost::shared_ptr); float video_frame_rate () const; - libdcp::Size video_size () const; + dcp::Size video_size () const; VideoFrame video_length () const { return _video_length; } @@ -39,6 +39,6 @@ public: private: boost::weak_ptr _film; boost::shared_ptr _image_content; - boost::optional _video_size; + boost::optional _video_size; VideoFrame _video_length; }; diff --git a/src/lib/job.cc b/src/lib/job.cc index b543a043f..ce97ba2b2 100644 --- a/src/lib/job.cc +++ b/src/lib/job.cc @@ -66,7 +66,7 @@ Job::run_wrapper () run (); - } catch (libdcp::FileError& e) { + } catch (dcp::FileError& e) { string m = String::compose (_("An error occurred whilst handling the file %1."), boost::filesystem::path (e.filename()).leaf()); diff --git a/src/lib/kdm.cc b/src/lib/kdm.cc index cf551285b..35969a224 100644 --- a/src/lib/kdm.cc +++ b/src/lib/kdm.cc @@ -36,13 +36,13 @@ using boost::shared_ptr; struct ScreenKDM { - ScreenKDM (shared_ptr s, libdcp::KDM k) + ScreenKDM (shared_ptr s, dcp::KDM k) : screen (s) , kdm (k) {} shared_ptr screen; - libdcp::KDM kdm; + dcp::KDM kdm; }; static string @@ -107,12 +107,12 @@ make_screen_kdms ( boost::posix_time::ptime to ) { - list kdms = film->make_kdms (screens, dcp, from, to); + list kdms = film->make_kdms (screens, dcp, from, to); list screen_kdms; list >::iterator i = screens.begin (); - list::iterator j = kdms.begin (); + list::iterator j = kdms.begin (); while (i != screens.end() && j != kdms.end ()) { screen_kdms.push_back (ScreenKDM (*i, *j)); ++i; diff --git a/src/lib/player.cc b/src/lib/player.cc index 48c75078e..a8ba7cc53 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -270,7 +270,7 @@ Player::emit_video (weak_ptr weak_piece, shared_ptr video) FrameRateChange frc (content->video_frame_rate(), _film->video_frame_rate()); float const ratio = content->ratio() ? content->ratio()->ratio() : content->video_size_after_crop().ratio(); - libdcp::Size image_size = fit_ratio_within (ratio, _video_container_size); + dcp::Size image_size = fit_ratio_within (ratio, _video_container_size); if (_approximate_size) { image_size.width &= ~3; image_size.height &= ~3; @@ -346,12 +346,12 @@ Player::emit_audio (weak_ptr weak_piece, shared_ptr audio) AudioMapping map = content->audio_mapping (); for (int i = 0; i < map.content_channels(); ++i) { for (int j = 0; j < _film->audio_channels(); ++j) { - if (map.get (i, static_cast (j)) > 0) { + if (map.get (i, static_cast (j)) > 0) { dcp_mapped->accumulate_channel ( audio->data.get(), i, - static_cast (j), - map.get (i, static_cast (j)) + static_cast (j), + map.get (i, static_cast (j)) ); } } @@ -583,7 +583,7 @@ Player::playlist_changed () } void -Player::set_video_container_size (libdcp::Size s) +Player::set_video_container_size (dcp::Size s) { _video_container_size = s; @@ -658,7 +658,7 @@ Player::update_subtitle_from_image () assert (sc); dcpomatic::Rect in_rect = _image_subtitle.subtitle->rect; - libdcp::Size scaled_size; + dcp::Size scaled_size; in_rect.x += sc->subtitle_x_offset (); in_rect.y += sc->subtitle_y_offset (); @@ -731,8 +731,8 @@ Player::set_approximate_size () PlayerImage::PlayerImage ( shared_ptr in, Crop crop, - libdcp::Size inter_size, - libdcp::Size out_size, + dcp::Size inter_size, + dcp::Size out_size, Scaler const * scaler ) : _in (in) diff --git a/src/lib/player.h b/src/lib/player.h index 377e8bd18..1ef1f58b7 100644 --- a/src/lib/player.h +++ b/src/lib/player.h @@ -23,7 +23,6 @@ #include #include #include -#include #include "playlist.h" #include "content.h" #include "film.h" @@ -46,7 +45,7 @@ class Image; class PlayerImage { public: - PlayerImage (boost::shared_ptr, Crop, libdcp::Size, libdcp::Size, Scaler const *); + PlayerImage (boost::shared_ptr, Crop, dcp::Size, dcp::Size, Scaler const *); void set_subtitle (boost::shared_ptr, Position); @@ -55,8 +54,8 @@ public: private: boost::shared_ptr _in; Crop _crop; - libdcp::Size _inter_size; - libdcp::Size _out_size; + dcp::Size _inter_size; + dcp::Size _out_size; Scaler const * _scaler; boost::shared_ptr _subtitle_image; Position _subtitle_position; @@ -113,7 +112,7 @@ public: return _video_position; } - void set_video_container_size (libdcp::Size); + void set_video_container_size (dcp::Size); void set_approximate_size (); bool repeat_last_video (); @@ -175,7 +174,7 @@ private: AudioMerger _audio_merger; - libdcp::Size _video_container_size; + dcp::Size _video_container_size; boost::shared_ptr _black_frame; struct { diff --git a/src/lib/render_subtitles.cc b/src/lib/render_subtitles.cc index 630681761..c18cb4272 100644 --- a/src/lib/render_subtitles.cc +++ b/src/lib/render_subtitles.cc @@ -32,14 +32,14 @@ using boost::shared_ptr; using boost::optional; static int -calculate_position (libdcp::VAlign v_align, double v_position, int target_height, int offset) +calculate_position (dcp::VAlign v_align, double v_position, int target_height, int offset) { switch (v_align) { - case libdcp::TOP: + case dcp::TOP: return (v_position / 100) * target_height - offset; - case libdcp::CENTER: + case dcp::CENTER: return (0.5 + v_position / 100) * target_height - offset; - case libdcp::BOTTOM: + case dcp::BOTTOM: return (1.0 - v_position / 100) * target_height - offset; } @@ -47,7 +47,7 @@ calculate_position (libdcp::VAlign v_align, double v_position, int target_height } void -render_subtitles (list subtitles, libdcp::Size target, shared_ptr& image, Position& position) +render_subtitles (list subtitles, dcp::Size target, shared_ptr& image, Position& position) { if (subtitles.empty ()) { image.reset (); @@ -57,7 +57,7 @@ render_subtitles (list subtitles, libdcp::Size target, shared_ /* Estimate height that the subtitle image needs to be */ optional top; optional bottom; - for (list::const_iterator i = subtitles.begin(); i != subtitles.end(); ++i) { + for (list::const_iterator i = subtitles.begin(); i != subtitles.end(); ++i) { int const b = calculate_position (i->v_align(), i->v_position(), target.height, 0); int const t = b - i->size() * target.height / (11 * 72); @@ -68,7 +68,7 @@ render_subtitles (list subtitles, libdcp::Size target, shared_ top = top.get() - 32; bottom = bottom.get() + 32; - image.reset (new Image (PIX_FMT_RGBA, libdcp::Size (target.width, bottom.get() - top.get ()), false)); + image.reset (new Image (PIX_FMT_RGBA, dcp::Size (target.width, bottom.get() - top.get ()), false)); image->make_black (); Cairo::RefPtr surface = Cairo::ImageSurface::create ( @@ -87,7 +87,7 @@ render_subtitles (list subtitles, libdcp::Size target, shared_ context->set_line_width (1); - for (list::const_iterator i = subtitles.begin(); i != subtitles.end(); ++i) { + for (list::const_iterator i = subtitles.begin(); i != subtitles.end(); ++i) { string f = i->font (); if (f.empty ()) { f = "Arial"; @@ -104,9 +104,9 @@ render_subtitles (list subtitles, libdcp::Size target, shared_ /* XXX */ float fade_factor = 1; #if 0 - libdcp::Time now (time * 1000 / (4 * TIME_HZ)); - libdcp::Time end_fade_up = i->in() + i->fade_up_time (); - libdcp::Time start_fade_down = i->out() - i->fade_down_time (); + dcp::Time now (time * 1000 / (4 * TIME_HZ)); + dcp::Time end_fade_up = i->in() + i->fade_up_time (); + dcp::Time start_fade_down = i->out() - i->fade_down_time (); if (now < end_fade_up) { fade_factor = (now - i->in()) / i->fade_up_time(); } else if (now > start_fade_down) { @@ -121,9 +121,9 @@ render_subtitles (list subtitles, libdcp::Size target, shared_ int const x = 0; int const y = calculate_position (i->v_align (), i->v_position (), target.height, (layout->get_baseline() / PANGO_SCALE) + top.get ()); - if (i->effect() == libdcp::SHADOW) { + if (i->effect() == dcp::SHADOW) { /* Drop-shadow effect */ - libdcp::Color const ec = i->effect_color (); + dcp::Color const ec = i->effect_color (); context->set_source_rgba (float(ec.r) / 255, float(ec.g) / 255, float(ec.b) / 255, fade_factor); context->move_to (x + 4, y + 4); layout->add_to_cairo_context (context); @@ -132,15 +132,15 @@ render_subtitles (list subtitles, libdcp::Size target, shared_ /* The actual subtitle */ context->move_to (x, y); - libdcp::Color const c = i->color (); + dcp::Color const c = i->color (); context->set_source_rgba (float(c.r) / 255, float(c.g) / 255, float(c.b) / 255, fade_factor); layout->add_to_cairo_context (context); context->fill (); - if (i->effect() == libdcp::BORDER) { + if (i->effect() == dcp::BORDER) { /* Border effect */ context->move_to (x, y); - libdcp::Color ec = i->effect_color (); + dcp::Color ec = i->effect_color (); context->set_source_rgba (float(ec.r) / 255, float(ec.g) / 255, float(ec.b) / 255, fade_factor); layout->add_to_cairo_context (context); context->stroke (); diff --git a/src/lib/render_subtitles.h b/src/lib/render_subtitles.h index 22648387e..895a6fd25 100644 --- a/src/lib/render_subtitles.h +++ b/src/lib/render_subtitles.h @@ -17,11 +17,11 @@ */ -#include +#include #include #include "position.h" class Image; void -render_subtitles (std::list, libdcp::Size, boost::shared_ptr &, Position &); +render_subtitles (std::list, dcp::Size, boost::shared_ptr &, Position &); diff --git a/src/lib/server.cc b/src/lib/server.cc index 1f3f61e42..bf7541c33 100644 --- a/src/lib/server.cc +++ b/src/lib/server.cc @@ -57,7 +57,7 @@ using boost::bind; using boost::scoped_array; using boost::optional; using boost::lexical_cast; -using libdcp::Size; +using dcp::Size; Server::Server (shared_ptr log, bool verbose) : _log (log) @@ -85,7 +85,7 @@ Server::process (shared_ptr socket, struct timeval& after_read, struct t return -1; } - libdcp::Size size ( + dcp::Size size ( xml->number_child ("Width"), xml->number_child ("Height") ); diff --git a/src/lib/subrip_decoder.cc b/src/lib/subrip_decoder.cc index aecee4e3e..6639cee7c 100644 --- a/src/lib/subrip_decoder.cc +++ b/src/lib/subrip_decoder.cc @@ -17,6 +17,7 @@ */ +#include #include "subrip_decoder.h" using std::list; @@ -38,21 +39,21 @@ SubRipDecoder::pass () return true; } - list out; + list out; for (list::const_iterator i = _subtitles[_next].pieces.begin(); i != _subtitles[_next].pieces.end(); ++i) { out.push_back ( - libdcp::Subtitle ( + dcp::SubtitleString ( "Arial", i->italic, - libdcp::Color (255, 255, 255), + dcp::Color (255, 255, 255), 72, _subtitles[_next].from, _subtitles[_next].to, 0.9, - libdcp::BOTTOM, + dcp::BOTTOM, i->text, - libdcp::NONE, - libdcp::Color (255, 255, 255), + dcp::NONE, + dcp::Color (255, 255, 255), 0, 0 ) diff --git a/src/lib/subrip_subtitle.h b/src/lib/subrip_subtitle.h index f730ee492..2af5f66ae 100644 --- a/src/lib/subrip_subtitle.h +++ b/src/lib/subrip_subtitle.h @@ -36,7 +36,7 @@ struct SubRipSubtitlePiece bool bold; bool italic; bool underline; - libdcp::Color color; + dcp::Color color; }; struct SubRipSubtitle diff --git a/src/lib/subtitle_decoder.cc b/src/lib/subtitle_decoder.cc index e5cadb7b4..ce48e6619 100644 --- a/src/lib/subtitle_decoder.cc +++ b/src/lib/subtitle_decoder.cc @@ -41,7 +41,7 @@ SubtitleDecoder::image_subtitle (shared_ptr image, dcpomatic::Rect s) +SubtitleDecoder::text_subtitle (list s) { _pending.push_back (shared_ptr (new DecodedTextSubtitle (s))); } diff --git a/src/lib/subtitle_decoder.h b/src/lib/subtitle_decoder.h index 82662d192..6a962ca47 100644 --- a/src/lib/subtitle_decoder.h +++ b/src/lib/subtitle_decoder.h @@ -21,7 +21,7 @@ #define DCPOMATIC_SUBTITLE_DECODER_H #include -#include +#include #include "decoder.h" #include "rect.h" #include "types.h" @@ -38,7 +38,7 @@ public: protected: void image_subtitle (boost::shared_ptr, dcpomatic::Rect, ContentTime, ContentTime); - void text_subtitle (std::list); + void text_subtitle (std::list); }; #endif diff --git a/src/lib/types.h b/src/lib/types.h index 924279c25..a1b40f299 100644 --- a/src/lib/types.h +++ b/src/lib/types.h @@ -98,7 +98,7 @@ struct Crop /** Number of pixels to remove from the bottom */ int bottom; - libdcp::Size apply (libdcp::Size s, int minimum = 4) const { + dcp::Size apply (dcp::Size s, int minimum = 4) const { s.width -= left + right; s.height -= top + bottom; diff --git a/src/lib/util.cc b/src/lib/util.cc index 418d7b3e0..fd3a318b0 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -101,7 +101,7 @@ using boost::shared_ptr; using boost::thread; using boost::lexical_cast; using boost::optional; -using libdcp::Size; +using dcp::Size; static boost::thread::id ui_thread; static boost::filesystem::path backtrace_file; @@ -251,7 +251,7 @@ dependency_version_summary () << N_("libswscale ") << ffmpeg_version_to_string (swscale_version()) << N_(", ") << MagickVersion << N_(", ") << N_("libssh ") << ssh_version (0) << N_(", ") - << N_("libdcp ") << libdcp::version << N_(" git ") << libdcp::git_commit; + << N_("libdcp ") << dcp::version << N_(" git ") << dcp::git_commit; return s.str (); } @@ -343,7 +343,7 @@ dcpomatic_setup () set_terminate (terminate); Pango::init (); - libdcp::init (); + dcp::init (); Ratio::setup_ratios (); DCPContentType::setup_dcp_content_types (); @@ -889,7 +889,7 @@ tidy_for_filename (string f) return t; } -shared_ptr +shared_ptr make_signer () { boost::filesystem::path const sd = Config::instance()->signer_chain_directory (); @@ -909,47 +909,47 @@ make_signer () if (!boost::filesystem::exists (p)) { boost::filesystem::remove_all (sd); boost::filesystem::create_directories (sd); - libdcp::make_signer_chain (sd, openssl_path ()); + dcp::make_signer_chain (sd, openssl_path ()); break; } ++i; } - libdcp::CertificateChain chain; + dcp::CertificateChain chain; { boost::filesystem::path p (sd); p /= "ca.self-signed.pem"; - chain.add (shared_ptr (new libdcp::Certificate (p))); + chain.add (shared_ptr (new dcp::Certificate (p))); } { boost::filesystem::path p (sd); p /= "intermediate.signed.pem"; - chain.add (shared_ptr (new libdcp::Certificate (p))); + chain.add (shared_ptr (new dcp::Certificate (p))); } { boost::filesystem::path p (sd); p /= "leaf.signed.pem"; - chain.add (shared_ptr (new libdcp::Certificate (p))); + chain.add (shared_ptr (new dcp::Certificate (p))); } boost::filesystem::path signer_key (sd); signer_key /= "leaf.key"; - return shared_ptr (new libdcp::Signer (chain, signer_key)); + return shared_ptr (new dcp::Signer (chain, signer_key)); } -libdcp::Size -fit_ratio_within (float ratio, libdcp::Size full_frame) +dcp::Size +fit_ratio_within (float ratio, dcp::Size full_frame) { if (ratio < full_frame.ratio ()) { - return libdcp::Size (rint (full_frame.height * ratio), full_frame.height); + return dcp::Size (rint (full_frame.height * ratio), full_frame.height); } - return libdcp::Size (full_frame.width, rint (full_frame.width / ratio)); + return dcp::Size (full_frame.width, rint (full_frame.width / ratio)); } DCPTime diff --git a/src/lib/util.h b/src/lib/util.h index d3e6a67de..b89c71eee 100644 --- a/src/lib/util.h +++ b/src/lib/util.h @@ -32,6 +32,7 @@ #include #include #include +#include extern "C" { #include #include @@ -76,8 +77,8 @@ extern bool valid_image_file (boost::filesystem::path); extern boost::filesystem::path mo_path (); #endif extern std::string tidy_for_filename (std::string); -extern boost::shared_ptr make_signer (); -extern libdcp::Size fit_ratio_within (float ratio, libdcp::Size); +extern boost::shared_ptr make_signer (); +extern dcp::Size fit_ratio_within (float ratio, dcp::Size); struct FrameRateChange { diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc index bf13e1c76..80515ca4d 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -166,14 +166,14 @@ VideoContent::as_xml (xmlpp::Node* node) const void VideoContent::setup_default_colour_conversion () { - _colour_conversion = PresetColourConversion (_("sRGB"), 2.4, true, libdcp::colour_matrix::srgb_to_xyz, 2.6).conversion; + _colour_conversion = PresetColourConversion (_("sRGB"), 2.4, true, dcp::colour_matrix::srgb_to_xyz, 2.6).conversion; } void VideoContent::take_from_video_examiner (shared_ptr d) { /* These examiner calls could call other content methods which take a lock on the mutex */ - libdcp::Size const vs = d->video_size (); + dcp::Size const vs = d->video_size (); float const vfr = d->video_frame_rate (); { @@ -318,17 +318,17 @@ VideoContent::technical_summary () const return String::compose ("video: length %1, size %2x%3, rate %4", video_length(), video_size().width, video_size().height, video_frame_rate()); } -libdcp::Size +dcp::Size VideoContent::video_size_after_3d_split () const { - libdcp::Size const s = video_size (); + dcp::Size const s = video_size (); switch (video_frame_type ()) { case VIDEO_FRAME_TYPE_2D: return s; case VIDEO_FRAME_TYPE_3D_LEFT_RIGHT: - return libdcp::Size (s.width / 2, s.height); + return dcp::Size (s.width / 2, s.height); case VIDEO_FRAME_TYPE_3D_TOP_BOTTOM: - return libdcp::Size (s.width, s.height / 2); + return dcp::Size (s.width, s.height / 2); } assert (false); @@ -346,7 +346,7 @@ VideoContent::set_colour_conversion (ColourConversion c) } /** @return Video size after 3D split and crop */ -libdcp::Size +dcp::Size VideoContent::video_size_after_crop () const { return crop().apply (video_size_after_3d_split ()); diff --git a/src/lib/video_content.h b/src/lib/video_content.h index 8d901cbcd..96572bbd9 100644 --- a/src/lib/video_content.h +++ b/src/lib/video_content.h @@ -58,7 +58,7 @@ public: return _video_length; } - libdcp::Size video_size () const { + dcp::Size video_size () const { boost::mutex::scoped_lock lm (_mutex); return _video_size; } @@ -120,8 +120,8 @@ public: return _colour_conversion; } - libdcp::Size video_size_after_3d_split () const; - libdcp::Size video_size_after_crop () const; + dcp::Size video_size_after_3d_split () const; + dcp::Size video_size_after_crop () const; VideoFrame time_to_content_video_frames (DCPTime) const; @@ -139,7 +139,7 @@ private: void setup_default_colour_conversion (); - libdcp::Size _video_size; + dcp::Size _video_size; VideoFrameType _video_frame_type; Crop _crop; Ratio const * _ratio; diff --git a/src/lib/video_examiner.h b/src/lib/video_examiner.h index 98c0cdff1..6ee761384 100644 --- a/src/lib/video_examiner.h +++ b/src/lib/video_examiner.h @@ -26,6 +26,6 @@ class VideoExaminer public: virtual ~VideoExaminer () {} virtual float video_frame_rate () const = 0; - virtual libdcp::Size video_size () const = 0; + virtual dcp::Size video_size () const = 0; virtual VideoFrame video_length () const = 0; }; diff --git a/src/lib/writer.cc b/src/lib/writer.cc index 42187dc6e..24adffec6 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -19,9 +19,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include #include @@ -80,26 +80,24 @@ Writer::Writer (shared_ptr f, weak_ptr j) */ if (_film->three_d ()) { - _picture_asset.reset (new libdcp::StereoPictureAsset (_film->internal_video_mxf_dir (), _film->internal_video_mxf_filename ())); + _picture_mxf.reset (new dcp::StereoPictureMXF (_film->internal_video_mxf_dir (), _film->internal_video_mxf_filename ())); } else { - _picture_asset.reset (new libdcp::MonoPictureAsset (_film->internal_video_mxf_dir (), _film->internal_video_mxf_filename ())); + _picture_mxf.reset (new dcp::MonoPictureMXF (_film->internal_video_mxf_dir (), _film->internal_video_mxf_filename ())); } - _picture_asset->set_edit_rate (_film->video_frame_rate ()); - _picture_asset->set_size (fit_ratio_within (_film->container()->ratio(), _film->full_frame ())); - _picture_asset->set_interop (_film->interop ()); + _picture_mxf->set_edit_rate (_film->video_frame_rate ()); + _picture_mxf->set_size (fit_ratio_within (_film->container()->ratio(), _film->full_frame ())); if (_film->encrypted ()) { _picture_asset->set_key (_film->key ()); } - _picture_asset_writer = _picture_asset->start_write (_first_nonexistant_frame > 0); + _picture_mxf_writer = _picture_asset->start_write (_first_nonexistant_frame > 0, _film->interop() ? dcp::INTEROP : dcp::SMPTE); - _sound_asset.reset (new libdcp::SoundAsset (_film->directory (), _film->audio_mxf_filename ())); - _sound_asset->set_edit_rate (_film->video_frame_rate ()); - _sound_asset->set_channels (_film->audio_channels ()); - _sound_asset->set_sampling_rate (_film->audio_frame_rate ()); - _sound_asset->set_interop (_film->interop ()); + _sound_mxf.reset (new dcp::SoundMXF (_film->directory (), _film->audio_mxf_filename ())); + _sound_mxf->set_edit_rate (_film->video_frame_rate ()); + _sound_mxf->set_channels (_film->audio_channels ()); + _sound_mxf->set_sampling_rate (_film->audio_frame_rate ()); if (_film->encrypted ()) { _sound_asset->set_key (_film->key ()); @@ -161,7 +159,7 @@ Writer::fake_write (int frame, Eyes eyes) } FILE* ifi = fopen_boost (_film->info_path (frame, eyes), "r"); - libdcp::FrameInfo info (ifi); + dcp::FrameInfo info (ifi); fclose (ifi); QueueItem qi; @@ -258,7 +256,7 @@ try qi.encoded.reset (new EncodedData (_film->j2c_path (qi.frame, qi.eyes, false))); } - libdcp::FrameInfo fin = _picture_asset_writer->write (qi.encoded->data(), qi.encoded->size()); + dcp::FrameInfo fin = _picture_asset_writer->write (qi.encoded->data(), qi.encoded->size()); qi.encoded->write_info (_film, qi.frame, qi.eyes, fin); _last_written[qi.eyes] = qi.encoded; ++_full_written; @@ -273,7 +271,7 @@ try case QueueItem::REPEAT: { _film->log()->log (String::compose (N_("Writer REPEAT-writes %1 to MXF"), qi.frame)); - libdcp::FrameInfo fin = _picture_asset_writer->write ( + dcp::FrameInfo fin = _picture_asset_writer->write ( _last_written[qi.eyes]->data(), _last_written[qi.eyes]->size() ); @@ -418,10 +416,10 @@ Writer::finish () _sound_asset->set_directory (_film->dir (_film->dcp_name ())); _sound_asset->set_duration (frames); - libdcp::DCP dcp (_film->dir (_film->dcp_name())); + dcp::DCP dcp (_film->dir (_film->dcp_name())); - shared_ptr cpl ( - new libdcp::CPL ( + shared_ptr cpl ( + new dcp::CPL ( _film->dir (_film->dcp_name()), _film->dcp_name(), _film->dcp_content_type()->libdcp_kind (), @@ -432,10 +430,10 @@ Writer::finish () dcp.add_cpl (cpl); - cpl->add_reel (shared_ptr (new libdcp::Reel ( + cpl->add_reel (shared_ptr (new dcp::Reel ( _picture_asset, _sound_asset, - shared_ptr () + shared_ptr () ) )); @@ -448,9 +446,9 @@ Writer::finish () job->sub (_("Computing audio digest")); _sound_asset->compute_digest (boost::bind (&Job::set_progress, job.get(), _1, false)); - libdcp::XMLMetadata meta = Config::instance()->dcp_metadata (); + dcp::XMLMetadata meta = Config::instance()->dcp_metadata (); meta.set_issue_date_now (); - dcp.write_xml (_film->interop (), meta, _film->is_signed() ? make_signer () : shared_ptr ()); + dcp.write_xml (_film->interop (), meta, _film->is_signed() ? make_signer () : shared_ptr ()); _film->log()->log ( String::compose (N_("Wrote %1 FULL, %2 FAKE, %3 REPEAT; %4 pushed to disk"), _full_written, _fake_written, _repeat_written, _pushed_to_disk) @@ -493,7 +491,7 @@ Writer::check_existing_picture_mxf_frame (FILE* mxf, int f, Eyes eyes) return false; } - libdcp::FrameInfo info (ifi); + dcp::FrameInfo info (ifi); fclose (ifi); if (info.size == 0) { _film->log()->log (String::compose ("Existing frame %1 has no info file", f)); diff --git a/src/lib/writer.h b/src/lib/writer.h index 7af79a417..ca0bdeb92 100644 --- a/src/lib/writer.h +++ b/src/lib/writer.h @@ -29,15 +29,15 @@ class EncodedData; class AudioBuffers; class Job; -namespace libdcp { - class MonoPictureAsset; - class MonoPictureAssetWriter; - class StereoPictureAsset; - class StereoPictureAssetWriter; - class PictureAsset; - class PictureAssetWriter; - class SoundAsset; - class SoundAssetWriter; +namespace dcp { + class MonoPictureMXF; + class MonoPictureMXFWriter; + class StereoPictureMXF; + class StereoPictureMXFWriter; + class PictureMXF; + class PictureMXFWriter; + class SoundMXF; + class SoundMXFWriter; } struct QueueItem @@ -130,8 +130,8 @@ private: */ int _pushed_to_disk; - boost::shared_ptr _picture_asset; - boost::shared_ptr _picture_asset_writer; - boost::shared_ptr _sound_asset; - boost::shared_ptr _sound_asset_writer; + boost::shared_ptr _picture_mxf; + boost::shared_ptr _picture_mxf_writer; + boost::shared_ptr _sound_mxf; + boost::shared_ptr _sound_mxf_writer; }; diff --git a/src/tools/dcpomatic_kdm.cc b/src/tools/dcpomatic_kdm.cc index 3a2068d2b..bff4f825e 100644 --- a/src/tools/dcpomatic_kdm.cc +++ b/src/tools/dcpomatic_kdm.cc @@ -234,8 +234,8 @@ int main (int argc, char* argv[]) error ("you must specify --output"); } - shared_ptr certificate (new libdcp::Certificate (boost::filesystem::path (certificate_file))); - libdcp::KDM kdm = film->make_kdm (certificate, dcp, valid_from.get(), valid_to.get()); + shared_ptr certificate (new dcp::Certificate (boost::filesystem::path (certificate_file))); + dcp::KDM kdm = film->make_kdm (certificate, dcp, valid_from.get(), valid_to.get()); kdm.as_xml (output); if (verbose) { cout << "Generated KDM " << output << " for certificate.\n"; diff --git a/src/wx/audio_mapping_view.cc b/src/wx/audio_mapping_view.cc index c08da0912..75c8ea5de 100644 --- a/src/wx/audio_mapping_view.cc +++ b/src/wx/audio_mapping_view.cc @@ -156,7 +156,7 @@ AudioMappingView::left_click (wxGridEvent& ev) return; } - libdcp::Channel d = static_cast (ev.GetCol() - 1); + dcp::Channel d = static_cast (ev.GetCol() - 1); if (_map.get (ev.GetRow(), d) > 0) { _map.set (ev.GetRow(), d, 0); @@ -182,28 +182,28 @@ AudioMappingView::right_click (wxGridEvent& ev) void AudioMappingView::off () { - _map.set (_menu_row, static_cast (_menu_column - 1), 0); + _map.set (_menu_row, static_cast (_menu_column - 1), 0); map_changed (); } void AudioMappingView::full () { - _map.set (_menu_row, static_cast (_menu_column - 1), 1); + _map.set (_menu_row, static_cast (_menu_column - 1), 1); map_changed (); } void AudioMappingView::minus3dB () { - _map.set (_menu_row, static_cast (_menu_column - 1), 1 / sqrt (2)); + _map.set (_menu_row, static_cast (_menu_column - 1), 1 / sqrt (2)); map_changed (); } void AudioMappingView::edit () { - libdcp::Channel d = static_cast (_menu_column - 1); + dcp::Channel d = static_cast (_menu_column - 1); AudioGainDialog* dialog = new AudioGainDialog (this, _menu_row, _menu_column - 1, _map.get (_menu_row, d)); if (dialog->ShowModal () == wxID_OK) { @@ -242,7 +242,7 @@ AudioMappingView::update_cells () _grid->SetCellValue (i, 0, wxString::Format (wxT("%d"), i + 1)); for (int j = 1; j < _grid->GetNumberCols(); ++j) { - _grid->SetCellValue (i, j, std_to_wx (lexical_cast (_map.get (i, static_cast (j - 1))))); + _grid->SetCellValue (i, j, std_to_wx (lexical_cast (_map.get (i, static_cast (j - 1))))); } } @@ -318,7 +318,7 @@ AudioMappingView::mouse_moved (wxMouseEvent& ev) if (row != _last_tooltip_row || column != _last_tooltip_column) { wxString s; - float const gain = _map.get (row, static_cast (column - 1)); + float const gain = _map.get (row, static_cast (column - 1)); if (gain == 0) { s = wxString::Format (_("No audio will be passed from content channel %d to DCP channel %d."), row + 1, column); } else if (gain == 1) { diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc index 2e6f0557f..d636b3b3d 100644 --- a/src/wx/config_dialog.cc +++ b/src/wx/config_dialog.cc @@ -501,7 +501,7 @@ ConfigDialog::default_dcp_content_type_changed () void ConfigDialog::issuer_changed () { - libdcp::XMLMetadata m = Config::instance()->dcp_metadata (); + dcp::XMLMetadata m = Config::instance()->dcp_metadata (); m.issuer = wx_to_std (_issuer->GetValue ()); Config::instance()->set_dcp_metadata (m); } @@ -509,7 +509,7 @@ ConfigDialog::issuer_changed () void ConfigDialog::creator_changed () { - libdcp::XMLMetadata m = Config::instance()->dcp_metadata (); + dcp::XMLMetadata m = Config::instance()->dcp_metadata (); m.creator = wx_to_std (_creator->GetValue ()); Config::instance()->set_dcp_metadata (m); } diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index deee65a5f..d88f88f5e 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -51,7 +51,7 @@ using std::make_pair; using boost::shared_ptr; using boost::dynamic_pointer_cast; using boost::weak_ptr; -using libdcp::Size; +using dcp::Size; FilmViewer::FilmViewer (shared_ptr f, wxWindow* p) : wxPanel (p) diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h index 0e5c49c6d..0a535df9f 100644 --- a/src/wx/film_viewer.h +++ b/src/wx/film_viewer.h @@ -87,7 +87,7 @@ private: bool _got_frame; /** Size of our output (including padding if we have any) */ - libdcp::Size _out_size; + dcp::Size _out_size; /** Size of the panel that we have available */ - libdcp::Size _panel_size; + dcp::Size _panel_size; }; diff --git a/src/wx/screen_dialog.cc b/src/wx/screen_dialog.cc index 32a0bce43..4ca3fc91b 100644 --- a/src/wx/screen_dialog.cc +++ b/src/wx/screen_dialog.cc @@ -28,7 +28,7 @@ using std::string; using std::cout; using boost::shared_ptr; -ScreenDialog::ScreenDialog (wxWindow* parent, string title, string name, shared_ptr certificate) +ScreenDialog::ScreenDialog (wxWindow* parent, string title, string name, shared_ptr certificate) : wxDialog (parent, wxID_ANY, std_to_wx (title)) , _certificate (certificate) { @@ -76,7 +76,7 @@ ScreenDialog::name () const return wx_to_std (_name->GetValue()); } -shared_ptr +shared_ptr ScreenDialog::certificate () const { return _certificate; @@ -89,9 +89,9 @@ ScreenDialog::load_certificate () if (d->ShowModal () == wxID_OK) { try { - _certificate.reset (new libdcp::Certificate (boost::filesystem::path (wx_to_std (d->GetPath ())))); + _certificate.reset (new dcp::Certificate (boost::filesystem::path (wx_to_std (d->GetPath ())))); _certificate_text->SetValue (_certificate->certificate ()); - } catch (libdcp::MiscError& e) { + } catch (dcp::MiscError& e) { error_dialog (this, String::compose ("Could not read certificate file (%1)", e.what())); } } diff --git a/src/wx/screen_dialog.h b/src/wx/screen_dialog.h index 271ae2055..72a315062 100644 --- a/src/wx/screen_dialog.h +++ b/src/wx/screen_dialog.h @@ -24,10 +24,10 @@ class ScreenDialog : public wxDialog { public: - ScreenDialog (wxWindow *, std::string, std::string name = "", boost::shared_ptr c = boost::shared_ptr ()); + ScreenDialog (wxWindow *, std::string, std::string name = "", boost::shared_ptr c = boost::shared_ptr ()); std::string name () const; - boost::shared_ptr certificate () const; + boost::shared_ptr certificate () const; private: void load_certificate (); @@ -37,5 +37,5 @@ private: wxButton* _certificate_load; wxTextCtrl* _certificate_text; - boost::shared_ptr _certificate; + boost::shared_ptr _certificate; }; diff --git a/src/wx/video_panel.cc b/src/wx/video_panel.cc index b439d13c4..6a6e694cb 100644 --- a/src/wx/video_panel.cc +++ b/src/wx/video_panel.cc @@ -299,8 +299,8 @@ VideoPanel::setup_description () } Crop const crop = vcs->crop (); - if ((crop.left || crop.right || crop.top || crop.bottom) && vcs->video_size() != libdcp::Size (0, 0)) { - libdcp::Size cropped = vcs->video_size_after_crop (); + if ((crop.left || crop.right || crop.top || crop.bottom) && vcs->video_size() != dcp::Size (0, 0)) { + dcp::Size cropped = vcs->video_size_after_crop (); d << wxString::Format ( _("Cropped to %dx%d (%.2f:1)\n"), cropped.width, cropped.height, @@ -310,11 +310,11 @@ VideoPanel::setup_description () } Ratio const * ratio = vcs->ratio (); - libdcp::Size container_size = fit_ratio_within (_editor->film()->container()->ratio (), _editor->film()->full_frame ()); + dcp::Size container_size = fit_ratio_within (_editor->film()->container()->ratio (), _editor->film()->full_frame ()); float const ratio_value = ratio ? ratio->ratio() : vcs->video_size_after_crop().ratio (); /* We have a specified ratio to scale to */ - libdcp::Size const scaled = fit_ratio_within (ratio_value, container_size); + dcp::Size const scaled = fit_ratio_within (ratio_value, container_size); d << wxString::Format ( _("Scaled to %dx%d (%.2f:1)\n"), -- 2.30.2