Extract common code out into kdm_for_screen()
[dcpomatic.git] / src / lib / types.cc
index a0095cedfdf1e96bdba7f22fd4e86a0b36943ca2..9519b309729db5ed323ccdd7bcd8ef0ad93a9d1d 100644 (file)
@@ -35,6 +35,7 @@
 using std::max;
 using std::min;
 using std::string;
+using std::list;
 using boost::shared_ptr;
 using dcp::raw_convert;
 
@@ -193,7 +194,11 @@ CPLSummary::CPLSummary (boost::filesystem::path p)
        : dcp_directory (p.leaf().string())
 {
        dcp::DCP dcp (p);
-       dcp.read ();
+       list<dcp::VerificationNote> notes;
+       dcp.read (&notes);
+       if (!notes.empty()) {
+               throw dcp::ReadError(dcp::note_to_string(notes.front()));
+       }
 
        cpl_id = dcp.cpls().front()->id();
        cpl_annotation_text = dcp.cpls().front()->annotation_text();
@@ -201,9 +206,8 @@ CPLSummary::CPLSummary (boost::filesystem::path p)
 
        encrypted = false;
        BOOST_FOREACH (shared_ptr<dcp::CPL> j, dcp.cpls()) {
-               BOOST_FOREACH (shared_ptr<const dcp::ReelAsset> k, j->reel_assets()) {
-                       shared_ptr<const dcp::ReelMXF> mxf = boost::dynamic_pointer_cast<const dcp::ReelMXF> (k);
-                       if (mxf && mxf->key_id()) {
+               BOOST_FOREACH (shared_ptr<const dcp::ReelMXF> k, j->reel_mxfs()) {
+                       if (k->key_id()) {
                                encrypted = true;
                        }
                }