projects
/
dcpomatic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
cc76b51
)
Some allowances for video/audio/subtitle possibly being null.
author
Carl Hetherington
<cth@carlh.net>
Tue, 10 May 2016 12:26:55 +0000
(13:26 +0100)
committer
Carl Hetherington
<cth@carlh.net>
Wed, 18 May 2016 10:50:29 +0000
(11:50 +0100)
src/lib/dcp_content.cc
patch
|
blob
|
history
src/lib/dcp_subtitle_content.cc
patch
|
blob
|
history
src/lib/ffmpeg_content.cc
patch
|
blob
|
history
src/lib/image_content.cc
patch
|
blob
|
history
src/lib/sndfile_content.cc
patch
|
blob
|
history
src/lib/text_subtitle_content.cc
patch
|
blob
|
history
diff --git
a/src/lib/dcp_content.cc
b/src/lib/dcp_content.cc
index 2cd7e576f2f63d4f7fa27e1b85e45fd192bcae0b..dbd9bca8d4cd2fb9d3b87962ab12fcc9b039b772 100644
(file)
--- a/
src/lib/dcp_content.cc
+++ b/
src/lib/dcp_content.cc
@@
-166,10
+166,17
@@
DCPContent::as_xml (xmlpp::Node* node) const
node->add_child("Type")->add_child_text ("DCP");
Content::as_xml (node);
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);
}
if (subtitle) {
subtitle->as_xml (node);
}
diff --git
a/src/lib/dcp_subtitle_content.cc
b/src/lib/dcp_subtitle_content.cc
index 0702237f371a39f618e2e2bc99b8df94712104a6..a806c9cbd764125bf56ba72f7ecf34f0fd7dc3e4 100644
(file)
--- a/
src/lib/dcp_subtitle_content.cc
+++ b/
src/lib/dcp_subtitle_content.cc
@@
-101,6
+101,10
@@
DCPSubtitleContent::as_xml (xmlpp::Node* node) const
{
node->add_child("Type")->add_child_text ("DCPSubtitle");
Content::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("Length")->add_child_text (raw_convert<string> (_length.get ()));
}
diff --git
a/src/lib/ffmpeg_content.cc
b/src/lib/ffmpeg_content.cc
index a8206b13e05cdf0fa1ee7415027b714825a51f83..a0bf88c2513a077870d9c7e84b42b29940f7b253 100644
(file)
--- a/
src/lib/ffmpeg_content.cc
+++ b/
src/lib/ffmpeg_content.cc
@@
-156,9
+156,18
@@
FFmpegContent::as_xml (xmlpp::Node* node) const
{
node->add_child("Type")->add_child_text ("FFmpeg");
Content::as_xml (node);
{
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);
boost::mutex::scoped_lock lm (_mutex);
diff --git
a/src/lib/image_content.cc
b/src/lib/image_content.cc
index 15c20d8741b1ca4004c8b12600560762831d4f96..ef82b3779d29d60b4a2231fb2e4f0ab200e88857 100644
(file)
--- a/
src/lib/image_content.cc
+++ b/
src/lib/image_content.cc
@@
-103,7
+103,10
@@
ImageContent::as_xml (xmlpp::Node* node) const
{
node->add_child("Type")->add_child_text ("Image");
Content::as_xml (node);
{
node->add_child("Type")->add_child_text ("Image");
Content::as_xml (node);
- video->as_xml (node);
+
+ if (video) {
+ video->as_xml (node);
+ }
}
void
}
void
diff --git
a/src/lib/sndfile_content.cc
b/src/lib/sndfile_content.cc
index 7c204e9eb125a486691f66abd4e600d71d46c5bd..bf5f3af5bbd22775b0a2ef4a9134ae6bfaf2a031 100644
(file)
--- a/
src/lib/sndfile_content.cc
+++ b/
src/lib/sndfile_content.cc
@@
-49,20
+49,28
@@
SndfileContent::SndfileContent (shared_ptr<const Film> film, cxml::ConstNodePtr
, _audio_length (node->number_child<Frame> ("AudioLength"))
{
audio = AudioContent::from_xml (this, film, node);
, _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");
}
void
SndfileContent::as_xml (xmlpp::Node* node) const
{
node->add_child("Type")->add_child_text ("Sndfile");
+
Content::as_xml (node);
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("AudioLength")->add_child_text (raw_convert<string> (audio_length ()));
}
diff --git
a/src/lib/text_subtitle_content.cc
b/src/lib/text_subtitle_content.cc
index 74e785ff7cc104b8cb7185ed0b4d80070a415ec3..4fdd690c370af4ad0f53aa3e46246ce96c998829 100644
(file)
--- a/
src/lib/text_subtitle_content.cc
+++ b/
src/lib/text_subtitle_content.cc
@@
-79,7
+79,11
@@
TextSubtitleContent::as_xml (xmlpp::Node* node) const
{
node->add_child("Type")->add_child_text ("TextSubtitle");
Content::as_xml (node);
{
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 ()));
}
node->add_child("Length")->add_child_text (raw_convert<string> (_length.get ()));
}