diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-06-02 21:14:24 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-06-02 21:14:24 +0100 |
| commit | ca436a8e96e02f982790d4168ac3dfe1d589451c (patch) | |
| tree | 6f3ee681e03c2633b48fedb3e11b5ce2fadbaa06 /src/lib/audio_content.cc | |
| parent | 6f68971e81a9b16973b3784f2f3f93f42ceb2af1 (diff) | |
Fix crash when loading old state files.
Diffstat (limited to 'src/lib/audio_content.cc')
| -rw-r--r-- | src/lib/audio_content.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/lib/audio_content.cc b/src/lib/audio_content.cc index 2b402991c..7a4ca63a9 100644 --- a/src/lib/audio_content.cc +++ b/src/lib/audio_content.cc @@ -58,8 +58,19 @@ AudioContent::AudioContent (Content* parent) } shared_ptr<AudioContent> -AudioContent::from_xml (Content* parent, cxml::ConstNodePtr node) +AudioContent::from_xml (Content* parent, cxml::ConstNodePtr node, int version) { + if (version < 34) { + /* With old metadata FFmpeg content has the audio-related tags even with no + audio streams, so check for that. + */ + if (node->string_child("Type") == "FFmpeg" && node->node_children("AudioStream").empty()) { + return shared_ptr<AudioContent> (); + } + + /* Otherwise we can drop through to the newer logic */ + } + if (!node->optional_number_child<double> ("AudioGain")) { return shared_ptr<AudioContent> (); } |
