Accept missing MainSoundConfiguration and MainSoundSampleRate, for better or for...
authorCarl Hetherington <cth@carlh.net>
Thu, 3 Sep 2020 10:06:49 +0000 (12:06 +0200)
committerCarl Hetherington <cth@carlh.net>
Sun, 20 Sep 2020 17:32:42 +0000 (19:32 +0200)
src/cpl.cc

index 8285f87e6fa18f829bb4614e7c0472997e8583fb..494f53bed07a2688ae9179c8555609faf15086e1 100644 (file)
@@ -247,13 +247,15 @@ CPL::read_composition_metadata_asset (cxml::ConstNodePtr node)
                _luminance = Luminance (lum);
        }
 
-       _main_sound_configuration = node->string_child("MainSoundConfiguration");
+       _main_sound_configuration = node->optional_string_child("MainSoundConfiguration");
 
-       string sr = node->string_child("MainSoundSampleRate");
-       vector<string> sr_bits;
-       boost::split (sr_bits, sr, boost::is_any_of(" "));
-       DCP_ASSERT (sr_bits.size() == 2);
-       _main_sound_sample_rate = raw_convert<int>(sr_bits[0]);
+       optional<string> sr = node->optional_string_child("MainSoundSampleRate");
+       if (sr) {
+               vector<string> sr_bits;
+               boost::split (sr_bits, *sr, boost::is_any_of(" "));
+               DCP_ASSERT (sr_bits.size() == 2);
+               _main_sound_sample_rate = raw_convert<int>(sr_bits[0]);
+       }
 
        _main_picture_stored_area = dcp::Size (
                node->node_child("MainPictureStoredArea")->number_child<int>("Width"),