using boost::optional;
using namespace dcpomatic;
+
/** Get the open captions that should be burnt into a given period.
* @param period Period of interest.
* @param always_burn_captions Always burn captions even if their content is not set to burn.
list<PlayerText> ps;
- for (Map::const_iterator i = _data.begin(); i != _data.end(); ++i) {
+ for (auto const& i: _data) {
- shared_ptr<const TextContent> caption = i->first.lock ();
+ auto caption = i.first.lock ();
if (!caption) {
continue;
}
continue;
}
- for (auto j: i->second) {
+ for (auto j: i.second) {
DCPTimePeriod test (j.from, j.to.get_value_or(DCPTime::max()));
- optional<DCPTimePeriod> overlap = period.overlap (test);
+ auto overlap = period.overlap (test);
if (overlap && overlap->duration() > DCPTime(period.duration().get() / 2)) {
ps.push_back (j.subs);
}
return ps;
}
+
/** Remove subtitles that finish before a given time from our list.
* @param time Time to remove before.
*/
boost::mutex::scoped_lock lm (_mutex);
Map updated;
- for (Map::const_iterator i = _data.begin(); i != _data.end(); ++i) {
+ for (auto const& i: _data) {
list<Period> as;
- for (auto j: i->second) {
+ for (auto j: i.second) {
if (!j.to || j.to.get() >= time) {
as.push_back (j);
}
}
if (!as.empty ()) {
- updated[i->first] = as;
+ updated[i.first] = as;
}
}
_data = updated;
}
+
/** Add a new subtitle with a from time.
* @param content Content that the subtitle is from.
* @param ps Subtitles.
_data[content].push_back (Period (ps, from));
}
+
/** Add the to time for the last subtitle added from a piece of content.
* @param content Content that the subtitle is from.
* @param to To time for the last subtitle submitted to add_from for this content.
return make_pair (_data[content].back().subs, _data[content].back().from);
}
+
/** @param content Some content.
* @return true if we have any active subtitles from this content.
*/
{
boost::mutex::scoped_lock lm (_mutex);
- Map::const_iterator i = _data.find(content);
+ auto i = _data.find(content);
if (i == _data.end()) {
return false;
}
return !i->second.empty();
}
+
void
ActiveText::clear ()
{
*/
+
/** @file src/lib/active_captions.h
* @brief ActiveText class.
*/
+
#include "dcpomatic_time.h"
#include "player_text.h"
#include <boost/thread/mutex.hpp>
#include <list>
#include <map>
+
class TextContent;
+
/** @class ActiveText
* @brief A class to maintain information on active subtitles for Player.
*/
#include <dcp/atmos_asset.h>
+using std::make_shared;
using std::shared_ptr;
shared_ptr<dcp::AtmosAsset>
AtmosMetadata::create (dcp::Fraction edit_rate) const
{
- return shared_ptr<dcp::AtmosAsset> (new dcp::AtmosAsset(edit_rate, _first_frame, _max_channel_count, _max_object_count, _atmos_version));
+ return make_shared<dcp::AtmosAsset>(edit_rate, _first_frame, _max_channel_count, _max_object_count, _atmos_version);
}
}
-AudioContent::AudioContent (Content* parent, vector<shared_ptr<Content> > c)
+AudioContent::AudioContent (Content* parent, vector<shared_ptr<Content>> c)
: ContentPart (parent)
{
auto ref = c[0]->audio;
/* You can't call this with varying channel counts */
DCPOMATIC_ASSERT (!_tail || in->channels() == _tail->channels());
- shared_ptr<AudioBuffers> out (new AudioBuffers (in->channels(), in->frames()));
+ auto out = make_shared<AudioBuffers>(in->channels(), in->frames());
if (in->frames() > _samples) {
*/
-#include "audio_filter_graph.h"
+
#include "audio_buffers.h"
+#include "audio_filter_graph.h"
#include "compose.hpp"
extern "C" {
#include <libavfilter/buffersink.h>
#include "i18n.h"
-using std::string;
+
using std::cout;
+using std::make_shared;
using std::shared_ptr;
+using std::string;
+
AudioFilterGraph::AudioFilterGraph (int sample_rate, int channels)
: _sample_rate (sample_rate)
the constructor) so we need to create new buffers with some extra
silent channels.
*/
- shared_ptr<AudioBuffers> extended_buffers (new AudioBuffers (process_channels, buffers->frames()));
+ auto extended_buffers = make_shared<AudioBuffers>(process_channels, buffers->frames());
for (int i = 0; i < buffers->channels(); ++i) {
extended_buffers->copy_channel_from (buffers.get(), i, i);
}
private:
mutable boost::mutex _mutex;
- std::list<std::pair<std::shared_ptr<const AudioBuffers>, dcpomatic::DCPTime> > _buffers;
+ std::list<std::pair<std::shared_ptr<const AudioBuffers>, dcpomatic::DCPTime>> _buffers;
int _used_in_head = 0;
};
*/
+
#include "check_content_change_job.h"
-#include "job_manager.h"
-#include "examine_content_job.h"
#include "content.h"
+#include "examine_content_job.h"
#include "film.h"
+#include "job_manager.h"
#include <iostream>
#include "i18n.h"
+
using std::cout;
using std::make_shared;
using std::shared_ptr;
using std::string;
+
CheckContentChangeJob::CheckContentChangeJob (shared_ptr<const Film> film)
: Job (film)
{
return _utc_offset_minute;
}
- std::list<std::shared_ptr<dcpomatic::Screen> > screens () const {
+ std::list<std::shared_ptr<dcpomatic::Screen>> screens () const {
return _screens;
}
*/
+
+#include "cinema.h"
+#include "colour_conversion.h"
+#include "compose.hpp"
#include "config.h"
+#include "cross.h"
+#include "crypto.h"
+#include "dcp_content_type.h"
+#include "dkdm_recipient.h"
+#include "dkdm_wrapper.h"
+#include "film.h"
#include "filter.h"
+#include "log.h"
#include "ratio.h"
#include "types.h"
-#include "log.h"
-#include "dcp_content_type.h"
-#include "colour_conversion.h"
-#include "cinema.h"
#include "util.h"
-#include "cross.h"
-#include "film.h"
-#include "dkdm_wrapper.h"
-#include "compose.hpp"
-#include "crypto.h"
-#include "dkdm_recipient.h"
#include "zipper.h"
#include <dcp/certificate_chain.h>
#include <dcp/name_format.h>
#include "i18n.h"
-using std::vector;
+
using std::cout;
+using std::dynamic_pointer_cast;
using std::ifstream;
-using std::string;
using std::list;
-using std::min;
+using std::make_shared;
using std::max;
+using std::min;
using std::remove;
using std::shared_ptr;
-using std::make_shared;
-using boost::optional;
-using std::dynamic_pointer_cast;
+using std::string;
+using std::vector;
using boost::algorithm::trim;
+using boost::optional;
using dcp::raw_convert;
+
Config* Config::_instance = 0;
int const Config::_current_version = 3;
boost::signals2::signal<void ()> Config::FailedToLoad;
boost::signals2::signal<void (string)> Config::Warning;
boost::signals2::signal<bool (Config::BadReason)> Config::Bad;
+
/** Construct default configuration */
Config::Config ()
/* DKDMs are not considered a thing to reset on set_defaults() */
_dkdms = dynamic_pointer_cast<DKDMGroup> (DKDMBase::read (f.node_child("DKDMGroup")));
} else {
/* Old-style: one or more DKDM nodes */
- _dkdms.reset (new DKDMGroup ("root"));
+ _dkdms = make_shared<DKDMGroup>("root");
for (auto i: f.node_children("DKDM")) {
_dkdms->add (DKDMBase::read (i));
}
Config *
Config::instance ()
{
- if (_instance == 0) {
+ if (_instance == nullptr) {
_instance = new Config;
_instance->read ();
}
{
_dkdm_recipients.clear ();
for (auto i: f.node_children("DKDMRecipient")) {
- _dkdm_recipients.push_back (shared_ptr<DKDMRecipient>(new DKDMRecipient(i)));
+ _dkdm_recipients.push_back (make_shared<DKDMRecipient>(i));
}
}
return _tms_password;
}
- std::list<std::shared_ptr<Cinema> > cinemas () const {
+ std::list<std::shared_ptr<Cinema>> cinemas () const {
return _cinemas;
}
- std::list<std::shared_ptr<DKDMRecipient> > dkdm_recipients () const {
+ std::list<std::shared_ptr<DKDMRecipient>> dkdm_recipients () const {
return _dkdm_recipients;
}
*/
boost::optional<boost::filesystem::path> _default_kdm_directory;
bool _upload_after_make_dcp;
- std::list<std::shared_ptr<Cinema> > _cinemas;
- std::list<std::shared_ptr<DKDMRecipient> > _dkdm_recipients;
+ std::list<std::shared_ptr<Cinema>> _cinemas;
+ std::list<std::shared_ptr<DKDMRecipient>> _dkdm_recipients;
std::string _mail_server;
int _mail_port;
EmailProtocol _mail_protocol;
using std::cout;
using std::list;
using std::make_shared;
-using std::max;
-using std::pair;
using std::shared_ptr;
using std::string;
using std::vector;
#ifndef DCPOMATIC_CONTENT_H
#define DCPOMATIC_CONTENT_H
-#include "types.h"
-#include "signaller.h"
-#include "dcpomatic_time.h"
+
#include "change_signaller.h"
+#include "dcpomatic_time.h"
+#include "signaller.h"
+#include "types.h"
#include "user_property.h"
#include <libcxml/cxml.h>
#include <boost/filesystem.hpp>
extern void dcpomatic_sleep_milliseconds (int);
extern std::string cpu_info ();
extern void run_ffprobe (boost::filesystem::path, boost::filesystem::path);
-extern std::list<std::pair<std::string, std::string> > mount_info ();
+extern std::list<std::pair<std::string, std::string>> mount_info ();
extern boost::filesystem::path openssl_path ();
extern void make_foreground_application ();
#ifdef DCPOMATIC_DISK
/*
- Copyright (C) 2014-2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2022 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
#include "atmos_content.h"
-#include "dcp_content.h"
-#include "video_content.h"
#include "audio_content.h"
-#include "dcp_examiner.h"
-#include "job.h"
-#include "film.h"
-#include "config.h"
-#include "overlaps.h"
#include "compose.hpp"
+#include "config.h"
+#include "dcp_content.h"
#include "dcp_decoder.h"
-#include "log.h"
+#include "dcp_examiner.h"
#include "dcpomatic_log.h"
+#include "film.h"
+#include "job.h"
+#include "log.h"
+#include "overlaps.h"
#include "text_content.h"
+#include "video_content.h"
#include <dcp/dcp.h>
#include <dcp/raw_convert.h>
#include <dcp/exceptions.h>
bool have_assetmap = false;
bool have_metadata = false;
- for (directory_iterator i(p); i != directory_iterator(); ++i) {
- if (i->path().filename() == "ASSETMAP" || i->path().filename() == "ASSETMAP.xml") {
+ for (auto i: directory_iterator(p)) {
+ if (i.path().filename() == "ASSETMAP" || i.path().filename() == "ASSETMAP.xml") {
have_assetmap = true;
- } else if (i->path().filename() == "metadata.xml") {
+ } else if (i.path().filename() == "metadata.xml") {
have_metadata = true;
}
}
{
shared_ptr<DCPDecoder> decoder;
try {
- decoder.reset (new DCPDecoder (film, shared_from_this(), false, film->tolerant(), shared_ptr<DCPDecoder>()));
+ decoder = make_shared<DCPDecoder>(film, shared_from_this(), false, film->tolerant(), shared_ptr<DCPDecoder>());
} catch (dcp::ReadError &) {
/* We couldn't read the DCP, so it's probably missing */
return false;
{
shared_ptr<DCPDecoder> decoder;
try {
- decoder.reset (new DCPDecoder (film, shared_from_this(), false, film->tolerant(), shared_ptr<DCPDecoder>()));
+ decoder = make_shared<DCPDecoder>(film, shared_from_this(), false, film->tolerant(), shared_ptr<DCPDecoder>());
} catch (dcp::ReadError &) {
/* We couldn't read the DCP, so it's probably missing */
return false;
/*
- Copyright (C) 2014-2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2022 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "atmos_decoder.h"
-#include "dcp_decoder.h"
-#include "dcp_content.h"
#include "audio_content.h"
-#include "video_decoder.h"
#include "audio_decoder.h"
-#include "j2k_image_proxy.h"
-#include "text_decoder.h"
-#include "ffmpeg_image_proxy.h"
-#include "image.h"
#include "config.h"
+#include "dcp_content.h"
+#include "dcp_decoder.h"
#include "digester.h"
+#include "ffmpeg_image_proxy.h"
#include "frame_interval_checker.h"
-#include <dcp/dcp.h>
+#include "image.h"
+#include "j2k_image_proxy.h"
+#include "text_decoder.h"
+#include "video_decoder.h"
#include <dcp/cpl.h>
-#include <dcp/reel.h>
+#include <dcp/dcp.h>
+#include <dcp/decrypted_kdm.h>
#include <dcp/mono_picture_asset.h>
#include <dcp/mono_picture_asset_reader.h>
-#include <dcp/stereo_picture_asset.h>
-#include <dcp/stereo_picture_asset_reader.h>
+#include <dcp/mono_picture_frame.h>
+#include <dcp/reel.h>
+#include <dcp/reel_atmos_asset.h>
+#include <dcp/reel_closed_caption_asset.h>
#include <dcp/reel_picture_asset.h>
#include <dcp/reel_sound_asset.h>
#include <dcp/reel_subtitle_asset.h>
-#include <dcp/reel_closed_caption_asset.h>
-#include <dcp/mono_picture_frame.h>
-#include <dcp/stereo_picture_frame.h>
-#include <dcp/sound_frame.h>
#include <dcp/sound_asset_reader.h>
+#include <dcp/sound_frame.h>
+#include <dcp/stereo_picture_asset.h>
+#include <dcp/stereo_picture_asset_reader.h>
+#include <dcp/stereo_picture_frame.h>
#include <dcp/subtitle_image.h>
-#include <dcp/decrypted_kdm.h>
-#include <dcp/reel_atmos_asset.h>
#include <iostream>
#include "i18n.h"
-using std::list;
+
using std::cout;
+using std::dynamic_pointer_cast;
+using std::list;
+using std::make_shared;
using std::map;
+using std::shared_ptr;
using std::string;
using std::vector;
-using std::shared_ptr;
-using std::dynamic_pointer_cast;
-using std::make_shared;
using boost::optional;
using namespace dcpomatic;
-DCPDecoder::DCPDecoder (shared_ptr<const Film> film, shared_ptr<const DCPContent> c, bool fast, bool tolerant, shared_ptr<DCPDecoder> old)
- : DCP (c, tolerant)
+
+DCPDecoder::DCPDecoder (shared_ptr<const Film> film, shared_ptr<const DCPContent> content, bool fast, bool tolerant, shared_ptr<DCPDecoder> old)
+ : DCP (content, tolerant)
, Decoder (film)
{
- if (c->can_be_played()) {
- if (c->video) {
- video = make_shared<VideoDecoder>(this, c);
+ if (content->can_be_played()) {
+ if (content->video) {
+ video = make_shared<VideoDecoder>(this, content);
}
- if (c->audio) {
- audio = make_shared<AudioDecoder>(this, c->audio, fast);
+ if (content->audio) {
+ audio = make_shared<AudioDecoder>(this, content->audio, fast);
}
- for (auto i: c->text) {
+ for (auto i: content->text) {
/* XXX: this time here should be the time of the first subtitle, not 0 */
text.push_back (make_shared<TextDecoder>(this, i, ContentTime()));
}
- if (c->atmos) {
- atmos = make_shared<AtmosDecoder>(this, c);
+ if (content->atmos) {
+ atmos = make_shared<AtmosDecoder>(this, content);
}
}
the same before we re-use _reels.
*/
- _lazy_digest = calculate_lazy_digest (c);
+ _lazy_digest = calculate_lazy_digest (content);
if (old && old->lazy_digest() == _lazy_digest) {
_reels = old->_reels;
return true;
}
- double const vfr = _dcp_content->active_video_frame_rate (film());
+ auto const vfr = _dcp_content->active_video_frame_rate (film());
/* Frame within the (played part of the) reel that is coming up next */
- int64_t const frame = _next.frames_round (vfr);
+ auto const frame = _next.frames_round (vfr);
- shared_ptr<dcp::PictureAsset> picture_asset = (*_reel)->main_picture()->asset();
+ auto picture_asset = (*_reel)->main_picture()->asset();
DCPOMATIC_ASSERT (picture_asset);
/* We must emit texts first as when we emit the video for this frame
pass_texts (_next, picture_asset->size());
if ((_mono_reader || _stereo_reader) && (_decode_referenced || !_dcp_content->reference_video())) {
- int64_t const entry_point = (*_reel)->main_picture()->entry_point().get_value_or(0);
+ auto const entry_point = (*_reel)->main_picture()->entry_point().get_value_or(0);
if (_mono_reader) {
video->emit (
film(),
}
if (_sound_reader && (_decode_referenced || !_dcp_content->reference_audio())) {
- int64_t const entry_point = (*_reel)->main_sound()->entry_point().get_value_or(0);
- shared_ptr<const dcp::SoundFrame> sf = _sound_reader->get_frame (entry_point + frame);
- uint8_t const * from = sf->data ();
+ auto const entry_point = (*_reel)->main_sound()->entry_point().get_value_or(0);
+ auto sf = _sound_reader->get_frame (entry_point + frame);
+ auto from = sf->data ();
int const channels = _dcp_content->audio->stream()->channels ();
int const frames = sf->size() / (3 * channels);
- shared_ptr<AudioBuffers> data (new AudioBuffers (channels, frames));
- float** data_data = data->data();
+ auto data = make_shared<AudioBuffers>(channels, frames);
+ auto data_data = data->data();
for (int i = 0; i < frames; ++i) {
for (int j = 0; j < channels; ++j) {
data_data[j][i] = static_cast<int> ((from[0] << 8) | (from[1] << 16) | (from[2] << 24)) / static_cast<float> (INT_MAX - 256);
if (_atmos_reader) {
DCPOMATIC_ASSERT (_atmos_metadata);
- int64_t const entry_point = (*_reel)->atmos()->entry_point().get_value_or(0);
+ auto const entry_point = (*_reel)->atmos()->entry_point().get_value_or(0);
atmos->emit (film(), _atmos_reader->get_frame(entry_point + frame), _offset + frame, *_atmos_metadata);
}
return false;
}
+
void
DCPDecoder::pass_texts (ContentTime next, dcp::Size size)
{
ContentTime next, shared_ptr<dcp::SubtitleAsset> asset, bool reference, int64_t entry_point, shared_ptr<TextDecoder> decoder, dcp::Size size
)
{
- double const vfr = _dcp_content->active_video_frame_rate (film());
+ auto const vfr = _dcp_content->active_video_frame_rate (film());
/* Frame within the (played part of the) reel that is coming up next */
- int64_t const frame = next.frames_round (vfr);
+ auto const frame = next.frames_round (vfr);
if (_decode_referenced || !reference) {
auto subs = asset->subtitles_during (
}
}
+
void
DCPDecoder::next_reel ()
{
get_readers ();
}
+
void
DCPDecoder::get_readers ()
{
}
if ((*_reel)->main_picture()) {
- shared_ptr<dcp::PictureAsset> asset = (*_reel)->main_picture()->asset ();
- shared_ptr<dcp::MonoPictureAsset> mono = dynamic_pointer_cast<dcp::MonoPictureAsset> (asset);
- shared_ptr<dcp::StereoPictureAsset> stereo = dynamic_pointer_cast<dcp::StereoPictureAsset> (asset);
+ auto asset = (*_reel)->main_picture()->asset ();
+ auto mono = dynamic_pointer_cast<dcp::MonoPictureAsset> (asset);
+ auto stereo = dynamic_pointer_cast<dcp::StereoPictureAsset> (asset);
DCPOMATIC_ASSERT (mono || stereo);
if (mono) {
_mono_reader = mono->start_read ();
}
if ((*_reel)->atmos()) {
- shared_ptr<dcp::AtmosAsset> asset = (*_reel)->atmos()->asset();
+ auto asset = (*_reel)->atmos()->asset();
_atmos_reader = asset->start_read();
_atmos_reader->set_check_hmac (false);
_atmos_metadata = AtmosMetadata (asset);
}
}
+
void
DCPDecoder::seek (ContentTime t, bool accurate)
{
/* Pre-roll for subs */
- ContentTime pre = t - ContentTime::from_seconds (pre_roll_seconds);
+ auto pre = t - ContentTime::from_seconds (pre_roll_seconds);
if (pre < ContentTime()) {
pre = ContentTime ();
}
pre >= ContentTime::from_frames ((*_reel)->main_picture()->actual_duration(), _dcp_content->active_video_frame_rate(film()))
) {
- ContentTime rd = ContentTime::from_frames ((*_reel)->main_picture()->actual_duration(), _dcp_content->active_video_frame_rate(film()));
+ auto rd = ContentTime::from_frames ((*_reel)->main_picture()->actual_duration(), _dcp_content->active_video_frame_rate(film()));
pre -= rd;
t -= rd;
next_reel ();
/* Pass texts in the pre-roll */
- double const vfr = _dcp_content->active_video_frame_rate (film());
+ auto const vfr = _dcp_content->active_video_frame_rate (film());
for (int i = 0; i < pre_roll_seconds * vfr; ++i) {
pass_texts (pre, (*_reel)->main_picture()->asset()->size());
pre += ContentTime::from_frames (1, vfr);
_next = t;
}
+
void
DCPDecoder::set_decode_referenced (bool r)
{
}
}
+
void
DCPDecoder::set_forced_reduction (optional<int> reduction)
{
_forced_reduction = reduction;
}
+
string
DCPDecoder::calculate_lazy_digest (shared_ptr<const DCPContent> c) const
{
return d.get ();
}
+
ContentTime
DCPDecoder::position () const
{
vector<FontData> data;
for (auto i: _reels) {
if (i->main_subtitle() && i->main_subtitle()->asset()) {
- map<string, dcp::ArrayData> fm = i->main_subtitle()->asset()->font_data();
- for (map<string, dcp::ArrayData>::const_iterator j = fm.begin(); j != fm.end(); ++j) {
- data.push_back (FontData(j->first, j->second));
+ for (auto const& j: i->main_subtitle()->asset()->font_data()) {
+ data.push_back (FontData(j.first, j.second));
}
}
}
*/
-#include "dcp_examiner.h"
+#include "config.h"
#include "dcp_content.h"
+#include "dcp_examiner.h"
#include "dcpomatic_log.h"
#include "exceptions.h"
#include "image.h"
-#include "config.h"
#include "util.h"
+#include <dcp/cpl.h>
#include <dcp/dcp.h>
#include <dcp/decrypted_kdm.h>
-#include <dcp/cpl.h>
-#include <dcp/reel.h>
-#include <dcp/reel_picture_asset.h>
-#include <dcp/reel_sound_asset.h>
#include <dcp/mono_picture_asset.h>
#include <dcp/mono_picture_asset_reader.h>
#include <dcp/mono_picture_frame.h>
-#include <dcp/stereo_picture_asset.h>
-#include <dcp/stereo_picture_asset_reader.h>
-#include <dcp/stereo_picture_frame.h>
-#include <dcp/sound_asset.h>
-#include <dcp/sound_asset_reader.h>
-#include <dcp/subtitle_asset.h>
+#include <dcp/reel.h>
#include <dcp/reel_atmos_asset.h>
-#include <dcp/reel_subtitle_asset.h>
#include <dcp/reel_closed_caption_asset.h>
#include <dcp/reel_markers_asset.h>
+#include <dcp/reel_picture_asset.h>
+#include <dcp/reel_sound_asset.h>
+#include <dcp/reel_subtitle_asset.h>
#include <dcp/sound_asset.h>
+#include <dcp/sound_asset.h>
+#include <dcp/sound_asset_reader.h>
+#include <dcp/stereo_picture_asset.h>
+#include <dcp/stereo_picture_asset_reader.h>
+#include <dcp/stereo_picture_frame.h>
+#include <dcp/subtitle_asset.h>
#include <iostream>
#include "i18n.h"
* @return Encoded data.
*/
ArrayData
-DCPVideo::encode_locally ()
+DCPVideo::encode_locally () const
{
auto const comment = Config::instance()->dcp_j2k_comment();
* @return Encoded data.
*/
ArrayData
-DCPVideo::encode_remotely (EncodeServerDescription serv, int timeout)
+DCPVideo::encode_remotely (EncodeServerDescription serv, int timeout) const
{
boost::asio::io_service io_service;
boost::asio::ip::tcp::resolver resolver (io_service);
DCPVideo (DCPVideo const&) = delete;
DCPVideo& operator= (DCPVideo const&) = delete;
- dcp::ArrayData encode_locally ();
- dcp::ArrayData encode_remotely (EncodeServerDescription, int timeout = 30);
+ dcp::ArrayData encode_locally () const;
+ dcp::ArrayData encode_remotely (EncodeServerDescription, int timeout = 30) const;
int index () const {
return _index;
*/
+
#include "atmos_mxf_content.h"
#include "atmos_mxf_decoder.h"
-#include "ffmpeg_content.h"
-#include "ffmpeg_decoder.h"
#include "dcp_content.h"
#include "dcp_decoder.h"
+#include "dcp_subtitle_content.h"
+#include "dcp_subtitle_decoder.h"
+#include "ffmpeg_content.h"
+#include "ffmpeg_decoder.h"
#include "image_content.h"
#include "image_decoder.h"
#include "string_text_file_content.h"
#include "string_text_file_decoder.h"
-#include "dcp_subtitle_content.h"
-#include "dcp_subtitle_decoder.h"
+#include "timer.h"
#include "video_mxf_content.h"
#include "video_mxf_decoder.h"
-#include "timer.h"
+
+using std::dynamic_pointer_cast;
using std::list;
+using std::make_shared;
using std::shared_ptr;
-using std::dynamic_pointer_cast;
+
template <class T>
shared_ptr<T>
maybe_cast (shared_ptr<Decoder> d)
{
if (!d) {
- return shared_ptr<T> ();
+ return {};
}
return dynamic_pointer_cast<T> (d);
}
shared_ptr<Decoder>
decoder_factory (shared_ptr<const Film> film, shared_ptr<const Content> content, bool fast, bool tolerant, shared_ptr<Decoder> old_decoder)
{
- shared_ptr<const FFmpegContent> fc = dynamic_pointer_cast<const FFmpegContent> (content);
+ auto fc = dynamic_pointer_cast<const FFmpegContent> (content);
if (fc) {
- return shared_ptr<Decoder> (new FFmpegDecoder(film, fc, fast));
+ return make_shared<FFmpegDecoder>(film, fc, fast);
}
- shared_ptr<const DCPContent> dc = dynamic_pointer_cast<const DCPContent> (content);
+ auto dc = dynamic_pointer_cast<const DCPContent> (content);
if (dc) {
try {
- return shared_ptr<Decoder> (new DCPDecoder(film, dc, fast, tolerant, maybe_cast<DCPDecoder>(old_decoder)));
+ return make_shared<DCPDecoder>(film, dc, fast, tolerant, maybe_cast<DCPDecoder>(old_decoder));
} catch (KDMError& e) {
/* This will be found and reported to the user when the content is examined */
- return shared_ptr<Decoder>();
+ return {};
}
}
- shared_ptr<const ImageContent> ic = dynamic_pointer_cast<const ImageContent> (content);
+ auto ic = dynamic_pointer_cast<const ImageContent> (content);
if (ic) {
- return shared_ptr<Decoder> (new ImageDecoder(film, ic));
+ return make_shared<ImageDecoder>(film, ic);
}
- shared_ptr<const StringTextFileContent> rc = dynamic_pointer_cast<const StringTextFileContent> (content);
+ auto rc = dynamic_pointer_cast<const StringTextFileContent> (content);
if (rc) {
- return shared_ptr<Decoder> (new StringTextFileDecoder(film, rc));
+ return make_shared<StringTextFileDecoder>(film, rc);
}
- shared_ptr<const DCPSubtitleContent> dsc = dynamic_pointer_cast<const DCPSubtitleContent> (content);
+ auto dsc = dynamic_pointer_cast<const DCPSubtitleContent> (content);
if (dsc) {
- return shared_ptr<Decoder> (new DCPSubtitleDecoder(film, dsc));
+ return make_shared<DCPSubtitleDecoder>(film, dsc);
}
- shared_ptr<const VideoMXFContent> vmc = dynamic_pointer_cast<const VideoMXFContent> (content);
+ auto vmc = dynamic_pointer_cast<const VideoMXFContent> (content);
if (vmc) {
- return shared_ptr<Decoder> (new VideoMXFDecoder(film, vmc));
+ return make_shared<VideoMXFDecoder>(film, vmc);
}
- shared_ptr<const AtmosMXFContent> amc = dynamic_pointer_cast<const AtmosMXFContent> (content);
+ auto amc = dynamic_pointer_cast<const AtmosMXFContent> (content);
if (amc) {
- return shared_ptr<Decoder> (new AtmosMXFDecoder(film, amc));
+ return make_shared<AtmosMXFDecoder>(film, amc);
}
- return shared_ptr<Decoder> ();
+ return {};
}
#include "dkdm_recipient.h"
-#include "kdm_with_metadata.h"
#include "film.h"
+#include "kdm_with_metadata.h"
#include <dcp/raw_convert.h>
)
{
if (!recipient->recipient) {
- return KDMWithMetadataPtr();
+ return {};
}
dcp::LocalTime const begin(valid_from, recipient->utc_offset_hour, recipient->utc_offset_minute);
}
set_timestamps_to_now (cr);
- for (directory_iterator i = directory_iterator(from); i != directory_iterator(); ++i) {
- copy (i->path(), cr, total_remaining, total, copied_files, nanomsg);
+ for (auto i: directory_iterator(from)) {
+ copy (i.path(), cr, total_remaining, total, copied_files, nanomsg);
}
} else {
string const write_digest = write (from, cr, total_remaining, total, nanomsg);
*/
+#include "compose.hpp"
+#include "config.h"
+#include "dcpomatic_log.h"
+#include "digester.h"
+#include "exceptions.h"
#include "ffmpeg.h"
+#include "ffmpeg_audio_stream.h"
#include "ffmpeg_content.h"
+#include "ffmpeg_subtitle_stream.h"
#include "film.h"
-#include "exceptions.h"
-#include "util.h"
#include "log.h"
-#include "dcpomatic_log.h"
-#include "ffmpeg_subtitle_stream.h"
-#include "ffmpeg_audio_stream.h"
-#include "digester.h"
-#include "compose.hpp"
-#include "config.h"
+#include "util.h"
#include <dcp/raw_convert.h>
extern "C" {
#include <libavcodec/avcodec.h>
auto const f = full_length.frames_round (vfr);
auto v = video->position(film()).get_value_or(ContentTime()).frames_round(vfr) + 1;
while (v < f) {
- video->emit (film(), shared_ptr<const ImageProxy> (new RawImageProxy (_black_image)), v);
+ video->emit (film(), make_shared<const RawImageProxy>(_black_image), v);
++v;
}
}
void maybe_add_subtitle ();
- std::list<std::shared_ptr<VideoFilterGraph> > _filter_graphs;
+ std::list<std::shared_ptr<VideoFilterGraph>> _filter_graphs;
boost::mutex _filter_graphs_mutex;
dcpomatic::ContentTime _pts_offset;
void audio (std::shared_ptr<AudioBuffers>);
private:
- std::map<Eyes, std::shared_ptr<FFmpegFileEncoder> > _encoders;
+ std::map<Eyes, std::shared_ptr<FFmpegFileEncoder>> _encoders;
};
int _output_audio_channels;
#include <boost/filesystem.hpp>
#include <boost/regex.hpp>
#include <unistd.h>
-#include <stdexcept>
-#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <iomanip>
+#include <iostream>
#include <set>
+#include <stdexcept>
#include "i18n.h"
*/
+
/** @file src/film.h
* @brief A representation of some audio and video content, and details of
* how they should be presented in a DCP.
*/
+
#ifndef DCPOMATIC_FILM_H
#define DCPOMATIC_FILM_H
+
#include "change_signaller.h"
#include "dcp_text_track.h"
#include "frame_rate_change.h"
#include <string>
#include <vector>
+
namespace xmlpp {
class Document;
}
struct recover_test_2d_encrypted;
struct atmos_encrypted_passthrough_test;
+
class InfoFileHandle
{
public:
return _isdcf_date;
}
-
/* SET */
void set_directory (boost::filesystem::path);
*/
-#include "frame_rate_change.h"
-#include "types.h"
+#include "compose.hpp"
#include "content.h"
#include "film.h"
-#include "compose.hpp"
+#include "frame_rate_change.h"
+#include "types.h"
#include <cmath>
#include "i18n.h"
-using std::string;
using std::shared_ptr;
+using std::string;
FrameRateChange::FrameRateChange ()
return lrintf(powf(2.0f, d->log2_chroma_w));
}
+
/** @param n Component index.
* @return Number of samples (i.e. pixels, unless sub-sampled) in each direction for this component.
*/
);
}
+
/** @return Number of planes */
int
Image::planes () const
{
+ if (_pixel_format == AV_PIX_FMT_PAL8) {
+ return 2;
+ }
+
auto d = av_pix_fmt_desc_get(_pixel_format);
if (!d) {
throw PixelFormatError ("planes()", _pixel_format);
}
- if (_pixel_format == AV_PIX_FMT_PAL8) {
- return 2;
- }
-
if ((d->flags & AV_PIX_FMT_FLAG_PLANAR) == 0) {
return 1;
}
return out;
}
+
shared_ptr<Image>
Image::convert_pixel_format (dcp::YUVToRGB yuv_to_rgb, AVPixelFormat out_format, Alignment out_alignment, bool fast) const
{
return scale(size(), yuv_to_rgb, out_format, out_alignment, fast);
}
+
/** @param out_size Size to scale to.
* @param yuv_to_rgb YUVToRGB transform transform to use, if required.
* @param out_format Output pixel format.
return scaled;
}
+
/** Blacken a YUV image whose bits per pixel is rounded up to 16 */
void
Image::yuv_16_black (uint16_t v, bool alpha)
}
}
+
uint16_t
Image::swap_16 (uint16_t v)
{
return ((v >> 8) & 0xff) | ((v & 0xff) << 8);
}
+
void
Image::make_part_black (int const start, int const width)
{
}
}
+
void
Image::make_black ()
{
}
}
+
void
Image::make_transparent ()
{
memset (data()[0], 0, sample_size(0).height * stride()[0]);
}
+
void
Image::alpha_blend (shared_ptr<const Image> other, Position<int> position)
{
}
}
+
void
Image::copy (shared_ptr<const Image> other, Position<int> position)
{
}
}
+
void
Image::read_from_socket (shared_ptr<Socket> socket)
{
}
}
+
void
Image::write_to_socket (shared_ptr<Socket> socket) const
{
}
}
+
float
Image::bytes_per_pixel (int c) const
{
return bpp[c];
}
+
/** Construct a Image of a given size and format, allocating memory
* as required.
*
}
}
+
Image::Image (Image const & other)
: std::enable_shared_from_this<Image>(other)
, _size (other._size)
}
}
+
Image::Image (AVFrame const * frame, Alignment alignment)
: _size (frame->width, frame->height)
, _pixel_format (static_cast<AVPixelFormat>(frame->format))
}
}
+
Image::Image (shared_ptr<const Image> other, Alignment alignment)
: _size (other->_size)
, _pixel_format (other->_pixel_format)
}
}
+
Image&
Image::operator= (Image const & other)
{
return *this;
}
+
void
Image::swap (Image & other)
{
std::swap (_alignment, other._alignment);
}
+
Image::~Image ()
{
for (int i = 0; i < planes(); ++i) {
av_free (_stride);
}
+
uint8_t * const *
Image::data () const
{
return _data;
}
+
int const *
Image::line_size () const
{
return _line_size;
}
+
int const *
Image::stride () const
{
return _stride;
}
+
dcp::Size
Image::size () const
{
return _size;
}
+
Image::Alignment
Image::alignment () const
{
return true;
}
+
/** Fade the image.
* @param f Amount to fade by; 0 is black, 1 is no fade.
*/
return m;
}
+
class Memory
{
public:
size_t size;
};
+
static void
png_write_data (png_structp png_ptr, png_bytep data, png_size_t length)
{
mem->size += length;
}
+
static void
png_flush (png_structp)
{
}
+
static void
png_error_fn (png_structp png_ptr, char const * message)
{
reinterpret_cast<Image*>(png_get_error_ptr(png_ptr))->png_error (message);
}
+
void
Image::png_error (char const * message)
{
throw EncodeError (String::compose ("Error during PNG write: %1", message));
}
+
dcp::ArrayData
Image::as_png () const
{
*/
-#include "image_content.h"
-#include "video_content.h"
-#include "image_examiner.h"
+
#include "compose.hpp"
+#include "exceptions.h"
#include "film.h"
-#include "job.h"
#include "frame_rate_change.h"
-#include "exceptions.h"
+#include "image_content.h"
+#include "image_examiner.h"
#include "image_filename_sorter.h"
+#include "job.h"
+#include "video_content.h"
#include <libcxml/cxml.h>
#include <libxml++/libxml++.h>
#include <iostream>
#include "i18n.h"
-using std::string;
+
using std::cout;
using std::list;
-using std::vector;
+using std::make_shared;
using std::shared_ptr;
+using std::string;
+using std::vector;
using namespace dcpomatic;
+
ImageContent::ImageContent (boost::filesystem::path p)
{
- video.reset (new VideoContent (this));
+ video = make_shared<VideoContent>(this);
if (boost::filesystem::is_regular_file (p) && valid_image_file (p)) {
add_path (p);
video = VideoContent::from_xml (this, node, version);
}
+
string
ImageContent::summary () const
{
return s;
}
+
string
ImageContent::technical_summary () const
{
return s;
}
+
void
ImageContent::as_xml (xmlpp::Node* node, bool with_paths) const
{
}
}
+
void
ImageContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
{
job->sub (_("Scanning image files"));
vector<boost::filesystem::path> paths;
int n = 0;
- for (boost::filesystem::directory_iterator i(*_path_to_scan); i != boost::filesystem::directory_iterator(); ++i) {
- if (boost::filesystem::is_regular_file (i->path()) && valid_image_file (i->path())) {
- paths.push_back (i->path());
+ for (auto i: boost::filesystem::directory_iterator(*_path_to_scan)) {
+ if (boost::filesystem::is_regular_file(i.path()) && valid_image_file (i.path())) {
+ paths.push_back (i.path());
}
++n;
if ((n % 1000) == 0) {
Content::examine (film, job);
- shared_ptr<ImageExaminer> examiner (new ImageExaminer (film, shared_from_this(), job));
+ auto examiner = make_shared<ImageExaminer>(film, shared_from_this(), job);
video->take_from_examiner (examiner);
set_default_colour_conversion ();
}
+
DCPTime
ImageContent::full_length (shared_ptr<const Film> film) const
{
return DCPTime::from_frames (llrint(video->length_after_3d_combine() * frc.factor()), film->video_frame_rate());
}
+
DCPTime
ImageContent::approximate_length () const
{
return DCPTime::from_frames (video->length_after_3d_combine(), 24);
}
+
string
ImageContent::identifier () const
{
return buffer;
}
+
bool
ImageContent::still () const
{
return number_of_paths() == 1;
}
+
void
ImageContent::set_default_colour_conversion ()
{
}
}
+
void
ImageContent::add_properties (shared_ptr<const Film> film, list<UserProperty>& p) const
{
*/
+#include "exceptions.h"
+#include "ffmpeg_image_proxy.h"
+#include "film.h"
+#include "frame_interval_checker.h"
+#include "image.h"
#include "image_content.h"
#include "image_decoder.h"
-#include "video_decoder.h"
-#include "image.h"
-#include "ffmpeg_image_proxy.h"
#include "j2k_image_proxy.h"
-#include "film.h"
-#include "exceptions.h"
#include "video_content.h"
-#include "frame_interval_checker.h"
+#include "video_decoder.h"
#include <boost/filesystem.hpp>
#include <iostream>
*/
-#include "image_content.h"
-#include "image_examiner.h"
-#include "film.h"
-#include "job.h"
-#include "exceptions.h"
+#include "compose.hpp"
#include "config.h"
#include "cross.h"
-#include "compose.hpp"
+#include "exceptions.h"
#include "ffmpeg_image_proxy.h"
+#include "film.h"
#include "image.h"
+#include "image_content.h"
+#include "image_examiner.h"
+#include "job.h"
#include <dcp/openjpeg_image.h>
#include <dcp/exceptions.h>
#include <dcp/j2k_transcode.h>
using std::cout;
using std::list;
-using std::sort;
using std::shared_ptr;
+using std::sort;
using boost::optional;
*/
+
#include "image_filename_sorter.h"
#include <dcp/locale_convert.h>
#include <boost/filesystem.hpp>
#include <boost/optional.hpp>
#include <iostream>
+
using std::list;
using std::string;
using dcp::locale_convert;
using boost::optional;
+
bool
ImageFilenameSorter::operator() (boost::filesystem::path a, boost::filesystem::path b)
{
- string an = extract_numbers (a);
- string bn = extract_numbers (b);
+ auto an = extract_numbers (a);
+ auto bn = extract_numbers (b);
int const anl = an.length ();
int const bnl = bn.length ();
ImageFilenameSorter::extract_numbers (boost::filesystem::path p)
{
string numbers;
- string const ps = p.leaf().string();
+ auto const ps = p.leaf().string();
for (size_t i = 0; i < ps.size(); ++i) {
if (isdigit (ps[i])) {
numbers += ps[i];
*/
-#include "image_proxy.h"
-#include "raw_image_proxy.h"
+#include "cross.h"
+#include "exceptions.h"
#include "ffmpeg_image_proxy.h"
-#include "j2k_image_proxy.h"
#include "image.h"
-#include "exceptions.h"
-#include "cross.h"
+#include "image_proxy.h"
+#include "j2k_image_proxy.h"
+#include "raw_image_proxy.h"
#include <dcp/util.h>
#include <libcxml/cxml.h>
#include <iostream>
*/
-#include "scoped_temporary.h"
#include "compose.hpp"
-#include "exceptions.h"
#include "cross.h"
+#include "exceptions.h"
+#include "scoped_temporary.h"
#include "util.h"
#include <curl/curl.h>
#include <zip.h>
using std::function;
using std::list;
using std::string;
-using boost::optional;
using boost::algorithm::trim;
+using boost::optional;
static size_t
auto const cr = curl_easy_perform (curl);
if (cr != CURLE_OK) {
- return list<string>();
+ return {};
}
list<string> result;
*/
-#include "j2k_encoder.h"
-#include "util.h"
-#include "film.h"
-#include "log.h"
-#include "dcpomatic_log.h"
+#include "compose.hpp"
#include "config.h"
-#include "dcp_video.h"
#include "cross.h"
-#include "writer.h"
+#include "dcp_video.h"
+#include "dcpomatic_log.h"
+#include "encode_server_description.h"
#include "encode_server_finder.h"
+#include "film.h"
+#include "j2k_encoder.h"
+#include "log.h"
#include "player.h"
#include "player_video.h"
-#include "encode_server_description.h"
-#include "compose.hpp"
+#include "util.h"
+#include "writer.h"
#include <libcxml/cxml.h>
#include <iostream>
#include "i18n.h"
-using std::list;
using std::cout;
using std::exception;
+using std::list;
+using std::make_shared;
using std::shared_ptr;
using std::weak_ptr;
-using std::make_shared;
using boost::optional;
using dcp::Data;
using namespace dcpomatic;
*/
-#include "j2k_image_proxy.h"
+#include "dcpomatic_assert.h"
#include "dcpomatic_socket.h"
#include "image.h"
-#include "dcpomatic_assert.h"
+#include "j2k_image_proxy.h"
#include "warnings.h"
-#include <dcp/raw_convert.h>
-#include <dcp/openjpeg_image.h>
-#include <dcp/mono_picture_frame.h>
-#include <dcp/stereo_picture_frame.h>
#include <dcp/colour_conversion.h>
-#include <dcp/rgb_xyz.h>
#include <dcp/j2k_transcode.h>
+#include <dcp/mono_picture_frame.h>
+#include <dcp/openjpeg_image.h>
+#include <dcp/raw_convert.h>
+#include <dcp/rgb_xyz.h>
+#include <dcp/stereo_picture_frame.h>
#include <libcxml/cxml.h>
DCPOMATIC_DISABLE_WARNINGS
#include <libxml++/libxml++.h>
*/
+
/** @file src/job.cc
* @brief A parent class to represent long-running tasks which are run in their own thread.
*/
-#include "job.h"
-#include "util.h"
+
+#include "compose.hpp"
#include "cross.h"
+#include "dcpomatic_log.h"
#include "exceptions.h"
#include "film.h"
+#include "job.h"
#include "log.h"
-#include "dcpomatic_log.h"
-#include "compose.hpp"
+#include "util.h"
#include <dcp/exceptions.h>
#include <sub/exceptions.h>
-#include <boost/thread.hpp>
-#include <boost/filesystem.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/filesystem.hpp>
+#include <boost/thread.hpp>
#include <iostream>
#include "i18n.h"
-using std::string;
-using std::list;
+
using std::cout;
+using std::function;
+using std::list;
using std::shared_ptr;
+using std::string;
using boost::optional;
-using std::function;
using namespace dcpomatic;
+
/** @param film Associated film, or 0 */
Job::Job (shared_ptr<const Film> film)
: _film (film)
}
+
Job::~Job ()
{
#ifdef DCPOMATIC_DEBUG
#endif
}
+
void
Job::stop_thread ()
{
} catch (...) {}
}
+
/** Start the job in a separate thread, returning immediately */
void
Job::start ()
#endif
}
+
/** A wrapper for the ::run() method to catch exceptions */
void
Job::run_wrapper ()
}
}
+
/** @return true if this job is new (ie has not started running) */
bool
Job::is_new () const
return _state == NEW;
}
+
/** @return true if the job is running */
bool
Job::running () const
return _state == RUNNING;
}
+
/** @return true if the job has finished (either successfully or unsuccessfully) */
bool
Job::finished () const
return _state == FINISHED_OK || _state == FINISHED_ERROR || _state == FINISHED_CANCELLED;
}
+
/** @return true if the job has finished successfully */
bool
Job::finished_ok () const
return _state == FINISHED_OK;
}
+
/** @return true if the job has finished unsuccessfully */
bool
Job::finished_in_error () const
return _state == FINISHED_ERROR;
}
+
bool
Job::finished_cancelled () const
{
return _state == FINISHED_CANCELLED;
}
+
bool
Job::paused_by_user () const
{
return _state == PAUSED_BY_USER;
}
+
bool
Job::paused_by_priority () const
{
return _state == PAUSED_BY_PRIORITY;
}
+
/** Set the state of this job.
* @param s New state.
*/
}
}
+
/** @return DCPTime (in seconds) that this sub-job has been running */
int
Job::elapsed_sub_time () const
return time (0) - _sub_start_time;
}
+
/** Check to see if this job has been interrupted or paused */
void
Job::check_for_interruption_or_pause ()
set_progress_common (p);
}
+
void
Job::set_progress_common (optional<float> p)
{
emit (boost::bind (boost::ref (Progress)));
}
+
/** @return fractional progress of the current sub-job, if known */
optional<float>
Job::progress () const
return _progress;
}
+
void
Job::sub (string n)
{
_sub_start_time = time (0);
}
+
string
Job::error_details () const
{
return _error_details;
}
+
/** @return A summary of any error that the job has generated */
string
Job::error_summary () const
return _error_summary;
}
+
/** Set the current error string.
* @param s New error string.
* @param d New error detail string.
_error_details = d;
}
+
/** Say that this job's progress will be unknown until further notice */
void
Job::set_progress_unknown ()
set_progress_common (optional<float> ());
}
+
/** @return Human-readable status of this job */
string
Job::status () const
return s;
}
+
string
Job::json_status () const
{
return "";
}
+
/** @return An estimate of the remaining time for this sub-job, in seconds */
int
Job::remaining_time () const
return elapsed_sub_time() / progress().get() - elapsed_sub_time();
}
+
void
Job::cancel ()
{
_thread.join ();
}
+
/** @return true if the job was paused, false if it was not running */
bool
Job::pause_by_user ()
return paused;
}
+
void
Job::pause_by_priority ()
{
}
}
+
void
Job::resume ()
{
}
}
+
void
Job::when_finished (boost::signals2::connection& connection, function<void()> finished)
{
}
}
+
optional<string>
Job::message () const
{
return _message;
}
+
void
Job::set_message (string m)
{
*/
-#include "json_server.h"
-#include "job_manager.h"
-#include "job.h"
-#include "util.h"
#include "film.h"
+#include "job.h"
+#include "job_manager.h"
+#include "json_server.h"
#include "transcode_job.h"
+#include "util.h"
#include <dcp/raw_convert.h>
#include <boost/asio.hpp>
#include <boost/bind/bind.hpp>
#include <iostream>
-using std::string;
using std::cout;
-using std::map;
+using std::dynamic_pointer_cast;
using std::list;
-using boost::thread;
+using std::make_shared;
+using std::map;
using std::shared_ptr;
-using std::dynamic_pointer_cast;
+using std::string;
using boost::asio::ip::tcp;
+using boost::thread;
using dcp::raw_convert;
tcp::acceptor a (io_service, tcp::endpoint (tcp::v4 (), port));
while (true) {
try {
- shared_ptr<tcp::socket> s (new tcp::socket (io_service));
+ auto s = make_shared<tcp::socket>(io_service);
a.accept (*s);
handle (s);
}
*/
-#include "log.h"
-#include "cross.h"
#include "config.h"
+#include "cross.h"
+#include "log.h"
#include "string_log_entry.h"
#include <time.h>
#include <cstdio>
#include "i18n.h"
-using std::string;
using std::cout;
-using std::shared_ptr;
using std::make_shared;
+using std::shared_ptr;
+using std::string;
Log::Log ()
*/
-#include "mid_side_decoder.h"
#include "audio_buffers.h"
#include "audio_mapping.h"
+#include "mid_side_decoder.h"
#include "i18n.h"
*/
-#include "nanomsg.h"
#include "dcpomatic_log.h"
#include "exceptions.h"
+#include "nanomsg.h"
#include <nanomsg/nn.h>
#include <nanomsg/pair.h>
-#include <stdexcept>
#include <cerrno>
+#include <stdexcept>
-using std::string;
using std::runtime_error;
+using std::string;
using boost::optional;
*/
+#include "content.h"
#include "overlaps.h"
#include "types.h"
-#include "content.h"
using std::function;
#include "atmos_decoder.h"
-#include "player.h"
-#include "film.h"
#include "audio_buffers.h"
+#include "audio_content.h"
+#include "audio_decoder.h"
+#include "audio_processor.h"
+#include "compose.hpp"
+#include "config.h"
#include "content_audio.h"
+#include "content_video.h"
#include "dcp_content.h"
+#include "dcp_decoder.h"
#include "dcpomatic_log.h"
-#include "job.h"
+#include "decoder.h"
+#include "decoder_factory.h"
+#include "ffmpeg_content.h"
+#include "film.h"
+#include "frame_rate_change.h"
#include "image.h"
-#include "raw_image_proxy.h"
-#include "ratio.h"
+#include "image_decoder.h"
+#include "job.h"
#include "log.h"
-#include "render_text.h"
-#include "config.h"
-#include "content_video.h"
+#include "piece.h"
+#include "player.h"
#include "player_video.h"
-#include "frame_rate_change.h"
-#include "audio_processor.h"
#include "playlist.h"
+#include "ratio.h"
+#include "raw_image_proxy.h"
#include "referenced_reel_asset.h"
-#include "decoder_factory.h"
-#include "decoder.h"
-#include "video_decoder.h"
-#include "audio_decoder.h"
+#include "render_text.h"
+#include "shuffler.h"
#include "text_content.h"
#include "text_decoder.h"
-#include "ffmpeg_content.h"
-#include "audio_content.h"
-#include "dcp_decoder.h"
-#include "image_decoder.h"
-#include "compose.hpp"
-#include "shuffler.h"
#include "timer.h"
+#include "video_decoder.h"
#include <dcp/reel.h>
+#include <dcp/reel_closed_caption_asset.h>
+#include <dcp/reel_picture_asset.h>
#include <dcp/reel_sound_asset.h>
#include <dcp/reel_subtitle_asset.h>
-#include <dcp/reel_picture_asset.h>
-#include <dcp/reel_closed_caption_asset.h>
-#include <stdint.h>
#include <algorithm>
#include <iostream>
+#include <stdint.h>
#include "i18n.h"
using std::list;
using std::make_pair;
using std::make_shared;
+using std::make_shared;
using std::max;
using std::min;
using std::min;
using std::shared_ptr;
using std::vector;
using std::weak_ptr;
-using std::make_shared;
using boost::optional;
using boost::scoped_ptr;
#if BOOST_VERSION >= 106100
_black = Empty (_film, playlist(), bind(&have_video, _1), _playback_length);
_silent = Empty (_film, playlist(), bind(&have_audio, _1), _playback_length);
- _next_video_time = boost::optional<dcpomatic::DCPTime>();
+ _next_video_time = boost::none;
_next_video_eyes = Eyes::BOTH;
- _next_audio_time = boost::optional<dcpomatic::DCPTime>();
+ _next_audio_time = boost::none;
}
_next_video_eyes = Eyes::LEFT;
_next_audio_time = time;
} else {
- _next_video_time = optional<DCPTime>();
- _next_video_eyes = optional<Eyes>();
- _next_audio_time = optional<DCPTime>();
+ _next_video_time = boost::none;
+ _next_video_eyes = boost::none;
+ _next_audio_time = boost::none;
}
_black.set_position (time);
optional<DCPTime>
-Player::content_time_to_dcp (shared_ptr<Content> content, ContentTime t)
+Player::content_time_to_dcp (shared_ptr<const Content> content, ContentTime t)
{
boost::mutex::scoped_lock lm (_mutex);
#include "atmos_metadata.h"
#include "audio_merger.h"
#include "audio_stream.h"
-#include "content.h"
#include "content_atmos.h"
#include "content_audio.h"
#include "content_text.h"
#include "empty.h"
#include "film.h"
#include "image.h"
-#include "piece.h"
#include "player_text.h"
#include "position_image.h"
#include "shuffler.h"
}
class AtmosContent;
+class AudioBuffers;
+class Content;
class PlayerVideo;
class Playlist;
-class AudioBuffers;
class ReferencedReelAsset;
-class Shuffler;
class PlayerProperty
void set_play_referenced ();
void set_dcp_decode_reduction (boost::optional<int> reduction);
- boost::optional<dcpomatic::DCPTime> content_time_to_dcp (std::shared_ptr<Content> content, dcpomatic::ContentTime t);
+ boost::optional<dcpomatic::DCPTime> content_time_to_dcp (std::shared_ptr<const Content> content, dcpomatic::ContentTime t);
boost::signals2::signal<void (ChangeType, int, bool)> Change;
void construct ();
void setup_pieces ();
void setup_pieces_unlocked ();
- void flush ();
void film_change (ChangeType, Film::Property);
void playlist_change (ChangeType);
void playlist_content_change (ChangeType, int, bool);
/** > 0 if we are suspended (i.e. pass() and seek() do nothing) */
boost::atomic<int> _suspended;
- std::list<std::shared_ptr<Piece> > _pieces;
+ std::list<std::shared_ptr<Piece>> _pieces;
/** Size of the image we are rendering to; this may be the DCP frame size, or
* the size of preview in a window.
AudioMerger _audio_merger;
std::unique_ptr<Shuffler> _shuffler;
- std::list<std::pair<std::shared_ptr<PlayerVideo>, dcpomatic::DCPTime> > _delay;
+ std::list<std::pair<std::shared_ptr<PlayerVideo>, dcpomatic::DCPTime>> _delay;
class StreamState
{
*/
-#include "player_text.h"
#include "font.h"
+#include "player_text.h"
using std::list;
*/
+
#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;
+
PlayerVideo::PlayerVideo (
shared_ptr<const ImageProxy> in,
Crop crop,
}
+
PlayerVideo::PlayerVideo (shared_ptr<cxml::Node> node, shared_ptr<Socket> socket)
{
_crop = Crop (node);
}
}
+
void
PlayerVideo::set_text (PositionImage image)
{
_text = image;
}
+
shared_ptr<Image>
PlayerVideo::image (function<AVPixelFormat (AVPixelFormat)> pixel_format, VideoRange video_range, bool fast) const
{
}
}
+
void
PlayerVideo::add_metadata (xmlpp::Node* node) const
{
}
}
+
void
PlayerVideo::write_to_socket (shared_ptr<Socket> socket) const
{
}
}
+
bool
PlayerVideo::has_j2k () const
{
return _crop == Crop() && _out_size == j2k->size() && _inter_size == j2k->size() && !_text && !_fade && !_colour_conversion;
}
+
shared_ptr<const dcp::Data>
PlayerVideo::j2k () const
{
return j2k->j2k ();
}
+
Position<int>
PlayerVideo::inter_position () const
{
return Position<int> ((_out_size.width - _inter_size.width) / 2, (_out_size.height - _inter_size.height) / 2);
}
+
/** @return true if this PlayerVideo is definitely the same as another, false if it is probably not */
bool
PlayerVideo::same (shared_ptr<const PlayerVideo> other) const
return _in->same (other->_in);
}
+
AVPixelFormat
PlayerVideo::force (AVPixelFormat, AVPixelFormat force_to)
{
return p == AV_PIX_FMT_XYZ12LE ? AV_PIX_FMT_XYZ12LE : AV_PIX_FMT_RGB48LE;
}
+
void
PlayerVideo::prepare (function<AVPixelFormat (AVPixelFormat)> pixel_format, VideoRange video_range, Image::Alignment alignment, bool fast, bool proxy_only)
{
}
}
+
size_t
PlayerVideo::memory_used () const
{
return _in->memory_used();
}
+
/** @return Shallow copy of this; _in and _text are shared between the original and the copy */
shared_ptr<PlayerVideo>
PlayerVideo::shallow_copy () const
);
}
+
/** Re-read crop, fade, inter/out size, colour conversion and video range from our content.
* @return true if this was possible, false if not.
*/
*/
-#include "playlist.h"
-#include "video_content.h"
-#include "text_content.h"
-#include "ffmpeg_decoder.h"
-#include "ffmpeg_content.h"
-#include "image_decoder.h"
#include "audio_content.h"
+#include "compose.hpp"
+#include "config.h"
#include "content_factory.h"
#include "dcp_content.h"
+#include "digester.h"
+#include "ffmpeg_content.h"
+#include "ffmpeg_decoder.h"
+#include "image_decoder.h"
#include "job.h"
-#include "config.h"
+#include "playlist.h"
+#include "text_content.h"
#include "util.h"
-#include "digester.h"
-#include "compose.hpp"
+#include "video_content.h"
#include <libcxml/cxml.h>
#include <libxml++/libxml++.h>
#include <boost/bind/placeholders.hpp>
#include "i18n.h"
-using std::list;
using std::cout;
-using std::vector;
-using std::min;
+using std::dynamic_pointer_cast;
+using std::list;
using std::max;
-using std::string;
+using std::min;
using std::pair;
-using boost::optional;
using std::shared_ptr;
+using std::string;
+using std::vector;
using std::weak_ptr;
-using std::dynamic_pointer_cast;
+using boost::optional;
using namespace dcpomatic;
#if BOOST_VERSION >= 106100
using namespace boost::placeholders;
: wxDialog (parent, wxID_ANY, title)
, _recipient (recipient)
{
- wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
+ auto overall_sizer = new wxBoxSizer (wxVERTICAL);
SetSizer (overall_sizer);
_sizer = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
++r;
wxClientDC dc (this);
- wxFont font = _name->GetFont ();
+ auto font = _name->GetFont ();
font.SetFamily (wxFONTFAMILY_TELETYPE);
dc.SetFont (font);
- wxSize size = dc.GetTextExtent (wxT ("1234567890123456789012345678"));
- size.SetHeight (-1);
+ auto size = dc.GetTextExtent(wxT("1234567890123456789012345678"));
+ size.SetHeight (-1);
add_label_to_sizer (_sizer, this, _("Recipient certificate"), true, wxGBPosition (r, 0));
- wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+ auto s = new wxBoxSizer (wxHORIZONTAL);
_recipient_thumbprint = new StaticText (this, wxT (""), wxDefaultPosition, size);
_recipient_thumbprint->SetFont (font);
set_recipient (recipient);
overall_sizer->Add (_sizer, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
- wxSizer* buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL);
+ auto buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL);
if (buttons) {
overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
}
void
RecipientDialog::get_recipient_from_file ()
{
- wxFileDialog* d = new wxFileDialog (this, _("Select Certificate File"));
+ auto d = new wxFileDialog (this, _("Select Certificate File"));
if (d->ShowModal () == wxID_OK) {
load_recipient (boost::filesystem::path (wx_to_std (d->GetPath ())));
}
void
RecipientDialog::setup_sensitivity ()
{
- wxButton* ok = dynamic_cast<wxButton*> (FindWindowById (wxID_OK, this));
+ auto ok = dynamic_cast<wxButton*> (FindWindowById (wxID_OK, this));
if (ok) {
ok->Enable (static_cast<bool>(_recipient) && !_name->GetValue().IsEmpty());
}
DCPOMATIC_ENABLE_WARNINGS
+using std::dynamic_pointer_cast;
using std::map;
-using std::string;
+using std::make_shared;
using std::shared_ptr;
+using std::string;
using boost::bind;
-using std::dynamic_pointer_cast;
using boost::optional;
using namespace dcpomatic;
#if BOOST_VERSION >= 106100
/* XXX: assuming that all FFmpeg streams have bitmap subs */
if (_stream->colours().empty()) {
_job_manager_connection = JobManager::instance()->ActiveJobsChanged.connect(boost::bind(&SubtitleAppearanceDialog::active_jobs_changed, this, _1));
- _job = JobManager::instance()->add(shared_ptr<Job>(new ExamineFFmpegSubtitlesJob(film, ff)));
+ _job = JobManager::instance()->add(make_shared<ExamineFFmpegSubtitlesJob>(film, ff));
}
}
*/
+
#ifndef DCPOMATIC_WX_TIMECODE_H
#define DCPOMATIC_WX_TIMECODE_H
+
#include "wx_util.h"
#include "lib/dcpomatic_time.h"
#include "lib/types.h"
#include <wx/wx.h>
#include <boost/signals2.hpp>
+
class TimecodeBase : public wxPanel
{
public:
bool _ignore_changed = false;
};
+
template <class T>
class Timecode : public TimecodeBase
{
}
void
-TimelineContentView::do_paint (wxGraphicsContext* gc, list<dcpomatic::Rect<int> > overlaps)
+TimelineContentView::do_paint (wxGraphicsContext* gc, list<dcpomatic::Rect<int>> overlaps)
{
DCPOMATIC_ASSERT (_track);
return;
}
- DCPTime const position = cont->position ();
- DCPTime const len = cont->length_after_trim (film);
+ auto const position = cont->position ();
+ auto const len = cont->length_after_trim (film);
wxColour selected (background_colour().Red() / 2, background_colour().Green() / 2, background_colour().Blue() / 2);
void set_y (int y);
private:
- void do_paint (wxGraphicsContext* gc, std::list<dcpomatic::Rect<int> > overlaps);
+ void do_paint (wxGraphicsContext* gc, std::list<dcpomatic::Rect<int>> overlaps);
int _y; ///< y position in tracks (not pixels)
};
void
-checked_set (wxChoice* widget, vector<pair<string, string> > items)
+checked_set (wxChoice* widget, vector<pair<string, string>> items)
{
vector<pair<string, string>> current;
for (unsigned int i = 0; i < widget->GetCount(); ++i) {
*/
-#include "lib/film.h"
+#include "lib/config.h"
+#include "lib/content_factory.h"
#include "lib/dcp_content.h"
#include "lib/dcp_decoder.h"
-#include "lib/content_factory.h"
-#include "lib/player.h"
#include "lib/examine_content_job.h"
+#include "lib/film.h"
#include "lib/job_manager.h"
-#include "lib/config.h"
+#include "lib/piece.h"
+#include "lib/player.h"
#include "test.h"
#include <dcp/cpl.h>
#include <dcp/dcp.h>
#include "lib/content_factory.h"
#include "lib/dcpomatic_time.h"
#include "lib/film.h"
+#include "lib/piece.h"
#include "lib/player.h"
#include "lib/video_content.h"
#include "test.h"
*/
-#include "lib/film.h"
-#include "lib/ratio.h"
+#include "lib/content_factory.h"
+#include "lib/dcp_content.h"
+#include "lib/dcp_content_type.h"
#include "lib/ffmpeg_content.h"
+#include "lib/film.h"
#include "lib/image_content.h"
-#include "lib/dcp_content_type.h"
-#include "lib/dcp_content.h"
-#include "lib/video_content.h"
+#include "lib/ratio.h"
#include "lib/string_text_file_content.h"
-#include "lib/content_factory.h"
+#include "lib/video_content.h"
#include "test.h"
#include <boost/test/unit_test.hpp>
#include <iostream>
-using std::list;
using std::cout;
-using std::vector;
-using std::string;
-using std::shared_ptr;
-using std::make_shared;
using std::function;
+using std::list;
+using std::make_shared;
+using std::shared_ptr;
+using std::string;
+using std::vector;
using namespace dcpomatic;
auto check_image = check_proxy.image(Image::Alignment::COMPACT).image;
BOOST_REQUIRE_EQUAL (ref_image->pixel_format(), check_image->pixel_format());
- AVPixelFormat const format = ref_image->pixel_format();
+ auto const format = ref_image->pixel_format();
BOOST_REQUIRE (ref_image->size() == check_image->size());
int const width = ref_image->size().width;