Merge master.
[dcpomatic.git] / src / lib / film.cc
index 577c29e3a55afeb8a7c85e29883c2bf7c30bcff6..26810992175d8da91065dfc4052d7da424afa0a2 100644 (file)
@@ -92,6 +92,8 @@ using dcp::raw_convert;
  * Use <Scale> tag in <VideoContent> rather than <Ratio>.
  * 8 -> 9
  * DCI -> ISDCF
+ * 9 -> 10
+ * Subtitle X and Y scale.
  *
  * Bumped to 32 for 2.0 branch; some times are expressed in Times rather
  * than frames now.
@@ -591,18 +593,22 @@ Film::isdcf_name (bool if_created_now) const
                d << "_" << container()->isdcf_name();
        }
 
-       /* XXX: this only works for content which has been scaled to a given ratio,
-          and uses the first bit of content only.
-       */
+       /* XXX: this uses the first bit of content only */
 
        /* The standard says we don't do this for trailers, for some strange reason */
        if (dcp_content_type() && dcp_content_type()->libdcp_kind() != dcp::TRAILER) {
                ContentList cl = content ();
                Ratio const * content_ratio = 0;
-               for (ContentList::const_iterator i = cl.begin(); i != cl.end(); ++i) {
+               for (ContentList::iterator i = cl.begin(); i != cl.end(); ++i) {
                        shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> (*i);
-                       if (vc && (content_ratio == 0 || vc->scale().ratio() != content_ratio)) {
-                               content_ratio = vc->scale().ratio();
+                       if (vc) {
+                               /* Here's the first piece of video content */
+                               if (vc->scale().ratio ()) {
+                                       content_ratio = vc->scale().ratio ();
+                               } else {
+                                       content_ratio = Ratio::from_ratio (vc->video_size().ratio ());
+                               }
+                               break;
                        }
                }