From 4bd57fbbac67ac04ec47a9765b9f278aa1691851 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 13 Apr 2021 23:50:28 +0200 Subject: Tidying a few things up. --- src/reel_atmos_asset.h | 9 +++++++-- src/reel_closed_caption_asset.h | 10 +++++++--- src/reel_interop_closed_caption_asset.h | 10 +++++++--- src/reel_interop_subtitle_asset.h | 8 ++++++-- src/reel_mono_picture_asset.h | 4 ++-- src/reel_picture_asset.h | 10 +++++----- src/reel_smpte_closed_caption_asset.h | 11 ++++++++--- src/reel_smpte_subtitle_asset.h | 8 ++++++-- src/reel_sound_asset.h | 10 +++++----- src/reel_stereo_picture_asset.h | 4 ++-- src/reel_subtitle_asset.h | 16 ++++++++++------ 11 files changed, 65 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/reel_atmos_asset.h b/src/reel_atmos_asset.h index 2e4a8d4e..6ceec984 100644 --- a/src/reel_atmos_asset.h +++ b/src/reel_atmos_asset.h @@ -60,8 +60,12 @@ public: ReelAtmosAsset (std::shared_ptr asset, int64_t entry_point); explicit ReelAtmosAsset (std::shared_ptr); - std::shared_ptr asset () const { - return asset_of_type (); + std::shared_ptr asset () const { + return asset_of_type(); + } + + std::shared_ptr asset () { + return asset_of_type(); } xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const override; @@ -71,6 +75,7 @@ private: boost::optional key_type () const override { return std::string("MDEK"); } + std::string cpl_node_name (Standard standard) const override; std::pair cpl_node_namespace () const override; }; diff --git a/src/reel_closed_caption_asset.h b/src/reel_closed_caption_asset.h index a1f3b6ec..78e05659 100644 --- a/src/reel_closed_caption_asset.h +++ b/src/reel_closed_caption_asset.h @@ -62,12 +62,16 @@ public: ReelClosedCaptionAsset (std::shared_ptr asset, Fraction edit_rate, int64_t instrinsic_duration, int64_t entry_point); explicit ReelClosedCaptionAsset (std::shared_ptr); - bool equals (std::shared_ptr, EqualityOptions, NoteHandler) const; + std::shared_ptr asset () const { + return asset_of_type(); + } - std::shared_ptr asset () const { - return std::dynamic_pointer_cast(_asset_ref.asset()); + std::shared_ptr asset () { + return asset_of_type(); } + bool equals (std::shared_ptr, EqualityOptions, NoteHandler) const; + void set_language (dcp::LanguageTag l) { _language = l.to_string(); } diff --git a/src/reel_interop_closed_caption_asset.h b/src/reel_interop_closed_caption_asset.h index bb5b5cec..ec954346 100644 --- a/src/reel_interop_closed_caption_asset.h +++ b/src/reel_interop_closed_caption_asset.h @@ -54,12 +54,16 @@ public: ReelInteropClosedCaptionAsset (std::shared_ptr asset, Fraction edit_rate, int64_t instrinsic_duration, int64_t entry_point); explicit ReelInteropClosedCaptionAsset (std::shared_ptr); - xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const override; + std::shared_ptr interop_asset () const { + return asset_of_type(); + } - std::shared_ptr interop_asset () const { - return std::dynamic_pointer_cast(asset()); + std::shared_ptr interop_asset () { + return asset_of_type(); } + xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const override; + private: std::string cpl_node_name (Standard) const; std::pair cpl_node_namespace () const override; diff --git a/src/reel_interop_subtitle_asset.h b/src/reel_interop_subtitle_asset.h index 83a7ab25..7e90e9e0 100644 --- a/src/reel_interop_subtitle_asset.h +++ b/src/reel_interop_subtitle_asset.h @@ -54,8 +54,12 @@ public: ReelInteropSubtitleAsset (std::shared_ptr asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point); explicit ReelInteropSubtitleAsset (std::shared_ptr); - std::shared_ptr interop_asset () const { - return std::dynamic_pointer_cast(asset()); + std::shared_ptr interop_asset () const { + return asset_of_type(); + } + + std::shared_ptr interop_asset () { + return asset_of_type(); } }; diff --git a/src/reel_mono_picture_asset.h b/src/reel_mono_picture_asset.h index 9f1335be..50e904b2 100644 --- a/src/reel_mono_picture_asset.h +++ b/src/reel_mono_picture_asset.h @@ -62,12 +62,12 @@ public: /** @return the MonoPictureAsset that this object refers to */ std::shared_ptr mono_asset () const { - return asset_of_type (); + return asset_of_type(); } /** @return the MonoPictureAsset that this object refers to */ std::shared_ptr mono_asset () { - return asset_of_type (); + return asset_of_type(); } private: diff --git a/src/reel_picture_asset.h b/src/reel_picture_asset.h index 5a925e24..e79c4455 100644 --- a/src/reel_picture_asset.h +++ b/src/reel_picture_asset.h @@ -57,19 +57,19 @@ public: ReelPictureAsset (std::shared_ptr asset, int64_t entry_point); explicit ReelPictureAsset (std::shared_ptr); - virtual xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const; - bool equals (std::shared_ptr, EqualityOptions, NoteHandler) const; - /** @return the PictureAsset that this object refers to */ std::shared_ptr asset () const { - return asset_of_type (); + return asset_of_type(); } /** @return the PictureAsset that this object refers to */ std::shared_ptr asset () { - return asset_of_type (); + return asset_of_type(); } + virtual xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const override; + bool equals (std::shared_ptr, EqualityOptions, NoteHandler) const; + /** @return picture frame rate */ Fraction frame_rate () const { return _frame_rate; diff --git a/src/reel_smpte_closed_caption_asset.h b/src/reel_smpte_closed_caption_asset.h index 889ce5f6..8b38d2ad 100644 --- a/src/reel_smpte_closed_caption_asset.h +++ b/src/reel_smpte_closed_caption_asset.h @@ -55,12 +55,17 @@ public: ReelSMPTEClosedCaptionAsset (std::shared_ptr asset, Fraction edit_rate, int64_t instrinsic_duration, int64_t entry_point); explicit ReelSMPTEClosedCaptionAsset (std::shared_ptr); - xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const override; + std::shared_ptr smpte_asset () { + return asset_of_type(); + } - std::shared_ptr smpte_asset () const { - return std::dynamic_pointer_cast(asset()); + std::shared_ptr smpte_asset () const { + return asset_of_type(); } + xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const override; + + private: boost::optional key_type () const override { return std::string("MDSK"); diff --git a/src/reel_smpte_subtitle_asset.h b/src/reel_smpte_subtitle_asset.h index aaff9a98..2a097309 100644 --- a/src/reel_smpte_subtitle_asset.h +++ b/src/reel_smpte_subtitle_asset.h @@ -56,8 +56,12 @@ public: ReelSMPTESubtitleAsset (std::shared_ptr asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point); explicit ReelSMPTESubtitleAsset (std::shared_ptr); - std::shared_ptr smpte_asset () const { - return std::dynamic_pointer_cast(asset()); + std::shared_ptr smpte_asset () const { + return asset_of_type(); + } + + std::shared_ptr smpte_asset () { + return asset_of_type(); } private: diff --git a/src/reel_sound_asset.h b/src/reel_sound_asset.h index 0b4d0f9d..5eee23be 100644 --- a/src/reel_sound_asset.h +++ b/src/reel_sound_asset.h @@ -55,17 +55,17 @@ public: ReelSoundAsset (std::shared_ptr content, int64_t entry_point); explicit ReelSoundAsset (std::shared_ptr); - bool equals (std::shared_ptr, EqualityOptions, NoteHandler) const; + /** @return the SoundAsset that this object refers to */ + std::shared_ptr asset () const { + return asset_of_type(); + } /** @return the SoundAsset that this object refers to */ std::shared_ptr asset () { return asset_of_type(); } - /** @return the SoundAsset that this object refers to */ - std::shared_ptr asset () const { - return asset_of_type(); - } + bool equals (std::shared_ptr, EqualityOptions, NoteHandler) const; private: boost::optional key_type () const; diff --git a/src/reel_stereo_picture_asset.h b/src/reel_stereo_picture_asset.h index 7e603108..beedc4a6 100644 --- a/src/reel_stereo_picture_asset.h +++ b/src/reel_stereo_picture_asset.h @@ -62,12 +62,12 @@ public: /** @return the StereoPictureAsset that this object refers to */ std::shared_ptr stereo_asset () const { - return asset_of_type (); + return asset_of_type(); } /** @return the StereoPictureAsset that this object refers to */ std::shared_ptr stereo_asset () { - return asset_of_type (); + return asset_of_type(); } private: diff --git a/src/reel_subtitle_asset.h b/src/reel_subtitle_asset.h index a4e674ba..95013d34 100644 --- a/src/reel_subtitle_asset.h +++ b/src/reel_subtitle_asset.h @@ -65,14 +65,18 @@ public: ReelSubtitleAsset (std::shared_ptr asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point); explicit ReelSubtitleAsset (std::shared_ptr); - xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const; - - bool equals (std::shared_ptr, EqualityOptions, NoteHandler) const; + std::shared_ptr asset () const { + return asset_of_type(); + } - std::shared_ptr asset () const { - return std::dynamic_pointer_cast(_asset_ref.asset()); + std::shared_ptr asset () { + return asset_of_type(); } + xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const override; + + bool equals (std::shared_ptr, EqualityOptions, NoteHandler) const; + void set_language (dcp::LanguageTag language); boost::optional language () const { @@ -89,7 +93,7 @@ protected: private: friend struct ::verify_invalid_language1; - std::string cpl_node_name (Standard standard) const; + std::string cpl_node_name (Standard standard) const override; }; -- cgit v1.2.3