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()));
+ audio->stream()->mapping().as_xml (node->add_child("AudioMapping"));
+ }
+
if (subtitle) {
subtitle->as_xml (node);
}
{
node->add_child("Type")->add_child_text ("DCPSubtitle");
Content::as_xml (node);
- subtitle->as_xml (node);
+
+ if (subtitle) {
+ subtitle->as_xml (node);
+ }
+
node->add_child("Length")->add_child_text (raw_convert<string> (_length.get ()));
}
{
node->add_child("Type")->add_child_text ("FFmpeg");
Content::as_xml (node);
- video->as_xml (node);
- audio->as_xml (node);
- subtitle->as_xml (node);
+
+ if (video) {
+ video->as_xml (node);
+ }
+
+ if (audio) {
+ audio->as_xml (node);
+ }
+
+ if (subtitle) {
+ subtitle->as_xml (node);
+ }
boost::mutex::scoped_lock lm (_mutex);
{
node->add_child("Type")->add_child_text ("Image");
Content::as_xml (node);
- video->as_xml (node);
+
+ if (video) {
+ video->as_xml (node);
+ }
}
void
, _audio_length (node->number_child<Frame> ("AudioLength"))
{
audio = AudioContent::from_xml (this, film, node);
- audio->set_stream (
- AudioStreamPtr (
- new AudioStream (node->number_child<int> ("AudioFrameRate"), AudioMapping (node->node_child ("AudioMapping"), version)))
- );
+
+ if (audio) {
+ audio->set_stream (
+ AudioStreamPtr (
+ new AudioStream (node->number_child<int> ("AudioFrameRate"), AudioMapping (node->node_child ("AudioMapping"), version)))
+ );
+ }
}
void
SndfileContent::as_xml (xmlpp::Node* node) const
{
node->add_child("Type")->add_child_text ("Sndfile");
+
Content::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 (audio) {
+ 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"));
+ }
+
node->add_child("AudioLength")->add_child_text (raw_convert<string> (audio_length ()));
}
{
node->add_child("Type")->add_child_text ("TextSubtitle");
Content::as_xml (node);
- subtitle->as_xml (node);
+
+ if (subtitle) {
+ subtitle->as_xml (node);
+ }
+
node->add_child("Length")->add_child_text (raw_convert<string> (_length.get ()));
}