player->set_play_referenced ();
player->Audio.connect (bind (&AnalyseAudioJob::analyse, this, _1, _2));
- DCPTime const length = _playlist->length ();
+ DCPTime const length = _playlist->length (_film);
Frame const len = DCPTime (length - _start).frames_round (_film->audio_frame_rate());
_samples_per_point = max (int64_t (1), len / _num_points);
_done += frames;
- DCPTime const length = _playlist->length ();
+ DCPTime const length = _playlist->length (_film);
set_progress ((time.seconds() - _start.seconds()) / (length.seconds() - _start.seconds()));
}
using std::string;
using boost::shared_ptr;
-AtmosMXFContent::AtmosMXFContent (shared_ptr<const Film> film, boost::filesystem::path path)
- : Content (film, path)
+AtmosMXFContent::AtmosMXFContent (boost::filesystem::path path)
+ : Content (path)
{
}
-AtmosMXFContent::AtmosMXFContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int)
- : Content (film, node)
+AtmosMXFContent::AtmosMXFContent (cxml::ConstNodePtr node, int)
+ : Content (node)
{
}
}
void
-AtmosMXFContent::examine (shared_ptr<Job> job)
+AtmosMXFContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
{
job->set_progress_unknown ();
- Content::examine (job);
+ Content::examine (film, job);
shared_ptr<dcp::AtmosAsset> a (new dcp::AtmosAsset (path(0)));
{
}
DCPTime
-AtmosMXFContent::full_length () const
+AtmosMXFContent::full_length (shared_ptr<const Film> film) const
{
- FrameRateChange const frc (active_video_frame_rate(), film()->video_frame_rate());
- return DCPTime::from_frames (llrint (_length * frc.factor()), film()->video_frame_rate());
+ FrameRateChange const frc (active_video_frame_rate(film), film->video_frame_rate());
+ return DCPTime::from_frames (llrint (_length * frc.factor()), film->video_frame_rate());
}
class AtmosMXFContent : public Content
{
public:
- AtmosMXFContent (boost::shared_ptr<const Film> film, boost::filesystem::path path);
- AtmosMXFContent (boost::shared_ptr<const Film> film, cxml::ConstNodePtr node, int version);
+ AtmosMXFContent (boost::filesystem::path path);
+ AtmosMXFContent (cxml::ConstNodePtr node, int version);
boost::shared_ptr<AtmosMXFContent> shared_from_this () {
return boost::dynamic_pointer_cast<AtmosMXFContent> (Content::shared_from_this ());
}
- void examine (boost::shared_ptr<Job> job);
+ void examine (boost::shared_ptr<const Film> film, boost::shared_ptr<Job> job);
std::string summary () const;
void as_xml (xmlpp::Node* node, bool with_path) const;
- DCPTime full_length () const;
+ DCPTime full_length (boost::shared_ptr<const Film> film) const;
static bool valid_mxf (boost::filesystem::path path);
* that it is in sync with the active video content at its start time.
*/
int
-AudioContent::resampled_frame_rate () const
+AudioContent::resampled_frame_rate (shared_ptr<const Film> film) const
{
/* Resample to a DCI-approved sample rate */
double t = has_rate_above_48k() ? 96000 : 48000;
- FrameRateChange frc (_parent->active_video_frame_rate(), _parent->film()->video_frame_rate());
+ FrameRateChange frc (_parent->active_video_frame_rate(film), film->video_frame_rate());
/* Compensate if the DCP is being run at a different frame rate
to the source; that is, if the video is run such that it will
}
string
-AudioContent::processing_description () const
+AudioContent::processing_description (shared_ptr<const Film> film) const
{
if (streams().empty ()) {
return "";
optional<int> common_frame_rate;
BOOST_FOREACH (AudioStreamPtr i, streams()) {
- if (i->frame_rate() != resampled_frame_rate()) {
+ if (i->frame_rate() != resampled_frame_rate(film)) {
resampled = true;
} else {
not_resampled = true;
}
if (not_resampled && resampled) {
- return String::compose (_("Some audio will be resampled to %1Hz"), resampled_frame_rate ());
+ return String::compose (_("Some audio will be resampled to %1Hz"), resampled_frame_rate(film));
}
if (!not_resampled && resampled) {
if (same) {
- return String::compose (_("Audio will be resampled from %1Hz to %2Hz"), common_frame_rate.get(), resampled_frame_rate ());
+ return String::compose (_("Audio will be resampled from %1Hz to %2Hz"), common_frame_rate.get(), resampled_frame_rate(film));
} else {
- return String::compose (_("Audio will be resampled to %1Hz"), resampled_frame_rate ());
+ return String::compose (_("Audio will be resampled to %1Hz"), resampled_frame_rate(film));
}
}
}
void
-AudioContent::add_properties (list<UserProperty>& p) const
+AudioContent::add_properties (shared_ptr<const Film> film, list<UserProperty>& p) const
{
shared_ptr<const AudioStream> stream;
if (streams().size() == 1) {
p.push_back (UserProperty (UserProperty::AUDIO, _("Content audio sample rate"), stream->frame_rate(), _("Hz")));
}
- FrameRateChange const frc (_parent->active_video_frame_rate(), _parent->film()->video_frame_rate());
- ContentTime const c (_parent->full_length(), frc);
+ FrameRateChange const frc (_parent->active_video_frame_rate(film), film->video_frame_rate());
+ ContentTime const c (_parent->full_length(film), frc);
p.push_back (
UserProperty (UserProperty::LENGTH, _("Full length in video frames at content rate"), c.frames_round(frc.source))
);
}
- p.push_back (UserProperty (UserProperty::AUDIO, _("DCP sample rate"), resampled_frame_rate (), _("Hz")));
+ p.push_back (UserProperty (UserProperty::AUDIO, _("DCP sample rate"), resampled_frame_rate(film), _("Hz")));
p.push_back (UserProperty (UserProperty::LENGTH, _("Full length in video frames at DCP rate"), c.frames_round (frc.dcp)));
if (stream) {
UserProperty (
UserProperty::LENGTH,
_("Full length in audio samples at DCP rate"),
- c.frames_round (resampled_frame_rate ())
+ c.frames_round(resampled_frame_rate(film))
)
);
}
}
void
-AudioContent::modify_position (DCPTime& pos) const
+AudioContent::modify_position (shared_ptr<const Film> film, DCPTime& pos) const
{
- pos = pos.round (_parent->film()->audio_frame_rate());
+ pos = pos.round (film->audio_frame_rate());
}
void
AudioMapping mapping () const;
void set_mapping (AudioMapping);
- int resampled_frame_rate () const;
+ int resampled_frame_rate (boost::shared_ptr<const Film> film) const;
bool has_rate_above_48k () const;
std::vector<std::string> channel_names () const;
return _delay;
}
- std::string processing_description () const;
+ std::string processing_description (boost::shared_ptr<const Film> film) const;
std::vector<AudioStreamPtr> streams () const {
boost::mutex::scoped_lock lm (_mutex);
void set_streams (std::vector<AudioStreamPtr> streams);
AudioStreamPtr stream () const;
- void add_properties (std::list<UserProperty> &) const;
+ void add_properties (boost::shared_ptr<const Film> film, std::list<UserProperty> &) const;
- void modify_position (DCPTime& pos) const;
+ void modify_position (boost::shared_ptr<const Film> film, DCPTime& pos) const;
void modify_trim_start (ContentTime& pos) const;
static boost::shared_ptr<AudioContent> from_xml (Content* parent, cxml::ConstNodePtr, int version);
#include "i18n.h"
-#define LOG_GENERAL(...) _log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
+#define LOG_GENERAL(...) dcpomatic_log->log (String::compose(__VA_ARGS__), LogEntry::TYPE_GENERAL);
using std::cout;
using std::map;
using boost::shared_ptr;
using boost::optional;
-AudioDecoder::AudioDecoder (Decoder* parent, shared_ptr<const AudioContent> content, shared_ptr<Log> log, bool fast)
- : DecoderPart (parent, log)
+AudioDecoder::AudioDecoder (Decoder* parent, shared_ptr<const AudioContent> content, bool fast)
+ : DecoderPart (parent)
, _content (content)
, _fast (fast)
{
}
void
-AudioDecoder::emit (AudioStreamPtr stream, shared_ptr<const AudioBuffers> data, ContentTime time)
+AudioDecoder::emit (shared_ptr<const Film> film, AudioStreamPtr stream, shared_ptr<const AudioBuffers> data, ContentTime time)
{
if (ignore ()) {
return;
silence (_content->delay ());
}
time += ContentTime::from_seconds (_content->delay() / 1000.0);
- _positions[stream] = time.frames_round (_content->resampled_frame_rate ());
+ _positions[stream] = time.frames_round (_content->resampled_frame_rate(film));
}
shared_ptr<Resampler> resampler;
if (i != _resamplers.end ()) {
resampler = i->second;
} else {
- if (stream->frame_rate() != _content->resampled_frame_rate()) {
+ if (stream->frame_rate() != _content->resampled_frame_rate(film)) {
LOG_GENERAL (
"Creating new resampler from %1 to %2 with %3 channels",
stream->frame_rate(),
- _content->resampled_frame_rate(),
+ _content->resampled_frame_rate(film),
stream->channels()
);
- resampler.reset (new Resampler (stream->frame_rate(), _content->resampled_frame_rate(), stream->channels()));
+ resampler.reset (new Resampler (stream->frame_rate(), _content->resampled_frame_rate(film), stream->channels()));
if (_fast) {
resampler->set_fast ();
}
/** @return Time just after the last thing that was emitted from a given stream */
ContentTime
-AudioDecoder::stream_position (AudioStreamPtr stream) const
+AudioDecoder::stream_position (shared_ptr<const Film> film, AudioStreamPtr stream) const
{
PositionMap::const_iterator i = _positions.find (stream);
DCPOMATIC_ASSERT (i != _positions.end ());
- return ContentTime::from_frames (i->second, _content->resampled_frame_rate());
+ return ContentTime::from_frames (i->second, _content->resampled_frame_rate(film));
}
ContentTime
-AudioDecoder::position () const
+AudioDecoder::position (shared_ptr<const Film> film) const
{
optional<ContentTime> p;
for (PositionMap::const_iterator i = _positions.begin(); i != _positions.end(); ++i) {
- ContentTime const ct = stream_position (i->first);
+ ContentTime const ct = stream_position (film, i->first);
if (!p || ct < *p) {
p = ct;
}
class AudioContent;
class AudioDecoderStream;
class Log;
+class Film;
class Resampler;
/** @class AudioDecoder.
class AudioDecoder : public boost::enable_shared_from_this<AudioDecoder>, public DecoderPart
{
public:
- AudioDecoder (Decoder* parent, boost::shared_ptr<const AudioContent> content, boost::shared_ptr<Log> log, bool fast);
+ AudioDecoder (Decoder* parent, boost::shared_ptr<const AudioContent> content, bool fast);
- ContentTime position () const;
- void emit (AudioStreamPtr stream, boost::shared_ptr<const AudioBuffers>, ContentTime);
+ ContentTime position (boost::shared_ptr<const Film> film) const;
+ void emit (boost::shared_ptr<const Film> film, AudioStreamPtr stream, boost::shared_ptr<const AudioBuffers>, ContentTime);
void seek ();
void flush ();
- ContentTime stream_position (AudioStreamPtr stream) const;
+ ContentTime stream_position (boost::shared_ptr<const Film> film, AudioStreamPtr stream) const;
/** @return Number of frames of data that were accepted */
boost::signals2::signal<void (AudioStreamPtr, ContentAudio)> Data;
int const ContentProperty::TRIM_END = 404;
int const ContentProperty::VIDEO_FRAME_RATE = 405;
-Content::Content (shared_ptr<const Film> film)
- : _film (film)
- , _position (0)
+Content::Content ()
+ : _position (0)
, _trim_start (0)
, _trim_end (0)
, _change_signals_frequent (false)
}
-Content::Content (shared_ptr<const Film> film, DCPTime p)
- : _film (film)
- , _position (p)
+Content::Content (DCPTime p)
+ : _position (p)
, _trim_start (0)
, _trim_end (0)
, _change_signals_frequent (false)
}
-Content::Content (shared_ptr<const Film> film, boost::filesystem::path p)
- : _film (film)
- , _position (0)
+Content::Content (boost::filesystem::path p)
+ : _position (0)
, _trim_start (0)
, _trim_end (0)
, _change_signals_frequent (false)
add_path (p);
}
-Content::Content (shared_ptr<const Film> film, cxml::ConstNodePtr node)
- : _film (film)
- , _change_signals_frequent (false)
+Content::Content (cxml::ConstNodePtr node)
+ : _change_signals_frequent (false)
{
list<cxml::NodePtr> path_children = node->node_children ("Path");
BOOST_FOREACH (cxml::NodePtr i, path_children) {
_video_frame_rate = node->optional_number_child<double> ("VideoFrameRate");
}
-Content::Content (shared_ptr<const Film> film, vector<shared_ptr<Content> > c)
- : _film (film)
- , _position (c.front()->position ())
+Content::Content (vector<shared_ptr<Content> > c)
+ : _position (c.front()->position ())
, _trim_start (c.front()->trim_start ())
, _trim_end (c.back()->trim_end ())
, _video_frame_rate (c.front()->video_frame_rate())
}
void
-Content::examine (shared_ptr<Job> job)
+Content::examine (shared_ptr<const Film>, shared_ptr<Job> job)
{
if (job) {
job->sub (_("Computing digest"));
}
void
-Content::set_position (DCPTime p)
+Content::set_position (shared_ptr<const Film> film, DCPTime p)
{
/* video and audio content can modify its position */
if (video) {
- video->modify_position (p);
+ video->modify_position (film, p);
}
if (audio) {
- audio->modify_position (p);
+ audio->modify_position (film, p);
}
ChangeSignaller<Content> cc (this, ContentProperty::POSITION);
shared_ptr<Content>
-Content::clone () const
+Content::clone (shared_ptr<const Film> film) const
{
- shared_ptr<const Film> film = _film.lock ();
- if (!film) {
- return shared_ptr<Content> ();
- }
-
/* This is a bit naughty, but I can't think of a compelling reason not to do it ... */
xmlpp::Document doc;
xmlpp::Node* node = doc.create_root_node ("Content");
/* notes is unused here (we assume) */
list<string> notes;
- return content_factory (film, cxml::NodePtr (new cxml::Node (node)), Film::current_state_version, notes);
+ return content_factory (film, cxml::NodePtr(new cxml::Node(node)), Film::current_state_version, notes);
}
string
}
DCPTime
-Content::length_after_trim () const
+Content::length_after_trim (shared_ptr<const Film> film) const
{
- return max (DCPTime (), full_length() - DCPTime (trim_start() + trim_end(), film()->active_frame_rate_change (position ())));
+ return max (DCPTime(), full_length(film) - DCPTime(trim_start() + trim_end(), film->active_frame_rate_change(position())));
}
/** @return string which changes when something about this content changes which affects
return p;
}
-shared_ptr<const Film>
-Content::film () const
-{
- shared_ptr<const Film> film = _film.lock ();
- DCPOMATIC_ASSERT (film);
- return film;
-}
-
/** @return DCP times of points within this content where a reel split could occur */
list<DCPTime>
Content::reel_split_points () const
}
double
-Content::active_video_frame_rate () const
+Content::active_video_frame_rate (shared_ptr<const Film> film) const
{
{
boost::mutex::scoped_lock lm (_mutex);
prepared for any concurrent video content or perhaps
just the DCP rate.
*/
- shared_ptr<const Film> film = _film.lock ();
- DCPOMATIC_ASSERT (film);
return film->active_frame_rate_change(position()).source;
}
class Content : public boost::enable_shared_from_this<Content>, public Signaller, public boost::noncopyable
{
public:
- explicit Content (boost::shared_ptr<const Film>);
- Content (boost::shared_ptr<const Film>, DCPTime);
- Content (boost::shared_ptr<const Film>, boost::filesystem::path);
- Content (boost::shared_ptr<const Film>, cxml::ConstNodePtr);
- Content (boost::shared_ptr<const Film>, std::vector<boost::shared_ptr<Content> >);
+ explicit Content ();
+ Content (DCPTime);
+ Content (boost::filesystem::path);
+ Content (cxml::ConstNodePtr);
+ Content (std::vector<boost::shared_ptr<Content> >);
virtual ~Content () {}
/** Examine the content to establish digest, frame rates and any other
* useful metadata.
* @param job Job to use to report progress, or 0.
*/
- virtual void examine (boost::shared_ptr<Job> job);
+ virtual void examine (boost::shared_ptr<const Film> film, boost::shared_ptr<Job> job);
virtual void take_settings_from (boost::shared_ptr<const Content> c);
virtual std::string technical_summary () const;
virtual void as_xml (xmlpp::Node *, bool with_paths) const;
- virtual DCPTime full_length () const = 0;
+ virtual DCPTime full_length (boost::shared_ptr<const Film>) const = 0;
virtual std::string identifier () const;
/** @return points at which to split this content when
* REELTYPE_BY_VIDEO_CONTENT is in use.
*/
virtual std::list<DCPTime> reel_split_points () const;
- boost::shared_ptr<Content> clone () const;
+ boost::shared_ptr<Content> clone (boost::shared_ptr<const Film> film) const;
void set_paths (std::vector<boost::filesystem::path> paths);
return _digest;
}
- void set_position (DCPTime);
+ void set_position (boost::shared_ptr<const Film> film, DCPTime);
/** DCPTime that this content starts; i.e. the time that the first
* bit of the content (trimmed or not) will happen.
}
/** @return Time immediately after the last thing in this content */
- DCPTime end () const {
- return position() + length_after_trim();
+ DCPTime end (boost::shared_ptr<const Film> film) const {
+ return position() + length_after_trim(film);
}
- DCPTime length_after_trim () const;
+ DCPTime length_after_trim (boost::shared_ptr<const Film> film) const;
boost::optional<double> video_frame_rate () const {
boost::mutex::scoped_lock lm (_mutex);
void set_video_frame_rate (double r);
void unset_video_frame_rate ();
- double active_video_frame_rate () const;
+ double active_video_frame_rate (boost::shared_ptr<const Film> film) const;
void set_change_signals_frequent (bool f) {
_change_signals_frequent = f;
}
- boost::shared_ptr<const Film> film () const;
-
std::list<UserProperty> user_properties () const;
std::string calculate_digest () const;
virtual void add_properties (std::list<UserProperty> &) const;
- boost::weak_ptr<const Film> _film;
-
/** _mutex which should be used to protect accesses, as examine
* jobs can update content state in threads other than the main one.
*/
using boost::shared_ptr;
using boost::optional;
-#define LOG_GENERAL(...) film->log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
+#define LOG_GENERAL(...) dcpomatic_log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
/** Create a Content object from an XML node.
- * @param film Film that the content will be in.
* @param node XML description.
* @param version XML state version.
* @param notes A list to which is added descriptions of any non-critial warnings / messages.
/* SndfileContent is now handled by the FFmpeg code rather than by
separate libsndfile-based code.
*/
- content.reset (new FFmpegContent (film, node, version, notes));
+ content.reset (new FFmpegContent (node, version, notes));
} else if (type == "Image") {
- content.reset (new ImageContent (film, node, version));
+ content.reset (new ImageContent (node, version));
} else if (type == "Sndfile") {
/* SndfileContent is now handled by the FFmpeg code rather than by
separate libsndfile-based code.
*/
- content.reset (new FFmpegContent (film, node, version, notes));
+ content.reset (new FFmpegContent (node, version, notes));
content->audio->set_stream (
AudioStreamPtr (
);
} else if (type == "SubRip" || type == "TextSubtitle") {
- content.reset (new StringTextFileContent (film, node, version));
+ content.reset (new StringTextFileContent (node, version));
} else if (type == "DCP") {
- content.reset (new DCPContent (film, node, version));
+ content.reset (new DCPContent (node, version));
} else if (type == "DCPSubtitle") {
- content.reset (new DCPSubtitleContent (film, node, version));
+ content.reset (new DCPSubtitleContent (node, version));
} else if (type == "VideoMXF") {
- content.reset (new VideoMXFContent (film, node, version));
+ content.reset (new VideoMXFContent (node, version));
} else if (type == "AtmosMXF") {
- content.reset (new AtmosMXFContent (film, node, version));
+ content.reset (new AtmosMXFContent (node, version));
}
/* See if this content should be nudged to start on a video frame */
DCPTime const old_pos = content->position();
- content->set_position(old_pos);
+ content->set_position(film, old_pos);
if (old_pos != content->position()) {
string note = _("Your project contains video content that was not aligned to a frame boundary.");
note += " ";
}
/** Create some Content objects from a file or directory.
- * @param film Film that the content will be in.
* @param path File or directory.
* @return Content objects.
*/
list<shared_ptr<Content> >
-content_factory (shared_ptr<const Film> film, boost::filesystem::path path)
+content_factory (boost::filesystem::path path)
{
list<shared_ptr<Content> > content;
}
if (image_files > 0 && sound_files == 0) {
- content.push_back (shared_ptr<Content> (new ImageContent (film, path)));
+ content.push_back (shared_ptr<Content> (new ImageContent(path)));
} else if (image_files == 0 && sound_files > 0) {
for (boost::filesystem::directory_iterator i(path); i != boost::filesystem::directory_iterator(); ++i) {
- content.push_back (shared_ptr<FFmpegContent> (new FFmpegContent (film, i->path())));
+ content.push_back (shared_ptr<FFmpegContent> (new FFmpegContent(i->path())));
}
}
transform (ext.begin(), ext.end(), ext.begin(), ::tolower);
if (valid_image_file (path)) {
- single.reset (new ImageContent (film, path));
+ single.reset (new ImageContent(path));
} else if (ext == ".srt" || ext == ".ssa" || ext == ".ass") {
- single.reset (new StringTextFileContent (film, path));
+ single.reset (new StringTextFileContent(path));
} else if (ext == ".xml") {
cxml::Document doc;
doc.read_file (path);
if (doc.root_name() == "DCinemaSecurityMessage") {
throw KDMAsContentError ();
}
- single.reset (new DCPSubtitleContent (film, path));
+ single.reset (new DCPSubtitleContent(path));
} else if (ext == ".mxf" && dcp::SMPTESubtitleAsset::valid_mxf (path)) {
- single.reset (new DCPSubtitleContent (film, path));
+ single.reset (new DCPSubtitleContent(path));
} else if (ext == ".mxf" && VideoMXFContent::valid_mxf (path)) {
- single.reset (new VideoMXFContent (film, path));
+ single.reset (new VideoMXFContent(path));
} else if (ext == ".mxf" && AtmosMXFContent::valid_mxf (path)) {
- single.reset (new AtmosMXFContent (film, path));
+ single.reset (new AtmosMXFContent(path));
}
if (!single) {
- single.reset (new FFmpegContent (film, path));
+ single.reset (new FFmpegContent(path));
}
content.push_back (single);
class Content;
extern boost::shared_ptr<Content> content_factory (boost::shared_ptr<const Film>, cxml::ConstNodePtr, int, std::list<std::string> &);
-extern std::list<boost::shared_ptr<Content> > content_factory (boost::shared_ptr<const Film>, boost::filesystem::path);
+extern std::list<boost::shared_ptr<Content> > content_factory (boost::filesystem::path);
using std::string;
using boost::shared_ptr;
-#define LOG_GENERAL(...) _dcp_content->film()->log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
+#define LOG_GENERAL(...) dcpomatic_log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
/** Find all the CPLs in our directories, cross-add assets and return the CPLs */
list<shared_ptr<dcp::CPL> >
int const DCPContentProperty::TEXTS = 606;
int const DCPContentProperty::CPL = 607;
-#define LOG_GENERAL(...) this->film()->log()->log(String::compose(__VA_ARGS__), LogEntry::TYPE_GENERAL);
+#define LOG_GENERAL(...) dcpomatic_log->log(String::compose(__VA_ARGS__), LogEntry::TYPE_GENERAL);
-DCPContent::DCPContent (shared_ptr<const Film> film, boost::filesystem::path p)
- : Content (film)
- , _encrypted (false)
+DCPContent::DCPContent (boost::filesystem::path p)
+ : _encrypted (false)
, _needs_assets (false)
, _kdm_valid (false)
, _reference_video (false)
}
}
-DCPContent::DCPContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
- : Content (film, node)
+DCPContent::DCPContent (cxml::ConstNodePtr node, int version)
+ : Content (node)
{
video = VideoContent::from_xml (this, node, version);
audio = AudioContent::from_xml (this, node, version);
}
void
-DCPContent::examine (shared_ptr<Job> job)
+DCPContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
{
bool const needed_assets = needs_assets ();
bool const needed_kdm = needs_kdm ();
if (job) {
job->set_progress_unknown ();
}
- Content::examine (job);
+ Content::examine (film, job);
shared_ptr<DCPExaminer> examiner (new DCPExaminer (shared_from_this ()));
AudioStreamPtr as (new AudioStream (examiner->audio_frame_rate(), examiner->audio_length(), examiner->audio_channels()));
audio->set_stream (as);
AudioMapping m = as->mapping ();
- film()->make_audio_mapping_default (m);
+ film->make_audio_mapping_default (m);
as->set_mapping (m);
}
}
DCPTime
-DCPContent::full_length () const
+DCPContent::full_length (shared_ptr<const Film> film) const
{
if (!video) {
return DCPTime();
}
- FrameRateChange const frc (active_video_frame_rate (), film()->video_frame_rate ());
- return DCPTime::from_frames (llrint (video->length () * frc.factor ()), film()->video_frame_rate ());
+ FrameRateChange const frc (active_video_frame_rate(film), film->video_frame_rate());
+ return DCPTime::from_frames (llrint(video->length() * frc.factor()), film->video_frame_rate());
}
string
}
void
-DCPContent::add_properties (list<UserProperty>& p) const
+DCPContent::add_properties (shared_ptr<const Film> film, list<UserProperty>& p) const
{
Content::add_properties (p);
if (video) {
video->add_properties (p);
}
if (audio) {
- audio->add_properties (p);
+ audio->add_properties (film, p);
}
}
}
list<DCPTimePeriod>
-DCPContent::reels () const
+DCPContent::reels (shared_ptr<const Film> film) const
{
list<int64_t> reel_lengths = _reel_lengths;
if (reel_lengths.empty ()) {
reel_lengths = examiner->reel_lengths ();
} catch (...) {
/* Could not examine the DCP; guess reels */
- reel_lengths.push_back (length_after_trim().frames_round (film()->video_frame_rate ()));
+ reel_lengths.push_back (length_after_trim(film).frames_round(film->video_frame_rate()));
}
}
BOOST_FOREACH (int64_t i, reel_lengths) {
/* This reel runs from `pos' to `to' */
- DCPTime const to = pos + DCPTime::from_frames (i, film()->video_frame_rate());
+ DCPTime const to = pos + DCPTime::from_frames (i, film->video_frame_rate());
if (to > position()) {
- p.push_back (DCPTimePeriod (max(position(), pos), min(end(), to)));
- if (to > end()) {
+ p.push_back (DCPTimePeriod (max(position(), pos), min(end(film), to)));
+ if (to > end(film)) {
break;
}
}
}
list<DCPTime>
-DCPContent::reel_split_points () const
+DCPContent::reel_split_points (shared_ptr<const Film> film) const
{
list<DCPTime> s;
- BOOST_FOREACH (DCPTimePeriod i, reels()) {
+ BOOST_FOREACH (DCPTimePeriod i, reels(film)) {
s.push_back (i.from);
}
return s;
}
bool
-DCPContent::can_reference (function<bool (shared_ptr<const Content>)> part, string overlapping, string& why_not) const
+DCPContent::can_reference (shared_ptr<const Film> film, function<bool (shared_ptr<const Content>)> part, string overlapping, string& why_not) const
{
/* We must be using the same standard as the film */
if (_standard) {
- if (_standard.get() == dcp::INTEROP && !film()->interop()) {
+ if (_standard.get() == dcp::INTEROP && !film->interop()) {
/// TRANSLATORS: this string will follow "Cannot reference this DCP: "
why_not = _("it is Interop and the film is set to SMPTE.");
return false;
- } else if (_standard.get() == dcp::SMPTE && film()->interop()) {
+ } else if (_standard.get() == dcp::SMPTE && film->interop()) {
/// TRANSLATORS: this string will follow "Cannot reference this DCP: "
why_not = _("it is SMPTE and the film is set to Interop.");
return false;
}
/* And the same frame rate */
- if (!video_frame_rate() || (lrint(video_frame_rate().get()) != film()->video_frame_rate())) {
+ if (!video_frame_rate() || (lrint(video_frame_rate().get()) != film->video_frame_rate())) {
/// TRANSLATORS: this string will follow "Cannot reference this DCP: "
why_not = _("it has a different frame rate to the film.");
return false;
}
- list<DCPTimePeriod> const fr = film()->reels ();
+ list<DCPTimePeriod> const fr = film->reels ();
list<DCPTimePeriod> reel_list;
try {
- reel_list = reels ();
+ reel_list = reels (film);
} catch (dcp::DCPReadError) {
/* We couldn't read the DCP; it's probably missing */
return false;
}
}
- ContentList a = overlaps (film()->content(), part, position(), end());
+ ContentList a = overlaps (film, film->content(), part, position(), end(film));
if (a.size() != 1 || a.front().get() != this) {
why_not = overlapping;
return false;
}
bool
-DCPContent::can_reference_video (string& why_not) const
+DCPContent::can_reference_video (shared_ptr<const Film> film, string& why_not) const
{
if (!video) {
why_not = _("There is no video in this DCP");
video_res = RESOLUTION_4K;
}
- if (film()->resolution() != video_res) {
+ if (film->resolution() != video_res) {
if (video_res == RESOLUTION_4K) {
/// TRANSLATORS: this string will follow "Cannot reference this DCP: "
why_not = _("it is 4K and the film is 2K.");
why_not = _("it is 2K and the film is 4K.");
}
return false;
- } else if (film()->frame_size() != video->size()) {
+ } else if (film->frame_size() != video->size()) {
/// TRANSLATORS: this string will follow "Cannot reference this DCP: "
why_not = _("its video frame size differs from the film's.");
return false;
}
/// TRANSLATORS: this string will follow "Cannot reference this DCP: "
- return can_reference (bind (&check_video, _1), _("it overlaps other video content; remove the other content."), why_not);
+ return can_reference (film, bind (&check_video, _1), _("it overlaps other video content; remove the other content."), why_not);
}
static
}
bool
-DCPContent::can_reference_audio (string& why_not) const
+DCPContent::can_reference_audio (shared_ptr<const Film> film, string& why_not) const
{
shared_ptr<DCPDecoder> decoder;
try {
- decoder.reset (new DCPDecoder (shared_from_this(), film()->log(), false));
+ decoder.reset (new DCPDecoder (shared_from_this(), false));
} catch (dcp::DCPReadError) {
/* We couldn't read the DCP, so it's probably missing */
return false;
}
/// TRANSLATORS: this string will follow "Cannot reference this DCP: "
- return can_reference (bind (&check_audio, _1), _("it overlaps other audio content; remove the other content."), why_not);
+ return can_reference (film, bind (&check_audio, _1), _("it overlaps other audio content; remove the other content."), why_not);
}
static
}
bool
-DCPContent::can_reference_text (TextType type, string& why_not) const
+DCPContent::can_reference_text (shared_ptr<const Film> film, TextType type, string& why_not) const
{
shared_ptr<DCPDecoder> decoder;
try {
- decoder.reset (new DCPDecoder (shared_from_this(), film()->log(), false));
+ decoder.reset (new DCPDecoder (shared_from_this(), false));
} catch (dcp::DCPReadError) {
/* We couldn't read the DCP, so it's probably missing */
return false;
}
/// TRANSLATORS: this string will follow "Cannot reference this DCP: "
- return can_reference (bind (&check_text, _1), _("it overlaps other text content; remove the other content."), why_not);
+ return can_reference (film, bind (&check_text, _1), _("it overlaps other text content; remove the other content."), why_not);
}
void
class DCPContent : public Content
{
public:
- DCPContent (boost::shared_ptr<const Film>, boost::filesystem::path p);
- DCPContent (boost::shared_ptr<const Film>, cxml::ConstNodePtr, int version);
+ DCPContent (boost::filesystem::path p);
+ DCPContent (cxml::ConstNodePtr, int version);
boost::shared_ptr<DCPContent> shared_from_this () {
return boost::dynamic_pointer_cast<DCPContent> (Content::shared_from_this ());
return boost::dynamic_pointer_cast<const DCPContent> (Content::shared_from_this ());
}
- DCPTime full_length () const;
+ DCPTime full_length (boost::shared_ptr<const Film> film) const;
- void examine (boost::shared_ptr<Job>);
+ void examine (boost::shared_ptr<const Film> film, boost::shared_ptr<Job>);
std::string summary () const;
std::string technical_summary () const;
void as_xml (xmlpp::Node *, bool with_paths) const;
void take_settings_from (boost::shared_ptr<const Content> c);
void set_default_colour_conversion ();
- std::list<DCPTime> reel_split_points () const;
+ std::list<DCPTime> reel_split_points (boost::shared_ptr<const Film> film) const;
std::vector<boost::filesystem::path> directories () const;
return _reference_video;
}
- bool can_reference_video (std::string &) const;
+ bool can_reference_video (boost::shared_ptr<const Film> film, std::string &) const;
void set_reference_audio (bool r);
return _reference_audio;
}
- bool can_reference_audio (std::string &) const;
+ bool can_reference_audio (boost::shared_ptr<const Film> film, std::string &) const;
void set_reference_text (TextType type, bool r);
return _reference_text[type];
}
- bool can_reference_text (TextType type, std::string &) const;
+ bool can_reference_text (boost::shared_ptr<const Film> film, TextType type, std::string &) const;
void set_cpl (std::string id);
private:
friend class reels_test5;
- void add_properties (std::list<UserProperty>& p) const;
+ void add_properties (boost::shared_ptr<const Film> film, std::list<UserProperty>& p) const;
void read_directory (boost::filesystem::path);
- std::list<DCPTimePeriod> reels () const;
+ std::list<DCPTimePeriod> reels (boost::shared_ptr<const Film> film) const;
bool can_reference (
+ boost::shared_ptr<const Film> film,
boost::function <bool (boost::shared_ptr<const Content>)>,
std::string overlapping,
std::string& why_not
using boost::dynamic_pointer_cast;
using boost::optional;
-DCPDecoder::DCPDecoder (shared_ptr<const DCPContent> c, shared_ptr<Log> log, bool fast)
+DCPDecoder::DCPDecoder (shared_ptr<const DCPContent> c, bool fast)
: DCP (c)
, _decode_referenced (false)
{
if (c->video) {
- video.reset (new VideoDecoder (this, c, log));
+ video.reset (new VideoDecoder (this, c));
}
if (c->audio) {
- audio.reset (new AudioDecoder (this, c->audio, log, fast));
+ audio.reset (new AudioDecoder (this, c->audio, fast));
}
BOOST_FOREACH (shared_ptr<TextContent> i, c->text) {
/* XXX: this time here should be the time of the first subtitle, not 0 */
- text.push_back (shared_ptr<TextDecoder> (new TextDecoder (this, i, log, ContentTime())));
+ text.push_back (shared_ptr<TextDecoder> (new TextDecoder (this, i, ContentTime())));
}
list<shared_ptr<dcp::CPL> > cpl_list = cpls ();
bool
-DCPDecoder::pass ()
+DCPDecoder::pass (shared_ptr<const Film> film)
{
if (_reel == _reels.end () || !_dcp_content->can_be_played ()) {
return true;
}
- double const vfr = _dcp_content->active_video_frame_rate ();
+ double 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);
/* We must emit texts first as when we emit the video for this frame
it will expect already to have the texts.
*/
- pass_texts (_next, picture_asset->size());
+ pass_texts (film, _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 ();
if (_mono_reader) {
video->emit (
+ film,
shared_ptr<ImageProxy> (
new J2KImageProxy (
_mono_reader->get_frame (entry_point + frame),
);
} else {
video->emit (
+ film,
shared_ptr<ImageProxy> (
new J2KImageProxy (
_stereo_reader->get_frame (entry_point + frame),
);
video->emit (
+ film,
shared_ptr<ImageProxy> (
new J2KImageProxy (
_stereo_reader->get_frame (entry_point + frame),
}
}
- audio->emit (_dcp_content->audio->stream(), data, ContentTime::from_frames (_offset, vfr) + _next);
+ audio->emit (film, _dcp_content->audio->stream(), data, ContentTime::from_frames (_offset, vfr) + _next);
}
_next += ContentTime::from_frames (1, vfr);
}
void
-DCPDecoder::pass_texts (ContentTime next, dcp::Size size)
+DCPDecoder::pass_texts (shared_ptr<const Film> film, ContentTime next, dcp::Size size)
{
list<shared_ptr<TextDecoder> >::const_iterator decoder = text.begin ();
if ((*_reel)->main_subtitle()) {
DCPOMATIC_ASSERT (decoder != text.end ());
pass_texts (
- next, (*_reel)->main_subtitle()->asset(), _dcp_content->reference_text(TEXT_OPEN_SUBTITLE), (*_reel)->main_subtitle()->entry_point(), *decoder, size
+ film,
+ next,
+ (*_reel)->main_subtitle()->asset(),
+ _dcp_content->reference_text(TEXT_OPEN_SUBTITLE),
+ (*_reel)->main_subtitle()->entry_point(),
+ *decoder,
+ size
);
++decoder;
}
BOOST_FOREACH (shared_ptr<dcp::ReelClosedCaptionAsset> i, (*_reel)->closed_captions()) {
DCPOMATIC_ASSERT (decoder != text.end ());
pass_texts (
- next, i->asset(), _dcp_content->reference_text(TEXT_CLOSED_CAPTION), i->entry_point(), *decoder, size
+ film, next, i->asset(), _dcp_content->reference_text(TEXT_CLOSED_CAPTION), i->entry_point(), *decoder, size
);
++decoder;
}
}
void
-DCPDecoder::pass_texts (ContentTime next, shared_ptr<dcp::SubtitleAsset> asset, bool reference, int64_t entry_point, shared_ptr<TextDecoder> decoder, dcp::Size size)
+DCPDecoder::pass_texts (
+ shared_ptr<const Film> film, 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 ();
+ double 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);
}
void
-DCPDecoder::seek (ContentTime t, bool accurate)
+DCPDecoder::seek (shared_ptr<const Film> film, ContentTime t, bool accurate)
{
if (!_dcp_content->can_be_played ()) {
return;
}
- Decoder::seek (t, accurate);
+ Decoder::seek (film, t, accurate);
_reel = _reels.begin ();
_offset = 0;
/* Seek to pre-roll position */
- while (_reel != _reels.end() && pre >= ContentTime::from_frames ((*_reel)->main_picture()->duration(), _dcp_content->active_video_frame_rate ())) {
- ContentTime rd = ContentTime::from_frames ((*_reel)->main_picture()->duration(), _dcp_content->active_video_frame_rate ());
+ while (_reel != _reels.end() && pre >= ContentTime::from_frames ((*_reel)->main_picture()->duration(), _dcp_content->active_video_frame_rate(film))) {
+ ContentTime rd = ContentTime::from_frames ((*_reel)->main_picture()->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 ();
+ double 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());
+ pass_texts (film, pre, (*_reel)->main_picture()->asset()->size());
pre += ContentTime::from_frames (1, vfr);
}
/* Seek to correct position */
- while (_reel != _reels.end() && t >= ContentTime::from_frames ((*_reel)->main_picture()->duration(), _dcp_content->active_video_frame_rate ())) {
- t -= ContentTime::from_frames ((*_reel)->main_picture()->duration(), _dcp_content->active_video_frame_rate ());
+ while (_reel != _reels.end() && t >= ContentTime::from_frames ((*_reel)->main_picture()->duration(), _dcp_content->active_video_frame_rate(film))) {
+ t -= ContentTime::from_frames ((*_reel)->main_picture()->duration(), _dcp_content->active_video_frame_rate(film));
next_reel ();
}
class DCPDecoder : public DCP, public Decoder
{
public:
- DCPDecoder (boost::shared_ptr<const DCPContent>, boost::shared_ptr<Log> log, bool fast);
+ DCPDecoder (boost::shared_ptr<const DCPContent>, bool fast);
std::list<boost::shared_ptr<dcp::Reel> > reels () const {
return _reels;
void set_decode_referenced (bool r);
void set_forced_reduction (boost::optional<int> reduction);
- bool pass ();
- void seek (ContentTime t, bool accurate);
+ bool pass (boost::shared_ptr<const Film> film);
+ void seek (boost::shared_ptr<const Film> film, ContentTime t, bool accurate);
private:
friend struct dcp_subtitle_within_dcp_test;
void next_reel ();
void get_readers ();
- void pass_texts (ContentTime next, dcp::Size size);
+ void pass_texts (boost::shared_ptr<const Film> film, ContentTime next, dcp::Size size);
void pass_texts (
- ContentTime next, boost::shared_ptr<dcp::SubtitleAsset> asset, bool reference, int64_t entry_point, boost::shared_ptr<TextDecoder> decoder, dcp::Size size
+ boost::shared_ptr<const Film> film,
+ ContentTime next,
+ boost::shared_ptr<dcp::SubtitleAsset> asset,
+ bool reference,
+ int64_t entry_point,
+ boost::shared_ptr<TextDecoder> decoder,
+ dcp::Size size
);
/** Time of next thing to return from pass relative to the start of _reel */
using boost::dynamic_pointer_cast;
using dcp::raw_convert;
-DCPSubtitleContent::DCPSubtitleContent (shared_ptr<const Film> film, boost::filesystem::path path)
- : Content (film, path)
+DCPSubtitleContent::DCPSubtitleContent (boost::filesystem::path path)
+ : Content (path)
{
text.push_back (shared_ptr<TextContent> (new TextContent (this, TEXT_OPEN_SUBTITLE, TEXT_OPEN_SUBTITLE)));
}
-DCPSubtitleContent::DCPSubtitleContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
- : Content (film, node)
+DCPSubtitleContent::DCPSubtitleContent (cxml::ConstNodePtr node, int version)
+ : Content (node)
, _length (node->number_child<ContentTime::Type> ("Length"))
{
text = TextContent::from_xml (this, node, version);
}
void
-DCPSubtitleContent::examine (shared_ptr<Job> job)
+DCPSubtitleContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
{
- Content::examine (job);
+ Content::examine (film, job);
shared_ptr<dcp::SubtitleAsset> sc = load (path (0));
}
DCPTime
-DCPSubtitleContent::full_length () const
+DCPSubtitleContent::full_length (shared_ptr<const Film> film) const
{
- FrameRateChange const frc (active_video_frame_rate(), film()->video_frame_rate());
+ FrameRateChange const frc (active_video_frame_rate(film), film->video_frame_rate());
return DCPTime (_length, frc);
}
class DCPSubtitleContent : public DCPSubtitle, public Content
{
public:
- DCPSubtitleContent (boost::shared_ptr<const Film>, boost::filesystem::path);
- DCPSubtitleContent (boost::shared_ptr<const Film>, cxml::ConstNodePtr, int);
+ DCPSubtitleContent (boost::filesystem::path);
+ DCPSubtitleContent (cxml::ConstNodePtr, int);
- void examine (boost::shared_ptr<Job>);
+ void examine (boost::shared_ptr<const Film> film, boost::shared_ptr<Job>);
std::string summary () const;
std::string technical_summary () const;
void as_xml (xmlpp::Node *, bool with_paths) const;
- DCPTime full_length () const;
+ DCPTime full_length (boost::shared_ptr<const Film> film) const;
private:
ContentTime _length;
using boost::dynamic_pointer_cast;
using boost::bind;
-DCPSubtitleDecoder::DCPSubtitleDecoder (shared_ptr<const DCPSubtitleContent> content, shared_ptr<Log> log)
+DCPSubtitleDecoder::DCPSubtitleDecoder (shared_ptr<const DCPSubtitleContent> content)
{
shared_ptr<dcp::SubtitleAsset> c (load (content->path (0)));
_subtitles = c->subtitles ();
if (_next != _subtitles.end()) {
first = content_time_period(*_next).from;
}
- text.push_back (shared_ptr<TextDecoder> (new TextDecoder (this, content->only_text(), log, first)));
+ text.push_back (shared_ptr<TextDecoder> (new TextDecoder (this, content->only_text(), first)));
}
void
-DCPSubtitleDecoder::seek (ContentTime time, bool accurate)
+DCPSubtitleDecoder::seek (shared_ptr<const Film> film, ContentTime time, bool accurate)
{
- Decoder::seek (time, accurate);
+ Decoder::seek (film, time, accurate);
_next = _subtitles.begin ();
list<shared_ptr<dcp::Subtitle> >::const_iterator i = _subtitles.begin ();
}
bool
-DCPSubtitleDecoder::pass ()
+DCPSubtitleDecoder::pass (shared_ptr<const Film>)
{
if (_next == _subtitles.end ()) {
return true;
class DCPSubtitleDecoder : public DCPSubtitle, public Decoder
{
public:
- DCPSubtitleDecoder (boost::shared_ptr<const DCPSubtitleContent>, boost::shared_ptr<Log> log);
+ DCPSubtitleDecoder (boost::shared_ptr<const DCPSubtitleContent>);
- bool pass ();
- void seek (ContentTime time, bool accurate);
+ bool pass (boost::shared_ptr<const Film> film);
+ void seek (boost::shared_ptr<const Film> film, ContentTime time, bool accurate);
private:
ContentTimePeriod content_time_period (boost::shared_ptr<dcp::Subtitle> s) const;
/** @return Earliest time of content that the next pass() will emit */
ContentTime
-Decoder::position () const
+Decoder::position (shared_ptr<const Film> film) const
{
optional<ContentTime> pos;
- if (video && !video->ignore() && (!pos || video->position() < *pos)) {
- pos = video->position();
+ if (video && !video->ignore() && (!pos || video->position(film) < *pos)) {
+ pos = video->position(film);
}
- if (audio && !audio->ignore() && (!pos || audio->position() < *pos)) {
- pos = audio->position();
+ if (audio && !audio->ignore() && (!pos || audio->position(film) < *pos)) {
+ pos = audio->position(film);
}
BOOST_FOREACH (shared_ptr<TextDecoder> i, text) {
- if (!i->ignore() && (!pos || i->position() < *pos)) {
- pos = i->position();
+ if (!i->ignore() && (!pos || i->position(film) < *pos)) {
+ pos = i->position(film);
}
}
}
void
-Decoder::seek (ContentTime, bool)
+Decoder::seek (shared_ptr<const Film>, ContentTime, bool)
{
if (video) {
video->seek ();
class AudioDecoder;
class TextDecoder;
class DecoderPart;
+class Film;
/** @class Decoder.
* @brief Parent class for decoders of content.
/** Do some decoding and perhaps emit video, audio or subtitle data.
* @return true if this decoder will emit no more data unless a seek() happens.
*/
- virtual bool pass () = 0;
- virtual void seek (ContentTime time, bool accurate);
+ virtual bool pass (boost::shared_ptr<const Film> film) = 0;
+ virtual void seek (boost::shared_ptr<const Film> film, ContentTime time, bool accurate);
- ContentTime position () const;
+ ContentTime position (boost::shared_ptr<const Film> film) const;
};
#endif
using boost::dynamic_pointer_cast;
shared_ptr<Decoder>
-decoder_factory (shared_ptr<const Content> content, shared_ptr<Log> log, bool fast)
+decoder_factory (shared_ptr<const Film> film, shared_ptr<const Content> content, bool fast)
{
shared_ptr<const FFmpegContent> fc = dynamic_pointer_cast<const FFmpegContent> (content);
if (fc) {
- return shared_ptr<Decoder> (new FFmpegDecoder (fc, log, fast));
+ return shared_ptr<Decoder> (new FFmpegDecoder(film, fc, fast));
}
shared_ptr<const DCPContent> dc = dynamic_pointer_cast<const DCPContent> (content);
if (dc) {
try {
- return shared_ptr<Decoder> (new DCPDecoder (dc, log, fast));
+ return shared_ptr<Decoder> (new DCPDecoder(dc, fast));
} catch (KDMError& e) {
/* This will be found and reported to the user when the content is examined */
return shared_ptr<Decoder>();
shared_ptr<const ImageContent> ic = dynamic_pointer_cast<const ImageContent> (content);
if (ic) {
- return shared_ptr<Decoder> (new ImageDecoder (ic, log));
+ return shared_ptr<Decoder> (new ImageDecoder(ic));
}
shared_ptr<const StringTextFileContent> rc = dynamic_pointer_cast<const StringTextFileContent> (content);
if (rc) {
- return shared_ptr<Decoder> (new StringTextFileDecoder (rc, log));
+ return shared_ptr<Decoder> (new StringTextFileDecoder(rc));
}
shared_ptr<const DCPSubtitleContent> dsc = dynamic_pointer_cast<const DCPSubtitleContent> (content);
if (dsc) {
- return shared_ptr<Decoder> (new DCPSubtitleDecoder (dsc, log));
+ return shared_ptr<Decoder> (new DCPSubtitleDecoder(dsc));
}
shared_ptr<const VideoMXFContent> vmc = dynamic_pointer_cast<const VideoMXFContent> (content);
if (vmc) {
- return shared_ptr<Decoder> (new VideoMXFDecoder (vmc, log));
+ return shared_ptr<Decoder> (new VideoMXFDecoder(vmc));
}
return shared_ptr<Decoder> ();
class ImageDecoder;
extern boost::shared_ptr<Decoder> decoder_factory (
+ boost::shared_ptr<const Film> film,
boost::shared_ptr<const Content> content,
- boost::shared_ptr<Log> log,
bool fast
);
using boost::shared_ptr;
-DecoderPart::DecoderPart (Decoder* parent, shared_ptr<Log> log)
+DecoderPart::DecoderPart (Decoder* parent)
: _parent (parent)
- , _log (log)
, _ignore (false)
{
class Decoder;
class Log;
+class Film;
class DecoderPart
{
public:
- DecoderPart (Decoder* parent, boost::shared_ptr<Log> log);
+ DecoderPart (Decoder* parent);
virtual ~DecoderPart () {}
- virtual ContentTime position () const = 0;
+ virtual ContentTime position (boost::shared_ptr<const Film> film) const = 0;
virtual void seek () = 0;
void set_ignore (bool i) {
protected:
Decoder* _parent;
- boost::shared_ptr<Log> _log;
private:
bool _ignore;
using boost::dynamic_pointer_cast;
using boost::function;
-Empty::Empty (list<shared_ptr<Piece> > pieces, DCPTime length, function<bool (shared_ptr<Piece>)> part)
+Empty::Empty (shared_ptr<const Film> film, list<shared_ptr<Piece> > pieces, function<bool (shared_ptr<Piece>)> part)
{
list<DCPTimePeriod> full;
BOOST_FOREACH (shared_ptr<Piece> i, pieces) {
if (part(i)) {
- full.push_back (DCPTimePeriod (i->content->position(), i->content->end()));
+ full.push_back (DCPTimePeriod (i->content->position(), i->content->end(film)));
}
}
- _periods = subtract (DCPTimePeriod(DCPTime(), length), coalesce(full));
+ _periods = subtract (DCPTimePeriod(DCPTime(), film->length()), coalesce(full));
if (!_periods.empty ()) {
_position = _periods.front().from;
{
public:
Empty () {}
- Empty (std::list<boost::shared_ptr<Piece> > pieces, DCPTime length, boost::function<bool (boost::shared_ptr<Piece>)> part);
+ Empty (boost::shared_ptr<const Film> film, std::list<boost::shared_ptr<Piece> > pieces, boost::function<bool (boost::shared_ptr<Piece>)> part);
DCPTime position () const {
return _position;
void
ExamineContentJob::run ()
{
- _content->examine (shared_from_this ());
+ _content->examine (_film, shared_from_this());
set_progress (1);
set_state (FINISHED_OK);
}
/* This might not work too well in some cases of multiple FFmpeg decoders,
but it's probably good enough.
*/
- _ffmpeg_log = _ffmpeg_content->film()->log ();
av_log_set_callback (FFmpeg::ffmpeg_log_callback);
_file_group.set_paths (_ffmpeg_content->paths ());
throw DecodeError (N_("could not open decoder"));
}
} else {
- shared_ptr<Log> log = _ffmpeg_log.lock ();
- if (log) {
- log->log (String::compose ("No codec found for stream %1", i), LogEntry::TYPE_WARNING);
- }
+ dcpomatic_log->log (String::compose ("No codec found for stream %1", i), LogEntry::TYPE_WARNING);
}
}
}
#include "i18n.h"
-#define LOG_GENERAL(...) film->log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
+#define LOG_GENERAL(...) dcpomatic_log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
using std::string;
using std::vector;
int const FFmpegContentProperty::SUBTITLE_STREAM = 101;
int const FFmpegContentProperty::FILTERS = 102;
-FFmpegContent::FFmpegContent (shared_ptr<const Film> film, boost::filesystem::path p)
- : Content (film, p)
+FFmpegContent::FFmpegContent (boost::filesystem::path p)
+ : Content (p)
, _encrypted (false)
{
return static_cast<T>(*v);
}
-FFmpegContent::FFmpegContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version, list<string>& notes)
- : Content (film, node)
+FFmpegContent::FFmpegContent (cxml::ConstNodePtr node, int version, list<string>& notes)
+ : Content (node)
{
video = VideoContent::from_xml (this, node, version);
audio = AudioContent::from_xml (this, node, version);
_encrypted = node->optional_bool_child("Encrypted").get_value_or(false);
}
-FFmpegContent::FFmpegContent (shared_ptr<const Film> film, vector<shared_ptr<Content> > c)
- : Content (film, c)
+FFmpegContent::FFmpegContent (vector<shared_ptr<Content> > c)
+ : Content (c)
{
vector<shared_ptr<Content> >::const_iterator i = c.begin ();
}
void
-FFmpegContent::examine (shared_ptr<Job> job)
+FFmpegContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
{
ChangeSignaller<Content> cc1 (this, FFmpegContentProperty::SUBTITLE_STREAMS);
ChangeSignaller<Content> cc2 (this, FFmpegContentProperty::SUBTITLE_STREAM);
job->set_progress_unknown ();
- Content::examine (job);
+ Content::examine (film, job);
shared_ptr<FFmpegExaminer> examiner (new FFmpegExaminer (shared_from_this (), job));
AudioStreamPtr as = audio->streams().front();
AudioMapping m = as->mapping ();
- film()->make_audio_mapping_default (m, first_path);
+ film->make_audio_mapping_default (m, first_path);
as->set_mapping (m);
}
}
DCPTime
-FFmpegContent::full_length () const
+FFmpegContent::full_length (shared_ptr<const Film> film) const
{
- FrameRateChange const frc (active_video_frame_rate (), film()->video_frame_rate ());
+ FrameRateChange const frc (active_video_frame_rate(film), film->video_frame_rate());
if (video) {
- return DCPTime::from_frames (llrint (video->length_after_3d_combine() * frc.factor()), film()->video_frame_rate());
+ return DCPTime::from_frames (llrint (video->length_after_3d_combine() * frc.factor()), film->video_frame_rate());
}
DCPOMATIC_ASSERT (audio);
}
void
-FFmpegContent::add_properties (list<UserProperty>& p) const
+FFmpegContent::add_properties (shared_ptr<const Film> film, list<UserProperty>& p) const
{
Content::add_properties (p);
}
if (audio) {
- audio->add_properties (p);
+ audio->add_properties (film, p);
}
}
class FFmpegContent : public Content
{
public:
- FFmpegContent (boost::shared_ptr<const Film>, boost::filesystem::path);
- FFmpegContent (boost::shared_ptr<const Film>, cxml::ConstNodePtr, int version, std::list<std::string> &);
- FFmpegContent (boost::shared_ptr<const Film>, std::vector<boost::shared_ptr<Content> >);
+ FFmpegContent (boost::filesystem::path);
+ FFmpegContent (cxml::ConstNodePtr, int version, std::list<std::string> &);
+ FFmpegContent (std::vector<boost::shared_ptr<Content> >);
boost::shared_ptr<FFmpegContent> shared_from_this () {
return boost::dynamic_pointer_cast<FFmpegContent> (Content::shared_from_this ());
}
- void examine (boost::shared_ptr<Job>);
+ void examine (boost::shared_ptr<const Film> film, boost::shared_ptr<Job>);
void take_settings_from (boost::shared_ptr<const Content> c);
std::string summary () const;
std::string technical_summary () const;
void as_xml (xmlpp::Node *, bool with_paths) const;
- DCPTime full_length () const;
+ DCPTime full_length (boost::shared_ptr<const Film> film) const;
std::string identifier () const;
}
private:
- void add_properties (std::list<UserProperty> &) const;
+ void add_properties (boost::shared_ptr<const Film> film, std::list<UserProperty> &) const;
friend struct ffmpeg_pts_offset_test;
friend struct audio_sampling_rate_test;
#include "i18n.h"
-#define LOG_GENERAL(...) _log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
-#define LOG_ERROR(...) _log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_ERROR);
-#define LOG_WARNING_NC(...) _log->log (__VA_ARGS__, LogEntry::TYPE_WARNING);
-#define LOG_WARNING(...) _log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_WARNING);
+#define LOG_GENERAL(...) dcpomatic_log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
+#define LOG_ERROR(...) dcpomatic_log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_ERROR);
+#define LOG_WARNING_NC(...) dcpomatic_log->log (__VA_ARGS__, LogEntry::TYPE_WARNING);
+#define LOG_WARNING(...) dcpomatic_log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_WARNING);
using std::cout;
using std::string;
using boost::dynamic_pointer_cast;
using dcp::Size;
-FFmpegDecoder::FFmpegDecoder (shared_ptr<const FFmpegContent> c, shared_ptr<Log> log, bool fast)
+FFmpegDecoder::FFmpegDecoder (shared_ptr<const Film> film, shared_ptr<const FFmpegContent> c, bool fast)
: FFmpeg (c)
- , _log (log)
, _have_current_subtitle (false)
{
if (c->video) {
- video.reset (new VideoDecoder (this, c, log));
- _pts_offset = pts_offset (c->ffmpeg_audio_streams(), c->first_video(), c->active_video_frame_rate());
+ video.reset (new VideoDecoder (this, c));
+ _pts_offset = pts_offset (c->ffmpeg_audio_streams(), c->first_video(), c->active_video_frame_rate(film));
/* It doesn't matter what size or pixel format this is, it just needs to be black */
_black_image.reset (new Image (AV_PIX_FMT_RGB24, dcp::Size (128, 128), true));
_black_image->make_black ();
}
if (c->audio) {
- audio.reset (new AudioDecoder (this, c->audio, log, fast));
+ audio.reset (new AudioDecoder (this, c->audio, fast));
}
if (c->only_text()) {
/* XXX: this time here should be the time of the first subtitle, not 0 */
- text.push_back (shared_ptr<TextDecoder> (new TextDecoder (this, c->only_text(), log, ContentTime())));
+ text.push_back (shared_ptr<TextDecoder> (new TextDecoder (this, c->only_text(), ContentTime())));
}
_next_time.resize (_format_context->nb_streams);
}
void
-FFmpegDecoder::flush ()
+FFmpegDecoder::flush (shared_ptr<const Film> film)
{
/* Get any remaining frames */
/* XXX: should we reset _packet.data and size after each *_decode_* call? */
- while (video && decode_video_packet ()) {}
+ while (video && decode_video_packet(film)) {}
if (audio) {
- decode_audio_packet ();
+ decode_audio_packet (film);
}
/* Make sure all streams are the same length and round up to the next video frame */
- FrameRateChange const frc = _ffmpeg_content->film()->active_frame_rate_change(_ffmpeg_content->position());
- ContentTime full_length (_ffmpeg_content->full_length(), frc);
+ FrameRateChange const frc = film->active_frame_rate_change(_ffmpeg_content->position());
+ ContentTime full_length (_ffmpeg_content->full_length(film), frc);
full_length = full_length.ceil (frc.source);
if (video) {
double const vfr = _ffmpeg_content->video_frame_rate().get();
Frame const f = full_length.frames_round (vfr);
- Frame v = video->position().frames_round (vfr) + 1;
+ Frame v = video->position(film).frames_round (vfr) + 1;
while (v < f) {
- video->emit (shared_ptr<const ImageProxy> (new RawImageProxy (_black_image)), v);
+ video->emit (film, shared_ptr<const ImageProxy> (new RawImageProxy (_black_image)), v);
++v;
}
}
BOOST_FOREACH (shared_ptr<FFmpegAudioStream> i, _ffmpeg_content->ffmpeg_audio_streams ()) {
- ContentTime a = audio->stream_position(i);
+ ContentTime a = audio->stream_position(film, i);
/* Unfortunately if a is 0 that really means that we don't know the stream position since
there has been no data on it since the last seek. In this case we'll just do nothing
here. I'm not sure if that's the right idea.
ContentTime to_do = min (full_length - a, ContentTime::from_seconds (0.1));
shared_ptr<AudioBuffers> silence (new AudioBuffers (i->channels(), to_do.frames_ceil (i->frame_rate())));
silence->make_silent ();
- audio->emit (i, silence, a);
+ audio->emit (film, i, silence, a);
a += to_do;
}
}
}
bool
-FFmpegDecoder::pass ()
+FFmpegDecoder::pass (shared_ptr<const Film> film)
{
int r = av_read_frame (_format_context, &_packet);
LOG_ERROR (N_("error on av_read_frame (%1) (%2)"), &buf[0], r);
}
- flush ();
+ flush (film);
return true;
}
shared_ptr<const FFmpegContent> fc = _ffmpeg_content;
if (_video_stream && si == _video_stream.get() && !video->ignore()) {
- decode_video_packet ();
+ decode_video_packet (film);
} else if (fc->subtitle_stream() && fc->subtitle_stream()->uses_index(_format_context, si) && !only_text()->ignore()) {
decode_subtitle_packet ();
} else {
- decode_audio_packet ();
+ decode_audio_packet (film);
}
av_packet_unref (&_packet);
}
void
-FFmpegDecoder::seek (ContentTime time, bool accurate)
+FFmpegDecoder::seek (shared_ptr<const Film> film, ContentTime time, bool accurate)
{
- Decoder::seek (time, accurate);
+ Decoder::seek (film, time, accurate);
/* If we are doing an `accurate' seek, we need to use pre-roll, as
we don't really know what the seek will give us.
}
void
-FFmpegDecoder::decode_audio_packet ()
+FFmpegDecoder::decode_audio_packet (shared_ptr<const Film> film)
{
/* Audio packets can contain multiple frames, so we may have to call avcodec_decode_audio4
several times.
/* Give this data provided there is some, and its time is sane */
if (ct >= ContentTime() && data->frames() > 0) {
- audio->emit (*stream, data, ct);
+ audio->emit (film, *stream, data, ct);
}
}
}
bool
-FFmpegDecoder::decode_video_packet ()
+FFmpegDecoder::decode_video_packet (shared_ptr<const Film> film)
{
DCPOMATIC_ASSERT (_video_stream);
double const pts = i->second * av_q2d (_format_context->streams[_video_stream.get()]->time_base) + _pts_offset.seconds ();
video->emit (
+ film,
shared_ptr<ImageProxy> (new RawImageProxy (image)),
- llrint(pts * _ffmpeg_content->active_video_frame_rate())
+ llrint(pts * _ffmpeg_content->active_video_frame_rate(film))
);
} else {
LOG_WARNING_NC ("Dropping frame without PTS");
class FFmpegDecoder : public FFmpeg, public Decoder
{
public:
- FFmpegDecoder (boost::shared_ptr<const FFmpegContent>, boost::shared_ptr<Log> log, bool fast);
+ FFmpegDecoder (boost::shared_ptr<const Film> film, boost::shared_ptr<const FFmpegContent>, bool fast);
- bool pass ();
- void seek (ContentTime time, bool);
+ bool pass (boost::shared_ptr<const Film> film);
+ void seek (boost::shared_ptr<const Film> film, ContentTime time, bool);
private:
friend struct ::ffmpeg_pts_offset_test;
- void flush ();
+ void flush (boost::shared_ptr<const Film> film);
AVSampleFormat audio_sample_format (boost::shared_ptr<FFmpegAudioStream> stream) const;
int bytes_per_audio_sample (boost::shared_ptr<FFmpegAudioStream> stream) const;
- bool decode_video_packet ();
- void decode_audio_packet ();
+ bool decode_video_packet (boost::shared_ptr<const Film> film);
+ void decode_audio_packet (boost::shared_ptr<const Film> film);
void decode_subtitle_packet ();
void decode_bitmap_subtitle (AVSubtitleRect const * rect, ContentTime from);
void maybe_add_subtitle ();
boost::shared_ptr<AudioBuffers> deinterleave_audio (boost::shared_ptr<FFmpegAudioStream> stream) const;
- boost::shared_ptr<Log> _log;
-
std::list<boost::shared_ptr<VideoFilterGraph> > _filter_graphs;
boost::mutex _filter_graphs_mutex;
/* We want to call Playlist::maybe_sequence but this must happen after the
main signal emission (since the butler will see that emission and un-suspend itself).
*/
- emit (boost::bind(&Playlist::maybe_sequence, _playlist.get()));
+ emit (boost::bind(&Playlist::maybe_sequence, _playlist.get(), shared_from_this()));
}
} else {
Change (type, p);
if (Config::instance()->automatic_audio_analysis() && content->audio && !disable_audio_analysis) {
shared_ptr<Playlist> playlist (new Playlist);
- playlist->add (content);
+ playlist->add (shared_from_this(), content);
boost::signals2::connection c;
JobManager::instance()->analyse_audio (
shared_from_this(), playlist, false, c, bind (&Film::audio_analysis_finished, this)
{
/* Add {video,subtitle} content after any existing {video,subtitle} content */
if (c->video) {
- c->set_position (_playlist->video_end());
+ c->set_position (shared_from_this(), _playlist->video_end(shared_from_this()));
} else if (!c->text.empty()) {
- c->set_position (_playlist->text_end());
+ c->set_position (shared_from_this(), _playlist->text_end(shared_from_this()));
}
if (_template_film) {
}
}
- _playlist->add (c);
+ _playlist->add (shared_from_this(), c);
}
void
void
Film::move_content_earlier (shared_ptr<Content> c)
{
- _playlist->move_earlier (c);
+ _playlist->move_earlier (shared_from_this(), c);
}
void
Film::move_content_later (shared_ptr<Content> c)
{
- _playlist->move_later (c);
+ _playlist->move_later (shared_from_this(), c);
}
/** @return length of the film from time 0 to the last thing on the playlist */
DCPTime
Film::length () const
{
- return _playlist->length().ceil(video_frame_rate());
+ return _playlist->length(shared_from_this()).ceil(video_frame_rate());
}
int
uint64_t
Film::required_disk_space () const
{
- return _playlist->required_disk_space (j2k_bandwidth(), audio_channels(), audio_frame_rate());
+ return _playlist->required_disk_space (shared_from_this(), j2k_bandwidth(), audio_channels(), audio_frame_rate());
}
/** This method checks the disk that the Film is on and tries to decide whether or not
void
Film::repeat_content (ContentList c, int n)
{
- _playlist->repeat (c, n);
+ _playlist->repeat (shared_from_this(), c, n);
}
void
}
}
- DCPTime video_end = last_video ? last_video->end() : DCPTime(0);
+ DCPTime video_end = last_video ? last_video->end(shared_from_this()) : DCPTime(0);
if (last_split) {
/* Definitely go from the last split to the end of the video content */
p.push_back (DCPTimePeriod (last_split.get(), video_end));
string
Film::content_summary (DCPTimePeriod period) const
{
- return _playlist->content_summary (period);
+ return _playlist->content_summary (shared_from_this(), period);
}
void
using std::vector;
using boost::shared_ptr;
-ImageContent::ImageContent (shared_ptr<const Film> film, boost::filesystem::path p)
- : Content (film)
+ImageContent::ImageContent (boost::filesystem::path p)
{
video.reset (new VideoContent (this));
}
-ImageContent::ImageContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
- : Content (film, node)
+ImageContent::ImageContent (cxml::ConstNodePtr node, int version)
+ : Content (node)
{
video = VideoContent::from_xml (this, node, version);
}
}
void
-ImageContent::examine (shared_ptr<Job> job)
+ImageContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
{
if (_path_to_scan) {
job->sub (_("Scanning image files"));
set_paths (paths);
}
- Content::examine (job);
-
- shared_ptr<const Film> film = _film.lock ();
- DCPOMATIC_ASSERT (film);
+ Content::examine (film, job);
shared_ptr<ImageExaminer> examiner (new ImageExaminer (film, shared_from_this(), job));
video->take_from_examiner (examiner);
}
DCPTime
-ImageContent::full_length () const
+ImageContent::full_length (shared_ptr<const Film> film) const
{
- shared_ptr<const Film> film = _film.lock ();
- DCPOMATIC_ASSERT (film);
- FrameRateChange const frc (active_video_frame_rate(), film->video_frame_rate());
- return DCPTime::from_frames (llrint (video->length_after_3d_combine() * frc.factor ()), film->video_frame_rate ());
+ FrameRateChange const frc (active_video_frame_rate(film), film->video_frame_rate());
+ return DCPTime::from_frames (llrint(video->length_after_3d_combine() * frc.factor()), film->video_frame_rate());
}
string
class ImageContent : public Content
{
public:
- ImageContent (boost::shared_ptr<const Film>, boost::filesystem::path);
- ImageContent (boost::shared_ptr<const Film>, cxml::ConstNodePtr, int);
+ ImageContent (boost::filesystem::path);
+ ImageContent (cxml::ConstNodePtr, int);
boost::shared_ptr<ImageContent> shared_from_this () {
return boost::dynamic_pointer_cast<ImageContent> (Content::shared_from_this ());
};
- void examine (boost::shared_ptr<Job>);
+ void examine (boost::shared_ptr<const Film> film, boost::shared_ptr<Job>);
std::string summary () const;
std::string technical_summary () const;
void as_xml (xmlpp::Node *, bool with_paths) const;
- DCPTime full_length () const;
+ DCPTime full_length (boost::shared_ptr<const Film> film) const;
std::string identifier () const;
using boost::shared_ptr;
using dcp::Size;
-ImageDecoder::ImageDecoder (shared_ptr<const ImageContent> c, shared_ptr<Log> log)
+ImageDecoder::ImageDecoder (shared_ptr<const ImageContent> c)
: _image_content (c)
, _frame_video_position (0)
{
- video.reset (new VideoDecoder (this, c, log));
+ video.reset (new VideoDecoder (this, c));
}
bool
-ImageDecoder::pass ()
+ImageDecoder::pass (boost::shared_ptr<const Film> film)
{
if (_frame_video_position >= _image_content->video->length()) {
return true;
}
}
- video->emit (_image, _frame_video_position);
+ video->emit (film, _image, _frame_video_position);
++_frame_video_position;
return false;
}
void
-ImageDecoder::seek (ContentTime time, bool accurate)
+ImageDecoder::seek (shared_ptr<const Film> film, ContentTime time, bool accurate)
{
- Decoder::seek (time, accurate);
- _frame_video_position = time.frames_round (_image_content->active_video_frame_rate ());
+ Decoder::seek (film, time, accurate);
+ _frame_video_position = time.frames_round (_image_content->active_video_frame_rate(film));
}
class ImageDecoder : public Decoder
{
public:
- ImageDecoder (boost::shared_ptr<const ImageContent> c, boost::shared_ptr<Log> log);
+ ImageDecoder (boost::shared_ptr<const ImageContent> c);
boost::shared_ptr<const ImageContent> content () {
return _image_content;
}
- bool pass ();
- void seek (ContentTime, bool);
+ bool pass (boost::shared_ptr<const Film> film);
+ void seek (boost::shared_ptr<const Film> film, ContentTime, bool);
private:
using std::cout;
using boost::shared_ptr;
+boost::shared_ptr<Log> dcpomatic_log;
+
Log::Log ()
: _types (0)
{
boost::signals2::scoped_connection _config_connection;
};
+extern boost::shared_ptr<Log> dcpomatic_log;
+
#endif
using boost::shared_ptr;
using boost::function;
-ContentList overlaps (ContentList cl, function<bool (shared_ptr<const Content>)> part, DCPTime from, DCPTime to)
+ContentList overlaps (shared_ptr<const Film> film, ContentList cl, function<bool (shared_ptr<const Content>)> part, DCPTime from, DCPTime to)
{
ContentList overlaps;
DCPTimePeriod period (from, to);
BOOST_FOREACH (shared_ptr<Content> i, cl) {
- if (part(i) && DCPTimePeriod(i->position(), i->end()).overlap(period)) {
+ if (part(i) && DCPTimePeriod(i->position(), i->end(film)).overlap(period)) {
overlaps.push_back (i);
}
}
#include "dcpomatic_time.h"
class ContentPart;
+class Film;
/** @return Pieces of content with a given part (video, audio,
* subtitle) that overlap a specified time range in the given
* ContentList
*/
ContentList overlaps (
- ContentList cl, boost::function<bool (boost::shared_ptr<const Content>)> part, DCPTime from, DCPTime to
+ boost::shared_ptr<const Film> film, ContentList cl, boost::function<bool (boost::shared_ptr<const Content>)> part, DCPTime from, DCPTime to
);
#include "i18n.h"
-#define LOG_GENERAL(...) _film->log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
+#define LOG_GENERAL(...) dcpomatic_log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
using std::list;
using std::cout;
continue;
}
- shared_ptr<Decoder> decoder = decoder_factory (i, _film->log(), _fast);
- FrameRateChange frc (i->active_video_frame_rate(), _film->video_frame_rate());
+ shared_ptr<Decoder> decoder = decoder_factory (_film, i, _fast);
+ FrameRateChange frc (i->active_video_frame_rate(_film), _film->video_frame_rate());
if (!decoder) {
/* Not something that we can decode; e.g. Atmos content */
}
}
- _black = Empty (_pieces, _film->length(), bind(&have_video, _1));
- _silent = Empty (_pieces, _film->length(), bind(&have_audio, _1));
+ _black = Empty (_film, _pieces, bind(&have_video, _1));
+ _silent = Empty (_film, _pieces, bind(&have_audio, _1));
_last_video_time = DCPTime ();
_last_video_eyes = EYES_BOTH;
Player::dcp_to_content_video (shared_ptr<const Piece> piece, DCPTime t) const
{
DCPTime s = t - piece->content->position ();
- s = min (piece->content->length_after_trim(), s);
+ s = min (piece->content->length_after_trim(_film), s);
s = max (DCPTime(), s + DCPTime (piece->content->trim_start(), piece->frc));
/* It might seem more logical here to convert s to a ContentTime (using the FrameRateChange)
Player::dcp_to_resampled_audio (shared_ptr<const Piece> piece, DCPTime t) const
{
DCPTime s = t - piece->content->position ();
- s = min (piece->content->length_after_trim(), s);
+ s = min (piece->content->length_after_trim(_film), s);
/* See notes in dcp_to_content_video */
return max (DCPTime (), DCPTime (piece->content->trim_start (), piece->frc) + s).frames_floor (_film->audio_frame_rate ());
}
Player::dcp_to_content_time (shared_ptr<const Piece> piece, DCPTime t) const
{
DCPTime s = t - piece->content->position ();
- s = min (piece->content->length_after_trim(), s);
+ s = min (piece->content->length_after_trim(_film), s);
return max (ContentTime (), ContentTime (s, piece->frc) + piece->content->trim_start());
}
scoped_ptr<DCPDecoder> decoder;
try {
- decoder.reset (new DCPDecoder (j, _film->log(), false));
+ decoder.reset (new DCPDecoder (j, false));
} catch (...) {
return a;
}
return false;
}
- if (_playlist->length() == DCPTime()) {
+ if (_playlist->length(_film) == DCPTime()) {
/* Special case of an empty Film; just give one black frame */
emit_video (black_player_video_frame(EYES_BOTH), DCPTime());
return true;
continue;
}
- DCPTime const t = content_time_to_dcp (i, max(i->decoder->position(), i->content->trim_start()));
- if (t > i->content->end()) {
+ DCPTime const t = content_time_to_dcp (i, max(i->decoder->position(_film), i->content->trim_start()));
+ if (t > i->content->end(_film)) {
i->done = true;
} else {
switch (which) {
case CONTENT:
- earliest_content->done = earliest_content->decoder->pass ();
+ earliest_content->done = earliest_content->decoder->pass (_film);
break;
case BLACK:
emit_video (black_player_video_frame(EYES_BOTH), _black.position());
return;
}
- FrameRateChange frc(piece->content->active_video_frame_rate(), _film->video_frame_rate());
+ FrameRateChange frc(piece->content->active_video_frame_rate(_film), _film->video_frame_rate());
if (frc.skip && (video.frame % 2) == 1) {
return;
}
/* Fill gaps that we discover now that we have some video which needs to be emitted.
This is where we need to fill to.
*/
- DCPTime fill_to = min (time, piece->content->end());
+ DCPTime fill_to = min (time, piece->content->end(_film));
if (_last_video_time) {
DCPTime fill_from = max (*_last_video_time, piece->content->position());
if (fill_to_eyes == EYES_BOTH) {
fill_to_eyes = EYES_LEFT;
}
- if (fill_to == piece->content->end()) {
+ if (fill_to == piece->content->end(_film)) {
/* Don't fill after the end of the content */
fill_to_eyes = EYES_LEFT;
}
new PlayerVideo (
video.image,
piece->content->video->crop (),
- piece->content->video->fade (video.frame),
+ piece->content->video->fade (_film, video.frame),
piece->content->video->scale().size (
piece->content->video, _video_container_size, _film->frame_size ()
),
DCPTime t = time;
for (int i = 0; i < frc.repeat; ++i) {
- if (t < piece->content->end()) {
+ if (t < piece->content->end(_film)) {
emit_video (_last_video[wp], t);
}
t += one_video_frame ();
/* Compute time in the DCP */
DCPTime time = resampled_audio_to_dcp (piece, content_audio.frame);
/* And the end of this block in the DCP */
- DCPTime end = time + DCPTime::from_frames(content_audio.audio->frames(), content->resampled_frame_rate());
+ DCPTime end = time + DCPTime::from_frames(content_audio.audio->frames(), content->resampled_frame_rate(_film));
/* Remove anything that comes before the start or after the end of the content */
if (time < piece->content->position()) {
}
content_audio.audio = cut.first;
time = cut.second;
- } else if (time > piece->content->end()) {
+ } else if (time > piece->content->end(_film)) {
/* Discard it all */
return;
- } else if (end > piece->content->end()) {
- Frame const remaining_frames = DCPTime(piece->content->end() - time).frames_round(_film->audio_frame_rate());
+ } else if (end > piece->content->end(_film)) {
+ Frame const remaining_frames = DCPTime(piece->content->end(_film) - time).frames_round(_film->audio_frame_rate());
if (remaining_frames == 0) {
return;
}
PlayerText ps;
DCPTime const from (content_time_to_dcp (piece, subtitle.from()));
- if (from > piece->content->end()) {
+ if (from > piece->content->end(_film)) {
return;
}
DCPTime const dcp_to = content_time_to_dcp (piece, to);
- if (dcp_to > piece->content->end()) {
+ if (dcp_to > piece->content->end(_film)) {
return;
}
BOOST_FOREACH (shared_ptr<Piece> i, _pieces) {
if (time < i->content->position()) {
/* Before; seek to the start of the content */
- i->decoder->seek (dcp_to_content_time (i, i->content->position()), accurate);
+ i->decoder->seek (_film, dcp_to_content_time (i, i->content->position()), accurate);
i->done = false;
- } else if (i->content->position() <= time && time < i->content->end()) {
+ } else if (i->content->position() <= time && time < i->content->end(_film)) {
/* During; seek to position */
- i->decoder->seek (dcp_to_content_time (i, time), accurate);
+ i->decoder->seek (_film, dcp_to_content_time (i, time), accurate);
i->done = false;
} else {
/* After; this piece is done */
* @return true if this was possible, false if not.
*/
bool
-PlayerVideo::reset_metadata (dcp::Size video_container_size, dcp::Size film_frame_size)
+PlayerVideo::reset_metadata (shared_ptr<const Film> film, dcp::Size video_container_size, dcp::Size film_frame_size)
{
shared_ptr<Content> content = _content.lock();
if (!content || !_video_frame) {
}
_crop = content->video->crop();
- _fade = content->video->fade(_video_frame.get());
+ _fade = content->video->fade(film, _video_frame.get());
_inter_size = content->video->scale().size(content->video, video_container_size, film_frame_size);
_out_size = video_container_size;
_colour_conversion = content->video->colour_conversion();
class Image;
class ImageProxy;
+class Film;
class Socket;
/** Everything needed to describe a video frame coming out of the player, but with the
void add_metadata (xmlpp::Node* node) const;
void send_binary (boost::shared_ptr<Socket> socket) const;
- bool reset_metadata (dcp::Size video_container_size, dcp::Size film_frame_size);
+ bool reset_metadata (boost::shared_ptr<const Film> film, dcp::Size video_container_size, dcp::Size film_frame_size);
bool has_j2k () const;
dcp::Data j2k () const;
Playlist::~Playlist ()
{
_content.clear ();
- reconnect ();
+ disconnect ();
}
void
-Playlist::content_change (ChangeType type, weak_ptr<Content> content, int property, bool frequent)
+Playlist::content_change (weak_ptr<const Film> weak_film, ChangeType type, weak_ptr<Content> content, int property, bool frequent)
{
+ shared_ptr<const Film> film = weak_film.lock ();
+ DCPOMATIC_ASSERT (film);
+
if (type == CHANGE_TYPE_DONE) {
if (
property == ContentProperty::TRIM_START ||
- any other position changes will be timeline drags which should not result in content
being sequenced.
*/
- maybe_sequence ();
+ maybe_sequence (film);
}
if (
}
void
-Playlist::maybe_sequence ()
+Playlist::maybe_sequence (shared_ptr<const Film> film)
{
if (!_sequence || _sequencing) {
return;
}
if (i->video->frame_type() == VIDEO_FRAME_TYPE_3D_RIGHT) {
- i->set_position (next_right);
- next_right = i->end();
+ i->set_position (film, next_right);
+ next_right = i->end(film);
} else {
- i->set_position (next_left);
- next_left = i->end();
+ i->set_position (film, next_left);
+ next_left = i->end(film);
}
placed.push_back (i);
continue;
}
- i->set_position (next);
- next = i->end();
+ i->set_position (film, next);
+ next = i->end(film);
}
/* This shouldn't be necessary but better safe than sorry (there could be old files) */
sort (_content.begin(), _content.end(), ContentSorter ());
- reconnect ();
+ reconnect (film);
}
/** @param node <Playlist> node.
}
void
-Playlist::add (shared_ptr<Content> c)
+Playlist::add (shared_ptr<const Film> film, shared_ptr<Content> c)
{
Change (CHANGE_TYPE_PENDING);
_content.push_back (c);
sort (_content.begin(), _content.end(), ContentSorter ());
- reconnect ();
+ reconnect (film);
Change (CHANGE_TYPE_DONE);
}
/** @return length of the playlist from time 0 to the last thing on the playlist */
DCPTime
-Playlist::length () const
+Playlist::length (shared_ptr<const Film> film) const
{
DCPTime len;
BOOST_FOREACH (shared_ptr<const Content> i, _content) {
- len = max (len, i->end());
+ len = max (len, i->end(film));
}
return len;
}
void
-Playlist::reconnect ()
+Playlist::disconnect ()
{
for (list<boost::signals2::connection>::iterator i = _content_connections.begin(); i != _content_connections.end(); ++i) {
i->disconnect ();
}
_content_connections.clear ();
+}
+
+void
+Playlist::reconnect (shared_ptr<const Film> film)
+{
+ disconnect ();
BOOST_FOREACH (shared_ptr<Content> i, _content) {
- _content_connections.push_back (i->Change.connect(boost::bind(&Playlist::content_change, this, _1, _2, _3, _4)));
+ _content_connections.push_back (i->Change.connect(boost::bind(&Playlist::content_change, this, film, _1, _2, _3, _4)));
}
}
DCPTime
-Playlist::video_end () const
+Playlist::video_end (shared_ptr<const Film> film) const
{
DCPTime end;
BOOST_FOREACH (shared_ptr<Content> i, _content) {
if (i->video) {
- end = max (end, i->end ());
+ end = max (end, i->end(film));
}
}
}
DCPTime
-Playlist::text_end () const
+Playlist::text_end (shared_ptr<const Film> film) const
{
DCPTime end;
BOOST_FOREACH (shared_ptr<Content> i, _content) {
if (!i->text.empty ()) {
- end = max (end, i->end ());
+ end = max (end, i->end(film));
}
}
}
void
-Playlist::repeat (ContentList c, int n)
+Playlist::repeat (shared_ptr<const Film> film, ContentList c, int n)
{
pair<DCPTime, DCPTime> range (DCPTime::max (), DCPTime ());
BOOST_FOREACH (shared_ptr<Content> i, c) {
range.first = min (range.first, i->position ());
range.second = max (range.second, i->position ());
- range.first = min (range.first, i->end ());
- range.second = max (range.second, i->end ());
+ range.first = min (range.first, i->end(film));
+ range.second = max (range.second, i->end(film));
}
Change (CHANGE_TYPE_PENDING);
DCPTime pos = range.second;
for (int i = 0; i < n; ++i) {
BOOST_FOREACH (shared_ptr<Content> j, c) {
- shared_ptr<Content> copy = j->clone ();
- copy->set_position (pos + copy->position() - range.first);
+ shared_ptr<Content> copy = j->clone (film);
+ copy->set_position (film, pos + copy->position() - range.first);
_content.push_back (copy);
}
pos += range.second - range.first;
sort (_content.begin(), _content.end(), ContentSorter ());
- reconnect ();
+ reconnect (film);
Change (CHANGE_TYPE_DONE);
}
void
-Playlist::move_earlier (shared_ptr<Content> c)
+Playlist::move_earlier (shared_ptr<const Film> film, shared_ptr<Content> c)
{
ContentList::iterator previous = _content.end ();
ContentList::iterator i = _content.begin();
shared_ptr<Content> previous_c = *previous;
DCPTime const p = previous_c->position ();
- previous_c->set_position (p + c->length_after_trim ());
- c->set_position (p);
+ previous_c->set_position (film, p + c->length_after_trim(film));
+ c->set_position (film, p);
}
void
-Playlist::move_later (shared_ptr<Content> c)
+Playlist::move_later (shared_ptr<const Film> film, shared_ptr<Content> c)
{
ContentList::iterator i = _content.begin();
while (i != _content.end() && *i != c) {
shared_ptr<Content> next_c = *next;
- next_c->set_position (c->position ());
- c->set_position (c->position() + next_c->length_after_trim ());
+ next_c->set_position (film, c->position());
+ c->set_position (film, c->position() + next_c->length_after_trim(film));
}
int64_t
-Playlist::required_disk_space (int j2k_bandwidth, int audio_channels, int audio_frame_rate) const
+Playlist::required_disk_space (shared_ptr<const Film> film, int j2k_bandwidth, int audio_channels, int audio_frame_rate) const
{
- int64_t video = uint64_t (j2k_bandwidth / 8) * length().seconds ();
- int64_t audio = uint64_t (audio_channels * audio_frame_rate * 3) * length().seconds ();
+ int64_t video = uint64_t (j2k_bandwidth / 8) * length(film).seconds();
+ int64_t audio = uint64_t (audio_channels * audio_frame_rate * 3) * length(film).seconds();
BOOST_FOREACH (shared_ptr<Content> i, _content) {
shared_ptr<DCPContent> d = dynamic_pointer_cast<DCPContent> (i);
if (d) {
if (d->reference_video()) {
- video -= uint64_t (j2k_bandwidth / 8) * d->length_after_trim().seconds();
+ video -= uint64_t (j2k_bandwidth / 8) * d->length_after_trim(film).seconds();
}
if (d->reference_audio()) {
- audio -= uint64_t (audio_channels * audio_frame_rate * 3) * d->length_after_trim().seconds();
+ audio -= uint64_t (audio_channels * audio_frame_rate * 3) * d->length_after_trim(film).seconds();
}
}
}
}
string
-Playlist::content_summary (DCPTimePeriod period) const
+Playlist::content_summary (shared_ptr<const Film> film, DCPTimePeriod period) const
{
string best_summary;
int best_score = -1;
BOOST_FOREACH (shared_ptr<Content> i, _content) {
int score = 0;
- optional<DCPTimePeriod> const o = DCPTimePeriod(i->position(), i->end()).overlap (period);
+ optional<DCPTimePeriod> const o = DCPTimePeriod(i->position(), i->end(film)).overlap (period);
if (o) {
score += 100 * o.get().duration().get() / period.duration().get();
}
void as_xml (xmlpp::Node *, bool with_content_paths);
void set_from_xml (boost::shared_ptr<const Film> film, cxml::ConstNodePtr node, int version, std::list<std::string>& notes);
- void add (boost::shared_ptr<Content>);
+ void add (boost::shared_ptr<const Film> film, boost::shared_ptr<Content>);
void remove (boost::shared_ptr<Content>);
void remove (ContentList);
- void move_earlier (boost::shared_ptr<Content>);
- void move_later (boost::shared_ptr<Content>);
+ void move_earlier (boost::shared_ptr<const Film> film, boost::shared_ptr<Content>);
+ void move_later (boost::shared_ptr<const Film> film, boost::shared_ptr<Content>);
ContentList content () const;
std::string video_identifier () const;
- DCPTime length () const;
+ DCPTime length (boost::shared_ptr<const Film> film) const;
boost::optional<DCPTime> start () const;
- int64_t required_disk_space (int j2k_bandwidth, int audio_channels, int audio_frame_rate) const;
+ int64_t required_disk_space (boost::shared_ptr<const Film> film, int j2k_bandwidth, int audio_channels, int audio_frame_rate) const;
int best_video_frame_rate () const;
- DCPTime video_end () const;
- DCPTime text_end () const;
+ DCPTime video_end (boost::shared_ptr<const Film> film) const;
+ DCPTime text_end (boost::shared_ptr<const Film> film) const;
FrameRateChange active_frame_rate_change (DCPTime, int dcp_frame_rate) const;
- std::string content_summary (DCPTimePeriod period) const;
+ std::string content_summary (boost::shared_ptr<const Film> film, DCPTimePeriod period) const;
std::pair<double, double> speed_up_range (int dcp_video_frame_rate) const;
void set_sequence (bool);
- void maybe_sequence ();
+ void maybe_sequence (boost::shared_ptr<const Film> film);
- void repeat (ContentList, int);
+ void repeat (boost::shared_ptr<const Film> film, ContentList, int);
/** Emitted when content has been added to or removed from the playlist; implies OrderChanged */
mutable boost::signals2::signal<void (ChangeType)> Change;
mutable boost::signals2::signal<void (ChangeType, boost::weak_ptr<Content>, int, bool)> ContentChange;
private:
- void content_change (ChangeType, boost::weak_ptr<Content>, int, bool);
- void reconnect ();
+ void content_change (boost::weak_ptr<const Film>, ChangeType, boost::weak_ptr<Content>, int, bool);
+ void disconnect ();
+ void reconnect (boost::shared_ptr<const Film> film);
/** List of content. Kept sorted in position order. */
ContentList _content;
using boost::optional;
using dcp::raw_convert;
-StringTextFileContent::StringTextFileContent (shared_ptr<const Film> film, boost::filesystem::path path)
- : Content (film, path)
+StringTextFileContent::StringTextFileContent (boost::filesystem::path path)
+ : Content (path)
{
text.push_back (shared_ptr<TextContent> (new TextContent (this, TEXT_OPEN_SUBTITLE, TEXT_UNKNOWN)));
}
-StringTextFileContent::StringTextFileContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
- : Content (film, node)
+StringTextFileContent::StringTextFileContent (cxml::ConstNodePtr node, int version)
+ : Content (node)
, _length (node->number_child<ContentTime::Type> ("Length"))
{
text = TextContent::from_xml (this, node, version);
}
void
-StringTextFileContent::examine (boost::shared_ptr<Job> job)
+StringTextFileContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
{
- Content::examine (job);
+ Content::examine (film, job);
StringTextFile s (shared_from_this ());
/* Default to turning these subtitles on */
}
DCPTime
-StringTextFileContent::full_length () const
+StringTextFileContent::full_length (shared_ptr<const Film> film) const
{
- FrameRateChange const frc (active_video_frame_rate(), film()->video_frame_rate ());
+ FrameRateChange const frc (active_video_frame_rate(film), film->video_frame_rate());
return DCPTime (_length, frc);
}
class StringTextFileContent : public Content
{
public:
- StringTextFileContent (boost::shared_ptr<const Film>, boost::filesystem::path);
- StringTextFileContent (boost::shared_ptr<const Film>, cxml::ConstNodePtr, int);
+ StringTextFileContent (boost::filesystem::path);
+ StringTextFileContent (cxml::ConstNodePtr, int);
boost::shared_ptr<StringTextFileContent> shared_from_this () {
return boost::dynamic_pointer_cast<StringTextFileContent> (Content::shared_from_this ());
}
- void examine (boost::shared_ptr<Job>);
+ void examine (boost::shared_ptr<const Film> film, boost::shared_ptr<Job>);
std::string summary () const;
std::string technical_summary () const;
void as_xml (xmlpp::Node *, bool with_paths) const;
- DCPTime full_length () const;
+ DCPTime full_length (boost::shared_ptr<const Film> film) const;
private:
ContentTime _length;
using boost::optional;
using boost::dynamic_pointer_cast;
-StringTextFileDecoder::StringTextFileDecoder (shared_ptr<const StringTextFileContent> content, shared_ptr<Log> log)
+StringTextFileDecoder::StringTextFileDecoder (shared_ptr<const StringTextFileContent> content)
: StringTextFile (content)
, _next (0)
{
if (!_subtitles.empty()) {
first = content_time_period(_subtitles[0]).from;
}
- text.push_back (shared_ptr<TextDecoder> (new TextDecoder (this, content->only_text(), log, first)));
+ text.push_back (shared_ptr<TextDecoder> (new TextDecoder (this, content->only_text(), first)));
}
void
-StringTextFileDecoder::seek (ContentTime time, bool accurate)
+StringTextFileDecoder::seek (shared_ptr<const Film> film, ContentTime time, bool accurate)
{
/* It's worth back-tracking a little here as decoding is cheap and it's nice if we don't miss
too many subtitles when seeking.
time = ContentTime();
}
- Decoder::seek (time, accurate);
+ Decoder::seek (film, time, accurate);
_next = 0;
while (_next < _subtitles.size() && ContentTime::from_seconds (_subtitles[_next].from.all_as_seconds ()) < time) {
}
bool
-StringTextFileDecoder::pass ()
+StringTextFileDecoder::pass (shared_ptr<const Film>)
{
if (_next >= _subtitles.size ()) {
return true;
#include "decoder.h"
class StringTextFileContent;
-class Log;
class StringTextFileDecoder : public Decoder, public StringTextFile
{
public:
- StringTextFileDecoder (boost::shared_ptr<const StringTextFileContent>, boost::shared_ptr<Log> log);
+ StringTextFileDecoder (boost::shared_ptr<const StringTextFileContent>);
- void seek (ContentTime time, bool accurate);
- bool pass ();
+ void seek (boost::shared_ptr<const Film> film, ContentTime time, bool accurate);
+ bool pass (boost::shared_ptr<const Film> film);
private:
ContentTimePeriod content_time_period (sub::Subtitle s) const;
TextDecoder::TextDecoder (
Decoder* parent,
shared_ptr<const TextContent> c,
- shared_ptr<Log> log,
ContentTime first
)
- : DecoderPart (parent, log)
+ : DecoderPart (parent)
, _content (c)
, _position (first)
{
TextDecoder (
Decoder* parent,
boost::shared_ptr<const TextContent>,
- boost::shared_ptr<Log> log,
ContentTime first
);
- ContentTime position () const {
+ ContentTime position (boost::shared_ptr<const Film>) const {
return _position;
}
#include "i18n.h"
-#define LOG_GENERAL(...) _parent->film()->log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
+#define LOG_GENERAL(...) dcpomatic_log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
int const VideoContentProperty::SIZE = 0;
int const VideoContentProperty::FRAME_TYPE = 1;
}
void
-VideoContent::scale_and_crop_to_fit_width ()
+VideoContent::scale_and_crop_to_fit_width (shared_ptr<const Film> film)
{
- shared_ptr<const Film> film = _parent->film ();
- set_scale (VideoContentScale (film->container ()));
+ set_scale (VideoContentScale(film->container()));
int const crop = max (0, int (size().height - double (film->frame_size().height) * size().width / film->frame_size().width));
set_left_crop (0);
}
void
-VideoContent::scale_and_crop_to_fit_height ()
+VideoContent::scale_and_crop_to_fit_height (shared_ptr<const Film> film)
{
- shared_ptr<const Film> film = _parent->film ();
- set_scale (VideoContentScale (film->container ()));
+ set_scale (VideoContentScale(film->container()));
int const crop = max (0, int (size().width - double (film->frame_size().width) * size().height / film->frame_size().height));
set_left_crop (crop / 2);
/** @param f Frame index within the whole (untrimmed) content */
optional<double>
-VideoContent::fade (Frame f) const
+VideoContent::fade (shared_ptr<const Film> film, Frame f) const
{
DCPOMATIC_ASSERT (f >= 0);
- shared_ptr<const Film> film = _parent->film ();
-
- double const vfr = _parent->active_video_frame_rate ();
+ double const vfr = _parent->active_video_frame_rate(film);
Frame const ts = _parent->trim_start().frames_round(vfr);
if ((f - ts) < fade_in()) {
}
string
-VideoContent::processing_description () const
+VideoContent::processing_description (shared_ptr<const Film> film) const
{
string d;
char buffer[256];
d += buffer;
}
- shared_ptr<const Film> film = _parent->film ();
dcp::Size const container_size = film->frame_size ();
dcp::Size const scaled = scale().size (shared_from_this(), container_size, container_size);
}
void
-VideoContent::modify_position (DCPTime& pos) const
+VideoContent::modify_position (shared_ptr<const Film> film, DCPTime& pos) const
{
- pos = pos.round (_parent->film()->video_frame_rate());
+ pos = pos.round (film->video_frame_rate());
}
void
dcp::Size size_after_3d_split () const;
dcp::Size size_after_crop () const;
- boost::optional<double> fade (Frame) const;
+ boost::optional<double> fade (boost::shared_ptr<const Film> film, Frame) const;
- void scale_and_crop_to_fit_width ();
- void scale_and_crop_to_fit_height ();
+ void scale_and_crop_to_fit_width (boost::shared_ptr<const Film> film);
+ void scale_and_crop_to_fit_height (boost::shared_ptr<const Film> film);
- std::string processing_description () const;
+ std::string processing_description (boost::shared_ptr<const Film> film) const;
void set_length (Frame);
void take_from_examiner (boost::shared_ptr<VideoExaminer>);
void add_properties (std::list<UserProperty> &) const;
- void modify_position (DCPTime& pos) const;
+ void modify_position (boost::shared_ptr<const Film> film, DCPTime& pos) const;
void modify_trim_start (ContentTime& pos) const;
static boost::shared_ptr<VideoContent> from_xml (Content* parent, cxml::ConstNodePtr, int);
using boost::shared_ptr;
using boost::optional;
-VideoDecoder::VideoDecoder (Decoder* parent, shared_ptr<const Content> c, shared_ptr<Log> log)
- : DecoderPart (parent, log)
+VideoDecoder::VideoDecoder (Decoder* parent, shared_ptr<const Content> c)
+ : DecoderPart (parent)
, _content (c)
{
* and so on.
*/
void
-VideoDecoder::emit (shared_ptr<const ImageProxy> image, Frame frame)
+VideoDecoder::emit (shared_ptr<const Film> film, shared_ptr<const ImageProxy> image, Frame frame)
{
if (ignore ()) {
return;
DCPOMATIC_ASSERT (false);
}
- _position = ContentTime::from_frames (frame, _content->active_video_frame_rate ());
+ _position = ContentTime::from_frames (frame, _content->active_video_frame_rate(film));
}
void
class VideoDecoder : public DecoderPart
{
public:
- VideoDecoder (Decoder* parent, boost::shared_ptr<const Content> c, boost::shared_ptr<Log> log);
+ VideoDecoder (Decoder* parent, boost::shared_ptr<const Content> c);
friend struct video_decoder_fill_test1;
friend struct video_decoder_fill_test2;
friend struct ffmpeg_pts_offset_test;
friend void ffmpeg_decoder_sequential_test_one (boost::filesystem::path file, float fps, int gaps, int video_length);
- ContentTime position () const {
+ ContentTime position (boost::shared_ptr<const Film>) const {
return _position;
}
void seek ();
-
- void emit (boost::shared_ptr<const ImageProxy>, Frame frame);
+ void emit (boost::shared_ptr<const Film> film, boost::shared_ptr<const ImageProxy>, Frame frame);
/** @return true if the emitted data was accepted, false if not */
boost::signals2::signal<void (ContentVideo)> Data;
using std::string;
using boost::shared_ptr;
-VideoMXFContent::VideoMXFContent (shared_ptr<const Film> film, boost::filesystem::path path)
- : Content (film, path)
+VideoMXFContent::VideoMXFContent (boost::filesystem::path path)
+ : Content (path)
{
}
-VideoMXFContent::VideoMXFContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
- : Content (film, node)
+VideoMXFContent::VideoMXFContent (cxml::ConstNodePtr node, int version)
+ : Content (node)
{
video = VideoContent::from_xml (this, node, version);
}
}
void
-VideoMXFContent::examine (shared_ptr<Job> job)
+VideoMXFContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
{
job->set_progress_unknown ();
- Content::examine (job);
+ Content::examine (film, job);
video.reset (new VideoContent (this));
shared_ptr<VideoMXFExaminer> examiner (new VideoMXFExaminer (shared_from_this ()));
}
DCPTime
-VideoMXFContent::full_length () const
+VideoMXFContent::full_length (shared_ptr<const Film> film) const
{
- FrameRateChange const frc (active_video_frame_rate(), film()->video_frame_rate());
- return DCPTime::from_frames (llrint (video->length_after_3d_combine() * frc.factor()), film()->video_frame_rate());
+ FrameRateChange const frc (active_video_frame_rate(film), film->video_frame_rate());
+ return DCPTime::from_frames (llrint (video->length_after_3d_combine() * frc.factor()), film->video_frame_rate());
}
void
class VideoMXFContent : public Content
{
public:
- VideoMXFContent (boost::shared_ptr<const Film> film, boost::filesystem::path path);
- VideoMXFContent (boost::shared_ptr<const Film> film, cxml::ConstNodePtr node, int version);
+ VideoMXFContent (boost::filesystem::path path);
+ VideoMXFContent (cxml::ConstNodePtr node, int version);
boost::shared_ptr<VideoMXFContent> shared_from_this () {
return boost::dynamic_pointer_cast<VideoMXFContent> (Content::shared_from_this ());
}
- void examine (boost::shared_ptr<Job> job);
+ void examine (boost::shared_ptr<const Film> film, boost::shared_ptr<Job> job);
std::string summary () const;
std::string technical_summary () const;
std::string identifier () const;
void as_xml (xmlpp::Node* node, bool with_paths) const;
- DCPTime full_length () const;
+ DCPTime full_length (boost::shared_ptr<const Film> film) const;
void add_properties (std::list<UserProperty>& p) const;
static bool valid_mxf (boost::filesystem::path path);
using boost::shared_ptr;
using boost::optional;
-VideoMXFDecoder::VideoMXFDecoder (shared_ptr<const VideoMXFContent> content, shared_ptr<Log> log)
+VideoMXFDecoder::VideoMXFDecoder (shared_ptr<const VideoMXFContent> content)
: _content (content)
{
- video.reset (new VideoDecoder (this, content, log));
+ video.reset (new VideoDecoder (this, content));
shared_ptr<dcp::MonoPictureAsset> mono;
try {
}
bool
-VideoMXFDecoder::pass ()
+VideoMXFDecoder::pass (shared_ptr<const Film> film)
{
- double const vfr = _content->active_video_frame_rate ();
+ double const vfr = _content->active_video_frame_rate (film);
int64_t const frame = _next.frames_round (vfr);
if (frame >= _content->video->length()) {
if (_mono_reader) {
video->emit (
+ film,
shared_ptr<ImageProxy> (
new J2KImageProxy (_mono_reader->get_frame(frame), _size, AV_PIX_FMT_XYZ12LE, optional<int>())
),
);
} else {
video->emit (
+ film,
shared_ptr<ImageProxy> (
new J2KImageProxy (_stereo_reader->get_frame(frame), _size, dcp::EYE_LEFT, AV_PIX_FMT_XYZ12LE, optional<int>())
),
frame
);
video->emit (
+ film,
shared_ptr<ImageProxy> (
new J2KImageProxy (_stereo_reader->get_frame(frame), _size, dcp::EYE_RIGHT, AV_PIX_FMT_XYZ12LE, optional<int>())
),
}
void
-VideoMXFDecoder::seek (ContentTime t, bool accurate)
+VideoMXFDecoder::seek (shared_ptr<const Film> film, ContentTime t, bool accurate)
{
- Decoder::seek (t, accurate);
+ Decoder::seek (film, t, accurate);
_next = t;
}
class VideoMXFDecoder : public Decoder
{
public:
- VideoMXFDecoder (boost::shared_ptr<const VideoMXFContent>, boost::shared_ptr<Log> log);
+ VideoMXFDecoder (boost::shared_ptr<const VideoMXFContent>);
- bool pass ();
- void seek (ContentTime t, bool accurate);
+ bool pass (boost::shared_ptr<const Film> film);
+ void seek (boost::shared_ptr<const Film> film, ContentTime t, bool accurate);
private:
#include "lib/job_manager.h"
#include "lib/job.h"
#include "lib/film.h"
+#include "lib/null_log.h"
#include "lib/video_content.h"
#include "lib/text_content.h"
#include "lib/ratio.h"
, _view_full_screen (0)
, _view_dual_screen (0)
{
+ /* XXX */
+ dcpomatic_log.reset (new NullLog());
+ cout << "here's the log " << dcpomatic_log.get() << "\n";
#if defined(DCPOMATIC_WINDOWS)
maybe_open_console ();
reset_film ();
try {
- shared_ptr<DCPContent> dcp (new DCPContent(_film, dir));
+ shared_ptr<DCPContent> dcp (new DCPContent(dir));
_film->examine_and_add_content (dcp);
bool const ok = display_progress (_("DCP-o-matic Player"), _("Loading content"));
if (!ok || !report_errors_from_last_job(this)) {
if (kdm) {
dcp->add_kdm (*kdm);
- dcp->examine (shared_ptr<Job>());
+ dcp->examine (_film, shared_ptr<Job>());
}
}
DCPOMATIC_ASSERT (dcp);
try {
dcp->add_kdm (dcp::EncryptedKDM (dcp::file_to_string (wx_to_std (d->GetPath ()), MAX_KDM_SIZE)));
- dcp->examine (shared_ptr<Job>());
+ dcp->examine (_film, shared_ptr<Job>());
} catch (exception& e) {
error_dialog (this, wxString::Format (_("Could not load KDM.")), std_to_wx(e.what()));
d->Destroy ();
}
dcp->set_cpl ((*i)->id());
- dcp->examine (shared_ptr<Job>());
+ dcp->examine (_film, shared_ptr<Job>());
}
void view_full_screen ()
if (content) {
_playlist.reset (new Playlist ());
- const_pointer_cast<Playlist> (_playlist)->add (content);
+ const_pointer_cast<Playlist>(_playlist)->add(film, content);
} else {
_playlist = film->playlist ();
}
return;
}
- checked_set (_description, ac.front()->audio->processing_description ());
+ checked_set (_description, ac.front()->audio->processing_description(_parent->film()));
}
void
}
string why_not;
- bool const can_reference = dcp && dcp->can_reference_audio (why_not);
+ bool const can_reference = dcp && dcp->can_reference_audio (_parent->film(), why_not);
setup_refer_button (_reference, _reference_note, dcp, can_reference, why_not);
if (_reference->GetValue ()) {
_peak->SetLabel (wxT (""));
} else {
shared_ptr<Playlist> playlist (new Playlist);
- playlist->add (sel.front ());
+ playlist->add (_parent->film(), sel.front());
try {
shared_ptr<AudioAnalysis> analysis (new AudioAnalysis (_parent->film()->audio_analysis_path (playlist)));
peak_dB = 20 * log10 (analysis->overall_sample_peak().first.peak) + analysis->gain_correction (playlist);
}
try {
- shared_ptr<FFmpegContent> joined (new FFmpegContent (film, fc));
+ shared_ptr<FFmpegContent> joined (new FFmpegContent(fc));
film->remove_content (_content);
film->examine_and_add_content (joined);
} catch (JoinError& e) {
if (r == wxID_OK) {
if (dc) {
- content.push_back (shared_ptr<DCPContent> (new DCPContent (film, path)));
+ content.push_back (shared_ptr<DCPContent>(new DCPContent(path)));
} else {
- content = content_factory (film, path);
+ content = content_factory (path);
}
}
list<shared_ptr<Content> > content;
try {
- content = content_factory (_film, path);
+ content = content_factory (path);
} catch (exception& e) {
error_dialog (_parent, e.what());
return;
}
try {
- _film->examine_and_add_content (shared_ptr<Content> (new DCPContent (_film, path)));
+ _film->examine_and_add_content (shared_ptr<Content> (new DCPContent (path)));
} catch (exception& e) {
error_dialog (_parent, e.what());
}
try {
BOOST_FOREACH (boost::filesystem::path i, paths) {
- BOOST_FOREACH (shared_ptr<Content> j, content_factory (_film, i)) {
+ BOOST_FOREACH (shared_ptr<Content> j, content_factory(i)) {
_film->examine_and_add_content (j);
}
}
void
Controls::add_clicked ()
{
- shared_ptr<Content> sel = selected_content()->clone();
+ shared_ptr<Content> sel = selected_content()->clone(_film);
DCPOMATIC_ASSERT (sel);
_film->examine_and_add_content (sel);
bool const ok = display_progress (_("DCP-o-matic"), _("Loading DCP"));
wxListItem it;
it.SetId(N);
it.SetColumn(0);
- DCPTime length = content->length_after_trim ();
+ DCPTime length = content->length_after_trim (_film);
int seconds = length.seconds();
int minutes = seconds / 60;
seconds -= minutes * 60;
try {
shared_ptr<Content> content;
if (is_directory(*i) && (is_regular_file(*i / "ASSETMAP") || is_regular_file(*i / "ASSETMAP.xml"))) {
- content.reset (new DCPContent(_film, *i));
+ content.reset (new DCPContent(*i));
} else if (i->path().extension() == ".mp4" || i->path().extension() == ".ecinema") {
- content = content_factory(_film, *i).front();
+ content = content_factory(*i).front();
}
if (content) {
return false;
}
- if (!_player_video.first->reset_metadata (_player->video_container_size(), _film->frame_size())) {
+ if (!_player_video.first->reset_metadata (_film, _player->video_container_size(), _film->frame_size())) {
return false;
}
string const len = String::compose(
wx_to_std(_("Length: %1 (%2 frames)")),
- time_to_hmsf(dcp->full_length(), lrint(*vfr)),
- dcp->full_length().frames_round(*vfr)
+ time_to_hmsf(dcp->full_length(fv->film()), lrint(*vfr)),
+ dcp->full_length(fv->film()).frames_round(*vfr)
);
checked_set (_dcp[r++], std_to_wx(len));
int const SubtitleAppearanceDialog::OUTLINE = 1;
int const SubtitleAppearanceDialog::SHADOW = 2;
-SubtitleAppearanceDialog::SubtitleAppearanceDialog (wxWindow* parent, shared_ptr<Content> content, shared_ptr<TextContent> caption)
+SubtitleAppearanceDialog::SubtitleAppearanceDialog (wxWindow* parent, shared_ptr<const Film> film, shared_ptr<Content> content, shared_ptr<TextContent> caption)
: wxDialog (parent, wxID_ANY, _("Caption appearance"))
+ , _film (film)
, _content (content)
, _caption (caption)
{
optional<ContentTime> fade_in = _caption->fade_in();
_force_fade_in->SetValue (static_cast<bool>(fade_in));
if (fade_in) {
- _fade_in->set (*fade_in, _content->active_video_frame_rate());
+ _fade_in->set (*fade_in, _content->active_video_frame_rate(film));
} else {
- _fade_in->set (ContentTime(), _content->active_video_frame_rate());
+ _fade_in->set (ContentTime(), _content->active_video_frame_rate(film));
}
optional<ContentTime> fade_out = _caption->fade_out();
_force_fade_out->SetValue (static_cast<bool>(fade_out));
if (fade_out) {
- _fade_out->set (*fade_out, _content->active_video_frame_rate ());
+ _fade_out->set (*fade_out, _content->active_video_frame_rate(film));
} else {
- _fade_out->set (ContentTime(), _content->active_video_frame_rate ());
+ _fade_out->set (ContentTime(), _content->active_video_frame_rate(film));
}
_outline_width->SetValue (_caption->outline_width ());
void
SubtitleAppearanceDialog::apply ()
{
+ shared_ptr<const Film> film = _film.lock ();
+
if (_force_colour->GetValue ()) {
wxColour const c = _colour->GetColour ();
_caption->set_colour (dcp::Colour (c.Red(), c.Green(), c.Blue()));
_caption->unset_effect_colour ();
}
if (_force_fade_in->GetValue ()) {
- _caption->set_fade_in (_fade_in->get (_content->active_video_frame_rate ()));
+ _caption->set_fade_in (_fade_in->get(_content->active_video_frame_rate(film)));
} else {
_caption->unset_fade_in ();
}
if (_force_fade_out->GetValue ()) {
- _caption->set_fade_out (_fade_out->get (_content->active_video_frame_rate ()));
+ _caption->set_fade_out (_fade_out->get(_content->active_video_frame_rate(film)));
} else {
_caption->unset_fade_out ();
}
class FFmpegSubtitleStream;
class wxCheckBox;
class wxWidget;
+class Film;
class SubtitleAppearanceDialog : public wxDialog
{
public:
- SubtitleAppearanceDialog (wxWindow* parent, boost::shared_ptr<Content> content, boost::shared_ptr<TextContent> caption);
+ SubtitleAppearanceDialog (wxWindow* parent, boost::shared_ptr<const Film> film, boost::shared_ptr<Content> content, boost::shared_ptr<TextContent> caption);
void apply ();
wxCheckBox* set_to (wxWindow* w, int& r);
void content_change (ChangeType type);
+ boost::weak_ptr<const Film> _film;
wxCheckBox* _force_colour;
wxColourPickerCtrl* _colour;
wxCheckBox* _force_effect;
}
string why_not;
- bool const can_reference = dcp && dcp->can_reference_text (_original_type, why_not);
+ bool const can_reference = dcp && dcp->can_reference_text (_parent->film(), _original_type, why_not);
setup_refer_button (_reference, _reference_note, dcp, can_reference, why_not);
bool const reference = _reference->GetValue ();
ContentList c = _parent->selected_text ();
DCPOMATIC_ASSERT (c.size() == 1);
- shared_ptr<Decoder> decoder = decoder_factory (c.front(), _parent->film()->log(), false);
+ shared_ptr<Decoder> decoder = decoder_factory (_parent->film(), c.front(), false);
if (decoder) {
_text_view = new TextView (this, _parent->film(), c.front(), c.front()->text_of_original_type(_original_type), decoder, _parent->film_viewer());
ContentList c = _parent->selected_text ();
DCPOMATIC_ASSERT (c.size() == 1);
- SubtitleAppearanceDialog* d = new SubtitleAppearanceDialog (this, c.front(), c.front()->text_of_original_type(_original_type));
+ SubtitleAppearanceDialog* d = new SubtitleAppearanceDialog (this, _parent->film(), c.front(), c.front()->text_of_original_type(_original_type));
if (d->ShowModal () == wxID_OK) {
d->apply ();
}
i->Stop.connect (bind (&TextView::data_stop, this, _1));
}
}
- while (!decoder->pass ()) {}
+ while (!decoder->pass (film)) {}
SetSizerAndFit (sizer);
}
template <class T>
int
-place (TimelineViewList& views, int& tracks)
+place (shared_ptr<const Film> film, TimelineViewList& views, int& tracks)
{
int const base = tracks;
int t = base;
shared_ptr<Content> content = cv->content();
- DCPTimePeriod const content_period (content->position(), content->end());
+ DCPTimePeriod const content_period (content->position(), content->end(film));
while (true) {
TimelineViewList::iterator j = views.begin();
shared_ptr<Content> test_content = test->content();
if (
test->track() && test->track().get() == t &&
- content_period.overlap(DCPTimePeriod(test_content->position(), test_content->end()))) {
+ content_period.overlap(DCPTimePeriod(test_content->position(), test_content->end(film)))) {
/* we have an overlap on track `t' */
++t;
break;
Audio N
*/
+ shared_ptr<const Film> film = _film.lock ();
+ DCPOMATIC_ASSERT (film);
+
_tracks = 0;
for (TimelineViewList::iterator i = _views.begin(); i != _views.end(); ++i) {
/* Texts */
- int const text_tracks = place<TimelineTextContentView> (_views, _tracks);
+ int const text_tracks = place<TimelineTextContentView> (film, _views, _tracks);
/* Atmos */
TimelineViewList views = _views;
sort(views.begin(), views.end(), AudioMappingComparator());
- int const audio_tracks = place<TimelineAudioContentView> (views, _tracks);
+ int const audio_tracks = place<TimelineAudioContentView> (film, views, _tracks);
_labels_view->set_3d (have_3d);
_labels_view->set_audio_tracks (audio_tracks);
continue;
}
+ shared_ptr<Film> film = _film.lock ();
+ DCPOMATIC_ASSERT (film);
+
_start_snaps.push_back (cv->content()->position());
_end_snaps.push_back (cv->content()->position());
- _start_snaps.push_back (cv->content()->end());
- _end_snaps.push_back (cv->content()->end());
+ _start_snaps.push_back (cv->content()->end(film));
+ _end_snaps.push_back (cv->content()->end(film));
BOOST_FOREACH (DCPTime i, cv->content()->reel_split_points()) {
_start_snaps.push_back (i);
DCPTime new_position = _down_view_position + DCPTime::from_seconds ((p.x - _down_point.x) / pps);
- if (_snap) {
+ shared_ptr<Film> film = _film.lock ();
+ DCPOMATIC_ASSERT (film);
- DCPTime const new_end = new_position + _down_view->content()->length_after_trim();
+ if (_snap) {
+ DCPTime const new_end = new_position + _down_view->content()->length_after_trim(film);
/* Signed `distance' to nearest thing (i.e. negative is left on the timeline,
positive is right).
*/
new_position = DCPTime ();
}
- _down_view->content()->set_position (new_position);
+ _down_view->content()->set_position (film, new_position);
- shared_ptr<Film> film = _film.lock ();
- DCPOMATIC_ASSERT (film);
film->set_sequence (false);
}
return dcpomatic::Rect<int> (
time_x (content->position ()),
y_pos (_track.get()),
- content->length_after_trim().seconds() * _timeline.pixels_per_second().get_value_or(0),
+ content->length_after_trim(film).seconds() * _timeline.pixels_per_second().get_value_or(0),
_timeline.pixels_per_track()
);
}
}
DCPTime const position = cont->position ();
- DCPTime const len = cont->length_after_trim ();
+ DCPTime const len = cont->length_after_trim (film);
wxColour selected (background_colour().Red() / 2, background_colour().Green() / 2, background_colour().Blue() / 2);
{
set<DCPTime> check;
BOOST_FOREACH (shared_ptr<const Content> i, _parent->selected ()) {
- check.insert (i->full_length ());
+ check.insert (i->full_length(_parent->film()));
}
if (check.size() == 1) {
- _full_length->set (_parent->selected().front()->full_length (), _parent->film()->video_frame_rate ());
+ _full_length->set (_parent->selected().front()->full_length(_parent->film()), _parent->film()->video_frame_rate());
} else {
_full_length->clear ();
}
{
set<DCPTime> check;
BOOST_FOREACH (shared_ptr<const Content> i, _parent->selected ()) {
- check.insert (i->length_after_trim ());
+ check.insert (i->length_after_trim(_parent->film()));
}
if (check.size() == 1) {
- _play_length->set (_parent->selected().front()->length_after_trim (), _parent->film()->video_frame_rate ());
+ _play_length->set (_parent->selected().front()->length_after_trim(_parent->film()), _parent->film()->video_frame_rate());
} else {
_play_length->clear ();
}
{
DCPTime const pos = _position->get (_parent->film()->video_frame_rate ());
BOOST_FOREACH (shared_ptr<Content> i, _parent->selected ()) {
- i->set_position (pos);
+ i->set_position (_parent->film(), pos);
}
}
ContentTime const trim = _trim_start->get (_parent->film()->video_frame_rate ());
BOOST_FOREACH (shared_ptr<Content> i, _parent->selected ()) {
- if (i->position() <= ph && ph < i->end()) {
+ if (i->position() <= ph && ph < i->end(_parent->film())) {
/* The playhead is in i. Use it as a reference to work out
where to put the playhead post-trim; we're trying to keep the playhead
at the same frame of content that we're looking at pre-trim.
BOOST_FOREACH (shared_ptr<Content> i, _parent->selected ()) {
FrameRateChange const frc = _parent->film()->active_frame_rate_change (i->position ());
i->set_trim_end (
- ContentTime (max(DCPTime(), i->full_length() - play_length), frc) - i->trim_start ()
+ ContentTime (max(DCPTime(), i->full_length(_parent->film()) - play_length), frc) - i->trim_start()
);
}
}
fv->set_coalesce_player_changes (true);
BOOST_FOREACH (shared_ptr<Content> i, _parent->selected ()) {
- if (i->position() < ph && ph < i->end ()) {
- FrameRateChange const frc = film->active_frame_rate_change (i->position ());
- i->set_trim_start (i->trim_start() + ContentTime (ph - i->position (), frc));
+ if (i->position() < ph && ph < i->end(film)) {
+ FrameRateChange const frc = film->active_frame_rate_change (i->position());
+ i->set_trim_start (i->trim_start() + ContentTime (ph - i->position(), frc));
new_ph = i->position ();
}
}
shared_ptr<const Film> film = _parent->film ();
DCPTime const ph = fv->position().floor (film->video_frame_rate ());
BOOST_FOREACH (shared_ptr<Content> i, _parent->selected ()) {
- if (i->position() < ph && ph < i->end ()) {
+ if (i->position() < ph && ph < i->end(film)) {
FrameRateChange const frc = film->active_frame_rate_change (i->position ());
- i->set_trim_end (ContentTime (i->position() + i->full_length() - ph - DCPTime::from_frames (1, frc.dcp), frc) - i->trim_start());
+ i->set_trim_end (ContentTime(i->position() + i->full_length(film) - ph - DCPTime::from_frames(1, frc.dcp), frc) - i->trim_start());
}
}
}
DCPTime const ph = fv->position ();
bool any_over_ph = false;
BOOST_FOREACH (shared_ptr<const Content> i, _parent->selected ()) {
- if (i->position() <= ph && ph < i->end()) {
+ if (i->position() <= ph && ph < i->end(_parent->film())) {
any_over_ph = true;
}
}
MoveToDialog* d = new MoveToDialog (this, position, _parent->film());
if (d->ShowModal() == wxID_OK) {
- BOOST_FOREACH (shared_ptr<Content> i, _parent->selected ()) {
- i->set_position (d->position ());
+ BOOST_FOREACH (shared_ptr<Content> i, _parent->selected()) {
+ i->set_position (_parent->film(), d->position());
}
}
d->Destroy ();
if (check.size() == 1) {
_fade_in->set (
- ContentTime::from_frames (vc.front()->video->fade_in (), vc.front()->active_video_frame_rate ()),
- vc.front()->active_video_frame_rate ()
+ ContentTime::from_frames (vc.front()->video->fade_in(), vc.front()->active_video_frame_rate(_parent->film())),
+ vc.front()->active_video_frame_rate(_parent->film())
);
} else {
_fade_in->clear ();
if (check.size() == 1) {
_fade_out->set (
- ContentTime::from_frames (vc.front()->video->fade_out (), vc.front()->active_video_frame_rate ()),
- vc.front()->active_video_frame_rate ()
+ ContentTime::from_frames (vc.front()->video->fade_out(), vc.front()->active_video_frame_rate(_parent->film())),
+ vc.front()->active_video_frame_rate(_parent->film())
);
} else {
_fade_out->clear ();
return;
}
- string d = vc.front()->video->processing_description ();
+ string d = vc.front()->video->processing_description (_parent->film());
size_t lines = count (d.begin(), d.end(), '\n');
for (int i = lines; i < 6; ++i) {
}
string why_not;
- bool const can_reference = dcp && dcp->can_reference_video (why_not);
+ bool const can_reference = dcp && dcp->can_reference_video (_parent->film(), why_not);
setup_refer_button (_reference, _reference_note, dcp, can_reference, why_not);
if (_reference->GetValue ()) {
{
shared_ptr<Film> film = new_test_film ("4k_test");
film->set_name ("4k_test");
- shared_ptr<FFmpegContent> c (new FFmpegContent (film, "test/data/test.mp4"));
+ shared_ptr<FFmpegContent> c (new FFmpegContent("test/data/test.mp4"));
film->set_resolution (RESOLUTION_4K);
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
film->set_container (Ratio::from_id ("185"));
film->set_name ("audio_analysis_test");
boost::filesystem::path p = private_data / "betty_L.wav";
- shared_ptr<FFmpegContent> c (new FFmpegContent (film, p));
+ shared_ptr<FFmpegContent> c (new FFmpegContent(p));
film->examine_and_add_content (c);
wait_for_jobs ();
{
shared_ptr<Film> film = new_test_film ("audio_analysis_negative_delay_test");
film->set_name ("audio_analysis_negative_delay_test");
- shared_ptr<FFmpegContent> c (new FFmpegContent (film, private_data / "boon_telly.mkv"));
+ shared_ptr<FFmpegContent> c (new FFmpegContent(private_data / "boon_telly.mkv"));
film->examine_and_add_content (c);
wait_for_jobs ();
{
shared_ptr<Film> film = new_test_film ("audio_analysis_test2");
film->set_name ("audio_analysis_test2");
- shared_ptr<FFmpegContent> c (new FFmpegContent (film, private_data / "3d_thx_broadway_2010_lossless.m2ts"));
+ shared_ptr<FFmpegContent> c (new FFmpegContent(private_data / "3d_thx_broadway_2010_lossless.m2ts"));
film->examine_and_add_content (c);
wait_for_jobs ();
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
film->set_name ("frobozz");
- shared_ptr<FFmpegContent> content (new FFmpegContent (film, "test/data/white.wav"));
+ shared_ptr<FFmpegContent> content (new FFmpegContent("test/data/white.wav"));
film->examine_and_add_content (content);
wait_for_jobs ();
film->set_container (Ratio::from_id ("185"));
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
film->set_name ("frobozz");
- shared_ptr<Content> content = content_factory(film, private_data / "20 The Wedding Convoy Song.m4a").front();
+ shared_ptr<Content> content = content_factory(private_data / "20 The Wedding Convoy Song.m4a").front();
film->examine_and_add_content (content);
wait_for_jobs ();
shared_ptr<Playlist> playlist (new Playlist);
- playlist->add (content);
+ playlist->add (film, content);
boost::signals2::connection c;
JobManager::instance()->analyse_audio (film, playlist, false, c, boost::bind (&finished));
BOOST_CHECK (!wait_for_jobs ());
film->set_container (Ratio::from_id ("185"));
film->set_name (film_name);
- shared_ptr<FFmpegContent> content (new FFmpegContent (film, "test/data/staircase.wav"));
+ shared_ptr<FFmpegContent> content (new FFmpegContent("test/data/staircase.wav"));
film->examine_and_add_content (content);
wait_for_jobs ();
content->audio->set_delay (delay_in_ms);
{
shared_ptr<Film> film = new_test_film ("audio_processor_test");
film->set_name ("audio_processor_test");
- shared_ptr<FFmpegContent> c (new FFmpegContent (film, "test/data/white.wav"));
+ shared_ptr<FFmpegContent> c (new FFmpegContent("test/data/white.wav"));
film->examine_and_add_content (c);
wait_for_jobs ();
film->set_name ("butler_test1");
film->set_container (Ratio::from_id ("185"));
- shared_ptr<Content> video = content_factory(film, "test/data/flat_red.png").front ();
+ shared_ptr<Content> video = content_factory("test/data/flat_red.png").front ();
film->examine_and_add_content (video);
- shared_ptr<Content> audio = content_factory(film, "test/data/staircase.wav").front ();
+ shared_ptr<Content> audio = content_factory("test/data/staircase.wav").front ();
film->examine_and_add_content (audio);
BOOST_REQUIRE (!wait_for_jobs ());
BOOST_AUTO_TEST_CASE (closed_caption_test1)
{
shared_ptr<Film> film = new_test_film2 ("closed_caption_test1");
- shared_ptr<StringTextFileContent> content (new StringTextFileContent (film, "test/data/subrip.srt"));
+ shared_ptr<StringTextFileContent> content (new StringTextFileContent("test/data/subrip.srt"));
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs ());
BOOST_AUTO_TEST_CASE (closed_caption_test2)
{
shared_ptr<Film> film = new_test_film2 ("closed_caption_test2");
- shared_ptr<StringTextFileContent> content1 (new StringTextFileContent (film, "test/data/subrip.srt"));
+ shared_ptr<StringTextFileContent> content1 (new StringTextFileContent("test/data/subrip.srt"));
film->examine_and_add_content (content1);
- shared_ptr<StringTextFileContent> content2 (new StringTextFileContent (film, "test/data/subrip2.srt"));
+ shared_ptr<StringTextFileContent> content2 (new StringTextFileContent("test/data/subrip2.srt"));
film->examine_and_add_content (content2);
- shared_ptr<StringTextFileContent> content3 (new StringTextFileContent (film, "test/data/subrip3.srt"));
+ shared_ptr<StringTextFileContent> content3 (new StringTextFileContent("test/data/subrip3.srt"));
film->examine_and_add_content (content3);
BOOST_REQUIRE (!wait_for_jobs ());
film->set_name ("content_test1");
film->set_container (Ratio::from_id ("185"));
- shared_ptr<Content> content = content_factory(film, private_data / "demo_sound_bug.mkv").front ();
+ shared_ptr<Content> content = content_factory(private_data / "demo_sound_bug.mkv").front ();
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs ());
film->make_dcp ();
{
shared_ptr<Film> film = new_test_film2 ("content_test2");
- shared_ptr<Content> content = content_factory(film, "test/data/red_23976.mp4").front();
+ shared_ptr<Content> content = content_factory("test/data/red_23976.mp4").front();
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs ());
content->set_trim_start(ContentTime::from_seconds(0.5));
shared_ptr<Film> film = new_test_film2 ("content_test3");
film->set_sequence (false);
- shared_ptr<Content> content = content_factory(film, "test/data/red_24.mp4").front();
+ shared_ptr<Content> content = content_factory("test/data/red_24.mp4").front();
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs ());
/* Position */
/* 12 frames */
- content->set_position (DCPTime::from_seconds (12.0 / 24.0));
+ content->set_position (film, DCPTime::from_seconds(12.0 / 24.0));
BOOST_CHECK (content->position() == DCPTime::from_seconds (12.0 / 24.0));
/* 11.2 frames */
- content->set_position (DCPTime::from_seconds (11.2 / 24.0));
+ content->set_position (film, DCPTime::from_seconds(11.2 / 24.0));
BOOST_CHECK (content->position() == DCPTime::from_seconds (11.0 / 24.0));
/* 13.9 frames */
- content->set_position (DCPTime::from_seconds (13.9 / 24.0));
+ content->set_position (film, DCPTime::from_seconds(13.9 / 24.0));
BOOST_CHECK (content->position() == DCPTime::from_seconds (14.0 / 24.0));
content->set_video_frame_rate (25);
BOOST_AUTO_TEST_CASE (dcp_playback_test)
{
shared_ptr<Film> film = new_test_film ("dcp_playback_test");
- shared_ptr<DCPContent> content (new DCPContent(film, private_data / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV"));
+ shared_ptr<DCPContent> content (new DCPContent(private_data / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV"));
film->examine_and_add_content (content);
wait_for_jobs ();
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
film->set_name ("frobozz");
film->set_interop (false);
- shared_ptr<DCPSubtitleContent> content (new DCPSubtitleContent (film, "test/data/dcp_sub.xml"));
+ shared_ptr<DCPSubtitleContent> content (new DCPSubtitleContent ("test/data/dcp_sub.xml"));
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs ());
- BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(2).get());
+ BOOST_CHECK_EQUAL (content->full_length(film).get(), DCPTime::from_seconds(2).get());
content->only_text()->set_use (true);
content->only_text()->set_burn (false);
film->set_container (Ratio::from_id ("185"));
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
film->set_name ("frobozz");
- shared_ptr<DCPContent> content (new DCPContent (film, private_data / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV"));
+ shared_ptr<DCPContent> content (new DCPContent(private_data / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV"));
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs ());
- shared_ptr<DCPDecoder> decoder (new DCPDecoder (content, film->log(), false));
+ shared_ptr<DCPDecoder> decoder (new DCPDecoder (content, false));
decoder->only_text()->PlainStart.connect (bind (store, _1));
stored = optional<ContentStringText> ();
- while (!decoder->pass() && !stored) {}
+ while (!decoder->pass(film) && !stored) {}
BOOST_REQUIRE (stored);
BOOST_REQUIRE_EQUAL (stored->subs.size(), 2);
film->set_container (Ratio::from_id ("185"));
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
film->set_name ("frobozz");
- shared_ptr<DCPSubtitleContent> content (new DCPSubtitleContent (film, "test/data/dcp_sub2.xml"));
+ shared_ptr<DCPSubtitleContent> content (new DCPSubtitleContent("test/data/dcp_sub2.xml"));
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs ());
- shared_ptr<DCPSubtitleDecoder> decoder (new DCPSubtitleDecoder (content, film->log()));
+ shared_ptr<DCPSubtitleDecoder> decoder (new DCPSubtitleDecoder(content));
decoder->only_text()->PlainStart.connect (bind (store, _1));
stored = optional<ContentStringText> ();
- while (!decoder->pass ()) {
+ while (!decoder->pass(film)) {
if (stored && stored->from() == ContentTime(0)) {
BOOST_CHECK_EQUAL (stored->subs.front().text(), "<b>Hello world!</b>");
}
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
film->set_name ("frobozz");
film->set_interop (true);
- shared_ptr<DCPSubtitleContent> content (new DCPSubtitleContent (film, "test/data/dcp_sub3.xml"));
+ shared_ptr<DCPSubtitleContent> content (new DCPSubtitleContent ("test/data/dcp_sub3.xml"));
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs ());
film->make_dcp ();
BOOST_REQUIRE (!wait_for_jobs ());
- shared_ptr<DCPSubtitleDecoder> decoder (new DCPSubtitleDecoder (content, film->log()));
+ shared_ptr<DCPSubtitleDecoder> decoder (new DCPSubtitleDecoder (content));
stored = optional<ContentStringText> ();
- while (!decoder->pass ()) {
+ while (!decoder->pass (film)) {
decoder->only_text()->PlainStart.connect (bind (store, _1));
if (stored && stored->from() == ContentTime::from_seconds(0.08)) {
list<dcp::SubtitleString> s = stored->subs;
shared_ptr<Film> film = new_test_film2 ("dcp_subtitle_test4");
film->set_interop (true);
- shared_ptr<DCPSubtitleContent> content (new DCPSubtitleContent (film, "test/data/dcp_sub3.xml"));
+ shared_ptr<DCPSubtitleContent> content (new DCPSubtitleContent ("test/data/dcp_sub3.xml"));
film->examine_and_add_content (content);
- shared_ptr<DCPSubtitleContent> content2 (new DCPSubtitleContent (film, "test/data/dcp_sub3.xml"));
+ shared_ptr<DCPSubtitleContent> content2 (new DCPSubtitleContent ("test/data/dcp_sub3.xml"));
film->examine_and_add_content (content2);
BOOST_REQUIRE (!wait_for_jobs ());
shared_ptr<Film> film = new_test_film ("digest_test");
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
film->set_name ("digest_test");
- shared_ptr<ImageContent> r (new ImageContent (film, "test/data/flat_red.png"));
- shared_ptr<ImageContent> g (new ImageContent (film, "test/data/flat_green.png"));
- shared_ptr<ImageContent> b (new ImageContent (film, "test/data/flat_blue.png"));
+ shared_ptr<ImageContent> r (new ImageContent("test/data/flat_red.png"));
+ shared_ptr<ImageContent> g (new ImageContent("test/data/flat_green.png"));
+ shared_ptr<ImageContent> b (new ImageContent("test/data/flat_blue.png"));
film->examine_and_add_content (r);
film->examine_and_add_content (g);
film->examine_and_add_content (b);
film->set_name ("empty_test1");
film->set_container (Ratio::from_id ("185"));
film->set_sequence (false);
- shared_ptr<ImageContent> contentA (new ImageContent (film, "test/data/simple_testcard_640x480.png"));
- shared_ptr<ImageContent> contentB (new ImageContent (film, "test/data/simple_testcard_640x480.png"));
+ shared_ptr<ImageContent> contentA (new ImageContent("test/data/simple_testcard_640x480.png"));
+ shared_ptr<ImageContent> contentB (new ImageContent("test/data/simple_testcard_640x480.png"));
film->examine_and_add_content (contentA);
film->examine_and_add_content (contentB);
contentA->video->set_scale (VideoContentScale (Ratio::from_id ("185")));
contentA->video->set_length (3);
- contentA->set_position (DCPTime::from_frames (2, vfr));
+ contentA->set_position (film, DCPTime::from_frames (2, vfr));
contentB->video->set_scale (VideoContentScale (Ratio::from_id ("185")));
contentB->video->set_length (1);
- contentB->set_position (DCPTime::from_frames (7, vfr));
+ contentB->set_position (film, DCPTime::from_frames (7, vfr));
shared_ptr<Player> player (new Player(film, film->playlist()));
- Empty black (player->_pieces, film->length(), bind(&has_video, _1));
+ Empty black (film, player->_pieces, bind(&has_video, _1));
BOOST_REQUIRE_EQUAL (black._periods.size(), 2);
BOOST_CHECK (black._periods.front().from == DCPTime());
BOOST_CHECK (black._periods.front().to == DCPTime::from_frames(2, vfr));
film->set_name ("empty_test1");
film->set_container (Ratio::from_id ("185"));
film->set_sequence (false);
- shared_ptr<ImageContent> contentA (new ImageContent (film, "test/data/simple_testcard_640x480.png"));
- shared_ptr<ImageContent> contentB (new ImageContent (film, "test/data/simple_testcard_640x480.png"));
+ shared_ptr<ImageContent> contentA (new ImageContent("test/data/simple_testcard_640x480.png"));
+ shared_ptr<ImageContent> contentB (new ImageContent("test/data/simple_testcard_640x480.png"));
film->examine_and_add_content (contentA);
film->examine_and_add_content (contentB);
contentA->video->set_scale (VideoContentScale (Ratio::from_id ("185")));
contentA->video->set_length (3);
- contentA->set_position (DCPTime(0));
+ contentA->set_position (film, DCPTime(0));
contentB->video->set_scale (VideoContentScale (Ratio::from_id ("185")));
contentB->video->set_length (1);
- contentB->set_position (DCPTime::from_frames (7, vfr));
+ contentB->set_position (film, DCPTime::from_frames(7, vfr));
shared_ptr<Player> player (new Player(film, film->playlist()));
- Empty black (player->_pieces, film->length(), bind(&has_video, _1));
+ Empty black (film, player->_pieces, bind(&has_video, _1));
BOOST_REQUIRE_EQUAL (black._periods.size(), 1);
BOOST_CHECK (black._periods.front().from == DCPTime::from_frames(3, vfr));
BOOST_CHECK (black._periods.front().to == DCPTime::from_frames(7, vfr));
shared_ptr<Film> film = new_test_film ("ffmpeg_audio_only_test");
film->set_name ("test_film");
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
- shared_ptr<FFmpegContent> c (new FFmpegContent (film, file));
+ shared_ptr<FFmpegContent> c (new FFmpegContent(file));
film->examine_and_add_content (c);
wait_for_jobs ();
film->write_metadata ();
{
shared_ptr<Film> film = new_test_film ("ffmpeg_audio_test");
film->set_name ("ffmpeg_audio_test");
- shared_ptr<FFmpegContent> c (new FFmpegContent (film, "test/data/staircase.mov"));
+ shared_ptr<FFmpegContent> c (new FFmpegContent ("test/data/staircase.mov"));
film->examine_and_add_content (c);
wait_for_jobs ();
BOOST_AUTO_TEST_CASE (ffmpeg_audio_test2)
{
shared_ptr<Film> film = new_test_film2 ("ffmpeg_audio_test2");
- shared_ptr<Content> content = content_factory(film, private_data / "wayne.mkv").front();
+ shared_ptr<Content> content = content_factory(private_data / "wayne.mkv").front();
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs ());
BOOST_AUTO_TEST_CASE (ffmpeg_audio_test3)
{
shared_ptr<Film> film = new_test_film2 ("ffmpeg_audio_test2");
- shared_ptr<Content> content = content_factory(film, private_data / "wayne.mkv").front();
+ shared_ptr<Content> content = content_factory(private_data / "wayne.mkv").front();
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs ());
{
shared_ptr<Film> film = new_test_film ("ffmpeg_dcp_test");
film->set_name ("test_film2");
- shared_ptr<FFmpegContent> c (new FFmpegContent (film, "test/data/test.mp4"));
+ shared_ptr<FFmpegContent> c (new FFmpegContent("test/data/test.mp4"));
film->examine_and_add_content (c);
wait_for_jobs ();
}
static void
-check (shared_ptr<FFmpegDecoder> decoder, int frame)
+check (shared_ptr<const Film> film, shared_ptr<FFmpegDecoder> decoder, int frame)
{
BOOST_REQUIRE (decoder->ffmpeg_content()->video_frame_rate ());
- decoder->seek (ContentTime::from_frames (frame, decoder->ffmpeg_content()->video_frame_rate().get()), true);
+ decoder->seek (film, ContentTime::from_frames (frame, decoder->ffmpeg_content()->video_frame_rate().get()), true);
stored = optional<ContentVideo> ();
- while (!decoder->pass() && !stored) {}
+ while (!decoder->pass(film) && !stored) {}
BOOST_CHECK (stored->frame <= frame);
}
BOOST_REQUIRE (boost::filesystem::exists (path));
shared_ptr<Film> film = new_test_film ("ffmpeg_decoder_seek_test_" + file.string());
- shared_ptr<FFmpegContent> content (new FFmpegContent (film, path));
+ shared_ptr<FFmpegContent> content (new FFmpegContent (path));
film->examine_and_add_content (content);
wait_for_jobs ();
- shared_ptr<Log> log (new NullLog);
- shared_ptr<FFmpegDecoder> decoder (new FFmpegDecoder (content, log, false));
+ shared_ptr<FFmpegDecoder> decoder (new FFmpegDecoder (film, content, false));
decoder->video->Data.connect (bind (&store, _1));
for (vector<int>::const_iterator i = frames.begin(); i != frames.end(); ++i) {
- check (decoder, *i);
+ check (film, decoder, *i);
}
}
BOOST_REQUIRE (boost::filesystem::exists (path));
shared_ptr<Film> film = new_test_film ("ffmpeg_decoder_sequential_test_" + file.string());
- shared_ptr<FFmpegContent> content (new FFmpegContent (film, path));
+ shared_ptr<FFmpegContent> content (new FFmpegContent(path));
film->examine_and_add_content (content);
wait_for_jobs ();
film->write_metadata ();
shared_ptr<Film> film = new_test_film (name);
film->set_name (name);
- shared_ptr<FFmpegContent> c (new FFmpegContent (film, content));
+ shared_ptr<FFmpegContent> c (new FFmpegContent(content));
film->set_container (Ratio::from_id ("185"));
film->set_audio_channels (6);
{
shared_ptr<Film> film = new_test_film ("ffmpeg_encoder_prores_test5");
film->set_name ("ffmpeg_encoder_prores_test5");
- shared_ptr<ImageContent> c (new ImageContent (film, private_data / "bbc405.png"));
+ shared_ptr<ImageContent> c (new ImageContent(private_data / "bbc405.png"));
film->set_container (Ratio::from_id ("185"));
film->set_audio_channels (6);
film->set_container (Ratio::from_id ("185"));
film->set_audio_channels (6);
- shared_ptr<StringTextFileContent> s (new StringTextFileContent (film, "test/data/subrip2.srt"));
+ shared_ptr<StringTextFileContent> s (new StringTextFileContent("test/data/subrip2.srt"));
film->examine_and_add_content (s);
BOOST_REQUIRE (!wait_for_jobs ());
s->only_text()->set_colour (dcp::Colour (255, 255, 0));
film->set_container (Ratio::from_id ("185"));
film->set_audio_channels (6);
- shared_ptr<FFmpegContent> c (new FFmpegContent (film, "test/data/test.mp4"));
+ shared_ptr<FFmpegContent> c (new FFmpegContent("test/data/test.mp4"));
film->examine_and_add_content (c);
BOOST_REQUIRE (!wait_for_jobs ());
- shared_ptr<StringTextFileContent> s (new StringTextFileContent (film, "test/data/subrip.srt"));
+ shared_ptr<StringTextFileContent> s (new StringTextFileContent("test/data/subrip.srt"));
film->examine_and_add_content (s);
BOOST_REQUIRE (!wait_for_jobs ());
s->only_text()->set_colour (dcp::Colour (255, 255, 0));
film->set_container (Ratio::from_id ("185"));
film->set_audio_channels (6);
- shared_ptr<StringTextFileContent> s (new StringTextFileContent (film, "test/data/subrip2.srt"));
+ shared_ptr<StringTextFileContent> s (new StringTextFileContent("test/data/subrip2.srt"));
film->examine_and_add_content (s);
BOOST_REQUIRE (!wait_for_jobs ());
s->only_text()->set_colour (dcp::Colour (255, 255, 0));
film->set_container (Ratio::from_id ("185"));
film->set_audio_channels (6);
- shared_ptr<FFmpegContent> c (new FFmpegContent (film, "test/data/test.mp4"));
+ shared_ptr<FFmpegContent> c (new FFmpegContent("test/data/test.mp4"));
film->examine_and_add_content (c);
BOOST_REQUIRE (!wait_for_jobs ());
- shared_ptr<StringTextFileContent> s (new StringTextFileContent (film, "test/data/subrip.srt"));
+ shared_ptr<StringTextFileContent> s (new StringTextFileContent("test/data/subrip.srt"));
film->examine_and_add_content (s);
BOOST_REQUIRE (!wait_for_jobs ());
s->only_text()->set_colour (dcp::Colour (255, 255, 0));
BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test4)
{
shared_ptr<Film> film = new_test_film2("ffmpeg_encoder_h264_test4");
- film->examine_and_add_content(shared_ptr<DCPContent>(new DCPContent(film, "test/data/scope_dcp")));
+ film->examine_and_add_content(shared_ptr<DCPContent>(new DCPContent("test/data/scope_dcp")));
BOOST_REQUIRE(!wait_for_jobs());
film->set_container(Ratio::from_id("185"));
film->set_container (Ratio::from_id ("185"));
film->set_audio_channels (6);
- shared_ptr<FFmpegContent> L (new FFmpegContent (film, "test/data/L.wav"));
+ shared_ptr<FFmpegContent> L (new FFmpegContent("test/data/L.wav"));
film->examine_and_add_content (L);
- shared_ptr<FFmpegContent> R (new FFmpegContent (film, "test/data/R.wav"));
+ shared_ptr<FFmpegContent> R (new FFmpegContent("test/data/R.wav"));
film->examine_and_add_content (R);
- shared_ptr<FFmpegContent> C (new FFmpegContent (film, "test/data/C.wav"));
+ shared_ptr<FFmpegContent> C (new FFmpegContent("test/data/C.wav"));
film->examine_and_add_content (C);
- shared_ptr<FFmpegContent> Ls (new FFmpegContent (film, "test/data/Ls.wav"));
+ shared_ptr<FFmpegContent> Ls (new FFmpegContent("test/data/Ls.wav"));
film->examine_and_add_content (Ls);
- shared_ptr<FFmpegContent> Rs (new FFmpegContent (film, "test/data/Rs.wav"));
+ shared_ptr<FFmpegContent> Rs (new FFmpegContent("test/data/Rs.wav"));
film->examine_and_add_content (Rs);
- shared_ptr<FFmpegContent> Lfe (new FFmpegContent (film, "test/data/Lfe.wav"));
+ shared_ptr<FFmpegContent> Lfe (new FFmpegContent("test/data/Lfe.wav"));
film->examine_and_add_content (Lfe);
BOOST_REQUIRE (!wait_for_jobs ());
AudioMapping map (1, MAX_DCP_AUDIO_CHANNELS);
- L->set_position (DCPTime::from_seconds (0));
+ L->set_position (film, DCPTime::from_seconds(0));
map.make_zero ();
map.set (0, 0, 1);
L->audio->set_mapping (map);
- R->set_position (DCPTime::from_seconds (1));
+ R->set_position (film, DCPTime::from_seconds(1));
map.make_zero ();
map.set (0, 1, 1);
R->audio->set_mapping (map);
- C->set_position (DCPTime::from_seconds (2));
+ C->set_position (film, DCPTime::from_seconds(2));
map.make_zero ();
map.set (0, 2, 1);
C->audio->set_mapping (map);
- Lfe->set_position (DCPTime::from_seconds (3));
+ Lfe->set_position (film, DCPTime::from_seconds(3));
map.make_zero ();
map.set (0, 3, 1);
Lfe->audio->set_mapping (map);
- Ls->set_position (DCPTime::from_seconds (4));
+ Ls->set_position (film, DCPTime::from_seconds(4));
map.make_zero ();
map.set (0, 4, 1);
Ls->audio->set_mapping (map);
- Rs->set_position (DCPTime::from_seconds (5));
+ Rs->set_position (film, DCPTime::from_seconds(5));
map.make_zero ();
map.set (0, 5, 1);
Rs->audio->set_mapping (map);
BOOST_AUTO_TEST_CASE (ffmpeg_examiner_test)
{
shared_ptr<Film> film = new_test_film ("ffmpeg_examiner_test");
- shared_ptr<FFmpegContent> content (new FFmpegContent (film, "test/data/count300bd24.m2ts"));
+ shared_ptr<FFmpegContent> content (new FFmpegContent ("test/data/count300bd24.m2ts"));
shared_ptr<FFmpegExaminer> examiner (new FFmpegExaminer (content));
BOOST_CHECK_EQUAL (examiner->first_video().get().get(), ContentTime::from_seconds(600).get());
BOOST_AUTO_TEST_CASE (ffmpeg_pts_offset_test)
{
shared_ptr<Film> film = new_test_film ("ffmpeg_pts_offset_test");
- shared_ptr<FFmpegContent> content (new FFmpegContent (film, "test/data/test.mp4"));
+ shared_ptr<FFmpegContent> content (new FFmpegContent ("test/data/test.mp4"));
film->examine_and_add_content (content);
wait_for_jobs ();
/* Sound == video so no offset required */
content->_first_video = ContentTime ();
content->ffmpeg_audio_streams().front()->first_audio = ContentTime ();
- FFmpegDecoder decoder (content, film->log(), false);
+ FFmpegDecoder decoder (film, content, false);
BOOST_CHECK_EQUAL (decoder._pts_offset.get(), 0);
}
/* Common offset should be removed */
content->_first_video = ContentTime::from_seconds (600);
content->ffmpeg_audio_streams().front()->first_audio = ContentTime::from_seconds (600);
- FFmpegDecoder decoder (content, film->log(), false);
+ FFmpegDecoder decoder (film, content, false);
BOOST_CHECK_EQUAL (decoder._pts_offset.get(), ContentTime::from_seconds(-600).get());
}
/* Video is on a frame boundary */
content->_first_video = ContentTime::from_frames (1, 24);
content->ffmpeg_audio_streams().front()->first_audio = ContentTime ();
- FFmpegDecoder decoder (content, film->log(), false);
+ FFmpegDecoder decoder (film, content, false);
BOOST_CHECK_EQUAL (decoder._pts_offset.get(), 0);
}
double const frame = 1.0 / 24.0;
content->_first_video = ContentTime::from_seconds (frame + 0.0215);
content->ffmpeg_audio_streams().front()->first_audio = ContentTime ();
- FFmpegDecoder decoder (content, film->log(), false);
+ FFmpegDecoder decoder (film, content, false);
BOOST_CHECK_CLOSE (decoder._pts_offset.seconds(), (frame - 0.0215), 0.00001);
}
double const frame = 1.0 / 24.0;
content->_first_video = ContentTime::from_seconds (frame + 0.0215 + 4.1);
content->ffmpeg_audio_streams().front()->first_audio = ContentTime::from_seconds (4.1);
- FFmpegDecoder decoder (content, film->log(), false);
+ FFmpegDecoder decoder (film, content, false);
BOOST_CHECK_CLOSE (decoder._pts_offset.seconds(), (frame - 0.0215) - 4.1, 0.1);
}
}
shared_ptr<Film> film = new_test_film ("file_naming_test");
film->set_name ("file_naming_test");
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
- shared_ptr<FFmpegContent> r (new FFmpegContent (film, "test/data/flat_red.png"));
+ shared_ptr<FFmpegContent> r (new FFmpegContent("test/data/flat_red.png"));
film->examine_and_add_content (r);
- shared_ptr<FFmpegContent> g (new FFmpegContent (film, "test/data/flat_green.png"));
+ shared_ptr<FFmpegContent> g (new FFmpegContent("test/data/flat_green.png"));
film->examine_and_add_content (g);
- shared_ptr<FFmpegContent> b (new FFmpegContent (film, "test/data/flat_blue.png"));
+ shared_ptr<FFmpegContent> b (new FFmpegContent("test/data/flat_blue.png"));
film->examine_and_add_content (b);
wait_for_jobs ();
shared_ptr<Film> film = new_test_film ("file_naming_test2");
film->set_name ("file_naming_test2");
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
- shared_ptr<FFmpegContent> r (new FFmpegContent (film, "test/data/flät_red.png"));
+ shared_ptr<FFmpegContent> r (new FFmpegContent("test/data/flät_red.png"));
film->examine_and_add_content (r);
- shared_ptr<FFmpegContent> g (new FFmpegContent (film, "test/data/flat_green.png"));
+ shared_ptr<FFmpegContent> g (new FFmpegContent("test/data/flat_green.png"));
film->examine_and_add_content (g);
- shared_ptr<FFmpegContent> b (new FFmpegContent (film, "test/data/flat_blue.png"));
+ shared_ptr<FFmpegContent> b (new FFmpegContent("test/data/flat_blue.png"));
film->examine_and_add_content (b);
wait_for_jobs ();
{
shared_ptr<Film> film = new_test_film ("best_dcp_frame_rate_test_single");
/* Get any piece of content, it doesn't matter what */
- shared_ptr<FFmpegContent> content (new FFmpegContent (film, "test/data/test.mp4"));
+ shared_ptr<FFmpegContent> content (new FFmpegContent("test/data/test.mp4"));
film->examine_and_add_content (content);
wait_for_jobs ();
{
shared_ptr<Film> film = new_test_film ("best_dcp_frame_rate_test_double");
/* Get any old content, it doesn't matter what */
- shared_ptr<FFmpegContent> A (new FFmpegContent (film, "test/data/test.mp4"));
+ shared_ptr<FFmpegContent> A (new FFmpegContent("test/data/test.mp4"));
film->examine_and_add_content (A);
- shared_ptr<FFmpegContent> B (new FFmpegContent (film, "test/data/test.mp4"));
+ shared_ptr<FFmpegContent> B (new FFmpegContent("test/data/test.mp4"));
film->examine_and_add_content (B);
wait_for_jobs ();
{
shared_ptr<Film> film = new_test_film ("audio_sampling_rate_test");
/* Get any piece of content, it doesn't matter what */
- shared_ptr<FFmpegContent> content (new FFmpegContent (film, "test/data/test.mp4"));
+ shared_ptr<FFmpegContent> content (new FFmpegContent("test/data/test.mp4"));
film->examine_and_add_content (content);
wait_for_jobs ();
content->_video_frame_rate = 24;
film->set_video_frame_rate (24);
stream->_frame_rate = 48000;
- BOOST_CHECK_EQUAL (content->audio->resampled_frame_rate(), 48000);
+ BOOST_CHECK_EQUAL (content->audio->resampled_frame_rate(film), 48000);
stream->_frame_rate = 44100;
- BOOST_CHECK_EQUAL (content->audio->resampled_frame_rate(), 48000);
+ BOOST_CHECK_EQUAL (content->audio->resampled_frame_rate(film), 48000);
stream->_frame_rate = 80000;
- BOOST_CHECK_EQUAL (content->audio->resampled_frame_rate(), 96000);
+ BOOST_CHECK_EQUAL (content->audio->resampled_frame_rate(film), 96000);
content->_video_frame_rate = 23.976;
film->set_video_frame_rate (24);
stream->_frame_rate = 48000;
- BOOST_CHECK_EQUAL (content->audio->resampled_frame_rate(), 47952);
+ BOOST_CHECK_EQUAL (content->audio->resampled_frame_rate(film), 47952);
content->_video_frame_rate = 29.97;
film->set_video_frame_rate (30);
BOOST_CHECK_EQUAL (film->video_frame_rate (), 30);
stream->_frame_rate = 48000;
- BOOST_CHECK_EQUAL (content->audio->resampled_frame_rate(), 47952);
+ BOOST_CHECK_EQUAL (content->audio->resampled_frame_rate(film), 47952);
content->_video_frame_rate = 25;
film->set_video_frame_rate (24);
stream->_frame_rate = 48000;
- BOOST_CHECK_EQUAL (content->audio->resampled_frame_rate(), 50000);
+ BOOST_CHECK_EQUAL (content->audio->resampled_frame_rate(film), 50000);
content->_video_frame_rate = 25;
film->set_video_frame_rate (24);
stream->_frame_rate = 44100;
- BOOST_CHECK_EQUAL (content->audio->resampled_frame_rate(), 50000);
+ BOOST_CHECK_EQUAL (content->audio->resampled_frame_rate(film), 50000);
/* Check some out-there conversions (not the best) */
/* The FrameRateChange within resampled_frame_rate should choose to double-up
the 14.99 fps video to 30 and then run it slow at 25.
*/
- BOOST_CHECK_EQUAL (content->audio->resampled_frame_rate(), lrint (48000 * 2 * 14.99 / 25));
+ BOOST_CHECK_EQUAL (content->audio->resampled_frame_rate(film), lrint (48000 * 2 * 14.99 / 25));
}
A->set_name ("frobozz");
A->set_interop (false);
- shared_ptr<FFmpegContent> c (new FFmpegContent (A, "test/data/test.mp4"));
+ shared_ptr<FFmpegContent> c (new FFmpegContent("test/data/test.mp4"));
A->examine_and_add_content (c);
A->set_encrypted (true);
BOOST_CHECK (!wait_for_jobs ());
B->set_name ("frobozz");
B->set_interop (false);
- shared_ptr<DCPContent> d (new DCPContent (B, "build/test/import_dcp_test/" + A->dcp_name()));
+ shared_ptr<DCPContent> d (new DCPContent("build/test/import_dcp_test/" + A->dcp_name()));
B->examine_and_add_content (d);
BOOST_CHECK (!wait_for_jobs ());
d->add_kdm (kdm);
film->set_container (Ratio::from_id ("185"));
film->set_name ("interrupt_encoder_test");
- shared_ptr<FFmpegContent> content (new FFmpegContent (film, private_data / "prophet_long_clip.mkv"));
+ shared_ptr<FFmpegContent> content (new FFmpegContent(private_data / "prophet_long_clip.mkv"));
film->examine_and_add_content (content);
wait_for_jobs ();
/* Test interior aspect ratio: shouldn't be shown with trailers */
- shared_ptr<ImageContent> content (new ImageContent (film, "test/data/simple_testcard_640x480.png"));
+ shared_ptr<ImageContent> content (new ImageContent ("test/data/simple_testcard_640x480.png"));
film->examine_and_add_content (content);
wait_for_jobs ();
content->video->set_scale (VideoContentScale (Ratio::from_id ("133")));
/* Test audio channel markup */
film->set_audio_channels (6);
- shared_ptr<FFmpegContent> sound (new FFmpegContent (film, "test/data/sine_440.wav"));
+ shared_ptr<FFmpegContent> sound (new FFmpegContent("test/data/sine_440.wav"));
film->examine_and_add_content (sound);
wait_for_jobs ();
BOOST_CHECK_EQUAL (film->isdcf_name(false), "LikeShouting_XSN-2_F-133_DE-fr_US-R_10_4K_DI_20140704_PP_SMPTE_OV");
film->set_name (name);
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
film->set_j2k_bandwidth (target_bits_per_second);
- shared_ptr<ImageContent> content (new ImageContent (film, private_data / "prophet_frame.tiff"));
+ shared_ptr<ImageContent> content (new ImageContent(private_data / "prophet_frame.tiff"));
film->examine_and_add_content (content);
wait_for_jobs ();
content->video->set_length (24 * duration);
film->set_container (Ratio::from_id ("185"));
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
film->set_name ("frobozz");
- shared_ptr<Content> content = content_factory(film, "test/data/flat_red.png").front ();
+ shared_ptr<Content> content = content_factory("test/data/flat_red.png").front ();
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs ());
film->make_dcp ();
film->set_container (Ratio::from_id ("185"));
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
film->set_name ("frobozz");
- shared_ptr<Content> content = content_factory(film, "test/data/flat_red.png").front ();
+ shared_ptr<Content> content = content_factory("test/data/flat_red.png").front ();
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs ());
content->video->set_frame_type (VIDEO_FRAME_TYPE_3D_LEFT_RIGHT);
{
shared_ptr<Film> film = new_test_film ("player_silence_padding_test");
film->set_name ("player_silence_padding_test");
- shared_ptr<FFmpegContent> c (new FFmpegContent (film, "test/data/test.mp4"));
+ shared_ptr<FFmpegContent> c (new FFmpegContent("test/data/test.mp4"));
film->set_container (Ratio::from_id ("185"));
film->set_audio_channels (6);
film->set_container (Ratio::from_id ("185"));
film->set_sequence (false);
film->set_interop (false);
- shared_ptr<ImageContent> contentA (new ImageContent (film, "test/data/simple_testcard_640x480.png"));
- shared_ptr<ImageContent> contentB (new ImageContent (film, "test/data/simple_testcard_640x480.png"));
+ shared_ptr<ImageContent> contentA (new ImageContent("test/data/simple_testcard_640x480.png"));
+ shared_ptr<ImageContent> contentB (new ImageContent("test/data/simple_testcard_640x480.png"));
film->examine_and_add_content (contentA);
film->examine_and_add_content (contentB);
contentA->video->set_scale (VideoContentScale (Ratio::from_id ("185")));
contentA->video->set_length (3);
- contentA->set_position (DCPTime::from_frames (2, film->video_frame_rate ()));
+ contentA->set_position (film, DCPTime::from_frames(2, film->video_frame_rate()));
contentB->video->set_scale (VideoContentScale (Ratio::from_id ("185")));
contentB->video->set_length (1);
- contentB->set_position (DCPTime::from_frames (7, film->video_frame_rate ()));
+ contentB->set_position (film, DCPTime::from_frames(7, film->video_frame_rate()));
film->make_dcp ();
film->set_name ("reels_test7");
film->set_container (Ratio::from_id ("185"));
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
- shared_ptr<Content> A = content_factory(film, "test/data/flat_red.png").front();
+ shared_ptr<Content> A = content_factory("test/data/flat_red.png").front();
film->examine_and_add_content (A);
BOOST_REQUIRE (!wait_for_jobs ());
- shared_ptr<Content> B = content_factory(film, "test/data/awkward_length.wav").front();
+ shared_ptr<Content> B = content_factory("test/data/awkward_length.wav").front();
film->examine_and_add_content (B);
BOOST_REQUIRE (!wait_for_jobs ());
film->set_video_frame_rate (24);
A->video->set_length (3 * 24);
- BOOST_CHECK (A->full_length() == DCPTime::from_frames(3 * 24, 24));
- BOOST_CHECK (B->full_length() == DCPTime(289920));
+ BOOST_CHECK (A->full_length(film) == DCPTime::from_frames(3 * 24, 24));
+ BOOST_CHECK (B->full_length(film) == DCPTime(289920));
/* Length should be rounded up from B's length to the next video frame */
BOOST_CHECK (film->length() == DCPTime::from_frames(3 * 24 + 1, 24));
film->set_container (Ratio::from_id ("185"));
film->set_audio_channels (6);
- shared_ptr<FFmpegContent> c (new FFmpegContent (film, "test/data/test.mp4"));
+ shared_ptr<FFmpegContent> c (new FFmpegContent("test/data/test.mp4"));
film->examine_and_add_content (c);
BOOST_REQUIRE (!wait_for_jobs ());
- shared_ptr<StringTextFileContent> s (new StringTextFileContent (film, "test/data/subrip.srt"));
+ shared_ptr<StringTextFileContent> s (new StringTextFileContent("test/data/subrip.srt"));
film->examine_and_add_content (s);
BOOST_REQUIRE (!wait_for_jobs ());
BOOST_AUTO_TEST_CASE (player_seek_test)
{
shared_ptr<Film> film (new Film (optional<boost::filesystem::path>()));
- shared_ptr<DCPContent> dcp (new DCPContent (film, private_data / "awkward_subs"));
+ shared_ptr<DCPContent> dcp (new DCPContent(private_data / "awkward_subs"));
film->examine_and_add_content (dcp, true);
BOOST_REQUIRE (!wait_for_jobs ());
dcp->only_text()->set_use (true);
BOOST_AUTO_TEST_CASE (player_seek_test2)
{
shared_ptr<Film> film (new Film (optional<boost::filesystem::path>()));
- shared_ptr<DCPContent> dcp (new DCPContent (film, private_data / "awkward_subs2"));
+ shared_ptr<DCPContent> dcp (new DCPContent(private_data / "awkward_subs2"));
film->examine_and_add_content (dcp, true);
BOOST_REQUIRE (!wait_for_jobs ());
dcp->only_text()->set_use (true);
BOOST_AUTO_TEST_CASE (player_trim_test)
{
shared_ptr<Film> film = new_test_film2 ("player_trim_test");
- shared_ptr<Content> A = content_factory(film, "test/data/flat_red.png").front();
+ shared_ptr<Content> A = content_factory("test/data/flat_red.png").front();
film->examine_and_add_content (A);
BOOST_REQUIRE (!wait_for_jobs ());
A->video->set_length (10 * 24);
- shared_ptr<Content> B = content_factory(film, "test/data/flat_red.png").front();
+ shared_ptr<Content> B = content_factory("test/data/flat_red.png").front();
film->examine_and_add_content (B);
BOOST_REQUIRE (!wait_for_jobs ());
B->video->set_length (10 * 24);
- B->set_position (DCPTime::from_seconds (10));
+ B->set_position (film, DCPTime::from_seconds(10));
B->set_trim_start (ContentTime::from_seconds (2));
film->make_dcp ();
BOOST_AUTO_TEST_CASE (player_ignore_video_and_audio_test)
{
shared_ptr<Film> film = new_test_film2 ("player_ignore_video_and_audio_test");
- shared_ptr<Content> ff = content_factory(film, private_data / "boon_telly.mkv").front();
+ shared_ptr<Content> ff = content_factory(private_data / "boon_telly.mkv").front();
film->examine_and_add_content (ff);
- shared_ptr<Content> text = content_factory(film, "test/data/subrip.srt").front();
+ shared_ptr<Content> text = content_factory("test/data/subrip.srt").front();
film->examine_and_add_content (text);
BOOST_REQUIRE (!wait_for_jobs());
text->only_text()->set_type (TEXT_CLOSED_CAPTION);
film->set_container (Ratio::from_id ("185"));
film->set_name ("recover_test");
- shared_ptr<FFmpegContent> content (new FFmpegContent (film, "test/data/count300bd24.m2ts"));
+ shared_ptr<FFmpegContent> content (new FFmpegContent("test/data/count300bd24.m2ts"));
film->examine_and_add_content (content);
wait_for_jobs ();
film->set_name ("recover_test");
film->set_three_d (true);
- shared_ptr<ImageContent> content (new ImageContent (film, "test/data/3d_test"));
+ shared_ptr<ImageContent> content (new ImageContent("test/data/3d_test"));
content->video->set_frame_type (VIDEO_FRAME_TYPE_3D_LEFT_RIGHT);
film->examine_and_add_content (content);
wait_for_jobs ();
film->set_name ("recover_test");
film->set_encrypted (true);
- shared_ptr<FFmpegContent> content (new FFmpegContent (film, "test/data/count300bd24.m2ts"));
+ shared_ptr<FFmpegContent> content (new FFmpegContent("test/data/count300bd24.m2ts"));
film->examine_and_add_content (content);
wait_for_jobs ();
{
shared_ptr<Film> film = new_test_film ("reels_test1");
film->set_container (Ratio::from_id ("185"));
- shared_ptr<FFmpegContent> A (new FFmpegContent (film, "test/data/test.mp4"));
+ shared_ptr<FFmpegContent> A (new FFmpegContent("test/data/test.mp4"));
film->examine_and_add_content (A);
- shared_ptr<FFmpegContent> B (new FFmpegContent (film, "test/data/test.mp4"));
+ shared_ptr<FFmpegContent> B (new FFmpegContent("test/data/test.mp4"));
film->examine_and_add_content (B);
wait_for_jobs ();
- BOOST_CHECK_EQUAL (A->full_length().get(), 288000);
+ BOOST_CHECK_EQUAL (A->full_length(film).get(), 288000);
film->set_reel_type (REELTYPE_SINGLE);
list<DCPTimePeriod> r = film->reels ();
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
{
- shared_ptr<ImageContent> c (new ImageContent (film, "test/data/flat_red.png"));
+ shared_ptr<ImageContent> c (new ImageContent("test/data/flat_red.png"));
film->examine_and_add_content (c);
wait_for_jobs ();
c->video->set_length (24);
}
{
- shared_ptr<ImageContent> c (new ImageContent (film, "test/data/flat_green.png"));
+ shared_ptr<ImageContent> c (new ImageContent("test/data/flat_green.png"));
film->examine_and_add_content (c);
wait_for_jobs ();
c->video->set_length (24);
}
{
- shared_ptr<ImageContent> c (new ImageContent (film, "test/data/flat_blue.png"));
+ shared_ptr<ImageContent> c (new ImageContent("test/data/flat_blue.png"));
film->examine_and_add_content (c);
wait_for_jobs ();
c->video->set_length (24);
film2->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
film2->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
- shared_ptr<DCPContent> c (new DCPContent (film2, film->dir (film->dcp_name ())));
+ shared_ptr<DCPContent> c (new DCPContent(film->dir(film->dcp_name())));
film2->examine_and_add_content (c);
BOOST_REQUIRE (!wait_for_jobs ());
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
film->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
- shared_ptr<Content> dcp (new DCPContent (film, "test/data/reels_test2"));
+ shared_ptr<Content> dcp (new DCPContent("test/data/reels_test2"));
film->examine_and_add_content (dcp);
- shared_ptr<Content> sub (new StringTextFileContent (film, "test/data/subrip.srt"));
+ shared_ptr<Content> sub (new StringTextFileContent("test/data/subrip.srt"));
film->examine_and_add_content (sub);
wait_for_jobs ();
BOOST_CHECK_EQUAL (i->to.get(), 96000 * 3);
++i;
BOOST_CHECK_EQUAL (i->from.get(), 96000 * 3);
- BOOST_CHECK_EQUAL (i->to.get(), sub->full_length().ceil(film->video_frame_rate()).get());
+ BOOST_CHECK_EQUAL (i->to.get(), sub->full_length(film).ceil(film->video_frame_rate()).get());
}
/** Check creation of a multi-reel DCP with a single .srt subtitle file;
/* 4 piece of 1s-long content */
shared_ptr<ImageContent> content[4];
for (int i = 0; i < 4; ++i) {
- content[i].reset (new ImageContent (film, "test/data/flat_green.png"));
+ content[i].reset (new ImageContent("test/data/flat_green.png"));
film->examine_and_add_content (content[i]);
wait_for_jobs ();
content[i]->video->set_length (24);
}
- shared_ptr<StringTextFileContent> subs (new StringTextFileContent (film, "test/data/subrip3.srt"));
+ shared_ptr<StringTextFileContent> subs (new StringTextFileContent("test/data/subrip3.srt"));
film->examine_and_add_content (subs);
wait_for_jobs ();
{
shared_ptr<Film> film = new_test_film ("reels_test5");
film->set_sequence (false);
- shared_ptr<DCPContent> dcp (new DCPContent (film, "test/data/reels_test4"));
+ shared_ptr<DCPContent> dcp (new DCPContent("test/data/reels_test4"));
film->examine_and_add_content (dcp);
BOOST_REQUIRE (!wait_for_jobs ());
/* Set to 2123 but it will be rounded up to the next frame (4000) */
- dcp->set_position(DCPTime(2123));
+ dcp->set_position(film, DCPTime(2123));
{
- list<DCPTimePeriod> p = dcp->reels ();
+ list<DCPTimePeriod> p = dcp->reels (film);
BOOST_REQUIRE_EQUAL (p.size(), 4);
list<DCPTimePeriod>::const_iterator i = p.begin();
BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 0), DCPTime(4000 + 96000)));
{
dcp->set_trim_start (ContentTime::from_seconds (0.5));
- list<DCPTimePeriod> p = dcp->reels ();
+ list<DCPTimePeriod> p = dcp->reels (film);
BOOST_REQUIRE_EQUAL (p.size(), 4);
list<DCPTimePeriod>::const_iterator i = p.begin();
BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 0), DCPTime(4000 + 48000)));
{
dcp->set_trim_end (ContentTime::from_seconds (0.5));
- list<DCPTimePeriod> p = dcp->reels ();
+ list<DCPTimePeriod> p = dcp->reels (film);
BOOST_REQUIRE_EQUAL (p.size(), 4);
list<DCPTimePeriod>::const_iterator i = p.begin();
BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 0), DCPTime(4000 + 48000)));
{
dcp->set_trim_start (ContentTime::from_seconds (1.5));
- list<DCPTimePeriod> p = dcp->reels ();
+ list<DCPTimePeriod> p = dcp->reels (film);
BOOST_REQUIRE_EQUAL (p.size(), 3);
list<DCPTimePeriod>::const_iterator i = p.begin();
BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 0), DCPTime(4000 + 48000)));
film->set_name ("reels_test6");
film->set_container (Ratio::from_id ("185"));
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
- shared_ptr<FFmpegContent> A (new FFmpegContent (film, "test/data/test2.mp4"));
+ shared_ptr<FFmpegContent> A (new FFmpegContent("test/data/test2.mp4"));
film->examine_and_add_content (A);
BOOST_REQUIRE (!wait_for_jobs ());
film->set_name ("reels_test7");
film->set_container (Ratio::from_id ("185"));
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
- shared_ptr<Content> A = content_factory(film, "test/data/flat_red.png").front();
+ shared_ptr<Content> A = content_factory("test/data/flat_red.png").front();
film->examine_and_add_content (A);
BOOST_REQUIRE (!wait_for_jobs ());
- shared_ptr<Content> B = content_factory(film, "test/data/awkward_length.wav").front();
+ shared_ptr<Content> B = content_factory("test/data/awkward_length.wav").front();
film->examine_and_add_content (B);
BOOST_REQUIRE (!wait_for_jobs ());
film->set_video_frame_rate (24);
film->set_name ("reels_test8");
film->set_container (Ratio::from_id ("185"));
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
- shared_ptr<FFmpegContent> A (new FFmpegContent (film, "test/data/test2.mp4"));
+ shared_ptr<FFmpegContent> A (new FFmpegContent("test/data/test2.mp4"));
film->examine_and_add_content (A);
BOOST_REQUIRE (!wait_for_jobs ());
BOOST_AUTO_TEST_CASE (reels_test9)
{
shared_ptr<Film> film = new_test_film2("reels_test9a");
- shared_ptr<FFmpegContent> A(new FFmpegContent(film, "test/data/flat_red.png"));
+ shared_ptr<FFmpegContent> A(new FFmpegContent("test/data/flat_red.png"));
film->examine_and_add_content(A);
BOOST_REQUIRE(!wait_for_jobs());
A->video->set_length(5 * 24);
BOOST_REQUIRE(!wait_for_jobs());
shared_ptr<Film> film2 = new_test_film2("reels_test9b");
- shared_ptr<DCPContent> B(new DCPContent(film2, film->dir(film->dcp_name())));
+ shared_ptr<DCPContent> B(new DCPContent(film->dir(film->dcp_name())));
film2->examine_and_add_content(B);
- film2->examine_and_add_content(content_factory(film, "test/data/dcp_sub4.xml").front());
+ film2->examine_and_add_content(content_factory("test/data/dcp_sub4.xml").front());
B->set_reference_video(true);
B->set_reference_audio(true);
BOOST_REQUIRE(!wait_for_jobs());
{
/* Make a DCP */
shared_ptr<Film> film = new_test_film2 ("remake_id_test1_1");
- shared_ptr<Content> content = content_factory(film, "test/data/flat_red.png").front();
+ shared_ptr<Content> content = content_factory("test/data/flat_red.png").front();
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs ());
film->make_dcp ();
{
/* Make a DCP */
shared_ptr<Film> film = new_test_film2 ("remake_id_test2_1");
- shared_ptr<Content> content = content_factory(film, "test/data/flat_red.png").front();
+ shared_ptr<Content> content = content_factory("test/data/flat_red.png").front();
film->examine_and_add_content (content);
film->set_encrypted (true);
BOOST_REQUIRE (!wait_for_jobs ());
/* Import the DCP into a new film */
shared_ptr<Film> film2 = new_test_film2("remake_id_test2_2");
- shared_ptr<DCPContent> dcp_content(new DCPContent(film2, film->dir(film->dcp_name())));
+ shared_ptr<DCPContent> dcp_content(new DCPContent(film->dir(film->dcp_name())));
film2->examine_and_add_content(dcp_content);
BOOST_REQUIRE(!wait_for_jobs());
dcp_content->add_kdm(kdm);
BOOST_AUTO_TEST_CASE (remake_with_subtitle_test)
{
shared_ptr<Film> film = new_test_film2 ("remake_with_subtitle_test");
- shared_ptr<FFmpegContent> content = dynamic_pointer_cast<FFmpegContent>(content_factory(film, private_data / "prophet_short_clip.mkv").front());
+ shared_ptr<FFmpegContent> content = dynamic_pointer_cast<FFmpegContent>(content_factory(private_data / "prophet_short_clip.mkv").front());
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs ());
content->only_text()->set_burn (true);
film->set_container (Ratio::from_id ("185"));
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
film->set_interop (false);
- shared_ptr<FFmpegContent> c (new FFmpegContent (film, "test/data/red_24.mp4"));
+ shared_ptr<FFmpegContent> c (new FFmpegContent("test/data/red_24.mp4"));
film->examine_and_add_content (c);
wait_for_jobs ();
shared_ptr<Film> film = new_test_film ("required_disk_space_test");
film->set_j2k_bandwidth (100000000);
film->set_audio_channels (6);
- shared_ptr<Content> content_a = content_factory(film, "test/data/flat_blue.png").front();
+ shared_ptr<Content> content_a = content_factory("test/data/flat_blue.png").front();
BOOST_REQUIRE (content_a);
film->examine_and_add_content (content_a);
- shared_ptr<DCPContent> content_b (new DCPContent (film, "test/data/burnt_subtitle_test_dcp"));
+ shared_ptr<DCPContent> content_b (new DCPContent("test/data/burnt_subtitle_test_dcp"));
film->examine_and_add_content (content_b);
wait_for_jobs ();
film->write_metadata ();
shared_ptr<Film> film = new_test_film ("scaling_test");
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
film->set_name ("scaling_test");
- shared_ptr<ImageContent> imc (new ImageContent (film, "test/data/simple_testcard_640x480.png"));
+ shared_ptr<ImageContent> imc (new ImageContent("test/data/simple_testcard_640x480.png"));
film->examine_and_add_content (imc);
film->set_container (Ratio::from_id ("185"));
film->set_name (film_name);
- shared_ptr<FFmpegContent> content (new FFmpegContent (film, "test/data/staircase.wav"));
+ shared_ptr<FFmpegContent> content (new FFmpegContent("test/data/staircase.wav"));
film->examine_and_add_content (content);
wait_for_jobs ();
film->set_container (Ratio::from_id ("185"));
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
film->set_interop (false);
- shared_ptr<FFmpegContent> c (new FFmpegContent (film, "test/data/count300bd48.m2ts"));
+ shared_ptr<FFmpegContent> c (new FFmpegContent("test/data/count300bd48.m2ts"));
film->examine_and_add_content (c);
wait_for_jobs ();
film->set_name ("frobozz");
film->set_audio_channels (6);
film->set_interop (false);
- shared_ptr<StringTextFileContent> content (new StringTextFileContent (film, "test/data/subrip2.srt"));
+ shared_ptr<StringTextFileContent> content (new StringTextFileContent("test/data/subrip2.srt"));
film->examine_and_add_content (content);
wait_for_jobs ();
film->set_name ("frobozz");
film->set_audio_channels (6);
film->set_interop (false);
- shared_ptr<StringTextFileContent> content (new StringTextFileContent (film, "test/data/subrip2.srt"));
+ shared_ptr<StringTextFileContent> content (new StringTextFileContent ("test/data/subrip2.srt"));
film->examine_and_add_content (content);
wait_for_jobs ();
film->set_name ("frobozz");
film->set_interop (true);
film->set_audio_channels (6);
- shared_ptr<StringTextFileContent> content (new StringTextFileContent (film, private_data / "Ankoemmling_short.srt"));
+ shared_ptr<StringTextFileContent> content (new StringTextFileContent(private_data / "Ankoemmling_short.srt"));
film->examine_and_add_content (content);
wait_for_jobs ();
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
film->set_name ("frobozz");
film->set_interop (false);
- shared_ptr<StringTextFileContent> content (new StringTextFileContent (film, "test/data/subrip2.srt"));
+ shared_ptr<StringTextFileContent> content (new StringTextFileContent("test/data/subrip2.srt"));
content->only_text()->set_use (true);
content->only_text()->set_burn (false);
film->examine_and_add_content (content);
film->set_name ("frobozz");
film->set_interop (true);
film->set_sequence (false);
- shared_ptr<StringTextFileContent> content (new StringTextFileContent (film, "test/data/subrip2.srt"));
+ shared_ptr<StringTextFileContent> content (new StringTextFileContent("test/data/subrip2.srt"));
content->only_text()->set_use (true);
content->only_text()->set_burn (false);
film->examine_and_add_content (content);
film->examine_and_add_content (content);
wait_for_jobs ();
- content->set_position (DCPTime (0));
+ content->set_position (film, DCPTime());
film->make_dcp ();
wait_for_jobs ();
film->write_metadata ();
{
shared_ptr<Film> film = new_test_film2 ("srt_subtitle_test6");
film->set_interop (false);
- shared_ptr<StringTextFileContent> content (new StringTextFileContent (film, "test/data/frames.srt"));
+ shared_ptr<StringTextFileContent> content (new StringTextFileContent("test/data/frames.srt"));
content->only_text()->set_use (true);
content->only_text()->set_burn (false);
film->examine_and_add_content (content);
BOOST_AUTO_TEST_CASE (srt_subtitle_test4)
{
shared_ptr<Film> film = new_test_film ("subrip_render_test");
- shared_ptr<StringTextFile> content (new StringTextFile (film, "test/data/subrip.srt"));
+ shared_ptr<StringTextFile> content (new StringTextFile("test/data/subrip.srt"));
content->examine (shared_ptr<Job> (), true);
BOOST_CHECK_EQUAL (content->full_length(), DCPTime::from_seconds ((3 * 60) + 56.471));
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
film->set_name ("frobozz");
film->set_interop (true);
- shared_ptr<StringTextFileContent> content (new StringTextFileContent (film, private_data / "DKH_UT_EN20160601def.ssa"));
+ shared_ptr<StringTextFileContent> content (new StringTextFileContent(private_data / "DKH_UT_EN20160601def.ssa"));
film->examine_and_add_content (content);
wait_for_jobs ();
BOOST_AUTO_TEST_CASE (subtitle_charset_test1)
{
shared_ptr<Film> film = new_test_film2 ("subtitle_charset_test1");
- shared_ptr<Content> content = content_factory (film, private_data / "PADDINGTON soustitresVFdef.srt").front ();
+ shared_ptr<Content> content = content_factory (private_data / "PADDINGTON soustitresVFdef.srt").front();
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs ());
}
BOOST_AUTO_TEST_CASE (subtitle_charset_test2)
{
shared_ptr<Film> film = new_test_film2 ("subtitle_charset_test2");
- shared_ptr<Content> content = content_factory (film, "test/data/osx.srt").front ();
+ shared_ptr<Content> content = content_factory ("test/data/osx.srt").front();
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs ());
shared_ptr<StringTextFileContent> ts = dynamic_pointer_cast<StringTextFileContent> (content);
BOOST_REQUIRE (ts);
/* Make sure we got the subtitle data from the file */
- BOOST_REQUIRE_EQUAL (content->full_length().get(), 6052032);
+ BOOST_REQUIRE_EQUAL (content->full_length(film).get(), 6052032);
}
film->set_container (Ratio::from_id ("185"));
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
film->set_name ("frobozz");
- shared_ptr<StringTextFileContent> content (new StringTextFileContent (film, "test/data/subrip5.srt"));
+ shared_ptr<StringTextFileContent> content (new StringTextFileContent("test/data/subrip5.srt"));
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs ());
content->only_text()->set_use (true);
BOOST_AUTO_TEST_CASE (subtitle_trim_test1)
{
shared_ptr<Film> film = new_test_film2 ("subtitle_trim_test1");
- shared_ptr<DCPSubtitleContent> content (new DCPSubtitleContent (film, "test/data/dcp_sub5.xml"));
+ shared_ptr<DCPSubtitleContent> content (new DCPSubtitleContent ("test/data/dcp_sub5.xml"));
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs ());
{
shared_ptr<Film> film = new_test_film ("threed_test1");
film->set_name ("test_film1");
- shared_ptr<FFmpegContent> c (new FFmpegContent (film, "test/data/test.mp4"));
+ shared_ptr<FFmpegContent> c (new FFmpegContent("test/data/test.mp4"));
film->examine_and_add_content (c);
wait_for_jobs ();
{
shared_ptr<Film> film = new_test_film ("threed_test2");
film->set_name ("test_film2");
- shared_ptr<FFmpegContent> c (new FFmpegContent (film, "test/data/test.mp4"));
+ shared_ptr<FFmpegContent> c (new FFmpegContent("test/data/test.mp4"));
film->examine_and_add_content (c);
wait_for_jobs ();
BOOST_AUTO_TEST_CASE (threed_test3)
{
shared_ptr<Film> film = new_test_film2 ("threed_test3");
- shared_ptr<FFmpegContent> L (new FFmpegContent (film, "test/data/test.mp4"));
+ shared_ptr<FFmpegContent> L (new FFmpegContent("test/data/test.mp4"));
film->examine_and_add_content (L);
- shared_ptr<FFmpegContent> R (new FFmpegContent (film, "test/data/test.mp4"));
+ shared_ptr<FFmpegContent> R (new FFmpegContent("test/data/test.mp4"));
film->examine_and_add_content (R);
wait_for_jobs ();
BOOST_AUTO_TEST_CASE (threed_test4)
{
shared_ptr<Film> film = new_test_film2 ("threed_test4");
- shared_ptr<FFmpegContent> L (new FFmpegContent (film, private_data / "LEFT_TEST_DCP3D4K.mov"));
+ shared_ptr<FFmpegContent> L (new FFmpegContent(private_data / "LEFT_TEST_DCP3D4K.mov"));
film->examine_and_add_content (L);
- shared_ptr<FFmpegContent> R (new FFmpegContent (film, private_data / "RIGHT_TEST_DCP3D4K.mov"));
+ shared_ptr<FFmpegContent> R (new FFmpegContent(private_data / "RIGHT_TEST_DCP3D4K.mov"));
film->examine_and_add_content (R);
wait_for_jobs ();
BOOST_AUTO_TEST_CASE (threed_test5)
{
shared_ptr<Film> film = new_test_film2 ("threed_test5");
- shared_ptr<FFmpegContent> L (new FFmpegContent (film, private_data / "boon_telly.mkv"));
+ shared_ptr<FFmpegContent> L (new FFmpegContent(private_data / "boon_telly.mkv"));
film->examine_and_add_content (L);
- shared_ptr<FFmpegContent> R (new FFmpegContent (film, private_data / "boon_telly.mkv"));
+ shared_ptr<FFmpegContent> R (new FFmpegContent(private_data / "boon_telly.mkv"));
film->examine_and_add_content (R);
wait_for_jobs ();
doc->read_string (xml);
list<string> notes;
- shared_ptr<FFmpegContent> content (new FFmpegContent (film, doc, film->state_version(), notes));
+ shared_ptr<FFmpegContent> content (new FFmpegContent(doc, film->state_version(), notes));
/* 25fps content, 25fps DCP */
film->set_video_frame_rate (25);
- BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(content->video->length() / 25.0).get());
+ BOOST_CHECK_EQUAL (content->full_length(film).get(), DCPTime::from_seconds(content->video->length() / 25.0).get());
/* 25fps content, 24fps DCP; length should be increased */
film->set_video_frame_rate (24);
- BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(content->video->length() / 24.0).get());
+ BOOST_CHECK_EQUAL (content->full_length(film).get(), DCPTime::from_seconds(content->video->length() / 24.0).get());
/* 25fps content, 30fps DCP; length should be decreased */
film->set_video_frame_rate (30);
- BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(content->video->length() / 30.0).get());
+ BOOST_CHECK_EQUAL (content->full_length(film).get(), DCPTime::from_seconds(content->video->length() / 30.0).get());
/* 25fps content, 50fps DCP; length should be the same */
film->set_video_frame_rate (50);
- BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(content->video->length() / 25.0).get());
+ BOOST_CHECK_EQUAL (content->full_length(film).get(), DCPTime::from_seconds(content->video->length() / 25.0).get());
/* 25fps content, 60fps DCP; length should be decreased */
film->set_video_frame_rate (60);
- BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(content->video->length() * (50.0 / 60) / 25.0).get());
+ BOOST_CHECK_EQUAL (content->full_length(film).get(), DCPTime::from_seconds(content->video->length() * (50.0 / 60) / 25.0).get());
/* Make the content audio-only */
content->video.reset ();
/* 24fps content, 24fps DCP */
film->set_video_frame_rate (24);
content->set_video_frame_rate (24);
- BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(1).get());
+ BOOST_CHECK_EQUAL (content->full_length(film).get(), DCPTime::from_seconds(1).get());
/* 25fps content, 25fps DCP */
film->set_video_frame_rate (25);
content->set_video_frame_rate (25);
- BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(1).get());
+ BOOST_CHECK_EQUAL (content->full_length(film).get(), DCPTime::from_seconds(1).get());
/* 25fps content, 24fps DCP; length should be increased */
film->set_video_frame_rate (24);
- BOOST_CHECK_SMALL (labs (content->full_length().get() - DCPTime::from_seconds(25.0 / 24).get()), 2L);
+ BOOST_CHECK_SMALL (labs (content->full_length(film).get() - DCPTime::from_seconds(25.0 / 24).get()), 2L);
/* 25fps content, 30fps DCP; length should be decreased */
film->set_video_frame_rate (30);
- BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(25.0 / 30).get());
+ BOOST_CHECK_EQUAL (content->full_length(film).get(), DCPTime::from_seconds(25.0 / 30).get());
/* 25fps content, 50fps DCP; length should be the same */
film->set_video_frame_rate (50);
- BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(1).get());
+ BOOST_CHECK_EQUAL (content->full_length(film).get(), DCPTime::from_seconds(1).get());
/* 25fps content, 60fps DCP; length should be decreased */
film->set_video_frame_rate (60);
- BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(50.0 / 60).get());
+ BOOST_CHECK_EQUAL (content->full_length(film).get(), DCPTime::from_seconds(50.0 / 60).get());
}
doc->read_string (xml);
list<string> notes;
- shared_ptr<FFmpegContent> content (new FFmpegContent (film, doc, film->state_version(), notes));
+ shared_ptr<FFmpegContent> content (new FFmpegContent(doc, film->state_version(), notes));
film->set_sequence (false);
film->add_content (content);
shared_ptr<Player> player (new Player (film, film->playlist ()));
/* Position 0, no trim, content rate = DCP rate */
- content->set_position (DCPTime ());
+ content->set_position (film, DCPTime());
content->set_trim_start (ContentTime ());
content->set_video_frame_rate (24);
film->set_video_frame_rate (24);
BOOST_CHECK_EQUAL (player->dcp_to_content_video (piece, DCPTime::from_seconds (3.0)), 72);
/* Position 3s, no trim, content rate = DCP rate */
- content->set_position (DCPTime::from_seconds (3));
+ content->set_position (film, DCPTime::from_seconds(3));
content->set_trim_start (ContentTime ());
content->set_video_frame_rate (24);
film->set_video_frame_rate (24);
BOOST_CHECK_EQUAL (player->dcp_to_content_video (piece, DCPTime::from_seconds (9.75)), 162);
/* Position 3s, 1.5s trim, content rate = DCP rate */
- content->set_position (DCPTime::from_seconds (3));
+ content->set_position (film, DCPTime::from_seconds(3));
content->set_trim_start (ContentTime::from_seconds (1.5));
content->set_video_frame_rate (24);
film->set_video_frame_rate (24);
Now, for example, a DCPTime position of 3s means 3s at 25fps. Since we run the video
fast (at 25fps) in this case, this means 75 frames of content video will be used.
*/
- content->set_position (DCPTime ());
+ content->set_position (film, DCPTime());
content->set_trim_start (ContentTime ());
content->set_video_frame_rate (24);
film->set_video_frame_rate (25);
BOOST_CHECK_EQUAL (player->dcp_to_content_video (piece, DCPTime::from_seconds (3.0)), 75);
/* Position 3s, no trim, content rate 24, DCP rate 25 */
- content->set_position (DCPTime::from_seconds (3));
+ content->set_position (film, DCPTime::from_seconds(3));
content->set_trim_start (ContentTime ());
content->set_video_frame_rate (24);
film->set_video_frame_rate (25);
so it's 1.6s at 24fps. Note that trims are rounded to the nearest video frame, so
some of these results are not quite what you'd perhaps expect.
*/
- content->set_position (DCPTime::from_seconds (3));
+ content->set_position (film, DCPTime::from_seconds(3));
content->set_trim_start (ContentTime::from_seconds (1.6));
content->set_video_frame_rate (24);
film->set_video_frame_rate (25);
be used to make 3 * 48 frames of DCP video. The results should be the same as the
content rate = DCP rate case.
*/
- content->set_position (DCPTime ());
+ content->set_position (film, DCPTime());
content->set_trim_start (ContentTime ());
content->set_video_frame_rate (24);
film->set_video_frame_rate (48);
BOOST_CHECK_EQUAL (player->dcp_to_content_video (piece, DCPTime::from_seconds (3.0)), 72);
/* Position 3s, no trim, content rate 24, DCP rate 48 */
- content->set_position (DCPTime::from_seconds (3));
+ content->set_position (film, DCPTime::from_seconds(3));
content->set_trim_start (ContentTime ());
content->set_video_frame_rate (24);
film->set_video_frame_rate (48);
BOOST_CHECK_EQUAL (player->dcp_to_content_video (piece, DCPTime::from_seconds (9.75)), 162);
/* Position 3s, 1.5s trim, content rate 24, DCP rate 48 */
- content->set_position (DCPTime::from_seconds (3));
+ content->set_position (film, DCPTime::from_seconds(3));
content->set_trim_start (ContentTime::from_seconds (1.5));
content->set_video_frame_rate (24);
film->set_video_frame_rate (48);
with skipped frames in this case, 3 * 48 frames of content video will
be used to make 3 * 24 frames of DCP video.
*/
- content->set_position (DCPTime ());
+ content->set_position (film, DCPTime());
content->set_trim_start (ContentTime ());
content->set_video_frame_rate (48);
film->set_video_frame_rate (24);
BOOST_CHECK_EQUAL (player->dcp_to_content_video (piece, DCPTime::from_seconds (3.0)), 144);
/* Position 3s, no trim, content rate 24, DCP rate 48 */
- content->set_position (DCPTime::from_seconds (3));
+ content->set_position (film, DCPTime::from_seconds(3));
content->set_trim_start (ContentTime ());
content->set_video_frame_rate (48);
film->set_video_frame_rate (24);
BOOST_CHECK_EQUAL (player->dcp_to_content_video (piece, DCPTime::from_seconds (9.75)), 324);
/* Position 3s, 1.5s trim, content rate 24, DCP rate 48 */
- content->set_position (DCPTime::from_seconds (3));
+ content->set_position (film, DCPTime::from_seconds(3));
content->set_trim_start (ContentTime::from_seconds (1.5));
content->set_video_frame_rate (48);
film->set_video_frame_rate (24);
BOOST_CHECK_EQUAL (player->dcp_to_content_video (piece, DCPTime::from_seconds (9.75)), 396);
/* Position 0s, no trim, content rate 29.9978733, DCP rate 30 */
- content->set_position (DCPTime::from_seconds (0));
+ content->set_position (film, DCPTime::from_seconds(0));
content->set_trim_start (ContentTime::from_seconds (0));
content->set_video_frame_rate (29.9978733);
film->set_video_frame_rate (30);
doc->read_string (xml);
list<string> notes;
- shared_ptr<FFmpegContent> content (new FFmpegContent (film, doc, film->state_version(), notes));
+ shared_ptr<FFmpegContent> content (new FFmpegContent(doc, film->state_version(), notes));
film->set_sequence (false);
film->add_content (content);
shared_ptr<Player> player (new Player (film, film->playlist ()));
/* Position 0, no trim, content rate = DCP rate */
- content->set_position (DCPTime ());
+ content->set_position (film, DCPTime());
content->set_trim_start (ContentTime ());
content->set_video_frame_rate (24);
film->set_video_frame_rate (24);
BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 72).get(), DCPTime::from_seconds(3.0).get());
/* Position 3s, no trim, content rate = DCP rate */
- content->set_position (DCPTime::from_seconds (3));
+ content->set_position (film, DCPTime::from_seconds(3));
content->set_trim_start (ContentTime ());
content->set_video_frame_rate (24);
film->set_video_frame_rate (24);
BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 162).get(), DCPTime::from_seconds(9.75).get());
/* Position 3s, 1.5s trim, content rate = DCP rate */
- content->set_position (DCPTime::from_seconds (3));
+ content->set_position (film, DCPTime::from_seconds(3));
content->set_trim_start (ContentTime::from_seconds (1.5));
content->set_video_frame_rate (24);
film->set_video_frame_rate (24);
Now, for example, a DCPTime position of 3s means 3s at 25fps. Since we run the video
fast (at 25fps) in this case, this means 75 frames of content video will be used.
*/
- content->set_position (DCPTime ());
+ content->set_position (film, DCPTime());
content->set_trim_start (ContentTime ());
content->set_video_frame_rate (24);
film->set_video_frame_rate (25);
BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 75).get(), DCPTime::from_seconds(3.0).get());
/* Position 3s, no trim, content rate 24, DCP rate 25 */
- content->set_position (DCPTime::from_seconds (3));
+ content->set_position (film, DCPTime::from_seconds(3));
content->set_trim_start (ContentTime ());
content->set_video_frame_rate (24);
film->set_video_frame_rate (25);
BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 169).get(), DCPTime::from_seconds(9.76).get());
/* Position 3s, 1.6s trim, content rate 24, DCP rate 25, so the 1.6s trim is at 24fps */
- content->set_position (DCPTime::from_seconds (3));
+ content->set_position (film, DCPTime::from_seconds(3));
content->set_trim_start (ContentTime::from_seconds (1.6));
content->set_video_frame_rate (24);
film->set_video_frame_rate (25);
be used to make 3 * 48 frames of DCP video. The results should be the same as the
content rate = DCP rate case.
*/
- content->set_position (DCPTime ());
+ content->set_position (film, DCPTime());
content->set_trim_start (ContentTime ());
content->set_video_frame_rate (24);
film->set_video_frame_rate (48);
BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 72).get(), DCPTime::from_seconds(3.0).get());
/* Position 3s, no trim, content rate 24, DCP rate 48 */
- content->set_position (DCPTime::from_seconds (3));
+ content->set_position (film, DCPTime::from_seconds(3));
content->set_trim_start (ContentTime ());
content->set_video_frame_rate (24);
film->set_video_frame_rate (48);
BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 162).get(), DCPTime::from_seconds(9.75).get());
/* Position 3s, 1.5s trim, content rate 24, DCP rate 48 */
- content->set_position (DCPTime::from_seconds (3));
+ content->set_position (film, DCPTime::from_seconds(3));
content->set_trim_start (ContentTime::from_seconds (1.5));
content->set_video_frame_rate (24);
film->set_video_frame_rate (48);
with skipped frames in this case, 3 * 48 frames of content video will
be used to make 3 * 24 frames of DCP video.
*/
- content->set_position (DCPTime ());
+ content->set_position (film, DCPTime());
content->set_trim_start (ContentTime ());
content->set_video_frame_rate (48);
film->set_video_frame_rate (24);
BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 144).get(), DCPTime::from_seconds(3.0).get());
/* Position 3s, no trim, content rate 24, DCP rate 48 */
- content->set_position (DCPTime::from_seconds (3));
+ content->set_position (film, DCPTime::from_seconds(3));
content->set_trim_start (ContentTime ());
content->set_video_frame_rate (48);
film->set_video_frame_rate (24);
BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 324).get(), DCPTime::from_seconds(9.75).get());
/* Position 3s, 1.5s trim, content rate 24, DCP rate 48 */
- content->set_position (DCPTime::from_seconds (3));
+ content->set_position (film, DCPTime::from_seconds(3));
content->set_trim_start (ContentTime::from_seconds (1.5));
content->set_video_frame_rate (48);
film->set_video_frame_rate (24);
doc->read_string (xml);
list<string> notes;
- shared_ptr<FFmpegContent> content (new FFmpegContent (film, doc, film->state_version(), notes));
+ shared_ptr<FFmpegContent> content (new FFmpegContent(doc, film->state_version(), notes));
AudioStreamPtr stream = content->audio->streams().front();
film->set_sequence (false);
film->add_content (content);
shared_ptr<Player> player (new Player (film, film->playlist ()));
/* Position 0, no trim, video/audio content rate = video/audio DCP rate */
- content->set_position (DCPTime ());
+ content->set_position (film, DCPTime());
content->set_trim_start (ContentTime ());
content->set_video_frame_rate (24);
film->set_video_frame_rate (24);
BOOST_CHECK_EQUAL (player->dcp_to_resampled_audio (piece, DCPTime::from_seconds (3.0)), 144000);
/* Position 3s, no trim, video/audio content rate = video/audio DCP rate */
- content->set_position (DCPTime::from_seconds (3));
+ content->set_position (film, DCPTime::from_seconds (3));
content->set_trim_start (ContentTime ());
content->set_video_frame_rate (24);
film->set_video_frame_rate (24);
BOOST_CHECK_EQUAL (player->dcp_to_resampled_audio (piece, DCPTime::from_seconds (9.75)), 324000);
/* Position 3s, 1.5s trim, video/audio content rate = video/audio DCP rate */
- content->set_position (DCPTime::from_seconds (3));
+ content->set_position (film, DCPTime::from_seconds (3));
content->set_trim_start (ContentTime::from_seconds (1.5));
content->set_video_frame_rate (24);
film->set_video_frame_rate (24);
BOOST_CHECK_EQUAL (player->dcp_to_resampled_audio (piece, DCPTime::from_seconds (9.75)), 396000);
/* Position 0, no trim, content video rate 24, DCP video rate 25, both audio rates still 48k */
- content->set_position (DCPTime ());
+ content->set_position (film, DCPTime());
content->set_trim_start (ContentTime ());
content->set_video_frame_rate (24);
film->set_video_frame_rate (25);
BOOST_CHECK_EQUAL (player->dcp_to_resampled_audio (piece, DCPTime::from_seconds (3.0)), 144000);
/* Position 3s, no trim, content video rate 24, DCP rate 25, both audio rates still 48k. */
- content->set_position (DCPTime::from_seconds (3));
+ content->set_position (film, DCPTime::from_seconds(3));
content->set_trim_start (ContentTime ());
content->set_video_frame_rate (24);
film->set_video_frame_rate (25);
/* Position 3s, 1.6s trim, content rate 24, DCP rate 25, both audio rates still 48k.
1s of content is 46080 samples after resampling.
*/
- content->set_position (DCPTime::from_seconds (3));
+ content->set_position (film, DCPTime::from_seconds(3));
content->set_trim_start (ContentTime::from_seconds (1.6));
content->set_video_frame_rate (24);
film->set_video_frame_rate (25);
with repeated frames in this case, audio samples will map straight through.
The results should be the same as the content rate = DCP rate case.
*/
- content->set_position (DCPTime ());
+ content->set_position (film, DCPTime());
content->set_trim_start (ContentTime ());
content->set_video_frame_rate (24);
film->set_video_frame_rate (48);
BOOST_CHECK_EQUAL (player->dcp_to_resampled_audio (piece, DCPTime::from_seconds (3.0)), 144000);
/* Position 3s, no trim, content rate 24, DCP rate 48 */
- content->set_position (DCPTime::from_seconds (3));
+ content->set_position (film, DCPTime::from_seconds(3));
content->set_trim_start (ContentTime ());
content->set_video_frame_rate (24);
film->set_video_frame_rate (24);
BOOST_CHECK_EQUAL (player->dcp_to_resampled_audio (piece, DCPTime::from_seconds (9.75)), 324000);
/* Position 3s, 1.5s trim, content rate 24, DCP rate 48 */
- content->set_position (DCPTime::from_seconds (3));
+ content->set_position (film, DCPTime::from_seconds(3));
content->set_trim_start (ContentTime::from_seconds (1.5));
content->set_video_frame_rate (24);
film->set_video_frame_rate (24);
Now, for example, a DCPTime position of 3s means 3s at 24fps. Since we run the video
with skipped frames in this case, audio samples should map straight through.
*/
- content->set_position (DCPTime ());
+ content->set_position (film, DCPTime());
content->set_trim_start (ContentTime ());
content->set_video_frame_rate (24);
film->set_video_frame_rate (48);
BOOST_CHECK_EQUAL (player->dcp_to_resampled_audio (piece, DCPTime::from_seconds (3.0)), 144000);
/* Position 3s, no trim, content rate 24, DCP rate 48 */
- content->set_position (DCPTime::from_seconds (3));
+ content->set_position (film, DCPTime::from_seconds(3));
content->set_trim_start (ContentTime ());
content->set_video_frame_rate (24);
film->set_video_frame_rate (24);
BOOST_CHECK_EQUAL (player->dcp_to_resampled_audio (piece, DCPTime::from_seconds (9.75)), 324000);
/* Position 3s, 1.5s trim, content rate 24, DCP rate 48 */
- content->set_position (DCPTime::from_seconds (3));
+ content->set_position (film, DCPTime::from_seconds(3));
content->set_trim_start (ContentTime::from_seconds (1.5));
content->set_video_frame_rate (24);
film->set_video_frame_rate (24);
BOOST_CHECK_EQUAL (player->dcp_to_resampled_audio (piece, DCPTime::from_seconds (9.75)), 396000);
/* Position 0, no trim, video content rate = video DCP rate, content audio rate = 44.1k */
- content->set_position (DCPTime ());
+ content->set_position (film, DCPTime());
content->set_trim_start (ContentTime ());
content->set_video_frame_rate (24);
film->set_video_frame_rate (24);
BOOST_CHECK_EQUAL (player->dcp_to_resampled_audio (piece, DCPTime::from_seconds (3.0)), 144000);
/* Position 3s, no trim, video content rate = video DCP rate, content audio rate = 44.1k */
- content->set_position (DCPTime::from_seconds (3));
+ content->set_position (film, DCPTime::from_seconds(3));
content->set_trim_start (ContentTime ());
content->set_video_frame_rate (24);
film->set_video_frame_rate (24);
BOOST_CHECK_EQUAL (player->dcp_to_resampled_audio (piece, DCPTime::from_seconds (9.75)), 324000);
/* Position 3s, 1.5s trim, video content rate = video DCP rate, content audio rate = 44.1k */
- content->set_position (DCPTime::from_seconds (3));
+ content->set_position (film, DCPTime::from_seconds(3));
content->set_trim_start (ContentTime::from_seconds (1.5));
content->set_video_frame_rate (24);
film->set_video_frame_rate (24);
BOOST_CHECK_EQUAL (player->dcp_to_resampled_audio (piece, DCPTime::from_seconds (9.75)), 396000);
/* Check with a large start trim */
- content->set_position (DCPTime::from_seconds (0));
+ content->set_position (film, DCPTime::from_seconds(0));
content->set_trim_start (ContentTime::from_seconds (54143));
content->set_video_frame_rate (24);
film->set_video_frame_rate (24);
film->set_sequence (false);
/* Staircase at an offset of 2000 samples, trimmed both start and end, with a gain of 6dB */
- shared_ptr<Content> staircase = content_factory(film, "test/data/staircase.wav").front ();
+ shared_ptr<Content> staircase = content_factory("test/data/staircase.wav").front ();
film->examine_and_add_content (staircase);
wait_for_jobs ();
- staircase->set_position (DCPTime::from_frames (2000, film->audio_frame_rate()));
+ staircase->set_position (film, DCPTime::from_frames (2000, film->audio_frame_rate()));
staircase->set_trim_start (ContentTime::from_frames (12, 48000));
staircase->set_trim_end (ContentTime::from_frames (35, 48000));
staircase->audio->set_gain (20 * log10(2));
/* And again at an offset of 50000 samples, trimmed both start and end, with a gain of 6dB */
- staircase = content_factory(film, "test/data/staircase.wav").front ();
+ staircase = content_factory("test/data/staircase.wav").front ();
film->examine_and_add_content (staircase);
wait_for_jobs ();
- staircase->set_position (DCPTime::from_frames (50000, film->audio_frame_rate()));
+ staircase->set_position (film, DCPTime::from_frames(50000, film->audio_frame_rate()));
staircase->set_trim_start (ContentTime::from_frames (12, 48000));
staircase->set_trim_end (ContentTime::from_frames (35, 48000));
staircase->audio->set_gain (20 * log10(2));
/* 1s of red at 5s in */
- shared_ptr<Content> red = content_factory(film, "test/data/flat_red.png").front ();
+ shared_ptr<Content> red = content_factory("test/data/flat_red.png").front ();
film->examine_and_add_content (red);
wait_for_jobs ();
- red->set_position (DCPTime::from_seconds (5));
+ red->set_position (film, DCPTime::from_seconds(5));
red->video->set_length (24);
film->set_video_frame_rate (24);
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
film->set_name ("frobozz");
film->set_audio_processor (AudioProcessor::from_id ("stereo-5.1-upmix-a"));
- shared_ptr<FFmpegContent> content (new FFmpegContent (film, "test/data/white.wav"));
+ shared_ptr<FFmpegContent> content (new FFmpegContent ("test/data/white.wav"));
film->examine_and_add_content (content);
wait_for_jobs ();
A->set_name ("frobozz");
A->set_interop (true);
- shared_ptr<FFmpegContent> c (new FFmpegContent (A, "test/data/test.mp4"));
+ shared_ptr<FFmpegContent> c (new FFmpegContent("test/data/test.mp4"));
A->examine_and_add_content (c);
A->set_encrypted (true);
wait_for_jobs ();
B->set_name ("frobozz");
B->set_interop (true);
- shared_ptr<DCPContent> d (new DCPContent (B, "build/test/vf_kdm_test_ov/" + A->dcp_name()));
+ shared_ptr<DCPContent> d (new DCPContent ("build/test/vf_kdm_test_ov/" + A->dcp_name()));
d->add_kdm (A_kdm);
d->set_reference_video (true);
B->examine_and_add_content (d);
C->set_name ("frobozz");
C->set_interop (true);
- shared_ptr<DCPContent> e (new DCPContent (C, "build/test/vf_kdm_test_vf/" + B->dcp_name()));
+ shared_ptr<DCPContent> e (new DCPContent ("build/test/vf_kdm_test_vf/" + B->dcp_name()));
e->add_kdm (B_kdm);
e->add_ov ("build/test/vf_kdm_test_ov/" + A->dcp_name());
C->examine_and_add_content (e);
{
shared_ptr<Film> film = new_test_film ("vf_test1");
film->set_interop (false);
- shared_ptr<DCPContent> dcp (new DCPContent (film, "test/data/reels_test2"));
+ shared_ptr<DCPContent> dcp (new DCPContent ("test/data/reels_test2"));
film->examine_and_add_content (dcp);
wait_for_jobs ();
/* Multi-reel DCP can't be referenced if we are using a single reel for the project */
film->set_reel_type (REELTYPE_SINGLE);
string why_not;
- BOOST_CHECK (!dcp->can_reference_video(why_not));
- BOOST_CHECK (!dcp->can_reference_audio(why_not));
- BOOST_CHECK (!dcp->can_reference_text(TEXT_OPEN_SUBTITLE, why_not));
- BOOST_CHECK (!dcp->can_reference_text(TEXT_CLOSED_CAPTION, why_not));
+ BOOST_CHECK (!dcp->can_reference_video(film, why_not));
+ BOOST_CHECK (!dcp->can_reference_audio(film, why_not));
+ BOOST_CHECK (!dcp->can_reference_text(film, TEXT_OPEN_SUBTITLE, why_not));
+ BOOST_CHECK (!dcp->can_reference_text(film, TEXT_CLOSED_CAPTION, why_not));
/* Multi-reel DCP can be referenced if we are using by-video-content */
film->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
- BOOST_CHECK (dcp->can_reference_video(why_not));
- BOOST_CHECK (dcp->can_reference_audio(why_not));
+ BOOST_CHECK (dcp->can_reference_video(film, why_not));
+ BOOST_CHECK (dcp->can_reference_audio(film, why_not));
/* (but reels_test2 has no texts to reference) */
- BOOST_CHECK (!dcp->can_reference_text(TEXT_OPEN_SUBTITLE, why_not));
- BOOST_CHECK (!dcp->can_reference_text(TEXT_CLOSED_CAPTION, why_not));
+ BOOST_CHECK (!dcp->can_reference_text(film, TEXT_OPEN_SUBTITLE, why_not));
+ BOOST_CHECK (!dcp->can_reference_text(film, TEXT_CLOSED_CAPTION, why_not));
- shared_ptr<FFmpegContent> other (new FFmpegContent (film, "test/data/test.mp4"));
+ shared_ptr<FFmpegContent> other (new FFmpegContent("test/data/test.mp4"));
film->examine_and_add_content (other);
wait_for_jobs ();
/* Not possible if there is overlap */
- other->set_position (DCPTime (0));
- BOOST_CHECK (!dcp->can_reference_video(why_not));
- BOOST_CHECK (!dcp->can_reference_audio(why_not));
- BOOST_CHECK (!dcp->can_reference_text(TEXT_OPEN_SUBTITLE, why_not));
- BOOST_CHECK (!dcp->can_reference_text(TEXT_CLOSED_CAPTION, why_not));
+ other->set_position (film, DCPTime());
+ BOOST_CHECK (!dcp->can_reference_video(film, why_not));
+ BOOST_CHECK (!dcp->can_reference_audio(film, why_not));
+ BOOST_CHECK (!dcp->can_reference_text(film, TEXT_OPEN_SUBTITLE, why_not));
+ BOOST_CHECK (!dcp->can_reference_text(film, TEXT_CLOSED_CAPTION, why_not));
/* This should not be considered an overlap */
- other->set_position (dcp->end ());
- BOOST_CHECK (dcp->can_reference_video(why_not));
- BOOST_CHECK (dcp->can_reference_audio(why_not));
+ other->set_position (film, dcp->end(film));
+ BOOST_CHECK (dcp->can_reference_video(film, why_not));
+ BOOST_CHECK (dcp->can_reference_audio(film, why_not));
/* (reels_test2 has no texts to reference) */
- BOOST_CHECK (!dcp->can_reference_text(TEXT_OPEN_SUBTITLE, why_not));
- BOOST_CHECK (!dcp->can_reference_text(TEXT_CLOSED_CAPTION, why_not));
+ BOOST_CHECK (!dcp->can_reference_text(film, TEXT_OPEN_SUBTITLE, why_not));
+ BOOST_CHECK (!dcp->can_reference_text(film, TEXT_CLOSED_CAPTION, why_not));
}
/** Make a OV with video and audio and a VF referencing the OV and adding subs */
shared_ptr<Film> ov = new_test_film ("vf_test2_ov");
ov->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
ov->set_name ("vf_test2_ov");
- shared_ptr<Content> video = content_factory (ov, "test/data/flat_red.png").front();
+ shared_ptr<Content> video = content_factory ("test/data/flat_red.png").front();
ov->examine_and_add_content (video);
wait_for_jobs ();
video->video->set_length (24 * 5);
- shared_ptr<Content> audio = content_factory(ov, "test/data/white.wav").front();
+ shared_ptr<Content> audio = content_factory ("test/data/white.wav").front();
ov->examine_and_add_content (audio);
wait_for_jobs ();
ov->make_dcp ();
vf->set_name ("vf_test2_vf");
vf->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
vf->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
- shared_ptr<DCPContent> dcp (new DCPContent (vf, ov->dir (ov->dcp_name ())));
+ shared_ptr<DCPContent> dcp (new DCPContent(ov->dir (ov->dcp_name ())));
BOOST_REQUIRE (dcp);
vf->examine_and_add_content (dcp);
wait_for_jobs ();
dcp->set_reference_video (true);
dcp->set_reference_audio (true);
- shared_ptr<Content> sub = content_factory(vf, "test/data/subrip4.srt").front();
+ shared_ptr<Content> sub = content_factory("test/data/subrip4.srt").front();
vf->examine_and_add_content (sub);
DCPOMATIC_ASSERT (!wait_for_jobs ());
vf->make_dcp ();
shared_ptr<Film> ov = new_test_film ("vf_test3_ov");
ov->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
ov->set_name ("vf_test3_ov");
- shared_ptr<Content> video = content_factory(ov, "test/data/flat_red.png").front();
+ shared_ptr<Content> video = content_factory("test/data/flat_red.png").front();
ov->examine_and_add_content (video);
wait_for_jobs ();
video->video->set_length (24 * 5);
- shared_ptr<Content> audio = content_factory(ov, "test/data/white.wav").front();
+ shared_ptr<Content> audio = content_factory("test/data/white.wav").front();
ov->examine_and_add_content (audio);
wait_for_jobs ();
ov->make_dcp ();
vf->set_name ("vf_test3_vf");
vf->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
vf->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
- shared_ptr<DCPContent> dcp (new DCPContent (vf, ov->dir (ov->dcp_name ())));
+ shared_ptr<DCPContent> dcp (new DCPContent(ov->dir(ov->dcp_name())));
BOOST_REQUIRE (dcp);
dcp->set_trim_start (ContentTime::from_seconds (1));
dcp->set_trim_end (ContentTime::from_seconds (1));
shared_ptr<Film> ov = new_test_film ("vf_test4_ov");
ov->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
ov->set_name ("vf_test4_ov");
- shared_ptr<Content> video = content_factory (ov, "test/data/flat_red.png").front();
+ shared_ptr<Content> video = content_factory("test/data/flat_red.png").front();
ov->examine_and_add_content (video);
wait_for_jobs ();
video->video->set_length (24 * 5);
- shared_ptr<Content> audio = content_factory(ov, "test/data/white.wav").front();
+ shared_ptr<Content> audio = content_factory("test/data/white.wav").front();
ov->examine_and_add_content (audio);
wait_for_jobs ();
ov->make_dcp ();
vf->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
vf->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
vf->set_sequence (false);
- shared_ptr<DCPContent> dcp (new DCPContent (vf, ov->dir (ov->dcp_name ())));
+ shared_ptr<DCPContent> dcp (new DCPContent(ov->dir(ov->dcp_name())));
BOOST_REQUIRE (dcp);
vf->examine_and_add_content (dcp);
wait_for_jobs ();
- dcp->set_position(DCPTime::from_seconds(10));
+ dcp->set_position(vf, DCPTime::from_seconds(10));
dcp->set_reference_video (true);
dcp->set_reference_audio (true);
- shared_ptr<Content> more_video = content_factory(vf, "test/data/flat_red.png").front();
+ shared_ptr<Content> more_video = content_factory("test/data/flat_red.png").front();
vf->examine_and_add_content (more_video);
DCPOMATIC_ASSERT (!wait_for_jobs ());
- more_video->set_position (DCPTime ());
+ more_video->set_position (vf, DCPTime());
vf->write_metadata ();
vf->make_dcp ();
DCPOMATIC_ASSERT (!wait_for_jobs ());
doc->read_string (s);
list<string> notes;
- shared_ptr<FFmpegContent> vc (new FFmpegContent (film, doc, 10, notes));
+ shared_ptr<FFmpegContent> vc (new FFmpegContent (doc, 10, notes));
optional<VideoContentScale> sc;
if (ratio) {
film->set_container (Ratio::from_id ("185"));
film->set_name ("video_mxf_content_test");
- shared_ptr<Content> content = content_factory(film, ref_mxf).front();
+ shared_ptr<Content> content = content_factory(ref_mxf).front();
shared_ptr<VideoMXFContent> check = dynamic_pointer_cast<VideoMXFContent> (content);
BOOST_REQUIRE (check);
film->examine_and_add_content (content);