40 #include "filesystem.h"
43 using std::shared_ptr;
52 : frame_buffer (4 * Kumu::Megabyte)
55 ASDCP::JP2K::CodestreamParser j2k_parser;
56 ASDCP::JP2K::FrameBuffer frame_buffer;
57 ASDCP::WriterInfo writer_info;
58 ASDCP::JP2K::PictureDescriptor picture_descriptor;
65 template <
class P,
class Q>
66 void dcp::start (J2KPictureAssetWriter* writer, shared_ptr<P> state, Q* asset, uint8_t
const * data,
int size)
68 asset->set_file (writer->_file);
70 if (ASDCP_FAILURE (state->j2k_parser.OpenReadFrame(data, size, state->frame_buffer))) {
71 boost::throw_exception (MiscError (
"could not parse J2K frame"));
74 state->j2k_parser.FillPictureDescriptor (state->picture_descriptor);
75 state->picture_descriptor.EditRate = ASDCP::Rational (asset->edit_rate().numerator, asset->edit_rate().denominator);
77 asset->set_size (Size (state->picture_descriptor.StoredWidth, state->picture_descriptor.StoredHeight));
78 asset->set_screen_aspect_ratio (Fraction (state->picture_descriptor.AspectRatio.Numerator, state->picture_descriptor.AspectRatio.Denominator));
80 asset->fill_writer_info (&state->writer_info, asset->id());
82 auto r = state->mxf_writer.OpenWrite(
83 dcp::filesystem::fix_long_path(*asset->file()).string().c_str(),
85 state->picture_descriptor,
90 if (ASDCP_FAILURE(r)) {
91 boost::throw_exception (MXFFileError(
"could not open MXF file for writing", asset->file()->string(), r));
94 writer->_started =
true;
Namespace for everything in libdcp.