diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-04-13 23:50:28 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-04-13 23:50:28 +0200 |
| commit | 4bd57fbbac67ac04ec47a9765b9f278aa1691851 (patch) | |
| tree | 55a607e6ac16fa52f69522312f2464443fac5aeb /src | |
| parent | 488e3d1bd5e6b17d49f6db4df14c64f4b64db89b (diff) | |
Tidying a few things up.
Diffstat (limited to 'src')
| -rw-r--r-- | src/reel_atmos_asset.h | 9 | ||||
| -rw-r--r-- | src/reel_closed_caption_asset.h | 10 | ||||
| -rw-r--r-- | src/reel_interop_closed_caption_asset.h | 10 | ||||
| -rw-r--r-- | src/reel_interop_subtitle_asset.h | 8 | ||||
| -rw-r--r-- | src/reel_mono_picture_asset.h | 4 | ||||
| -rw-r--r-- | src/reel_picture_asset.h | 10 | ||||
| -rw-r--r-- | src/reel_smpte_closed_caption_asset.h | 11 | ||||
| -rw-r--r-- | src/reel_smpte_subtitle_asset.h | 8 | ||||
| -rw-r--r-- | src/reel_sound_asset.h | 10 | ||||
| -rw-r--r-- | src/reel_stereo_picture_asset.h | 4 | ||||
| -rw-r--r-- | src/reel_subtitle_asset.h | 16 |
11 files changed, 65 insertions, 35 deletions
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<AtmosAsset> asset, int64_t entry_point); explicit ReelAtmosAsset (std::shared_ptr<const cxml::Node>); - std::shared_ptr<AtmosAsset> asset () const { - return asset_of_type<AtmosAsset> (); + std::shared_ptr<const AtmosAsset> asset () const { + return asset_of_type<const AtmosAsset>(); + } + + std::shared_ptr<AtmosAsset> asset () { + return asset_of_type<AtmosAsset>(); } xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const override; @@ -71,6 +75,7 @@ private: boost::optional<std::string> key_type () const override { return std::string("MDEK"); } + std::string cpl_node_name (Standard standard) const override; std::pair<std::string, std::string> 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<SubtitleAsset> asset, Fraction edit_rate, int64_t instrinsic_duration, int64_t entry_point); explicit ReelClosedCaptionAsset (std::shared_ptr<const cxml::Node>); - bool equals (std::shared_ptr<const ReelClosedCaptionAsset>, EqualityOptions, NoteHandler) const; + std::shared_ptr<const SubtitleAsset> asset () const { + return asset_of_type<const SubtitleAsset>(); + } - std::shared_ptr<SubtitleAsset> asset () const { - return std::dynamic_pointer_cast<SubtitleAsset>(_asset_ref.asset()); + std::shared_ptr<SubtitleAsset> asset () { + return asset_of_type<SubtitleAsset>(); } + bool equals (std::shared_ptr<const ReelClosedCaptionAsset>, 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<InteropSubtitleAsset> asset, Fraction edit_rate, int64_t instrinsic_duration, int64_t entry_point); explicit ReelInteropClosedCaptionAsset (std::shared_ptr<const cxml::Node>); - xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const override; + std::shared_ptr<const InteropSubtitleAsset> interop_asset () const { + return asset_of_type<const InteropSubtitleAsset>(); + } - std::shared_ptr<InteropSubtitleAsset> interop_asset () const { - return std::dynamic_pointer_cast<InteropSubtitleAsset>(asset()); + std::shared_ptr<InteropSubtitleAsset> interop_asset () { + return asset_of_type<InteropSubtitleAsset>(); } + xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const override; + private: std::string cpl_node_name (Standard) const; std::pair<std::string, std::string> 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<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point); explicit ReelInteropSubtitleAsset (std::shared_ptr<const cxml::Node>); - std::shared_ptr<InteropSubtitleAsset> interop_asset () const { - return std::dynamic_pointer_cast<InteropSubtitleAsset>(asset()); + std::shared_ptr<const InteropSubtitleAsset> interop_asset () const { + return asset_of_type<const InteropSubtitleAsset>(); + } + + std::shared_ptr<InteropSubtitleAsset> interop_asset () { + return asset_of_type<InteropSubtitleAsset>(); } }; 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<const MonoPictureAsset> mono_asset () const { - return asset_of_type<const MonoPictureAsset> (); + return asset_of_type<const MonoPictureAsset>(); } /** @return the MonoPictureAsset that this object refers to */ std::shared_ptr<MonoPictureAsset> mono_asset () { - return asset_of_type<MonoPictureAsset> (); + return asset_of_type<MonoPictureAsset>(); } 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<PictureAsset> asset, int64_t entry_point); explicit ReelPictureAsset (std::shared_ptr<const cxml::Node>); - virtual xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const; - bool equals (std::shared_ptr<const ReelPictureAsset>, EqualityOptions, NoteHandler) const; - /** @return the PictureAsset that this object refers to */ std::shared_ptr<const PictureAsset> asset () const { - return asset_of_type<const PictureAsset> (); + return asset_of_type<const PictureAsset>(); } /** @return the PictureAsset that this object refers to */ std::shared_ptr<PictureAsset> asset () { - return asset_of_type<PictureAsset> (); + return asset_of_type<PictureAsset>(); } + virtual xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const override; + bool equals (std::shared_ptr<const ReelPictureAsset>, 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<SMPTESubtitleAsset> asset, Fraction edit_rate, int64_t instrinsic_duration, int64_t entry_point); explicit ReelSMPTEClosedCaptionAsset (std::shared_ptr<const cxml::Node>); - xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const override; + std::shared_ptr<SMPTESubtitleAsset> smpte_asset () { + return asset_of_type<SMPTESubtitleAsset>(); + } - std::shared_ptr<SMPTESubtitleAsset> smpte_asset () const { - return std::dynamic_pointer_cast<SMPTESubtitleAsset>(asset()); + std::shared_ptr<const SMPTESubtitleAsset> smpte_asset () const { + return asset_of_type<const SMPTESubtitleAsset>(); } + xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const override; + + private: boost::optional<std::string> 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<SMPTESubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point); explicit ReelSMPTESubtitleAsset (std::shared_ptr<const cxml::Node>); - std::shared_ptr<SMPTESubtitleAsset> smpte_asset () const { - return std::dynamic_pointer_cast<SMPTESubtitleAsset>(asset()); + std::shared_ptr<const SMPTESubtitleAsset> smpte_asset () const { + return asset_of_type<const SMPTESubtitleAsset>(); + } + + std::shared_ptr<SMPTESubtitleAsset> smpte_asset () { + return asset_of_type<SMPTESubtitleAsset>(); } 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<dcp::SoundAsset> content, int64_t entry_point); explicit ReelSoundAsset (std::shared_ptr<const cxml::Node>); - bool equals (std::shared_ptr<const ReelSoundAsset>, EqualityOptions, NoteHandler) const; + /** @return the SoundAsset that this object refers to */ + std::shared_ptr<const SoundAsset> asset () const { + return asset_of_type<const SoundAsset>(); + } /** @return the SoundAsset that this object refers to */ std::shared_ptr<SoundAsset> asset () { return asset_of_type<SoundAsset>(); } - /** @return the SoundAsset that this object refers to */ - std::shared_ptr<const SoundAsset> asset () const { - return asset_of_type<const SoundAsset>(); - } + bool equals (std::shared_ptr<const ReelSoundAsset>, EqualityOptions, NoteHandler) const; private: boost::optional<std::string> 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<const StereoPictureAsset> stereo_asset () const { - return asset_of_type<const StereoPictureAsset> (); + return asset_of_type<const StereoPictureAsset>(); } /** @return the StereoPictureAsset that this object refers to */ std::shared_ptr<StereoPictureAsset> stereo_asset () { - return asset_of_type<StereoPictureAsset> (); + return asset_of_type<StereoPictureAsset>(); } 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<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point); explicit ReelSubtitleAsset (std::shared_ptr<const cxml::Node>); - xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const; - - bool equals (std::shared_ptr<const ReelSubtitleAsset>, EqualityOptions, NoteHandler) const; + std::shared_ptr<const SubtitleAsset> asset () const { + return asset_of_type<const SubtitleAsset>(); + } - std::shared_ptr<SubtitleAsset> asset () const { - return std::dynamic_pointer_cast<SubtitleAsset>(_asset_ref.asset()); + std::shared_ptr<SubtitleAsset> asset () { + return asset_of_type<SubtitleAsset>(); } + xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const override; + + bool equals (std::shared_ptr<const ReelSubtitleAsset>, EqualityOptions, NoteHandler) const; + void set_language (dcp::LanguageTag language); boost::optional<std::string> 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; }; |
