diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-07-23 11:56:28 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-07-23 11:56:28 +0100 |
| commit | ad3d9f8bbe623f87e440bd6a5a12520361a7661f (patch) | |
| tree | 3ff56c79f8a766f1090fa4448bba0c9507848889 /src | |
| parent | 41804f82645167deb0125635b77b4fecb4c738aa (diff) | |
Fixes for writing 3D CPLs.
Diffstat (limited to 'src')
| -rw-r--r-- | src/picture_asset.cc | 22 | ||||
| -rw-r--r-- | src/picture_asset.h | 12 | ||||
| -rw-r--r-- | src/picture_asset_writer.cc | 5 |
3 files changed, 30 insertions, 9 deletions
diff --git a/src/picture_asset.cc b/src/picture_asset.cc index cba5ecef..c1805e6f 100644 --- a/src/picture_asset.cc +++ b/src/picture_asset.cc @@ -68,11 +68,29 @@ PictureAsset::PictureAsset (string directory, string mxf_name) } string -PictureAsset::cpl_node_name () const +MonoPictureAsset::cpl_node_name () const { return "MainPicture"; } +int +MonoPictureAsset::edit_rate_factor () const +{ + return 1; +} + +string +StereoPictureAsset::cpl_node_name () const +{ + return "MainStereoscopicPicture"; +} + +int +StereoPictureAsset::edit_rate_factor () const +{ + return 2; +} + void PictureAsset::write_to_cpl (xmlpp::Node* node) const { @@ -86,7 +104,7 @@ PictureAsset::write_to_cpl (xmlpp::Node* node) const assert (i != c.end ()); - (*i)->add_child ("FrameRate")->add_child_text (lexical_cast<string> (_edit_rate) + " 1"); + (*i)->add_child ("FrameRate")->add_child_text (lexical_cast<string> (_edit_rate * edit_rate_factor ()) + " 1"); (*i)->add_child ("ScreenAspectRatio")->add_child_text (lexical_cast<string> (_size.width) + " " + lexical_cast<string> (_size.height)); } diff --git a/src/picture_asset.h b/src/picture_asset.h index 2031a9ed..58d9c748 100644 --- a/src/picture_asset.h +++ b/src/picture_asset.h @@ -81,12 +81,10 @@ protected: private: std::string key_type () const; - std::string cpl_node_name () const; + std::string cpl_node_name () const = 0; + virtual int edit_rate_factor () const = 0; }; -class MonoPictureAsset; - - /** A 2D (monoscopic) picture asset */ class MonoPictureAsset : public PictureAsset { @@ -164,6 +162,8 @@ public: private: std::string path_from_list (int f, std::vector<std::string> const & files) const; void construct (boost::function<std::string (int)>, MXFMetadata const &); + std::string cpl_node_name () const; + int edit_rate_factor () const; }; /** A 3D (stereoscopic) picture asset */ @@ -187,6 +187,10 @@ public: boost::shared_ptr<const StereoPictureFrame> get_frame (int n) const; bool equals (boost::shared_ptr<const Asset> other, EqualityOptions opt, boost::function<void (NoteType, std::string)> note) const; + +private: + std::string cpl_node_name () const; + int edit_rate_factor () const; }; diff --git a/src/picture_asset_writer.cc b/src/picture_asset_writer.cc index 18e509d6..32e13a17 100644 --- a/src/picture_asset_writer.cc +++ b/src/picture_asset_writer.cc @@ -183,7 +183,6 @@ StereoPictureAssetWriter::write (uint8_t* data, int size, Eye eye) boost::throw_exception (MXFFileError ("error in writing video MXF", _asset->path().string())); } - ++_frames_written; return FrameInfo (before_offset, _state->mxf_writer.Tell() - before_offset, hash); } @@ -237,6 +236,6 @@ StereoPictureAssetWriter::finalize () } _finalized = true; - _asset->set_intrinsic_duration (_frames_written); - _asset->set_duration (_frames_written); + _asset->set_intrinsic_duration (_frames_written / 2); + _asset->set_duration (_frames_written / 2); } |
