Still more licence fixups.
[libdcp.git] / src / atmos_asset.cc
1 /*
2     Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
3
4     This file is part of libdcp.
5
6     libdcp is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     libdcp is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with libdcp.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include "atmos_asset.h"
21 #include "exceptions.h"
22 #include "AS_DCP.h"
23
24 using std::string;
25 using namespace dcp;
26
27 AtmosAsset::AtmosAsset (boost::filesystem::path file)
28         : Asset (file)
29 {
30         ASDCP::ATMOS::MXFReader reader;
31         Kumu::Result_t r = reader.OpenRead (file.string().c_str());
32         if (ASDCP_FAILURE (r)) {
33                 boost::throw_exception (MXFFileError ("could not open MXF file for reading", file.string(), r));
34         }
35
36         ASDCP::ATMOS::AtmosDescriptor desc;
37         if (ASDCP_FAILURE (reader.FillAtmosDescriptor (desc))) {
38                 boost::throw_exception (DCPReadError ("could not read Atmos MXF information"));
39         }
40
41         _edit_rate = Fraction (desc.EditRate.Numerator, desc.EditRate.Denominator);
42         _intrinsic_duration = desc.ContainerDuration;
43         _first_frame = desc.FirstFrame;
44         _max_channel_count = desc.MaxChannelCount;
45         _max_object_count = desc.MaxObjectCount;
46 }
47
48 string
49 AtmosAsset::pkl_type (Standard) const
50 {
51         return "application/mxf";
52 }