summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-05-31 00:25:25 +0200
committerCarl Hetherington <cth@carlh.net>2021-05-31 00:25:25 +0200
commit5b27212aa670a5555b64d2123bb70673987564b4 (patch)
tree2092ef20424d9d8ba125df956b4295a8de5e8d6b /src/lib
parent7efb39f90c0e70d779fb5f19290851f366f01315 (diff)
Allow any ratio to appear in the ISDCF name as an interior aspect ratio (#2030).
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/film.cc18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc
index 0b717738d..62cbf0e50 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -911,19 +911,15 @@ Film::isdcf_name (bool if_created_now) const
/* Interior aspect ratio. The standard says we don't do this for trailers, for some strange reason */
if (dcp_content_type() && dcp_content_type()->libdcp_kind() != dcp::ContentKind::TRAILER) {
- Ratio const* content_ratio = nullptr;
- for (auto i: content ()) {
- if (i->video) {
- /* Here's the first piece of video content */
- content_ratio = Ratio::nearest_from_ratio(i->video->scaled_size(frame_size()).ratio());
- break;
+ auto cl = content();
+ auto first_video = std::find_if(cl.begin(), cl.end(), [](shared_ptr<Content> c) { return static_cast<bool>(c->video); });
+ if (first_video != cl.end()) {
+ auto first_ratio = lrintf((*first_video)->video->scaled_size(frame_size()).ratio() * 100);
+ auto container_ratio = lrintf(container()->ratio() * 100);
+ if (first_ratio != container_ratio) {
+ d += "-" + dcp::raw_convert<string>(first_ratio);
}
}
-
- if (content_ratio && content_ratio != container()) {
- /* This needs to be the numeric version of the ratio, and ::id() is close enough */
- d += "-" + content_ratio->id();
- }
}
auto audio_langs = audio_languages();