diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-05-10 13:26:55 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-05-18 11:50:29 +0100 |
| commit | 90becb40eb48467b6d31d6939bcfcf39c3c9652c (patch) | |
| tree | ae36f3eb019334ba214160eec52e81ab4c65f014 /src/lib/sndfile_content.cc | |
| parent | cc76b517f6a74f813ae38137bdc88ff3bafa6dd9 (diff) | |
Some allowances for video/audio/subtitle possibly being null.
Diffstat (limited to 'src/lib/sndfile_content.cc')
| -rw-r--r-- | src/lib/sndfile_content.cc | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/lib/sndfile_content.cc b/src/lib/sndfile_content.cc index 7c204e9eb..bf5f3af5b 100644 --- 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->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 ())); } |
