46 LIBDCP_DISABLE_WARNINGS
47 #include <asdcp/AS_DCP.h>
48 #include <asdcp/KM_fileio.h>
49 LIBDCP_ENABLE_WARNINGS
56 using std::shared_ptr;
60 struct MonoPictureAssetWriter::ASDCPState :
public ASDCPStateBase
62 ASDCP::JP2K::MXFWriter mxf_writer;
78 MonoPictureAssetWriter::start (uint8_t
const * data,
int size)
80 dcp::start (
this, _state, _picture_asset, data, size);
81 _picture_asset->set_frame_rate (_picture_asset->edit_rate());
86 MonoPictureAssetWriter::write (uint8_t
const * data,
int size)
94 if (ASDCP_FAILURE (_state->j2k_parser.OpenReadFrame(data, size, _state->frame_buffer))) {
95 boost::throw_exception (
MiscError (
"could not parse J2K frame"));
98 uint64_t
const before_offset = _state->mxf_writer.Tell ();
101 auto const r = _state->mxf_writer.WriteFrame (_state->frame_buffer, _crypto_context->context(), _crypto_context->hmac(), &hash);
102 if (ASDCP_FAILURE(r)) {
103 boost::throw_exception (
MXFFileError (
"error in writing video MXF",
_file.string(), r));
107 return FrameInfo (before_offset, _state->mxf_writer.Tell() - before_offset, hash);
112 MonoPictureAssetWriter::fake_write (
int size)
117 auto r = _state->mxf_writer.FakeWriteFrame (size);
118 if (ASDCP_FAILURE(r)) {
119 boost::throw_exception (
MXFFileError(
"error in writing video MXF",
_file.string(), r));
130 auto r = _state->mxf_writer.Finalize();
131 if (ASDCP_FAILURE(r)) {
132 boost::throw_exception (
MXFFileError(
"error in finalizing video MXF",
_file.string(), r));
boost::filesystem::path _file
An exception related to an MXF file.
A miscellaneous exception.
A helper class for writing to MonoPictureAssets.
MonoPictureAssetWriter(PictureAsset *a, boost::filesystem::path file, bool)
Parent class for classes which write picture assets.
An asset made up of JPEG2000 data.
int64_t _intrinsic_duration
Exceptions thrown by libdcp.
MonoPictureAssetWriter class.
Namespace for everything in libdcp.
Common parts of PictureAssetWriter.
Information about a single frame (either a monoscopic frame or a left or right eye stereoscopic frame...