White space: dcp_examiner.{cc,h}
authorCarl Hetherington <cth@carlh.net>
Sat, 12 Apr 2025 09:31:35 +0000 (11:31 +0200)
committerCarl Hetherington <cth@carlh.net>
Sat, 12 Apr 2025 09:31:35 +0000 (11:31 +0200)
src/lib/dcp_examiner.cc
src/lib/dcp_examiner.h

index 3ee6dd99c6eb2a2de890d8d650ab47419f54db3c..1c04d20a6797d2e65b690ea6bbe79cef2b060467 100644 (file)
@@ -65,13 +65,13 @@ using std::vector;
 using boost::optional;
 
 
-DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant)
+DCPExaminer::DCPExaminer(shared_ptr<const DCPContent> content, bool tolerant)
 {
        shared_ptr<dcp::CPL> selected_cpl;
 
-       auto cpls = dcp::find_and_resolve_cpls (content->directories(), tolerant);
+       auto cpls = dcp::find_and_resolve_cpls(content->directories(), tolerant);
 
-       if (content->cpl ()) {
+       if (content->cpl()) {
                /* Use the CPL that was specified, or that the content was using before */
                auto iter = std::find_if(cpls.begin(), cpls.end(), [content](shared_ptr<dcp::CPL> cpl) { return cpl->id() == content->cpl().get(); });
                if (iter == cpls.end()) {
@@ -111,7 +111,7 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant)
        }
 
        if (!selected_cpl) {
-               throw DCPError ("No CPLs found in DCP");
+               throw DCPError("No CPLs found in DCP");
        }
 
        if (content->kdm()) {
@@ -122,12 +122,12 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant)
        _name = selected_cpl->content_title_text();
        _content_kind = selected_cpl->content_kind();
 
-       LOG_GENERAL ("Selected CPL %1", _cpl);
+       LOG_GENERAL("Selected CPL %1", _cpl);
 
        auto try_to_parse_language = [](optional<string> lang) -> boost::optional<dcp::LanguageTag> {
                try {
                        if (lang) {
-                               return dcp::LanguageTag (*lang);
+                               return dcp::LanguageTag(*lang);
                        }
                } catch (...) {}
                return boost::none;
@@ -157,14 +157,14 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant)
                                if (!_video_frame_rate) {
                                        _video_frame_rate = fr;
                                } else if (_video_frame_rate.get() != fr) {
-                                       throw DCPError (_("Mismatched frame rates in DCP"));
+                                       throw DCPError(_("Mismatched frame rates in DCP"));
                                }
 
                                auto asset = reel->main_picture()->asset();
                                if (!_video_size) {
-                                       _video_size = asset->size ();
-                               } else if (_video_size.get() != asset->size ()) {
-                                       throw DCPError (_("Mismatched video sizes in DCP"));
+                                       _video_size = asset->size();
+                               } else if (_video_size.get() != asset->size()) {
+                                       throw DCPError(_("Mismatched video sizes in DCP"));
                                }
 
                                if (dynamic_pointer_cast<dcp::MPEG2PictureAsset>(asset)) {
@@ -188,18 +188,18 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant)
                                if (!_audio_channels) {
                                        _audio_channels = asset->channels();
                                } else if (_audio_channels.get() != asset->channels()) {
-                                       throw DCPError (_("Mismatched audio channel counts in DCP"));
+                                       throw DCPError(_("Mismatched audio channel counts in DCP"));
                                }
 
                                _active_audio_channels = std::max(_active_audio_channels.get_value_or(0), asset->active_channels());
 
                                if (!_audio_frame_rate) {
-                                       _audio_frame_rate = asset->sampling_rate ();
-                               } else if (_audio_frame_rate.get() != asset->sampling_rate ()) {
-                                       throw DCPError (_("Mismatched audio sample rates in DCP"));
+                                       _audio_frame_rate = asset->sampling_rate();
+                               } else if (_audio_frame_rate.get() != asset->sampling_rate()) {
+                                       throw DCPError(_("Mismatched audio sample rates in DCP"));
                                }
 
-                               _audio_language = try_to_parse_language (asset->language());
+                               _audio_language = try_to_parse_language(asset->language());
                                _audio_length += reel->main_sound()->actual_duration() * (asset->sampling_rate() * edit_rate.denominator / edit_rate.numerator);
                        }
                }
@@ -273,7 +273,7 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant)
 
                if (reel->main_markers ()) {
                        auto rm = reel->main_markers()->get();
-                       _markers.insert (rm.begin(), rm.end());
+                       _markers.insert(rm.begin(), rm.end());
                }
 
                if (reel->atmos()) {
@@ -307,7 +307,7 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant)
        _encrypted = selected_cpl->any_encrypted();
        _kdm_valid = true;
 
-       LOG_GENERAL_NC ("Check that everything encrypted has a key");
+       LOG_GENERAL_NC("Check that everything encrypted has a key");
 
        /* Check first that anything encrypted has a key.  We must do this, as if we try to
         * read encrypted data with asdcplib without even offering a key it will just return
@@ -316,12 +316,12 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant)
         */
        try {
                for (auto i: selected_cpl->reels()) {
-                       LOG_GENERAL ("Reel %1", i->id());
+                       LOG_GENERAL("Reel %1", i->id());
                        if (i->main_picture() && i->main_picture()->asset_ref().resolved()) {
                                auto pic = i->main_picture()->asset();
                                if (pic->encrypted() && !pic->key()) {
                                        _kdm_valid = false;
-                                       LOG_GENERAL_NC ("Picture has no key");
+                                       LOG_GENERAL_NC("Picture has no key");
                                        break;
                                }
                                auto j2k_mono = dynamic_pointer_cast<dcp::MonoJ2KPictureAsset>(pic);
@@ -330,12 +330,12 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant)
 
                                if (j2k_mono) {
                                        auto reader = j2k_mono->start_read();
-                                       reader->set_check_hmac (false);
+                                       reader->set_check_hmac(false);
                                        reader->get_frame(0)->xyz_image();
                                        _video_encoding = VideoEncoding::JPEG2000;
                                } else if (j2k_stereo) {
                                        auto reader = j2k_stereo->start_read();
-                                       reader->set_check_hmac (false);
+                                       reader->set_check_hmac(false);
                                        reader->get_frame(0)->xyz_image(dcp::Eye::LEFT);
                                        _video_encoding = VideoEncoding::JPEG2000;
                                } else if (mpeg2_mono) {
@@ -351,11 +351,11 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant)
                                auto sound = i->main_sound()->asset();
                                if (sound->encrypted() && !sound->key()) {
                                        _kdm_valid = false;
-                                       LOG_GENERAL_NC ("Sound has no key");
+                                       LOG_GENERAL_NC("Sound has no key");
                                        break;
                                }
                                auto reader = sound->start_read();
-                               reader->set_check_hmac (false);
+                               reader->set_check_hmac(false);
                                reader->get_frame(0);
                        }
 
@@ -364,7 +364,7 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant)
                                auto mxf_sub = dynamic_pointer_cast<dcp::MXF>(sub);
                                if (mxf_sub && mxf_sub->encrypted() && !mxf_sub->key()) {
                                        _kdm_valid = false;
-                                       LOG_GENERAL_NC ("Subtitle has no key");
+                                       LOG_GENERAL_NC("Subtitle has no key");
                                        break;
                                }
                                sub->texts();
@@ -385,21 +385,21 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant)
                                if (auto atmos = i->atmos()->asset()) {
                                        if (atmos->encrypted() && !atmos->key()) {
                                                _kdm_valid = false;
-                                               LOG_GENERAL_NC ("ATMOS sound has no key");
+                                               LOG_GENERAL_NC("ATMOS sound has no key");
                                                break;
                                        }
                                        auto reader = atmos->start_read();
-                                       reader->set_check_hmac (false);
+                                       reader->set_check_hmac(false);
                                        reader->get_frame(0);
                                }
                        }
                }
        } catch (dcp::ReadError& e) {
                _kdm_valid = false;
-               LOG_GENERAL ("KDM is invalid: %1", e.what());
+               LOG_GENERAL("KDM is invalid: %1", e.what());
        } catch (dcp::MiscError& e) {
                _kdm_valid = false;
-               LOG_GENERAL ("KDM is invalid: %1", e.what());
+               LOG_GENERAL("KDM is invalid: %1", e.what());
        }
 
        _standard = selected_cpl->standard();
index 5e2a33361ebb346872a6d8c7c3abe5a6f4c209f6..381afdaed0d3546291f7599e8000431fa3b4709d 100644 (file)
@@ -40,11 +40,11 @@ class DCPExaminer : public VideoExaminer, public AudioExaminer
 public:
        DCPExaminer(std::shared_ptr<const DCPContent>, bool tolerant);
 
-       bool has_video () const override {
+       bool has_video() const override {
                return _has_video;
        }
 
-       boost::optional<double> video_frame_rate () const override {
+       boost::optional<double> video_frame_rate() const override {
                return _video_frame_rate;
        }
 
@@ -52,55 +52,55 @@ public:
                return _video_size;
        }
 
-       Frame video_length () const override {
+       Frame video_length() const override {
                return _video_length;
        }
 
-       bool yuv () const override {
+       bool yuv() const override {
                return false;
        }
 
-       VideoRange range () const override {
+       VideoRange range() const override {
                return _video_range;
        }
 
-       PixelQuanta pixel_quanta () const override {
+       PixelQuanta pixel_quanta() const override {
                return {};
        }
 
-       std::string name () const {
+       std::string name() const {
                return _name;
        }
 
-       bool encrypted () const {
+       bool encrypted() const {
                return _encrypted;
        }
 
-       bool needs_assets () const {
+       bool needs_assets() const {
                return _needs_assets;
        }
 
-       bool has_audio () const override {
+       bool has_audio() const override {
                return _has_audio;
        }
 
-       int audio_channels () const override {
-               return _audio_channels.get_value_or (0);
+       int audio_channels() const override {
+               return _audio_channels.get_value_or(0);
        }
 
        int active_audio_channels() const {
                return _active_audio_channels.get_value_or(0);
        }
 
-       Frame audio_length () const override {
+       Frame audio_length() const override {
                return _audio_length;
        }
 
-       int audio_frame_rate () const override {
-               return _audio_frame_rate.get_value_or (48000);
+       int audio_frame_rate() const override {
+               return _audio_frame_rate.get_value_or(48000);
        }
 
-       boost::optional<dcp::LanguageTag> audio_language () const {
+       boost::optional<dcp::LanguageTag> audio_language() const {
                return _audio_language;
        }
 
@@ -108,11 +108,11 @@ public:
         *  Reels do not affect the return value of this method: if a DCP
         *  has any subtitles, type=TEXT_OPEN_SUBTITLE will return 1.
         */
-       int text_count (TextType type) const {
+       int text_count(TextType type) const {
                return _text_count[type];
        }
 
-       boost::optional<dcp::LanguageTag> open_subtitle_language () const {
+       boost::optional<dcp::LanguageTag> open_subtitle_language() const {
                return _open_subtitle_language;
        }
 
@@ -121,20 +121,20 @@ public:
        }
 
        DCPTextTrack dcp_subtitle_track(int i) const {
-               DCPOMATIC_ASSERT (i >= 0 && i < static_cast<int>(_dcp_subtitle_tracks.size()));
+               DCPOMATIC_ASSERT(i >= 0 && i < static_cast<int>(_dcp_subtitle_tracks.size()));
                return _dcp_subtitle_tracks[i];
        }
 
        DCPTextTrack dcp_caption_track(int i) const {
-               DCPOMATIC_ASSERT (i >= 0 && i < static_cast<int>(_dcp_caption_tracks.size()));
+               DCPOMATIC_ASSERT(i >= 0 && i < static_cast<int>(_dcp_caption_tracks.size()));
                return _dcp_caption_tracks[i];
        }
 
-       bool kdm_valid () const {
+       bool kdm_valid() const {
                return _kdm_valid;
        }
 
-       boost::optional<dcp::Standard> standard () const {
+       boost::optional<dcp::Standard> standard() const {
                return _standard;
        }
 
@@ -142,44 +142,44 @@ public:
                return _video_encoding;
        }
 
-       bool three_d () const {
+       bool three_d() const {
                return _three_d;
        }
 
-       dcp::ContentKind content_kind () const {
+       dcp::ContentKind content_kind() const {
                DCPOMATIC_ASSERT(_content_kind);
                return *_content_kind;
        }
 
-       std::string cpl () const {
+       std::string cpl() const {
                return _cpl;
        }
 
-       std::list<int64_t> reel_lengths () const {
+       std::list<int64_t> reel_lengths() const {
                return _reel_lengths;
        }
 
-       std::map<dcp::Marker, dcp::Time> markers () const {
+       std::map<dcp::Marker, dcp::Time> markers() const {
                return _markers;
        }
 
-       std::vector<dcp::Rating> ratings () const {
+       std::vector<dcp::Rating> ratings() const {
                return _ratings;
        }
 
-       std::vector<std::string> content_versions () const {
+       std::vector<std::string> content_versions() const {
                return _content_versions;
        }
 
-       bool has_atmos () const {
+       bool has_atmos() const {
                return _has_atmos;
        }
 
-       Frame atmos_length () const {
+       Frame atmos_length() const {
                return _atmos_length;
        }
 
-       dcp::Fraction atmos_edit_rate () const {
+       dcp::Fraction atmos_edit_rate() const {
                return _atmos_edit_rate;
        }