summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-01-17 20:23:43 +0000
committerCarl Hetherington <cth@carlh.net>2013-01-17 20:23:43 +0000
commitf150c837cdc6eeee8f61e743586ddbaf2a8c8010 (patch)
treef41d9caa339762701e462ce3dd64b786481d2909 /src
parent828c320df8c56208a8834971f5d937ce06a4edf2 (diff)
Replace length with intrinsic_duration.
Diffstat (limited to 'src')
-rw-r--r--src/cpl_file.h3
-rw-r--r--src/mxf_asset.cc12
-rw-r--r--src/mxf_asset.h10
-rw-r--r--src/picture_asset.cc32
-rw-r--r--src/picture_asset.h14
-rw-r--r--src/sound_asset.cc22
-rw-r--r--src/sound_asset.h10
7 files changed, 53 insertions, 50 deletions
diff --git a/src/cpl_file.h b/src/cpl_file.h
index 67b38a0d..44115401 100644
--- a/src/cpl_file.h
+++ b/src/cpl_file.h
@@ -37,8 +37,11 @@ public:
std::string id;
std::string annotation_text;
Fraction edit_rate;
+ /** Duration of the whole thing */
int64_t intrinsic_duration;
+ /** Start point in frames */
int64_t entry_point;
+ /** Duration that will actually play */
int64_t duration;
Fraction frame_rate;
Fraction screen_aspect_ratio;
diff --git a/src/mxf_asset.cc b/src/mxf_asset.cc
index 7e40f0e0..338d125f 100644
--- a/src/mxf_asset.cc
+++ b/src/mxf_asset.cc
@@ -36,12 +36,12 @@ using boost::shared_ptr;
using boost::dynamic_pointer_cast;
using namespace libdcp;
-MXFAsset::MXFAsset (string directory, string file_name, boost::signals2::signal<void (float)>* progress, int fps, int length)
+MXFAsset::MXFAsset (string directory, string file_name, boost::signals2::signal<void (float)>* progress, int fps, int intrinsic_duration)
: Asset (directory, file_name)
, _progress (progress)
, _fps (fps)
, _entry_point (0)
- , _length (length)
+ , _intrinsic_duration (intrinsic_duration)
{
}
@@ -84,8 +84,8 @@ MXFAsset::equals (shared_ptr<const Asset> other, EqualityOptions, list<string>&
return false;
}
- if (_length != other_mxf->_length) {
- notes.push_back ("MXF lengths differ");
+ if (_intrinsic_duration != other_mxf->_intrinsic_duration) {
+ notes.push_back ("MXF intrinsic durations differ");
return false;
}
@@ -93,7 +93,7 @@ MXFAsset::equals (shared_ptr<const Asset> other, EqualityOptions, list<string>&
}
int
-MXFAsset::length () const
+MXFAsset::intrinsic_duration () const
{
- return _length;
+ return _intrinsic_duration;
}
diff --git a/src/mxf_asset.h b/src/mxf_asset.h
index 798a7e50..10049232 100644
--- a/src/mxf_asset.h
+++ b/src/mxf_asset.h
@@ -35,15 +35,15 @@ public:
* @param file_name Name of MXF file.
* @param progress Signal to inform of progress.
* @param fps Frames per second.
- * @param length Length in frames.
+ * @param intrinsic_duration Duration of the whole asset in frames.
*/
- MXFAsset (std::string directory, std::string file_name, boost::signals2::signal<void (float)>* progress, int fps, int length);
+ MXFAsset (std::string directory, std::string file_name, boost::signals2::signal<void (float)>* progress, int fps, int intrinsic_duration);
void set_entry_point (int e);
virtual bool equals (boost::shared_ptr<const Asset> other, EqualityOptions opt, std::list<std::string>& notes) const;
- int length () const;
+ int intrinsic_duration () const;
protected:
/** Fill in a ADSCP::WriteInfo struct.
@@ -56,8 +56,8 @@ protected:
/** Frames per second */
int _fps;
int _entry_point;
- /** Length in frames */
- int _length;
+ /** Total length in frames */
+ int _intrinsic_duration;
};
}
diff --git a/src/picture_asset.cc b/src/picture_asset.cc
index e5d88a6e..905f75f5 100644
--- a/src/picture_asset.cc
+++ b/src/picture_asset.cc
@@ -46,8 +46,8 @@ using boost::dynamic_pointer_cast;
using boost::lexical_cast;
using namespace libdcp;
-PictureAsset::PictureAsset (string directory, string mxf_name, boost::signals2::signal<void (float)>* progress, int fps, int length)
- : MXFAsset (directory, mxf_name, progress, fps, length)
+PictureAsset::PictureAsset (string directory, string mxf_name, boost::signals2::signal<void (float)>* progress, int fps, int intrinsic_duration)
+ : MXFAsset (directory, mxf_name, progress, fps, intrinsic_duration)
{
}
@@ -59,9 +59,9 @@ PictureAsset::write_to_cpl (ostream& s) const
<< " <Id>urn:uuid:" << _uuid << "</Id>\n"
<< " <AnnotationText>" << _file_name << "</AnnotationText>\n"
<< " <EditRate>" << _fps << " 1</EditRate>\n"
- << " <IntrinsicDuration>" << _length << "</IntrinsicDuration>\n"
+ << " <IntrinsicDuration>" << _intrinsic_duration << "</IntrinsicDuration>\n"
<< " <EntryPoint>0</EntryPoint>\n"
- << " <Duration>" << _length << "</Duration>\n"
+ << " <Duration>" << _intrinsic_duration << "</Duration>\n"
<< " <FrameRate>" << _fps << " 1</FrameRate>\n"
<< " <ScreenAspectRatio>" << _size.width << " " << _size.height << "</ScreenAspectRatio>\n"
<< " </MainPicture>\n";
@@ -134,9 +134,9 @@ MonoPictureAsset::MonoPictureAsset (
string mxf_name,
boost::signals2::signal<void (float)>* progress,
int fps,
- int length,
+ int intrinsic_duration,
Size size)
- : PictureAsset (directory, mxf_name, progress, fps, length)
+ : PictureAsset (directory, mxf_name, progress, fps, intrinsic_duration)
{
_size = size;
construct (get_path);
@@ -148,16 +148,16 @@ MonoPictureAsset::MonoPictureAsset (
string mxf_name,
boost::signals2::signal<void (float)>* progress,
int fps,
- int length,
+ int intrinsic_duration,
Size size)
- : PictureAsset (directory, mxf_name, progress, fps, length)
+ : PictureAsset (directory, mxf_name, progress, fps, intrinsic_duration)
{
_size = size;
construct (boost::bind (&MonoPictureAsset::path_from_list, this, _1, files));
}
-MonoPictureAsset::MonoPictureAsset (string directory, string mxf_name, int fps, int length)
- : PictureAsset (directory, mxf_name, 0, fps, length)
+MonoPictureAsset::MonoPictureAsset (string directory, string mxf_name, int fps, int intrinsic_duration)
+ : PictureAsset (directory, mxf_name, 0, fps, intrinsic_duration)
{
ASDCP::JP2K::MXFReader reader;
if (ASDCP_FAILURE (reader.OpenRead (path().string().c_str()))) {
@@ -194,7 +194,7 @@ MonoPictureAsset::construct (boost::function<string (int)> get_path)
throw MXFFileError ("could not open MXF file for writing", path().string());
}
- for (int i = 0; i < _length; ++i) {
+ for (int i = 0; i < _intrinsic_duration; ++i) {
string const path = get_path (i);
@@ -208,7 +208,7 @@ MonoPictureAsset::construct (boost::function<string (int)> get_path)
}
if (_progress) {
- (*_progress) (0.5 * float (i) / _length);
+ (*_progress) (0.5 * float (i) / _intrinsic_duration);
}
}
@@ -240,7 +240,7 @@ MonoPictureAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt, li
shared_ptr<const MonoPictureAsset> other_picture = dynamic_pointer_cast<const MonoPictureAsset> (other);
assert (other_picture);
- for (int i = 0; i < _length; ++i) {
+ for (int i = 0; i < _intrinsic_duration; ++i) {
shared_ptr<const MonoPictureFrame> frame_A = get_frame (i);
shared_ptr<const MonoPictureFrame> frame_B = other_picture->get_frame (i);
@@ -266,7 +266,7 @@ StereoPictureAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt,
shared_ptr<const StereoPictureAsset> other_picture = dynamic_pointer_cast<const StereoPictureAsset> (other);
assert (other_picture);
- for (int i = 0; i < _length; ++i) {
+ for (int i = 0; i < _intrinsic_duration; ++i) {
shared_ptr<const StereoPictureFrame> frame_A = get_frame (i);
shared_ptr<const StereoPictureFrame> frame_B = other_picture->get_frame (i);
@@ -356,8 +356,8 @@ PictureAsset::frame_buffer_equals (
}
-StereoPictureAsset::StereoPictureAsset (string directory, string mxf_name, int fps, int length)
- : PictureAsset (directory, mxf_name, 0, fps, length)
+StereoPictureAsset::StereoPictureAsset (string directory, string mxf_name, int fps, int intrinsic_duration)
+ : PictureAsset (directory, mxf_name, 0, fps, intrinsic_duration)
{
ASDCP::JP2K::MXFSReader reader;
if (ASDCP_FAILURE (reader.OpenRead (path().string().c_str()))) {
diff --git a/src/picture_asset.h b/src/picture_asset.h
index 4bd7e8e4..d2c6f656 100644
--- a/src/picture_asset.h
+++ b/src/picture_asset.h
@@ -35,7 +35,7 @@ class StereoPictureFrame;
class PictureAsset : public MXFAsset
{
public:
- PictureAsset (std::string directory, std::string mxf_name, boost::signals2::signal<void (float)>* progress, int fps, int length);
+ PictureAsset (std::string directory, std::string mxf_name, boost::signals2::signal<void (float)>* progress, int fps, int intrinsic_duration);
/** Write details of this asset to a CPL stream.
* @param s Stream.
@@ -70,7 +70,7 @@ public:
* @param mxf_name Name of MXF file to create.
* @param progress Signal to inform of progress.
* @param fps Frames per second.
- * @param length Length in frames.
+ * @param intrinsic_duration Length of the whole asset in frames.
* @param size Size of images in pixels.
*/
MonoPictureAsset (
@@ -79,7 +79,7 @@ public:
std::string mxf_name,
boost::signals2::signal<void (float)>* progress,
int fps,
- int length,
+ int intrinsic_duration,
Size size
);
@@ -90,7 +90,7 @@ public:
* @param mxf_name Name of MXF file to create.
* @param progress Signal to inform of progress.
* @param fps Frames per second.
- * @param length Length in frames.
+ * @param intrinsic_duration Length of the whole asset in frames.
* @param size Size of images in pixels.
*/
MonoPictureAsset (
@@ -99,11 +99,11 @@ public:
std::string mxf_name,
boost::signals2::signal<void (float)>* progress,
int fps,
- int length,
+ int intrinsic_duration,
Size size
);
- MonoPictureAsset (std::string directory, std::string mxf_name, int fps, int length);
+ MonoPictureAsset (std::string directory, std::string mxf_name, int fps, int intrinsic_duration);
boost::shared_ptr<const MonoPictureFrame> get_frame (int n) const;
bool equals (boost::shared_ptr<const Asset> other, EqualityOptions opt, std::list<std::string>& notes) const;
@@ -117,7 +117,7 @@ private:
class StereoPictureAsset : public PictureAsset
{
public:
- StereoPictureAsset (std::string directory, std::string mxf_name, int fps, int length);
+ StereoPictureAsset (std::string directory, std::string mxf_name, int fps, int intrinsic_duration);
boost::shared_ptr<const StereoPictureFrame> get_frame (int n) const;
bool equals (boost::shared_ptr<const Asset> other, EqualityOptions opt, std::list<std::string>& notes) const;
diff --git a/src/sound_asset.cc b/src/sound_asset.cc
index 4f527409..07132665 100644
--- a/src/sound_asset.cc
+++ b/src/sound_asset.cc
@@ -42,9 +42,9 @@ using boost::lexical_cast;
using namespace libdcp;
SoundAsset::SoundAsset (
- vector<string> const & files, string directory, string mxf_name, boost::signals2::signal<void (float)>* progress, int fps, int length, int start_frame
+ vector<string> const & files, string directory, string mxf_name, boost::signals2::signal<void (float)>* progress, int fps, int intrinsic_duration, int start_frame
)
- : MXFAsset (directory, mxf_name, progress, fps, length)
+ : MXFAsset (directory, mxf_name, progress, fps, intrinsic_duration)
, _channels (files.size ())
, _sampling_rate (0)
, _start_frame (start_frame)
@@ -59,9 +59,9 @@ SoundAsset::SoundAsset (
string directory,
string mxf_name,
boost::signals2::signal<void (float)>* progress,
- int fps, int length, int start_frame, int channels
+ int fps, int intrinsic_duration, int start_frame, int channels
)
- : MXFAsset (directory, mxf_name, progress, fps, length)
+ : MXFAsset (directory, mxf_name, progress, fps, intrinsic_duration)
, _channels (channels)
, _sampling_rate (0)
, _start_frame (start_frame)
@@ -71,8 +71,8 @@ SoundAsset::SoundAsset (
construct (get_path);
}
-SoundAsset::SoundAsset (string directory, string mxf_name, int fps, int length)
- : MXFAsset (directory, mxf_name, 0, fps, length)
+SoundAsset::SoundAsset (string directory, string mxf_name, int fps, int intrinsic_duration)
+ : MXFAsset (directory, mxf_name, 0, fps, intrinsic_duration)
, _channels (0)
, _start_frame (0)
{
@@ -169,7 +169,7 @@ SoundAsset::construct (boost::function<string (Channel)> get_path)
}
}
- for (int i = 0; i < _length; ++i) {
+ for (int i = 0; i < _intrinsic_duration; ++i) {
for (int j = 0; j < _channels; ++j) {
memset (frame_buffer_channel[j].Data(), 0, frame_buffer_channel[j].Capacity());
@@ -197,7 +197,7 @@ SoundAsset::construct (boost::function<string (Channel)> get_path)
}
if (_progress) {
- (*_progress) (0.5 * float (i) / _length);
+ (*_progress) (0.5 * float (i) / _intrinsic_duration);
}
}
@@ -213,9 +213,9 @@ SoundAsset::write_to_cpl (ostream& s) const
<< " <Id>urn:uuid:" << _uuid << "</Id>\n"
<< " <AnnotationText>" << _file_name << "</AnnotationText>\n"
<< " <EditRate>" << _fps << " 1</EditRate>\n"
- << " <IntrinsicDuration>" << _length << "</IntrinsicDuration>\n"
+ << " <IntrinsicDuration>" << _intrinsic_duration << "</IntrinsicDuration>\n"
<< " <EntryPoint>0</EntryPoint>\n"
- << " <Duration>" << _length << "</Duration>\n"
+ << " <Duration>" << _intrinsic_duration << "</Duration>\n"
<< " </MainSound>\n";
}
@@ -265,7 +265,7 @@ SoundAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt, list<str
ASDCP::PCM::FrameBuffer buffer_A (1 * Kumu::Megabyte);
ASDCP::PCM::FrameBuffer buffer_B (1 * Kumu::Megabyte);
- for (int i = 0; i < _length; ++i) {
+ for (int i = 0; i < _intrinsic_duration; ++i) {
if (ASDCP_FAILURE (reader_A.ReadFrame (i, buffer_A))) {
throw DCPReadError ("could not read audio frame");
}
diff --git a/src/sound_asset.h b/src/sound_asset.h
index bd1811b1..95efccd6 100644
--- a/src/sound_asset.h
+++ b/src/sound_asset.h
@@ -43,7 +43,7 @@ public:
* @param mxf_name Name of MXF file to create.
* @param progress Signal to inform of progress.
* @param fps Frames per second.
- * @param length Length in frames.
+ * @param intrinsic_duration Length of the whole asset in frames.
* @param start_frame Frame in the source to start writing from.
*/
SoundAsset (
@@ -52,7 +52,7 @@ public:
std::string mxf_name,
boost::signals2::signal<void (float)>* progress,
int fps,
- int length,
+ int intrinsic_duration,
int start_frame
);
@@ -63,7 +63,7 @@ public:
* @param mxf_name Name of MXF file to create.
* @param progress Signal to inform of progress.
* @param fps Frames per second.
- * @param length Length in frames.
+ * @param intrinsic_duration Length of the whole asset in frames.
* @param start_frame Frame in the source to start writing from.
* @param channels Number of audio channels.
*/
@@ -73,7 +73,7 @@ public:
std::string mxf_name,
boost::signals2::signal<void (float)>* progress,
int fps,
- int length,
+ int intrinsic_duration,
int start_frame,
int channels
);
@@ -82,7 +82,7 @@ public:
std::string directory,
std::string mxf_name,
int fps,
- int length
+ int intrinsic_duration
);
/** Write details of this asset to a CPL stream.