2016-06-02 Carl Hetherington <cth@carlh.net>
+ * Fix crash when loading projects from pre-2.8.5.
+
* Fix broken content properties under translation.
* Version 2.8.7 released.
}
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> ();
}
void add_properties (std::list<UserProperty> &) const;
- static boost::shared_ptr<AudioContent> from_xml (Content* parent, cxml::ConstNodePtr);
+ static boost::shared_ptr<AudioContent> from_xml (Content* parent, cxml::ConstNodePtr, int version);
private:
: Content (film, node)
{
video = VideoContent::from_xml (this, node, version);
- audio = AudioContent::from_xml (this, node);
+ audio = AudioContent::from_xml (this, node, version);
subtitle = SubtitleContent::from_xml (this, node, version);
audio->set_stream (
: Content (film, node)
{
video = VideoContent::from_xml (this, node, version);
- audio = AudioContent::from_xml (this, node);
+ audio = AudioContent::from_xml (this, node, version);
subtitle = SubtitleContent::from_xml (this, node, version);
list<cxml::NodePtr> c = node->node_children ("SubtitleStream");
*
* 32 -> 33
* Changed <Period> to <Subtitle> in FFmpegSubtitleStream
+ * 33 -> 34
+ * Content only contains audio/subtitle-related tags if those things
+ * are present.
*/
-int const Film::current_state_version = 33;
+int const Film::current_state_version = 34;
/** Construct a Film object in a given directory.
*
shared_ptr<SubtitleContent>
SubtitleContent::from_xml (Content* parent, cxml::ConstNodePtr node, int version)
{
+ if (version < 34) {
+ /* With old metadata FFmpeg content has the subtitle-related tags even with no
+ subtitle streams, so check for that.
+ */
+ if (node->string_child("Type") == "FFmpeg" && node->node_children("SubtitleStream").empty()) {
+ return shared_ptr<SubtitleContent> ();
+ }
+
+ /* Otherwise we can drop through to the newer logic */
+ }
+
if (!node->optional_number_child<double>("SubtitleXOffset") && !node->optional_number_child<double>("SubtitleOffset")) {
return shared_ptr<SubtitleContent> ();
}