40 #include "filesystem.h"
43 using std::shared_ptr;
49 class MPEG2PictureAssetWriter;
54 ASDCP::MPEG2::Parser mpeg2_parser;
55 ASDCP::WriterInfo writer_info;
56 ASDCP::MPEG2::VideoDescriptor video_descriptor;
63 template <
class P,
class Q>
64 void dcp::start(MPEG2PictureAssetWriter* writer, shared_ptr<P> state, Q* asset, uint8_t
const * data,
int size)
66 asset->set_file (writer->_file);
68 if (ASDCP_FAILURE(state->mpeg2_parser.OpenRead(data, size))) {
69 boost::throw_exception(MiscError(
"could not parse MPEG2 frame"));
72 state->mpeg2_parser.FillVideoDescriptor(state->video_descriptor);
73 state->video_descriptor.EditRate = ASDCP::Rational(asset->edit_rate().numerator, asset->edit_rate().denominator);
75 asset->set_size(Size(state->video_descriptor.StoredWidth, state->video_descriptor.StoredHeight));
76 asset->set_screen_aspect_ratio(Fraction(state->video_descriptor.AspectRatio.Numerator, state->video_descriptor.AspectRatio.Denominator));
78 asset->fill_writer_info(&state->writer_info, asset->id());
80 auto r = state->mxf_writer.OpenWrite(
81 dcp::filesystem::fix_long_path(*asset->file()).string().c_str(),
83 state->video_descriptor,
88 if (ASDCP_FAILURE(r)) {
89 boost::throw_exception(MXFFileError(
"could not open MXF file for writing", asset->file()->string(), r));
92 writer->_started =
true;
Namespace for everything in libdcp.