From bb0a36c3a6bea9cd1ebdde7b8a3a04765e317569 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 19 May 2014 11:34:01 +0100 Subject: [PATCH 1/1] Use cxml::ConstNodePtr. --- src/lib/audio_content.cc | 2 +- src/lib/audio_content.h | 2 +- src/lib/audio_mapping.cc | 2 +- src/lib/audio_mapping.h | 5 +++-- src/lib/cinema.cc | 6 +++--- src/lib/cinema.h | 11 ++++------- src/lib/content.cc | 2 +- src/lib/content.h | 3 ++- src/lib/dci_metadata.cc | 2 +- src/lib/dci_metadata.h | 7 ++----- src/lib/dcp_video_frame.cc | 2 +- src/lib/dcp_video_frame.h | 2 +- src/lib/ffmpeg_content.cc | 8 ++++---- src/lib/ffmpeg_content.h | 8 ++++---- src/lib/image_content.cc | 2 +- src/lib/image_content.h | 2 +- src/lib/playlist.cc | 2 +- src/lib/playlist.h | 2 +- src/lib/sndfile_content.cc | 2 +- src/lib/sndfile_content.h | 2 +- src/lib/subrip_content.cc | 2 +- src/lib/subrip_content.h | 2 +- src/lib/subtitle_content.cc | 2 +- src/lib/subtitle_content.h | 2 +- src/lib/video_content.cc | 4 ++-- src/lib/video_content.h | 4 ++-- test/stream_test.cc | 2 +- 27 files changed, 44 insertions(+), 48 deletions(-) diff --git a/src/lib/audio_content.cc b/src/lib/audio_content.cc index e8fd4bbd3..c78dd3e69 100644 --- a/src/lib/audio_content.cc +++ b/src/lib/audio_content.cc @@ -57,7 +57,7 @@ AudioContent::AudioContent (shared_ptr f, boost::filesystem::path p) } -AudioContent::AudioContent (shared_ptr f, shared_ptr node) +AudioContent::AudioContent (shared_ptr f, cxml::ConstNodePtr node) : Content (f, node) { _audio_gain = node->number_child ("AudioGain"); diff --git a/src/lib/audio_content.h b/src/lib/audio_content.h index 09f90b85c..1ceb01f78 100644 --- a/src/lib/audio_content.h +++ b/src/lib/audio_content.h @@ -52,7 +52,7 @@ public: AudioContent (boost::shared_ptr, DCPTime); AudioContent (boost::shared_ptr, boost::filesystem::path); - AudioContent (boost::shared_ptr, boost::shared_ptr); + AudioContent (boost::shared_ptr, cxml::ConstNodePtr); AudioContent (boost::shared_ptr, std::vector >); void as_xml (xmlpp::Node *) const; diff --git a/src/lib/audio_mapping.cc b/src/lib/audio_mapping.cc index 496300b48..7d7e9f828 100644 --- a/src/lib/audio_mapping.cc +++ b/src/lib/audio_mapping.cc @@ -78,7 +78,7 @@ AudioMapping::make_default () } } -AudioMapping::AudioMapping (shared_ptr node, int state_version) +AudioMapping::AudioMapping (cxml::ConstNodePtr node, int state_version) { setup (node->number_child ("ContentChannels")); diff --git a/src/lib/audio_mapping.h b/src/lib/audio_mapping.h index d3f497fc2..7bf974c22 100644 --- a/src/lib/audio_mapping.h +++ b/src/lib/audio_mapping.h @@ -21,8 +21,9 @@ #define DCPOMATIC_AUDIO_MAPPING_H #include -#include #include +#include +#include namespace xmlpp { class Node; @@ -42,7 +43,7 @@ class AudioMapping public: AudioMapping (); AudioMapping (int channels); - AudioMapping (boost::shared_ptr, int); + AudioMapping (cxml::ConstNodePtr, int); /* Default copy constructor is fine */ diff --git a/src/lib/cinema.cc b/src/lib/cinema.cc index 43a432239..c8cb7b66c 100644 --- a/src/lib/cinema.cc +++ b/src/lib/cinema.cc @@ -24,7 +24,7 @@ using std::list; using boost::shared_ptr; -Cinema::Cinema (shared_ptr node) +Cinema::Cinema (cxml::ConstNodePtr node) : name (node->string_child ("Name")) , email (node->string_child ("Email")) { @@ -35,7 +35,7 @@ Cinema::Cinema (shared_ptr node) a constructor) */ void -Cinema::read_screens (shared_ptr node) +Cinema::read_screens (cxml::ConstNodePtr node) { list s = node->node_children ("Screen"); for (list::iterator i = s.begin(); i != s.end(); ++i) { @@ -67,7 +67,7 @@ Cinema::remove_screen (shared_ptr s) _screens.remove (s); } -Screen::Screen (shared_ptr node) +Screen::Screen (cxml::ConstNodePtr node) { name = node->string_child ("Name"); certificate = shared_ptr (new dcp::Certificate (node->string_child ("Certificate"))); diff --git a/src/lib/cinema.h b/src/lib/cinema.h index 2e7660860..74357f65d 100644 --- a/src/lib/cinema.h +++ b/src/lib/cinema.h @@ -23,13 +23,10 @@ #include #include +#include class Cinema; -namespace cxml { - class Node; -} - /** @class Screen * @brief A representation of a Screen for KDM generation. * @@ -44,7 +41,7 @@ public: , certificate (cert) {} - Screen (boost::shared_ptr); + Screen (cxml::ConstNodePtr); void as_xml (xmlpp::Element *) const; @@ -67,9 +64,9 @@ public: , email (e) {} - Cinema (boost::shared_ptr); + Cinema (cxml::ConstNodePtr); - void read_screens (boost::shared_ptr); + void read_screens (cxml::ConstNodePtr); void as_xml (xmlpp::Element *) const; diff --git a/src/lib/content.cc b/src/lib/content.cc index c4836cfa8..b6678cb4d 100644 --- a/src/lib/content.cc +++ b/src/lib/content.cc @@ -79,7 +79,7 @@ Content::Content (shared_ptr f, boost::filesystem::path p) _paths.push_back (p); } -Content::Content (shared_ptr f, shared_ptr node) +Content::Content (shared_ptr f, cxml::ConstNodePtr node) : _film (f) , _change_signals_frequent (false) { diff --git a/src/lib/content.h b/src/lib/content.h index 659995b3b..1d3764c20 100644 --- a/src/lib/content.h +++ b/src/lib/content.h @@ -30,6 +30,7 @@ #include #include #include +#include #include "types.h" #include "dcpomatic_time.h" @@ -59,7 +60,7 @@ public: Content (boost::shared_ptr); Content (boost::shared_ptr, DCPTime); Content (boost::shared_ptr, boost::filesystem::path); - Content (boost::shared_ptr, boost::shared_ptr); + Content (boost::shared_ptr, cxml::ConstNodePtr); Content (boost::shared_ptr, std::vector >); virtual ~Content () {} diff --git a/src/lib/dci_metadata.cc b/src/lib/dci_metadata.cc index 2c6e43654..c80d91305 100644 --- a/src/lib/dci_metadata.cc +++ b/src/lib/dci_metadata.cc @@ -28,7 +28,7 @@ using std::string; using boost::shared_ptr; using dcp::raw_convert; -DCIMetadata::DCIMetadata (shared_ptr node) +DCIMetadata::DCIMetadata (cxml::ConstNodePtr node) { content_version = node->number_child ("ContentVersion"); audio_language = node->string_child ("AudioLanguage"); diff --git a/src/lib/dci_metadata.h b/src/lib/dci_metadata.h index 738e439de..6563ff95c 100644 --- a/src/lib/dci_metadata.h +++ b/src/lib/dci_metadata.h @@ -22,10 +22,7 @@ #include #include - -namespace cxml { - class Node; -} +#include class DCIMetadata { @@ -34,7 +31,7 @@ public: : content_version (1) {} - DCIMetadata (boost::shared_ptr); + DCIMetadata (cxml::ConstNodePtr); void as_xml (xmlpp::Node *) const; void read_old_metadata (std::string, std::string); diff --git a/src/lib/dcp_video_frame.cc b/src/lib/dcp_video_frame.cc index 59f356a5a..d860c3195 100644 --- a/src/lib/dcp_video_frame.cc +++ b/src/lib/dcp_video_frame.cc @@ -93,7 +93,7 @@ DCPVideoFrame::DCPVideoFrame ( } -DCPVideoFrame::DCPVideoFrame (shared_ptr image, shared_ptr node, shared_ptr log) +DCPVideoFrame::DCPVideoFrame (shared_ptr image, cxml::ConstNodePtr node, shared_ptr log) : _image (image) , _log (log) { diff --git a/src/lib/dcp_video_frame.h b/src/lib/dcp_video_frame.h index 0a8b5f287..c51a3f02b 100644 --- a/src/lib/dcp_video_frame.h +++ b/src/lib/dcp_video_frame.h @@ -101,7 +101,7 @@ class DCPVideoFrame : public boost::noncopyable { public: DCPVideoFrame (boost::shared_ptr, int, Eyes, ColourConversion, int, int, Resolution, boost::shared_ptr); - DCPVideoFrame (boost::shared_ptr, boost::shared_ptr, boost::shared_ptr); + DCPVideoFrame (boost::shared_ptr, cxml::ConstNodePtr, boost::shared_ptr); boost::shared_ptr encode_locally (); boost::shared_ptr encode_remotely (ServerDescription); diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index a374bcf3e..d15f3fd26 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -59,7 +59,7 @@ FFmpegContent::FFmpegContent (shared_ptr f, boost::filesystem::path } -FFmpegContent::FFmpegContent (shared_ptr f, shared_ptr node, int version, list& notes) +FFmpegContent::FFmpegContent (shared_ptr f, cxml::ConstNodePtr node, int version, list& notes) : Content (f, node) , VideoContent (f, node, version) , AudioContent (f, node) @@ -312,7 +312,7 @@ operator!= (FFmpegStream const & a, FFmpegStream const & b) return a._id != b._id; } -FFmpegStream::FFmpegStream (shared_ptr node) +FFmpegStream::FFmpegStream (cxml::ConstNodePtr node) : name (node->string_child ("Name")) , _id (node->number_child ("Id")) { @@ -326,7 +326,7 @@ FFmpegStream::as_xml (xmlpp::Node* root) const root->add_child("Id")->add_child_text (raw_convert (_id)); } -FFmpegAudioStream::FFmpegAudioStream (shared_ptr node, int version) +FFmpegAudioStream::FFmpegAudioStream (cxml::ConstNodePtr node, int version) : FFmpegStream (node) , mapping (node->node_child ("Mapping"), version) { @@ -380,7 +380,7 @@ FFmpegStream::stream (AVFormatContext const * fc) const * @param t String returned from to_string(). * @param v State file version. */ -FFmpegSubtitleStream::FFmpegSubtitleStream (shared_ptr node) +FFmpegSubtitleStream::FFmpegSubtitleStream (cxml::ConstNodePtr node) : FFmpegStream (node) { diff --git a/src/lib/ffmpeg_content.h b/src/lib/ffmpeg_content.h index 37746ac9d..c546d69eb 100644 --- a/src/lib/ffmpeg_content.h +++ b/src/lib/ffmpeg_content.h @@ -41,7 +41,7 @@ public: , _id (i) {} - FFmpegStream (boost::shared_ptr); + FFmpegStream (cxml::ConstNodePtr); void as_xml (xmlpp::Node *) const; @@ -81,7 +81,7 @@ public: mapping.make_default (); } - FFmpegAudioStream (boost::shared_ptr, int); + FFmpegAudioStream (cxml::ConstNodePtr, int); void as_xml (xmlpp::Node *) const; @@ -109,7 +109,7 @@ public: : FFmpegStream (n, i) {} - FFmpegSubtitleStream (boost::shared_ptr); + FFmpegSubtitleStream (cxml::ConstNodePtr); void as_xml (xmlpp::Node *) const; }; @@ -128,7 +128,7 @@ class FFmpegContent : public VideoContent, public AudioContent, public SubtitleC { public: FFmpegContent (boost::shared_ptr, boost::filesystem::path); - FFmpegContent (boost::shared_ptr, boost::shared_ptr, int version, std::list &); + FFmpegContent (boost::shared_ptr, cxml::ConstNodePtr, int version, std::list &); FFmpegContent (boost::shared_ptr, std::vector >); boost::shared_ptr shared_from_this () { diff --git a/src/lib/image_content.cc b/src/lib/image_content.cc index 56c83d3f7..07f047ddd 100644 --- a/src/lib/image_content.cc +++ b/src/lib/image_content.cc @@ -54,7 +54,7 @@ ImageContent::ImageContent (shared_ptr f, boost::filesystem::path p) } -ImageContent::ImageContent (shared_ptr f, shared_ptr node, int version) +ImageContent::ImageContent (shared_ptr f, cxml::ConstNodePtr node, int version) : Content (f, node) , VideoContent (f, node, version) { diff --git a/src/lib/image_content.h b/src/lib/image_content.h index 6db24767d..a1b1437c8 100644 --- a/src/lib/image_content.h +++ b/src/lib/image_content.h @@ -31,7 +31,7 @@ class ImageContent : public VideoContent { public: ImageContent (boost::shared_ptr, boost::filesystem::path); - ImageContent (boost::shared_ptr, boost::shared_ptr, int); + ImageContent (boost::shared_ptr, cxml::ConstNodePtr, int); boost::shared_ptr shared_from_this () { return boost::dynamic_pointer_cast (Content::shared_from_this ()); diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc index 9a048980c..214badc7e 100644 --- a/src/lib/playlist.cc +++ b/src/lib/playlist.cc @@ -118,7 +118,7 @@ Playlist::video_identifier () const /** @param node node */ void -Playlist::set_from_xml (shared_ptr film, shared_ptr node, int version, list& notes) +Playlist::set_from_xml (shared_ptr film, cxml::ConstNodePtr node, int version, list& notes) { list c = node->node_children ("Content"); for (list::iterator i = c.begin(); i != c.end(); ++i) { diff --git a/src/lib/playlist.h b/src/lib/playlist.h index 4295a3e35..6280b1219 100644 --- a/src/lib/playlist.h +++ b/src/lib/playlist.h @@ -54,7 +54,7 @@ public: ~Playlist (); void as_xml (xmlpp::Node *); - void set_from_xml (boost::shared_ptr, boost::shared_ptr, int, std::list &); + void set_from_xml (boost::shared_ptr, cxml::ConstNodePtr, int, std::list &); void add (boost::shared_ptr); void remove (boost::shared_ptr); diff --git a/src/lib/sndfile_content.cc b/src/lib/sndfile_content.cc index cad5eb8e7..ed4f8ffd5 100644 --- a/src/lib/sndfile_content.cc +++ b/src/lib/sndfile_content.cc @@ -44,7 +44,7 @@ SndfileContent::SndfileContent (shared_ptr f, boost::filesystem::pat } -SndfileContent::SndfileContent (shared_ptr f, shared_ptr node, int version) +SndfileContent::SndfileContent (shared_ptr f, cxml::ConstNodePtr node, int version) : Content (f, node) , AudioContent (f, node) , _audio_mapping (node->node_child ("AudioMapping"), version) diff --git a/src/lib/sndfile_content.h b/src/lib/sndfile_content.h index bbc5111ff..dcd6cb55d 100644 --- a/src/lib/sndfile_content.h +++ b/src/lib/sndfile_content.h @@ -33,7 +33,7 @@ class SndfileContent : public AudioContent { public: SndfileContent (boost::shared_ptr, boost::filesystem::path); - SndfileContent (boost::shared_ptr, boost::shared_ptr, int); + SndfileContent (boost::shared_ptr, cxml::ConstNodePtr, int); boost::shared_ptr shared_from_this () { return boost::dynamic_pointer_cast (Content::shared_from_this ()); diff --git a/src/lib/subrip_content.cc b/src/lib/subrip_content.cc index 8f9c28e29..892578ade 100644 --- a/src/lib/subrip_content.cc +++ b/src/lib/subrip_content.cc @@ -39,7 +39,7 @@ SubRipContent::SubRipContent (shared_ptr film, boost::filesystem::pa } -SubRipContent::SubRipContent (shared_ptr film, shared_ptr node, int version) +SubRipContent::SubRipContent (shared_ptr film, cxml::ConstNodePtr node, int version) : Content (film, node) , SubtitleContent (film, node, version) , _length (node->number_child ("Length")) diff --git a/src/lib/subrip_content.h b/src/lib/subrip_content.h index 3a8380cec..5688f81d5 100644 --- a/src/lib/subrip_content.h +++ b/src/lib/subrip_content.h @@ -23,7 +23,7 @@ class SubRipContent : public SubtitleContent { public: SubRipContent (boost::shared_ptr, boost::filesystem::path); - SubRipContent (boost::shared_ptr, boost::shared_ptr, int); + SubRipContent (boost::shared_ptr, cxml::ConstNodePtr, int); boost::shared_ptr shared_from_this () { return boost::dynamic_pointer_cast (Content::shared_from_this ()); diff --git a/src/lib/subtitle_content.cc b/src/lib/subtitle_content.cc index 783c73e25..068bf7516 100644 --- a/src/lib/subtitle_content.cc +++ b/src/lib/subtitle_content.cc @@ -45,7 +45,7 @@ SubtitleContent::SubtitleContent (shared_ptr f, boost::filesystem::p } -SubtitleContent::SubtitleContent (shared_ptr f, shared_ptr node, int version) +SubtitleContent::SubtitleContent (shared_ptr f, cxml::ConstNodePtr node, int version) : Content (f, node) , _subtitle_x_offset (0) , _subtitle_y_offset (0) diff --git a/src/lib/subtitle_content.h b/src/lib/subtitle_content.h index 388637688..92d072ca6 100644 --- a/src/lib/subtitle_content.h +++ b/src/lib/subtitle_content.h @@ -34,7 +34,7 @@ class SubtitleContent : public virtual Content { public: SubtitleContent (boost::shared_ptr, boost::filesystem::path); - SubtitleContent (boost::shared_ptr, boost::shared_ptr, int version); + SubtitleContent (boost::shared_ptr, cxml::ConstNodePtr, int version); SubtitleContent (boost::shared_ptr, std::vector >); void as_xml (xmlpp::Node *) const; diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc index bd24621f7..a67a1777e 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -82,7 +82,7 @@ VideoContent::VideoContent (shared_ptr f, boost::filesystem::path p) setup_default_colour_conversion (); } -VideoContent::VideoContent (shared_ptr f, shared_ptr node, int version) +VideoContent::VideoContent (shared_ptr f, cxml::ConstNodePtr node, int version) : Content (f, node) { _video_length = ContentTime (node->number_child ("VideoLength")); @@ -396,7 +396,7 @@ VideoContentScale::VideoContentScale (bool scale) } -VideoContentScale::VideoContentScale (shared_ptr node) +VideoContentScale::VideoContentScale (cxml::NodePtr node) : _ratio (0) , _scale (true) { diff --git a/src/lib/video_content.h b/src/lib/video_content.h index 6b91997c9..8313c73ee 100644 --- a/src/lib/video_content.h +++ b/src/lib/video_content.h @@ -43,7 +43,7 @@ public: VideoContentScale (); VideoContentScale (Ratio const *); VideoContentScale (bool); - VideoContentScale (boost::shared_ptr); + VideoContentScale (cxml::NodePtr); dcp::Size size (boost::shared_ptr, dcp::Size, dcp::Size) const; std::string id () const; @@ -83,7 +83,7 @@ public: VideoContent (boost::shared_ptr); VideoContent (boost::shared_ptr, DCPTime, ContentTime); VideoContent (boost::shared_ptr, boost::filesystem::path); - VideoContent (boost::shared_ptr, boost::shared_ptr, int); + VideoContent (boost::shared_ptr, cxml::ConstNodePtr, int); VideoContent (boost::shared_ptr, std::vector >); void as_xml (xmlpp::Node *) const; diff --git a/test/stream_test.cc b/test/stream_test.cc index f30bc64d8..f9dfadad5 100644 --- a/test/stream_test.cc +++ b/test/stream_test.cc @@ -69,7 +69,7 @@ BOOST_AUTO_TEST_CASE (stream_test) map->add_child("DCP")->add_child_text ("2"); } - FFmpegAudioStream a (shared_ptr (new cxml::Node (root)), 5); + FFmpegAudioStream a (cxml::NodePtr (new cxml::Node (root)), 5); BOOST_CHECK_EQUAL (a.identifier(), "4"); BOOST_CHECK_EQUAL (a.frame_rate, 44100); -- 2.30.2