Extract dcpomatic::film::is_vf().
authorCarl Hetherington <cth@carlh.net>
Tue, 14 Jan 2025 09:51:04 +0000 (10:51 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 14 Jan 2025 22:51:12 +0000 (23:51 +0100)
src/lib/film.cc
src/lib/film_util.cc
src/lib/film_util.h

index 6c5aa0cbbd46806a78e787ec4050bd8bca2c0909..e2df95e32c03427037d54a6680de8973ee2f6452 100644 (file)
@@ -46,6 +46,7 @@
 #include "ffmpeg_subtitle_stream.h"
 #include "file_log.h"
 #include "film.h"
+#include "film_util.h"
 #include "font.h"
 #include "job.h"
 #include "job_manager.h"
@@ -1108,25 +1109,7 @@ Film::isdcf_name (bool if_created_now) const
                isdcf_name += "-3D";
        }
 
-       auto vf = false;
-       for (auto content: content_list) {
-               auto dcp = dynamic_pointer_cast<const DCPContent>(content);
-               if (!dcp) {
-                       continue;
-               }
-
-               bool any_text = false;
-               for (int i = 0; i < static_cast<int>(TextType::COUNT); ++i) {
-                       if (dcp->reference_text(static_cast<TextType>(i))) {
-                               any_text = true;
-                       }
-               }
-               if (dcp->reference_video() || dcp->reference_audio() || any_text) {
-                       vf = true;
-               }
-       }
-
-       if (vf) {
+       if (dcpomatic::film::is_vf(shared_from_this())) {
                isdcf_name += "_VF";
        } else {
                isdcf_name += "_OV";
index e5bc30db48d65b429e65eac9b5f64716db30628a..13068e91d460be7c2c18fb14fc99dc27e870d921 100644 (file)
 
 
 #include "config.h"
+#include "content.h"
+#include "dcp_content.h"
 #include "film.h"
 #include "film_util.h"
 
 
+using std::dynamic_pointer_cast;
 using std::shared_ptr;
 using boost::optional;
 
@@ -45,3 +48,28 @@ dcpomatic::film::add_files_override_path(shared_ptr<const Film> film)
                : boost::optional<boost::filesystem::path>();
 
 }
+
+
+bool
+dcpomatic::film::is_vf(shared_ptr<const Film> film)
+{
+       for (auto content: film->content()) {
+               auto dcp = dynamic_pointer_cast<const DCPContent>(content);
+               if (!dcp) {
+                       continue;
+               }
+
+               bool any_text = false;
+               for (int i = 0; i < static_cast<int>(TextType::COUNT); ++i) {
+                       if (dcp->reference_text(static_cast<TextType>(i))) {
+                               any_text = true;
+                       }
+               }
+               if (dcp->reference_video() || dcp->reference_audio() || any_text) {
+                       return true;
+               }
+       }
+
+       return false;
+}
+
index 958c2c3cc8ca405ef39f33d832ec9cf42ff60dec..50fbf22bda7d6d3bc9522fcec0249e27d0fa5e6a 100644 (file)
@@ -33,6 +33,7 @@ namespace film
 
 bool channel_is_mapped(std::shared_ptr<const Film> film, dcp::Channel channel);
 boost::optional<boost::filesystem::path> add_files_override_path(std::shared_ptr<const Film> film);
+bool is_vf(std::shared_ptr<const Film> film);
 
 
 }