diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-06-04 17:16:22 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-06-05 14:34:43 +0100 |
| commit | 2293c14a21f8a4929abd8b97033699f5d3bba1dc (patch) | |
| tree | a756d20b8cdfdfbbbd26eafb4addcd4d32042adf | |
| parent | 6c55e8d2c3b0129a19fc40dca344219021ad12ef (diff) | |
Move edit rate and intrinsic duration out of MXF.
| -rw-r--r-- | src/mono_picture_mxf_writer.cc | 1 | ||||
| -rw-r--r-- | src/mxf.cc | 21 | ||||
| -rw-r--r-- | src/mxf.h | 19 | ||||
| -rw-r--r-- | src/mxf_writer.cc | 1 | ||||
| -rw-r--r-- | src/picture_mxf.cc | 4 | ||||
| -rw-r--r-- | src/picture_mxf.h | 15 | ||||
| -rw-r--r-- | src/sound_mxf.cc | 4 | ||||
| -rw-r--r-- | src/sound_mxf.h | 15 | ||||
| -rw-r--r-- | src/sound_mxf_writer.cc | 1 | ||||
| -rw-r--r-- | src/stereo_picture_mxf_writer.cc | 1 |
10 files changed, 44 insertions, 38 deletions
diff --git a/src/mono_picture_mxf_writer.cc b/src/mono_picture_mxf_writer.cc index 01292876..7d8335c0 100644 --- a/src/mono_picture_mxf_writer.cc +++ b/src/mono_picture_mxf_writer.cc @@ -105,6 +105,7 @@ MonoPictureMXFWriter::finalize () boost::throw_exception (MXFFileError ("error in finalizing video MXF", _mxf->file().string(), r)); } + _picture_mxf->_intrinsic_duration = _frames_written; PictureMXFWriter::finalize (); } @@ -42,22 +42,19 @@ using boost::shared_ptr; using boost::dynamic_pointer_cast; using namespace dcp; -MXF::MXF (Fraction edit_rate) - : _edit_rate (edit_rate) - , _intrinsic_duration (0) - , _encryption_context (0) +MXF::MXF () + : _encryption_context (0) , _decryption_context (0) { - /* _intrinsic_duration must be set up up by a subclass */ + } MXF::MXF (boost::filesystem::path file) : Asset (file) - , _intrinsic_duration (0) , _encryption_context (0) , _decryption_context (0) { - /* _edit_rate and _intrinsic_duration must be set up up by a subclass */ + } MXF::~MXF () @@ -104,16 +101,6 @@ MXF::equals (shared_ptr<const Asset> other, EqualityOptions opt, NoteHandler not return false; } - if (_edit_rate != other_mxf->_edit_rate) { - note (DCP_ERROR, "MXF: edit rates differ"); - return false; - } - - if (_intrinsic_duration != other_mxf->_intrinsic_duration) { - note (DCP_ERROR, String::compose ("MXF: intrinsic durations differ (%1 vs %2)", _intrinsic_duration, other_mxf->_intrinsic_duration)); - return false; - } - if (_file.leaf() != other_mxf->file().leaf()) { if (!opt.mxf_filenames_can_differ) { note (DCP_ERROR, "MXF: filenames differ"); @@ -47,7 +47,7 @@ class MXFMetadata; class MXF : public Asset { public: - MXF (Fraction edit_rate); + MXF (); MXF (boost::filesystem::path file); ~MXF (); @@ -103,17 +103,6 @@ public: MXFMetadata metadata () const { return _metadata; } - - Fraction edit_rate () const { - return _edit_rate; - } - - /** @return The total length of this content in video frames. - * The amount of content presented may be less than this. - */ - int64_t intrinsic_duration () const { - return _intrinsic_duration; - } protected: friend class MXFWriter; @@ -122,12 +111,6 @@ protected: std::string pkl_type (Standard standard) const; void read_writer_info (ASDCP::WriterInfo const &); - Fraction _edit_rate; - /** The total length of this content in video frames. The amount of - * content presented may be less than this. - */ - int64_t _intrinsic_duration; - ASDCP::AESEncContext* _encryption_context; ASDCP::AESDecContext* _decryption_context; /** ID of the key used for encryption/decryption, or an empty string */ diff --git a/src/mxf_writer.cc b/src/mxf_writer.cc index 93f3ab07..d4aba72f 100644 --- a/src/mxf_writer.cc +++ b/src/mxf_writer.cc @@ -50,5 +50,4 @@ MXFWriter::finalize () { DCP_ASSERT (!_finalized); _finalized = true; - _mxf->_intrinsic_duration = _frames_written; } diff --git a/src/picture_mxf.cc b/src/picture_mxf.cc index 46aa7752..f3a1cd0b 100644 --- a/src/picture_mxf.cc +++ b/src/picture_mxf.cc @@ -48,12 +48,14 @@ using namespace dcp; PictureMXF::PictureMXF (boost::filesystem::path file) : MXF (file) + , _intrinsic_duration (0) { } PictureMXF::PictureMXF (Fraction edit_rate) - : MXF (edit_rate) + : _edit_rate (edit_rate) + , _intrinsic_duration (0) { } diff --git a/src/picture_mxf.h b/src/picture_mxf.h index 75119367..f2c3192e 100644 --- a/src/picture_mxf.h +++ b/src/picture_mxf.h @@ -81,7 +81,17 @@ public: _screen_aspect_ratio = r; } + Fraction edit_rate () const { + return _edit_rate; + } + + int64_t intrinsic_duration () const { + return _intrinsic_duration; + } + protected: + friend class MonoPictureMXFWriter; + friend class StereoPictureMXFWriter; bool frame_buffer_equals ( int frame, EqualityOptions opt, NoteHandler note, @@ -96,6 +106,11 @@ protected: void read_picture_descriptor (ASDCP::JP2K::PictureDescriptor const &); + Fraction _edit_rate; + /** The total length of this content in video frames. The amount of + * content presented may be less than this. + */ + int64_t _intrinsic_duration; /** picture size in pixels */ Size _size; Fraction _frame_rate; diff --git a/src/sound_mxf.cc b/src/sound_mxf.cc index e338c161..6e952bd0 100644 --- a/src/sound_mxf.cc +++ b/src/sound_mxf.cc @@ -44,6 +44,7 @@ using namespace dcp; SoundMXF::SoundMXF (boost::filesystem::path file) : MXF (file) + , _intrinsic_duration (0) , _channels (0) , _sampling_rate (0) { @@ -74,7 +75,8 @@ SoundMXF::SoundMXF (boost::filesystem::path file) } SoundMXF::SoundMXF (Fraction edit_rate, int sampling_rate, int channels) - : MXF (edit_rate) + : _edit_rate (edit_rate) + , _intrinsic_duration (0) , _channels (channels) , _sampling_rate (sampling_rate) { diff --git a/src/sound_mxf.h b/src/sound_mxf.h index 80585055..a8746311 100644 --- a/src/sound_mxf.h +++ b/src/sound_mxf.h @@ -63,11 +63,26 @@ public: return _sampling_rate; } + Fraction edit_rate () const { + return _edit_rate; + } + + int64_t intrinsic_duration () const { + return _intrinsic_duration; + } + private: + friend class SoundMXFWriter; + std::string asdcp_kind () const { return "Sound"; } + Fraction _edit_rate; + /** The total length of this content in video frames. The amount of + * content presented may be less than this. + */ + int64_t _intrinsic_duration; int _channels; ///< number of channels int _sampling_rate; ///< sampling rate in Hz }; diff --git a/src/sound_mxf_writer.cc b/src/sound_mxf_writer.cc index 52547b16..19250d9d 100644 --- a/src/sound_mxf_writer.cc +++ b/src/sound_mxf_writer.cc @@ -117,5 +117,6 @@ SoundMXFWriter::finalize () boost::throw_exception (MiscError ("could not finalise audio MXF")); } + _sound_mxf->_intrinsic_duration = _frames_written; MXFWriter::finalize (); } diff --git a/src/stereo_picture_mxf_writer.cc b/src/stereo_picture_mxf_writer.cc index 2c0468f6..a4bd7d9f 100644 --- a/src/stereo_picture_mxf_writer.cc +++ b/src/stereo_picture_mxf_writer.cc @@ -118,5 +118,6 @@ StereoPictureMXFWriter::finalize () boost::throw_exception (MXFFileError ("error in finalizing video MXF", _mxf->file().string(), r)); } + _picture_mxf->_intrinsic_duration = _frames_written; PictureMXFWriter::finalize (); } |
