int const AudioContentProperty::GAIN = 201;
int const AudioContentProperty::DELAY = 202;
-AudioContent::AudioContent (Content* parent, shared_ptr<const Film> film)
- : ContentPart (parent, film)
+AudioContent::AudioContent (Content* parent)
+ : ContentPart (parent)
, _gain (0)
, _delay (Config::instance()->default_audio_delay ())
{
}
shared_ptr<AudioContent>
-AudioContent::from_xml (Content* parent, shared_ptr<const Film> film, cxml::ConstNodePtr node)
+AudioContent::from_xml (Content* parent, cxml::ConstNodePtr node)
{
if (!node->optional_number_child<double> ("AudioGain")) {
return shared_ptr<AudioContent> ();
}
- return shared_ptr<AudioContent> (new AudioContent (parent, film, node));
+ return shared_ptr<AudioContent> (new AudioContent (parent, node));
}
-AudioContent::AudioContent (Content* parent, shared_ptr<const Film> film, cxml::ConstNodePtr node)
- : ContentPart (parent, film)
+AudioContent::AudioContent (Content* parent, cxml::ConstNodePtr node)
+ : ContentPart (parent)
{
_gain = node->number_child<double> ("AudioGain");
_delay = node->number_child<int> ("AudioDelay");
}
}
-AudioContent::AudioContent (Content* parent, shared_ptr<const Film> film, vector<shared_ptr<Content> > c)
- : ContentPart (parent, film)
+AudioContent::AudioContent (Content* parent, vector<shared_ptr<Content> > c)
+ : ContentPart (parent)
{
shared_ptr<AudioContent> ref = c[0]->audio;
DCPOMATIC_ASSERT (ref);
/* Resample to a DCI-approved sample rate */
double t = has_rate_above_48k() ? 96000 : 48000;
- shared_ptr<const Film> film = _film.lock ();
- DCPOMATIC_ASSERT (film);
- FrameRateChange frc (_parent->active_video_frame_rate(), film->video_frame_rate());
+ FrameRateChange frc (_parent->active_video_frame_rate(), _parent->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
p.push_back (UserProperty (_("Audio"), _("Content audio frame rate"), stream->frame_rate(), _("Hz")));
}
- shared_ptr<const Film> film = _film.lock ();
- DCPOMATIC_ASSERT (film);
-
- FrameRateChange const frc (_parent->active_video_frame_rate(), film->video_frame_rate());
+ FrameRateChange const frc (_parent->active_video_frame_rate(), _parent->film()->video_frame_rate());
ContentTime const c (_parent->full_length(), frc);
p.push_back (
class AudioContent : public ContentPart
{
public:
- AudioContent (Content* parent, boost::shared_ptr<const Film>);
- AudioContent (Content* parent, boost::shared_ptr<const Film>, std::vector<boost::shared_ptr<Content> >);
+ AudioContent (Content* parent);
+ AudioContent (Content* parent, std::vector<boost::shared_ptr<Content> >);
void as_xml (xmlpp::Node *) const;
std::string technical_summary () const;
void add_properties (std::list<UserProperty> &) const;
- static boost::shared_ptr<AudioContent> from_xml (Content* parent, boost::shared_ptr<const Film>, cxml::ConstNodePtr);
+ static boost::shared_ptr<AudioContent> from_xml (Content* parent, cxml::ConstNodePtr);
private:
- AudioContent (Content* parent, boost::shared_ptr<const Film>, cxml::ConstNodePtr);
+ AudioContent (Content* parent, cxml::ConstNodePtr);
/** Gain to apply to audio in dB */
double _gain;
class ContentPart
{
public:
- ContentPart (Content* parent, boost::shared_ptr<const Film> film)
+ ContentPart (Content* parent)
: _parent (parent)
- , _film (film)
{}
protected:
}
Content* _parent;
- boost::weak_ptr<const Film> _film;
mutable boost::mutex _mutex;
};
, _reference_audio (false)
, _reference_subtitle (false)
{
- video.reset (new VideoContent (this, film));
- audio.reset (new AudioContent (this, film));
+ video.reset (new VideoContent (this));
+ audio.reset (new AudioContent (this));
read_directory (p);
set_default_colour_conversion ();
DCPContent::DCPContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
: Content (film, node)
{
- video = VideoContent::from_xml (this, film, node, version);
- audio = AudioContent::from_xml (this, film, node);
- subtitle = SubtitleContent::from_xml (this, film, node, version);
+ video = VideoContent::from_xml (this, node, version);
+ audio = AudioContent::from_xml (this, node);
+ subtitle = SubtitleContent::from_xml (this, node, version);
audio->set_stream (
AudioStreamPtr (
boost::mutex::scoped_lock lm (_mutex);
_name = examiner->name ();
if (examiner->has_subtitles ()) {
- subtitle.reset (new SubtitleContent (this, film()));
+ subtitle.reset (new SubtitleContent (this));
}
_encrypted = examiner->encrypted ();
_kdm_valid = examiner->kdm_valid ();
DCPSubtitleContent::DCPSubtitleContent (shared_ptr<const Film> film, boost::filesystem::path path)
: Content (film, path)
{
- subtitle.reset (new SubtitleContent (this, film));
+ subtitle.reset (new SubtitleContent (this));
}
DCPSubtitleContent::DCPSubtitleContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
: Content (film, node)
, _length (node->number_child<ContentTime::Type> ("Length"))
{
- subtitle = SubtitleContent::from_xml (this, film, node, version);
+ subtitle = SubtitleContent::from_xml (this, node, version);
}
void
FFmpegContent::FFmpegContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version, list<string>& notes)
: Content (film, node)
{
- video = VideoContent::from_xml (this, film, node, version);
- audio = AudioContent::from_xml (this, film, node);
- subtitle = SubtitleContent::from_xml (this, film, node, version);
+ video = VideoContent::from_xml (this, node, version);
+ audio = AudioContent::from_xml (this, node);
+ subtitle = SubtitleContent::from_xml (this, node, version);
list<cxml::NodePtr> c = node->node_children ("SubtitleStream");
for (list<cxml::NodePtr>::const_iterator i = c.begin(); i != c.end(); ++i) {
FFmpegContent::FFmpegContent (shared_ptr<const Film> film, vector<boost::shared_ptr<Content> > c)
: Content (film, c)
{
- video.reset (new VideoContent (this, film, c));
- audio.reset (new AudioContent (this, film, c));
- subtitle.reset (new SubtitleContent (this, film, c));
+ video.reset (new VideoContent (this, c));
+ audio.reset (new AudioContent (this, c));
+ subtitle.reset (new SubtitleContent (this, c));
shared_ptr<FFmpegContent> ref = dynamic_pointer_cast<FFmpegContent> (c[0]);
DCPOMATIC_ASSERT (ref);
shared_ptr<FFmpegExaminer> examiner (new FFmpegExaminer (shared_from_this (), job));
if (examiner->has_video ()) {
- video.reset (new VideoContent (this, film ()));
+ video.reset (new VideoContent (this));
video->take_from_examiner (examiner);
set_default_colour_conversion ();
}
}
if (!examiner->audio_streams().empty ()) {
- audio.reset (new AudioContent (this, film ()));
+ audio.reset (new AudioContent (this));
BOOST_FOREACH (shared_ptr<FFmpegAudioStream> i, examiner->audio_streams ()) {
audio->add_stream (i);
_subtitle_streams = examiner->subtitle_streams ();
if (!_subtitle_streams.empty ()) {
- subtitle.reset (new SubtitleContent (this, film ()));
+ subtitle.reset (new SubtitleContent (this));
_subtitle_stream = _subtitle_streams.front ();
}
ImageContent::ImageContent (shared_ptr<const Film> film, boost::filesystem::path p)
: Content (film)
{
- video.reset (new VideoContent (this, film));
+ video.reset (new VideoContent (this));
if (boost::filesystem::is_regular_file (p) && valid_image_file (p)) {
_paths.push_back (p);
ImageContent::ImageContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
: Content (film, node)
{
- video = VideoContent::from_xml (this, film, node, version);
+ video = VideoContent::from_xml (this, node, version);
}
string
SndfileContent::SndfileContent (shared_ptr<const Film> film, boost::filesystem::path p)
: Content (film, p)
{
- audio.reset (new AudioContent (this, film));
+ audio.reset (new AudioContent (this));
}
SndfileContent::SndfileContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
: Content (film, node)
{
- audio = AudioContent::from_xml (this, film, node);
+ audio = AudioContent::from_xml (this, node);
if (audio) {
audio->set_stream (
#include "font.h"
#include "raw_convert.h"
#include "content.h"
-#include "film.h"
#include <libcxml/cxml.h>
#include <libxml++/libxml++.h>
#include <boost/foreach.hpp>
int const SubtitleContentProperty::OUTLINE = 509;
int const SubtitleContentProperty::OUTLINE_COLOUR = 510;
-SubtitleContent::SubtitleContent (Content* parent, shared_ptr<const Film> film)
- : ContentPart (parent, film)
+SubtitleContent::SubtitleContent (Content* parent)
+ : ContentPart (parent)
, _use (false)
, _burn (false)
, _x_offset (0)
}
shared_ptr<SubtitleContent>
-SubtitleContent::from_xml (Content* parent, shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
+SubtitleContent::from_xml (Content* parent, cxml::ConstNodePtr node, int version)
{
if (!node->optional_number_child<double>("SubtitleXOffset") && !node->optional_number_child<double>("SubtitleOffset")) {
return shared_ptr<SubtitleContent> ();
}
- return shared_ptr<SubtitleContent> (new SubtitleContent (parent, film, node, version));
+ return shared_ptr<SubtitleContent> (new SubtitleContent (parent, node, version));
}
-SubtitleContent::SubtitleContent (Content* parent, shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
- : ContentPart (parent, film)
+SubtitleContent::SubtitleContent (Content* parent, cxml::ConstNodePtr node, int version)
+ : ContentPart (parent)
, _use (false)
, _burn (false)
, _x_offset (0)
connect_to_fonts ();
}
-SubtitleContent::SubtitleContent (Content* parent, shared_ptr<const Film> film, vector<shared_ptr<Content> > c)
- : ContentPart (parent, film)
+SubtitleContent::SubtitleContent (Content* parent, vector<shared_ptr<Content> > c)
+ : ContentPart (parent)
{
shared_ptr<SubtitleContent> ref = c[0]->subtitle;
DCPOMATIC_ASSERT (ref);
class SubtitleContent : public ContentPart
{
public:
- SubtitleContent (Content* parent, boost::shared_ptr<const Film>);
- SubtitleContent (Content* parent, boost::shared_ptr<const Film>, std::vector<boost::shared_ptr<Content> >);
+ SubtitleContent (Content* parent);
+ SubtitleContent (Content* parent, std::vector<boost::shared_ptr<Content> >);
void as_xml (xmlpp::Node *) const;
std::string identifier () const;
return _outline_colour;
}
- static boost::shared_ptr<SubtitleContent> from_xml (Content* parent, boost::shared_ptr<const Film>, cxml::ConstNodePtr, int version);
+ static boost::shared_ptr<SubtitleContent> from_xml (Content* parent, cxml::ConstNodePtr, int version);
protected:
/** subtitle language (e.g. "German") or empty if it is not known */
private:
friend struct ffmpeg_pts_offset_test;
- SubtitleContent (Content* parent, boost::shared_ptr<const Film>, cxml::ConstNodePtr, int version);
+ SubtitleContent (Content* parent, cxml::ConstNodePtr, int version);
void font_changed ();
void connect_to_fonts ();
TextSubtitleContent::TextSubtitleContent (shared_ptr<const Film> film, boost::filesystem::path path)
: Content (film, path)
{
- subtitle.reset (new SubtitleContent (this, film));
+ subtitle.reset (new SubtitleContent (this));
}
TextSubtitleContent::TextSubtitleContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
: Content (film, node)
, _length (node->number_child<ContentTime::Type> ("Length"))
{
- subtitle = SubtitleContent::from_xml (this, film, node, version);
+ subtitle = SubtitleContent::from_xml (this, node, version);
}
void
#include "i18n.h"
-#define LOG_GENERAL(...) film->log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
+#define LOG_GENERAL(...) _parent->film()->log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
int const VideoContentProperty::SIZE = 0;
int const VideoContentProperty::FRAME_TYPE = 1;
using boost::optional;
using boost::dynamic_pointer_cast;
-VideoContent::VideoContent (Content* parent, shared_ptr<const Film> film)
- : ContentPart (parent, film)
+VideoContent::VideoContent (Content* parent)
+ : ContentPart (parent)
, _length (0)
, _frame_type (VIDEO_FRAME_TYPE_2D)
, _scale (VideoContentScale (Ratio::from_id ("178")))
}
shared_ptr<VideoContent>
-VideoContent::from_xml (Content* parent, shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
+VideoContent::from_xml (Content* parent, cxml::ConstNodePtr node, int version)
{
if (!node->optional_number_child<int> ("VideoWidth")) {
return shared_ptr<VideoContent> ();
}
- return shared_ptr<VideoContent> (new VideoContent (parent, film, node, version));
+ return shared_ptr<VideoContent> (new VideoContent (parent, node, version));
}
-VideoContent::VideoContent (Content* parent, shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
- : ContentPart (parent, film)
+VideoContent::VideoContent (Content* parent, cxml::ConstNodePtr node, int version)
+ : ContentPart (parent)
{
_size.width = node->number_child<int> ("VideoWidth");
_size.height = node->number_child<int> ("VideoHeight");
}
}
-VideoContent::VideoContent (Content* parent, shared_ptr<const Film> film, vector<shared_ptr<Content> > c)
- : ContentPart (parent, film)
+VideoContent::VideoContent (Content* parent, vector<shared_ptr<Content> > c)
+ : ContentPart (parent)
, _length (0)
, _yuv (false)
{
);
}
- shared_ptr<const Film> film = _film.lock ();
- DCPOMATIC_ASSERT (film);
LOG_GENERAL ("Video length obtained from header as %1 frames", _length);
if (d->video_frame_rate()) {
void
VideoContent::scale_and_crop_to_fit_width ()
{
- shared_ptr<const Film> film = _film.lock ();
- DCPOMATIC_ASSERT (film);
+ shared_ptr<const Film> film = _parent->film ();
set_scale (VideoContentScale (film->container ()));
int const crop = max (0, int (size().height - double (film->frame_size().height) * size().width / film->frame_size().width));
void
VideoContent::scale_and_crop_to_fit_height ()
{
- shared_ptr<const Film> film = _film.lock ();
- DCPOMATIC_ASSERT (film);
+ shared_ptr<const Film> film = _parent->film ();
set_scale (VideoContentScale (film->container ()));
int const crop = max (0, int (size().width - double (film->frame_size().width) * size().height / film->frame_size().height));
{
DCPOMATIC_ASSERT (f >= 0);
- shared_ptr<const Film> film = _film.lock ();
- DCPOMATIC_ASSERT (film);
+ shared_ptr<const Film> film = _parent->film ();
double const vfr = _parent->active_video_frame_rate ();
d << " (" << fixed << setprecision(2) << cropped.ratio () << ":1)\n";
}
- shared_ptr<const Film> film = _film.lock ();
- DCPOMATIC_ASSERT (film);
+ 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);
class VideoContent : public ContentPart, public boost::enable_shared_from_this<VideoContent>
{
public:
- VideoContent (Content* parent, boost::shared_ptr<const Film>);
- VideoContent (Content* parent, boost::shared_ptr<const Film>, std::vector<boost::shared_ptr<Content> >);
+ VideoContent (Content* parent);
+ VideoContent (Content* parent, std::vector<boost::shared_ptr<Content> >);
void as_xml (xmlpp::Node *) const;
std::string technical_summary () const;
void take_from_examiner (boost::shared_ptr<VideoExaminer>);
void add_properties (std::list<UserProperty> &) const;
- static boost::shared_ptr<VideoContent> from_xml (Content* parent, boost::shared_ptr<const Film>, cxml::ConstNodePtr, int);
+ static boost::shared_ptr<VideoContent> from_xml (Content* parent, cxml::ConstNodePtr, int);
private:
friend struct best_dcp_frame_rate_test_double;
friend struct audio_sampling_rate_test;
- VideoContent (Content* parent, boost::shared_ptr<const Film>, cxml::ConstNodePtr, int);
+ VideoContent (Content* parent, cxml::ConstNodePtr, int);
void setup_default_colour_conversion ();
Frame _length;
TestAudioContent (shared_ptr<const Film> film)
: Content (film)
{
- audio.reset (new AudioContent (this, film));
+ audio.reset (new AudioContent (this));
audio->set_stream (AudioStreamPtr (new AudioStream (48000, audio_length(), 2)));
}
-Subproject commit f70fddede90fdb87ff8ee2339f208d2658c665aa
+Subproject commit caafd158432719c233e4a6c255f32b78c1c545a2
film->examine_and_add_content (content);
wait_for_jobs ();
- content->audio.reset (new AudioContent (content.get(), film));
+ content->audio.reset (new AudioContent (content.get()));
content->audio->add_stream (shared_ptr<FFmpegAudioStream> (new FFmpegAudioStream));
content->_video_frame_rate = 24;