, _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.reset (new VideoContent (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.reset (new AudioContent (this, film, node));
audio->set_stream (
AudioStreamPtr (
- new AudioStream (node->number_child<int> ("AudioFrameRate"), AudioMapping (node->node_child ("AudioMapping"), version))
+ new AudioStream (
+ node->number_child<int> ("AudioFrameRate"),
+ node->number_child<Frame> ("AudioLength"),
+ AudioMapping (node->node_child ("AudioMapping"), version)
+ )
)
);
_name = node->string_child ("Name");
- if (node->bool_child ("HasSubtitles")) {
- subtitle.reset (new SubtitleContent (this, film, node, version));
- }
-
_encrypted = node->bool_child ("Encrypted");
if (node->optional_node_child ("KDM")) {
_kdm = dcp::EncryptedKDM (node->string_child ("KDM"));
{
boost::mutex::scoped_lock lm (_mutex);
- AudioStreamPtr as (new AudioStream (examiner->audio_frame_rate(), examiner->audio_channels ()));
+ 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);
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 ();
node->add_child("Type")->add_child_text ("DCP");
Content::as_xml (node);
- video->as_xml (node);
- audio->as_xml (node);
- node->add_child("AudioFrameRate")->add_child_text (raw_convert<string> (audio->stream()->frame_rate()));
- audio->stream()->mapping().as_xml (node->add_child("AudioMapping"));
+
+ if (video) {
+ video->as_xml (node);
+ }
+
+ if (audio) {
+ audio->as_xml (node);
+ node->add_child("AudioFrameRate")->add_child_text (raw_convert<string> (audio->stream()->frame_rate()));
+ node->add_child("AudioLength")->add_child_text (raw_convert<string> (audio->stream()->length()));
+ audio->stream()->mapping().as_xml (node->add_child("AudioMapping"));
+ }
+
if (subtitle) {
subtitle->as_xml (node);
}
boost::mutex::scoped_lock lm (_mutex);
node->add_child("Name")->add_child_text (_name);
- node->add_child("HasSubtitles")->add_child_text (subtitle ? "1" : "0");
node->add_child("Encrypted")->add_child_text (_encrypted ? "1" : "0");
if (_kdm) {
node->add_child("KDM")->add_child_text (_kdm->as_xml ());
DCPTime
DCPContent::full_length () const
{
- FrameRateChange const frc (video->frame_rate (), film()->video_frame_rate ());
+ FrameRateChange const frc (active_video_frame_rate (), film()->video_frame_rate ());
return DCPTime::from_frames (llrint (video->length () * frc.factor ()), film()->video_frame_rate ());
}
/* XXX: this needs to be fixed */
return true;
}
-
-void
-DCPContent::changed (int property)
-{
- if (property == VideoContentProperty::FRAME_RATE && subtitle) {
- subtitle->set_video_frame_rate (video->frame_rate ());
- }
-}