2 Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 * @brief A representation of some audio and video content, and details of
22 * how they should be presented in a DCP.
28 #include "job_manager.h"
29 #include "transcode_job.h"
30 #include "scp_dcp_job.h"
32 #include "exceptions.h"
33 #include "examine_content_job.h"
35 #include "ui_signaller.h"
38 #include "dcp_content_type.h"
42 #include "safe_stringstream.h"
43 #include "environment_info.h"
44 #include <libcxml/cxml.h>
46 #include <dcp/signer.h>
48 #include <dcp/local_time.h>
49 #include <dcp/raw_convert.h>
50 #include <dcp/decrypted_kdm.h>
51 #include <libxml++/libxml++.h>
52 #include <boost/filesystem.hpp>
53 #include <boost/algorithm/string.hpp>
54 #include <boost/lexical_cast.hpp>
55 #include <boost/foreach.hpp>
79 using boost::shared_ptr;
80 using boost::weak_ptr;
81 using boost::dynamic_pointer_cast;
82 using boost::to_upper_copy;
83 using boost::ends_with;
84 using boost::starts_with;
85 using boost::optional;
86 using boost::is_any_of;
89 using dcp::raw_convert;
90 using dcp::raw_convert;
92 #define LOG_GENERAL(...) log()->log (String::compose (__VA_ARGS__), Log::TYPE_GENERAL);
93 #define LOG_GENERAL_NC(...) log()->log (__VA_ARGS__, Log::TYPE_GENERAL);
96 * AudioMapping XML changed.
98 * Subtitle offset changed to subtitle y offset, and subtitle x offset added.
100 * Use <Scale> tag in <VideoContent> rather than <Ratio>.
104 * Subtitle X and Y scale.
106 * Bumped to 32 for 2.0 branch; some times are expressed in Times rather
109 int const Film::current_state_version = 32;
111 /** Construct a Film object in a given directory.
113 * @param dir Film directory.
116 Film::Film (boost::filesystem::path dir, bool log)
117 : _playlist (new Playlist)
118 , _use_isdcf_name (true)
119 , _dcp_content_type (Config::instance()->default_dcp_content_type ())
120 , _container (Config::instance()->default_container ())
121 , _resolution (RESOLUTION_2K)
124 , _j2k_bandwidth (Config::instance()->default_j2k_bandwidth ())
125 , _isdcf_metadata (Config::instance()->default_isdcf_metadata ())
126 , _video_frame_rate (24)
127 , _audio_channels (6)
129 , _sequence_video (true)
131 , _burn_subtitles (false)
132 , _state_version (current_state_version)
135 set_isdcf_date_today ();
137 _playlist_changed_connection = _playlist->Changed.connect (bind (&Film::playlist_changed, this));
138 _playlist_content_changed_connection = _playlist->ContentChanged.connect (bind (&Film::playlist_content_changed, this, _1, _2));
140 /* Make state.directory a complete path without ..s (where possible)
141 (Code swiped from Adam Bowen on stackoverflow)
144 boost::filesystem::path p (boost::filesystem::system_complete (dir));
145 boost::filesystem::path result;
146 for (boost::filesystem::path::iterator i = p.begin(); i != p.end(); ++i) {
148 if (boost::filesystem::is_symlink (result) || result.filename() == "..") {
151 result = result.parent_path ();
153 } else if (*i != ".") {
158 set_directory (result.make_preferred ());
160 _log.reset (new FileLog (file ("log")));
162 _log.reset (new NullLog);
165 _playlist->set_sequence_video (_sequence_video);
170 for (list<boost::signals2::connection>::const_iterator i = _job_connections.begin(); i != _job_connections.end(); ++i) {
176 Film::video_identifier () const
178 DCPOMATIC_ASSERT (container ());
181 s.imbue (std::locale::classic ());
183 s << container()->id()
184 << "_" << resolution_to_string (_resolution)
185 << "_" << _playlist->video_identifier()
186 << "_" << _video_frame_rate
187 << "_" << j2k_bandwidth();
201 if (_burn_subtitles) {
212 /** @return The path to the directory to write video frame info files to */
213 boost::filesystem::path
214 Film::info_dir () const
216 boost::filesystem::path p;
218 p /= video_identifier ();
222 boost::filesystem::path
223 Film::internal_video_mxf_dir () const
225 return dir ("video");
228 boost::filesystem::path
229 Film::internal_video_mxf_filename () const
231 return video_identifier() + ".mxf";
234 boost::filesystem::path
235 Film::video_mxf_filename () const
237 return filename_safe_name() + "_video.mxf";
240 boost::filesystem::path
241 Film::audio_mxf_filename () const
243 return filename_safe_name() + "_audio.mxf";
246 boost::filesystem::path
247 Film::subtitle_xml_filename () const
249 return filename_safe_name() + "_subtitle.xml";
253 Film::filename_safe_name () const
255 string const n = name ();
257 for (size_t i = 0; i < n.length(); ++i) {
258 if (isalnum (n[i])) {
268 boost::filesystem::path
269 Film::audio_analysis_dir () const
271 return dir ("analysis");
274 /** Add suitable Jobs to the JobManager to create a DCP for this Film */
278 set_isdcf_date_today ();
280 if (dcp_name().find ("/") != string::npos) {
281 throw BadSettingError (_("name"), _("cannot contain slashes"));
284 environment_info (log ());
286 ContentList cl = content ();
287 for (ContentList::const_iterator i = cl.begin(); i != cl.end(); ++i) {
288 LOG_GENERAL ("Content: %1", (*i)->technical_summary());
290 LOG_GENERAL ("DCP video rate %1 fps", video_frame_rate());
291 LOG_GENERAL ("%1 threads", Config::instance()->num_local_encoding_threads());
292 LOG_GENERAL ("J2K bandwidth %1", j2k_bandwidth());
294 if (container() == 0) {
295 throw MissingSettingError (_("container"));
298 if (content().empty()) {
299 throw StringError (_("You must add some content to the DCP before creating it"));
302 if (dcp_content_type() == 0) {
303 throw MissingSettingError (_("content type"));
306 if (name().empty()) {
307 throw MissingSettingError (_("name"));
310 JobManager::instance()->add (shared_ptr<Job> (new TranscodeJob (shared_from_this())));
313 /** Start a job to send our DCP to the configured TMS */
315 Film::send_dcp_to_tms ()
317 shared_ptr<Job> j (new SCPDCPJob (shared_from_this()));
318 JobManager::instance()->add (j);
321 /** Count the number of frames that have been encoded for this film.
322 * @return frame count.
325 Film::encoded_frames () const
327 if (container() == 0) {
332 for (boost::filesystem::directory_iterator i = boost::filesystem::directory_iterator (info_dir ()); i != boost::filesystem::directory_iterator(); ++i) {
334 boost::this_thread::interruption_point ();
340 shared_ptr<xmlpp::Document>
341 Film::metadata () const
343 shared_ptr<xmlpp::Document> doc (new xmlpp::Document);
344 xmlpp::Element* root = doc->create_root_node ("Metadata");
346 root->add_child("Version")->add_child_text (raw_convert<string> (current_state_version));
347 root->add_child("Name")->add_child_text (_name);
348 root->add_child("UseISDCFName")->add_child_text (_use_isdcf_name ? "1" : "0");
350 if (_dcp_content_type) {
351 root->add_child("DCPContentType")->add_child_text (_dcp_content_type->isdcf_name ());
355 root->add_child("Container")->add_child_text (_container->id ());
358 root->add_child("Resolution")->add_child_text (resolution_to_string (_resolution));
359 root->add_child("J2KBandwidth")->add_child_text (raw_convert<string> (_j2k_bandwidth));
360 _isdcf_metadata.as_xml (root->add_child ("ISDCFMetadata"));
361 root->add_child("VideoFrameRate")->add_child_text (raw_convert<string> (_video_frame_rate));
362 root->add_child("ISDCFDate")->add_child_text (boost::gregorian::to_iso_string (_isdcf_date));
363 root->add_child("AudioChannels")->add_child_text (raw_convert<string> (_audio_channels));
364 root->add_child("ThreeD")->add_child_text (_three_d ? "1" : "0");
365 root->add_child("SequenceVideo")->add_child_text (_sequence_video ? "1" : "0");
366 root->add_child("Interop")->add_child_text (_interop ? "1" : "0");
367 root->add_child("BurnSubtitles")->add_child_text (_burn_subtitles ? "1" : "0");
368 root->add_child("Signed")->add_child_text (_signed ? "1" : "0");
369 root->add_child("Encrypted")->add_child_text (_encrypted ? "1" : "0");
370 root->add_child("Key")->add_child_text (_key.hex ());
371 _playlist->as_xml (root->add_child ("Playlist"));
376 /** Write state to our `metadata' file */
378 Film::write_metadata () const
380 boost::filesystem::create_directories (directory ());
381 shared_ptr<xmlpp::Document> doc = metadata ();
382 doc->write_to_file_formatted (file("metadata.xml").string ());
386 /** Read state from our metadata file.
387 * @return Notes about things that the user should know about, or empty.
390 Film::read_metadata ()
392 if (boost::filesystem::exists (file ("metadata")) && !boost::filesystem::exists (file ("metadata.xml"))) {
393 throw StringError (_("This film was created with an older version of DCP-o-matic, and unfortunately it cannot be loaded into this version. You will need to create a new Film, re-add your content and set it up again. Sorry!"));
396 cxml::Document f ("Metadata");
397 f.read_file (file ("metadata.xml"));
399 _state_version = f.number_child<int> ("Version");
400 if (_state_version > current_state_version) {
401 throw StringError (_("This film was created with a newer version of DCP-o-matic, and it cannot be loaded into this version. Sorry!"));
404 _name = f.string_child ("Name");
405 if (_state_version >= 9) {
406 _use_isdcf_name = f.bool_child ("UseISDCFName");
407 _isdcf_metadata = ISDCFMetadata (f.node_child ("ISDCFMetadata"));
408 _isdcf_date = boost::gregorian::from_undelimited_string (f.string_child ("ISDCFDate"));
410 _use_isdcf_name = f.bool_child ("UseDCIName");
411 _isdcf_metadata = ISDCFMetadata (f.node_child ("DCIMetadata"));
412 _isdcf_date = boost::gregorian::from_undelimited_string (f.string_child ("DCIDate"));
416 optional<string> c = f.optional_string_child ("DCPContentType");
418 _dcp_content_type = DCPContentType::from_isdcf_name (c.get ());
423 optional<string> c = f.optional_string_child ("Container");
425 _container = Ratio::from_id (c.get ());
429 _resolution = string_to_resolution (f.string_child ("Resolution"));
430 _j2k_bandwidth = f.number_child<int> ("J2KBandwidth");
431 _video_frame_rate = f.number_child<int> ("VideoFrameRate");
432 _signed = f.optional_bool_child("Signed").get_value_or (true);
433 _encrypted = f.bool_child ("Encrypted");
434 _audio_channels = f.number_child<int> ("AudioChannels");
435 /* We used to allow odd numbers (and zero) channels, but it's just not worth
438 if (_audio_channels == 0) {
440 } else if ((_audio_channels % 2) == 1) {
443 _sequence_video = f.bool_child ("SequenceVideo");
444 _three_d = f.bool_child ("ThreeD");
445 _interop = f.bool_child ("Interop");
446 if (_state_version >= 32) {
447 _burn_subtitles = f.bool_child ("BurnSubtitles");
449 _key = dcp::Key (f.string_child ("Key"));
452 /* This method is the only one that can return notes (so far) */
453 _playlist->set_from_xml (shared_from_this(), f.node_child ("Playlist"), _state_version, notes);
455 /* Write backtraces to this film's directory, until another film is loaded */
456 set_backtrace_file (file ("backtrace.txt"));
462 /** Given a directory name, return its full path within the Film's directory.
463 * The directory (and its parents) will be created if they do not exist.
465 boost::filesystem::path
466 Film::dir (boost::filesystem::path d) const
468 boost::filesystem::path p;
472 boost::filesystem::create_directories (p);
477 /** Given a file or directory name, return its full path within the Film's directory.
478 * Any required parent directories will be created.
480 boost::filesystem::path
481 Film::file (boost::filesystem::path f) const
483 boost::filesystem::path p;
487 boost::filesystem::create_directories (p.parent_path ());
492 /** @return a ISDCF-compliant name for a DCP of this film */
494 Film::isdcf_name (bool if_created_now) const
498 string raw_name = name ();
500 /* Split the raw name up into words */
501 vector<string> words;
502 split (words, raw_name, is_any_of (" "));
506 /* Add each word to fixed_name */
507 for (vector<string>::const_iterator i = words.begin(); i != words.end(); ++i) {
510 /* First letter is always capitalised */
511 w[0] = toupper (w[0]);
513 /* Count caps in w */
515 for (size_t i = 0; i < w.size(); ++i) {
516 if (isupper (w[i])) {
521 /* If w is all caps make the rest of it lower case, otherwise
524 if (caps == w.size ()) {
525 for (size_t i = 1; i < w.size(); ++i) {
526 w[i] = tolower (w[i]);
530 for (size_t i = 0; i < w.size(); ++i) {
535 if (fixed_name.length() > 14) {
536 fixed_name = fixed_name.substr (0, 14);
541 if (dcp_content_type()) {
542 d << "_" << dcp_content_type()->isdcf_name();
543 d << "-" << isdcf_metadata().content_version;
546 ISDCFMetadata const dm = isdcf_metadata ();
548 if (dm.temp_version) {
552 if (dm.pre_release) {
560 if (!dm.chain.empty ()) {
561 d << "-" << dm.chain;
568 if (dm.two_d_version_of_three_d) {
572 if (!dm.mastered_luminance.empty ()) {
573 d << "-" << dm.mastered_luminance;
576 if (video_frame_rate() != 24) {
577 d << "-" << video_frame_rate();
581 d << "_" << container()->isdcf_name();
584 /* XXX: this uses the first bit of content only */
586 /* The standard says we don't do this for trailers, for some strange reason */
587 if (dcp_content_type() && dcp_content_type()->libdcp_kind() != dcp::TRAILER) {
588 ContentList cl = content ();
589 Ratio const * content_ratio = 0;
590 for (ContentList::iterator i = cl.begin(); i != cl.end(); ++i) {
591 shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> (*i);
593 /* Here's the first piece of video content */
594 if (vc->scale().ratio ()) {
595 content_ratio = vc->scale().ratio ();
597 content_ratio = Ratio::from_ratio (vc->video_size().ratio ());
603 if (content_ratio && content_ratio != container()) {
604 d << "-" << content_ratio->isdcf_name();
608 if (!dm.audio_language.empty ()) {
609 d << "_" << dm.audio_language;
610 if (!dm.subtitle_language.empty()) {
611 d << "-" << dm.subtitle_language;
617 if (!dm.territory.empty ()) {
618 d << "_" << dm.territory;
619 if (!dm.rating.empty ()) {
620 d << "-" << dm.rating;
624 switch (audio_channels ()) {
647 d << "_" << resolution_to_string (_resolution);
649 if (!dm.studio.empty ()) {
650 d << "_" << dm.studio;
653 if (if_created_now) {
654 d << "_" << boost::gregorian::to_iso_string (boost::gregorian::day_clock::local_day ());
656 d << "_" << boost::gregorian::to_iso_string (_isdcf_date);
659 if (!dm.facility.empty ()) {
660 d << "_" << dm.facility;
673 if (!dm.package_type.empty ()) {
674 d << "_" << dm.package_type;
680 /** @return name to give the DCP */
682 Film::dcp_name (bool if_created_now) const
684 if (use_isdcf_name()) {
685 return isdcf_name (if_created_now);
692 Film::set_directory (boost::filesystem::path d)
699 Film::set_name (string n)
702 signal_changed (NAME);
706 Film::set_use_isdcf_name (bool u)
709 signal_changed (USE_ISDCF_NAME);
713 Film::set_dcp_content_type (DCPContentType const * t)
715 _dcp_content_type = t;
716 signal_changed (DCP_CONTENT_TYPE);
720 Film::set_container (Ratio const * c)
723 signal_changed (CONTAINER);
727 Film::set_resolution (Resolution r)
730 signal_changed (RESOLUTION);
734 Film::set_j2k_bandwidth (int b)
737 signal_changed (J2K_BANDWIDTH);
741 Film::set_isdcf_metadata (ISDCFMetadata m)
744 signal_changed (ISDCF_METADATA);
748 Film::set_video_frame_rate (int f)
750 _video_frame_rate = f;
751 signal_changed (VIDEO_FRAME_RATE);
755 Film::set_audio_channels (int c)
758 signal_changed (AUDIO_CHANNELS);
762 Film::set_three_d (bool t)
765 signal_changed (THREE_D);
769 Film::set_interop (bool i)
772 signal_changed (INTEROP);
776 Film::set_burn_subtitles (bool b)
779 signal_changed (BURN_SUBTITLES);
783 Film::signal_changed (Property p)
789 set_video_frame_rate (_playlist->best_dcp_frame_rate ());
791 case Film::VIDEO_FRAME_RATE:
792 case Film::SEQUENCE_VIDEO:
793 _playlist->maybe_sequence_video ();
800 ui_signaller->emit (boost::bind (boost::ref (Changed), p));
805 Film::set_isdcf_date_today ()
807 _isdcf_date = boost::gregorian::day_clock::local_day ();
810 boost::filesystem::path
811 Film::info_path (int f, Eyes e) const
813 boost::filesystem::path p;
818 s << setfill('0') << f;
820 if (e == EYES_LEFT) {
822 } else if (e == EYES_RIGHT) {
830 /* info_dir() will already have added any initial bit of the path,
831 so don't call file() on this.
836 boost::filesystem::path
837 Film::j2c_path (int f, Eyes e, bool t) const
839 boost::filesystem::path p;
841 p /= video_identifier ();
845 s << setfill('0') << f;
847 if (e == EYES_LEFT) {
849 } else if (e == EYES_RIGHT) {
863 /** Find all the DCPs in our directory that can be dcp::DCP::read() and return details of their CPLs */
867 vector<CPLSummary> out;
869 boost::filesystem::path const dir = directory ();
870 for (boost::filesystem::directory_iterator i = boost::filesystem::directory_iterator(dir); i != boost::filesystem::directory_iterator(); ++i) {
872 boost::filesystem::is_directory (*i) &&
873 i->path().leaf() != "j2c" && i->path().leaf() != "video" && i->path().leaf() != "info" && i->path().leaf() != "analysis"
881 i->path().leaf().string(),
882 dcp.cpls().front()->id(),
883 dcp.cpls().front()->annotation_text(),
884 dcp.cpls().front()->file()
897 Film::make_player () const
899 return shared_ptr<Player> (new Player (shared_from_this (), _playlist));
903 Film::set_signed (bool s)
906 signal_changed (SIGNED);
910 Film::set_encrypted (bool e)
913 signal_changed (ENCRYPTED);
917 Film::playlist () const
923 Film::content () const
925 return _playlist->content ();
929 Film::examine_content (shared_ptr<Content> c)
931 shared_ptr<Job> j (new ExamineContentJob (shared_from_this(), c));
932 JobManager::instance()->add (j);
936 Film::examine_and_add_content (shared_ptr<Content> c)
938 if (dynamic_pointer_cast<FFmpegContent> (c)) {
939 run_ffprobe (c->path(0), file ("ffprobe.log"), _log);
942 shared_ptr<Job> j (new ExamineContentJob (shared_from_this(), c));
944 _job_connections.push_back (
945 j->Finished.connect (bind (&Film::maybe_add_content, this, boost::weak_ptr<Job> (j), boost::weak_ptr<Content> (c)))
948 JobManager::instance()->add (j);
952 Film::maybe_add_content (weak_ptr<Job> j, weak_ptr<Content> c)
954 shared_ptr<Job> job = j.lock ();
955 if (!job || !job->finished_ok ()) {
959 shared_ptr<Content> content = c.lock ();
961 add_content (content);
966 Film::add_content (shared_ptr<Content> c)
968 /* Add video content after any existing content */
969 if (dynamic_pointer_cast<VideoContent> (c)) {
970 c->set_position (_playlist->video_end ());
977 Film::remove_content (shared_ptr<Content> c)
979 _playlist->remove (c);
983 Film::move_content_earlier (shared_ptr<Content> c)
985 _playlist->move_earlier (c);
989 Film::move_content_later (shared_ptr<Content> c)
991 _playlist->move_later (c);
995 Film::length () const
997 return _playlist->length ();
1001 Film::best_video_frame_rate () const
1003 return _playlist->best_dcp_frame_rate ();
1007 Film::active_frame_rate_change (DCPTime t) const
1009 return _playlist->active_frame_rate_change (t, video_frame_rate ());
1013 Film::playlist_content_changed (boost::weak_ptr<Content> c, int p)
1015 if (p == VideoContentProperty::VIDEO_FRAME_RATE) {
1016 set_video_frame_rate (_playlist->best_dcp_frame_rate ());
1020 ui_signaller->emit (boost::bind (boost::ref (ContentChanged), c, p));
1025 Film::playlist_changed ()
1027 signal_changed (CONTENT);
1031 Film::audio_frame_rate () const
1038 Film::set_sequence_video (bool s)
1040 _sequence_video = s;
1041 _playlist->set_sequence_video (s);
1042 signal_changed (SEQUENCE_VIDEO);
1045 /** @return Size of the largest possible image in whatever resolution we are using */
1047 Film::full_frame () const
1049 switch (_resolution) {
1051 return dcp::Size (2048, 1080);
1053 return dcp::Size (4096, 2160);
1056 DCPOMATIC_ASSERT (false);
1057 return dcp::Size ();
1060 /** @return Size of the frame */
1062 Film::frame_size () const
1064 return fit_ratio_within (container()->ratio(), full_frame (), 1);
1069 dcp::Certificate target,
1070 boost::filesystem::path cpl_file,
1071 dcp::LocalTime from,
1072 dcp::LocalTime until,
1073 dcp::Formulation formulation
1076 shared_ptr<const dcp::CPL> cpl (new dcp::CPL (cpl_file));
1077 shared_ptr<const dcp::Signer> signer = Config::instance()->signer();
1078 if (!signer->valid ()) {
1079 throw InvalidSignerError ();
1082 return dcp::DecryptedKDM (
1083 cpl, key(), from, until, "DCP-o-matic", cpl->content_title_text(), dcp::LocalTime().as_string()
1084 ).encrypt (signer, target, formulation);
1087 list<dcp::EncryptedKDM>
1089 list<shared_ptr<Screen> > screens,
1090 boost::filesystem::path dcp,
1091 dcp::LocalTime from,
1092 dcp::LocalTime until,
1093 dcp::Formulation formulation
1096 list<dcp::EncryptedKDM> kdms;
1098 for (list<shared_ptr<Screen> >::iterator i = screens.begin(); i != screens.end(); ++i) {
1099 if ((*i)->certificate) {
1100 kdms.push_back (make_kdm ((*i)->certificate.get(), dcp, from, until, formulation));
1107 /** @return The approximate disk space required to encode a DCP of this film with the
1108 * current settings, in bytes.
1111 Film::required_disk_space () const
1113 return uint64_t (j2k_bandwidth() / 8) * length().seconds();
1116 /** This method checks the disk that the Film is on and tries to decide whether or not
1117 * there will be enough space to make a DCP for it. If so, true is returned; if not,
1118 * false is returned and required and availabe are filled in with the amount of disk space
1119 * required and available respectively (in Gb).
1121 * Note: the decision made by this method isn't, of course, 100% reliable.
1124 Film::should_be_enough_disk_space (double& required, double& available) const
1126 boost::filesystem::space_info s = boost::filesystem::space (internal_video_mxf_dir ());
1127 required = double (required_disk_space ()) / 1073741824.0f;
1128 available = double (s.available) / 1073741824.0f;
1129 return (available - required) > 1;
1133 Film::subtitle_language () const
1135 set<string> languages;
1137 ContentList cl = content ();
1138 BOOST_FOREACH (shared_ptr<Content>& c, cl) {
1139 shared_ptr<SubtitleContent> sc = dynamic_pointer_cast<SubtitleContent> (c);
1141 languages.insert (sc->subtitle_language ());
1146 BOOST_FOREACH (string s, languages) {
1147 if (!all.empty ()) {