X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Freel_writer.cc;h=b5a95d8b1d6e03a1b214632bac04318f133bb9f7;hb=313319ba2d8544bc25524e02e634804a503b54f1;hp=7b9ea09bf469cc03e003099c00346bc17047752b;hpb=689bf63d32a8276477ab12e83bd47a5ff67d3eae;p=dcpomatic.git diff --git a/src/lib/reel_writer.cc b/src/lib/reel_writer.cc index 7b9ea09bf..b5a95d8b1 100644 --- a/src/lib/reel_writer.cc +++ b/src/lib/reel_writer.cc @@ -18,18 +18,19 @@ */ -#include "reel_writer.h" -#include "film.h" + +#include "audio_buffers.h" +#include "compose.hpp" +#include "config.h" #include "cross.h" -#include "job.h" -#include "log.h" #include "dcpomatic_log.h" #include "digester.h" +#include "film.h" #include "font_data.h" -#include "compose.hpp" -#include "config.h" -#include "audio_buffers.h" #include "image.h" +#include "job.h" +#include "log.h" +#include "reel_writer.h" #include #include #include @@ -56,28 +57,30 @@ #include "i18n.h" -using std::list; -using std::string; -using std::cout; + +using std::dynamic_pointer_cast; using std::exception; +using std::list; +using std::make_shared; using std::map; using std::set; -using std::vector; using std::shared_ptr; -using std::make_shared; +using std::string; +using std::vector; +using std::weak_ptr; using boost::optional; -using std::dynamic_pointer_cast; #if BOOST_VERSION >= 106100 using namespace boost::placeholders; #endif -using std::weak_ptr; using dcp::ArrayData; using dcp::Data; using dcp::raw_convert; using namespace dcpomatic; + int const ReelWriter::_info_size = 48; + static dcp::MXFMetadata mxf_metadata () { @@ -95,6 +98,7 @@ mxf_metadata () return meta; } + /** @param job Related job, or 0. * @param text_only true to enable a special mode where the writer will expect only subtitles and closed captions to be written * (no picture nor sound) and not give errors in that case. This is used by the hints system to check the potential sizes of @@ -197,6 +201,7 @@ ReelWriter::ReelWriter ( _default_font = dcp::ArrayData(default_font_file()); } + /** @param frame reel-relative frame */ void ReelWriter::write_frame_info (Frame frame, Eyes eyes, dcp::FrameInfo info) const @@ -208,6 +213,7 @@ ReelWriter::write_frame_info (Frame frame, Eyes eyes, dcp::FrameInfo info) const checked_fwrite (info.hash.c_str(), info.hash.size(), handle->get(), handle->file()); } + dcp::FrameInfo ReelWriter::read_frame_info (shared_ptr info, Frame frame, Eyes eyes) const { @@ -224,6 +230,7 @@ ReelWriter::read_frame_info (shared_ptr info, Frame frame, Eyes return frame_info; } + long ReelWriter::frame_info_position (Frame frame, Eyes eyes) const { @@ -241,6 +248,7 @@ ReelWriter::frame_info_position (Frame frame, Eyes eyes) const DCPOMATIC_ASSERT (false); } + Frame ReelWriter::check_existing_picture_asset (boost::filesystem::path asset) { @@ -299,6 +307,7 @@ ReelWriter::check_existing_picture_asset (boost::filesystem::path asset) return first_nonexistant_frame; } + void ReelWriter::write (shared_ptr encoded, Frame frame, Eyes eyes) { @@ -340,6 +349,7 @@ ReelWriter::fake_write (int size) _picture_asset_writer->fake_write (size); } + void ReelWriter::repeat_write (Frame frame, Eyes eyes) { @@ -355,6 +365,7 @@ ReelWriter::repeat_write (Frame frame, Eyes eyes) write_frame_info (frame, eyes, fin); } + void ReelWriter::finish (boost::filesystem::path output_dcp) { @@ -440,6 +451,10 @@ ReelWriter::finish (boost::filesystem::path output_dcp) } } + +/** Try to make a ReelAsset for a subtitles or closed captions in a given period in the DCP. + * A SubtitleAsset can be provided, or we will use one from @ref refs if not. + */ template shared_ptr maybe_add_text ( @@ -681,7 +696,6 @@ ReelWriter::create_reel_text ( } - void ReelWriter::create_reel_markers (shared_ptr reel) const { @@ -695,7 +709,7 @@ ReelWriter::create_reel_markers (shared_ptr reel) const } if (!reel_markers.empty ()) { - auto ma = make_shared(dcp::Fraction(film()->video_frame_rate(), 1), reel->duration(), 0); + auto ma = make_shared(dcp::Fraction(film()->video_frame_rate(), 1), reel->duration()); for (auto const& i: reel_markers) { DCPTime relative = i.second - _period.from; auto hmsf = relative.split (film()->video_frame_rate()); @@ -764,6 +778,7 @@ try */ } + Frame ReelWriter::start () const { @@ -836,7 +851,8 @@ ReelWriter::empty_text_asset (TextType type, optional track, bool dcp::Effect::NONE, dcp::Colour(), dcp::Time(), - dcp::Time() + dcp::Time(), + 0 ) ); } @@ -902,6 +918,7 @@ ReelWriter::write (PlayerText subs, TextType type, optional track, } } + bool ReelWriter::existing_picture_frame_ok (FILE* asset_file, shared_ptr info_file, Frame frame) const {