From 0251d3f2986bf70d4721b7127ca6ddcc9da3b256 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 22 Aug 2012 18:57:05 +0100 Subject: Add basic example; tweak bits and pieces. --- src/dcp.cc | 6 +++--- src/picture_asset.cc | 8 ++++++-- src/sound_asset.cc | 4 +++- 3 files changed, 12 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/dcp.cc b/src/dcp.cc index 65a6a826..d3c5367b 100644 --- a/src/dcp.cc +++ b/src/dcp.cc @@ -52,7 +52,7 @@ DCP::DCP (string directory, string name, ContentKind content_kind, int fps, int , _fps (fps) , _length (length) { - + filesystem::create_directories (directory); } void @@ -274,8 +274,8 @@ DCP::DCP (string directory) p = (*i)->asset_list->main_stereoscopic_picture; } - assert (_fps == 0 || _fps == p->frame_rate.numerator); - _fps = p->frame_rate.numerator; + assert (_fps == 0 || _fps == p->edit_rate.numerator); + _fps = p->edit_rate.numerator; _length += p->duration; shared_ptr picture; diff --git a/src/picture_asset.cc b/src/picture_asset.cc index 3fbc0947..abc902d4 100644 --- a/src/picture_asset.cc +++ b/src/picture_asset.cc @@ -280,6 +280,8 @@ MonoPictureAsset::construct (sigc::slot get_path) for (int i = 0; i < _length; ++i) { string const path = get_path (i); + + cout << "reading " << path << "\n"; if (ASDCP_FAILURE (j2k_parser.OpenReadFrame (path.c_str(), frame_buffer))) { throw FileError ("could not open JPEG2000 file for reading", path); @@ -289,8 +291,10 @@ MonoPictureAsset::construct (sigc::slot get_path) if (ASDCP_FAILURE (mxf_writer.WriteFrame (frame_buffer, 0, 0))) { throw MiscError ("error in writing video MXF"); } - - (*_progress) (0.5 * float (i) / _length); + + if (_progress) { + (*_progress) (0.5 * float (i) / _length); + } } if (ASDCP_FAILURE (mxf_writer.Finalize())) { diff --git a/src/sound_asset.cc b/src/sound_asset.cc index 75ca3a76..732bb610 100644 --- a/src/sound_asset.cc +++ b/src/sound_asset.cc @@ -170,7 +170,9 @@ SoundAsset::construct (sigc::slot get_path) throw MiscError ("could not write audio MXF frame"); } - (*_progress) (0.5 * float (i) / _length); + if (_progress) { + (*_progress) (0.5 * float (i) / _length); + } } if (ASDCP_FAILURE (mxf_writer.Finalize())) { -- cgit v1.2.3