44 #include <asdcp/AS_DCP.h>
45 #include <asdcp/KM_fileio.h>
49 using std::shared_ptr;
50 using std::make_shared;
54 AtmosAsset::AtmosAsset (
Fraction edit_rate,
int first_frame,
int max_channel_count,
int max_object_count,
int atmos_version)
55 :
MXF (Standard::SMPTE)
56 , _edit_rate (edit_rate)
57 , _first_frame (first_frame)
58 , _max_channel_count (max_channel_count)
59 , _max_object_count (max_object_count)
60 , _atmos_id (make_uuid())
61 , _atmos_version (atmos_version)
67 AtmosAsset::AtmosAsset (boost::filesystem::path file)
69 ,
MXF (Standard::SMPTE)
71 Kumu::FileReaderFactory factory;
72 ASDCP::ATMOS::MXFReader reader(factory);
73 auto r = reader.OpenRead(dcp::filesystem::fix_long_path(file).
string().c_str());
74 if (ASDCP_FAILURE (r)) {
75 boost::throw_exception (
MXFFileError(
"could not open MXF file for reading", file.string(), r));
78 ASDCP::ATMOS::AtmosDescriptor desc;
79 if (ASDCP_FAILURE (reader.FillAtmosDescriptor (desc))) {
80 boost::throw_exception (
ReadError(
"could not read Atmos MXF information"));
83 _edit_rate =
Fraction (desc.EditRate.Numerator, desc.EditRate.Denominator);
84 _intrinsic_duration = desc.ContainerDuration;
85 _first_frame = desc.FirstFrame;
86 _max_channel_count = desc.MaxChannelCount;
87 _max_object_count = desc.MaxObjectCount;
90 Kumu::bin2UUIDhex (desc.AtmosID, ASDCP::UUIDlen,
id,
sizeof(
id));
93 _atmos_version = desc.AtmosVersion;
95 ASDCP::WriterInfo info;
96 if (ASDCP_FAILURE (reader.FillWriterInfo(info))) {
97 boost::throw_exception (
ReadError (
"could not read audio MXF information"));
100 _id = read_writer_info (info);
105 AtmosAsset::static_pkl_type (Standard)
107 return "application/mxf";
111 shared_ptr<AtmosAssetReader>
112 AtmosAsset::start_read ()
const
119 shared_ptr<AtmosAssetWriter>
120 AtmosAsset::start_write (boost::filesystem::path file)
AtmosAssetReader typedef.
Parent class for DCP assets, i.e. picture, sound, subtitles, closed captions, CPLs,...
boost::optional< boost::filesystem::path > file() const
A helper class for writing to AtmosAssets.
A fraction (i.e. a thing with an integer numerator and an integer denominator).
An exception related to an MXF file.
Parent for classes which represent MXF files.
boost::optional< Key > key() const
Any error that occurs when reading data from a DCP.
Exceptions thrown by libdcp.
Namespace for everything in libdcp.