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;
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)
{
}
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;
}
}
int
-MXFAsset::length () const
+MXFAsset::intrinsic_duration () const
{
- return _length;
+ return _intrinsic_duration;
}
* @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.
/** Frames per second */
int _fps;
int _entry_point;
- /** Length in frames */
- int _length;
+ /** Total length in frames */
+ int _intrinsic_duration;
};
}
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)
{
}
<< " <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";
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);
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()))) {
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);
}
if (_progress) {
- (*_progress) (0.5 * float (i) / _length);
+ (*_progress) (0.5 * float (i) / _intrinsic_duration);
}
}
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);
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);
}
-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()))) {
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.
* @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 (
std::string mxf_name,
boost::signals2::signal<void (float)>* progress,
int fps,
- int length,
+ int intrinsic_duration,
Size size
);
* @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 (
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;
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;
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)
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)
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)
{
}
}
- 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());
}
if (_progress) {
- (*_progress) (0.5 * float (i) / _length);
+ (*_progress) (0.5 * float (i) / _intrinsic_duration);
}
}
<< " <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";
}
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");
}
* @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 (
std::string mxf_name,
boost::signals2::signal<void (float)>* progress,
int fps,
- int length,
+ int intrinsic_duration,
int start_frame
);
* @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.
*/
std::string mxf_name,
boost::signals2::signal<void (float)>* progress,
int fps,
- int length,
+ int intrinsic_duration,
int start_frame,
int channels
);
std::string directory,
std::string mxf_name,
int fps,
- int length
+ int intrinsic_duration
);
/** Write details of this asset to a CPL stream.