diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-08-12 20:52:15 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-08-12 20:52:15 +0100 |
| commit | 916247147468aee47354ebb3088f47b8a56fcccf (patch) | |
| tree | 90fb72f6312a8935bf61ec5affaf82f7bb8b88f6 /src/picture_asset.cc | |
| parent | bc09fbc79580f56c93e35de25230af18b30e0e1e (diff) | |
Don't crash with no audio; get video MXF information from the MXF itself; get sampling rate from audio MXF.for-dcptovideo
Diffstat (limited to 'src/picture_asset.cc')
| -rw-r--r-- | src/picture_asset.cc | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/picture_asset.cc b/src/picture_asset.cc index 84c187df..7b6dd293 100644 --- a/src/picture_asset.cc +++ b/src/picture_asset.cc @@ -72,11 +72,21 @@ PictureAsset::PictureAsset ( construct (sigc::bind (sigc::mem_fun (*this, &PictureAsset::path_from_list), files)); } -PictureAsset::PictureAsset (string directory, string mxf_name, int fps, int length, int width, int height) +PictureAsset::PictureAsset (string directory, string mxf_name, int fps, int length) : Asset (directory, mxf_name, 0, fps, length) - , _width (width) - , _height (height) { + ASDCP::JP2K::MXFReader reader; + if (ASDCP_FAILURE (reader.OpenRead (mxf_path().string().c_str()))) { + throw FileError ("could not open MXF file for reading", mxf_path().string()); + } + + ASDCP::JP2K::PictureDescriptor desc; + if (ASDCP_FAILURE (reader.FillPictureDescriptor (desc))) { + throw DCPReadError ("could not read video MXF information"); + } + + _width = desc.StoredWidth; + _height = desc.StoredHeight; } |
