#include "dcp_subtitle_content.h"
#include "util.h"
#include <libcxml/cxml.h>
-#include <dcp/smpte_subtitle_content.h>
+#include <dcp/smpte_subtitle_asset.h>
using std::string;
using std::list;
content.reset (new SubRipContent (film, path));
} else if (ext == ".xml") {
content.reset (new DCPSubtitleContent (film, path));
- } else if (ext == ".mxf" && dcp::SMPTESubtitleContent::valid_mxf (path)) {
+ } else if (ext == ".mxf" && dcp::SMPTESubtitleAsset::valid_mxf (path)) {
content.reset (new DCPSubtitleContent (film, path));
}
/* XXX: assuming we have some subs and they are all at the same time */
DCPOMATIC_ASSERT (!subs.empty ());
return ContentTimePeriod (
- ContentTime::from_seconds (subs.front().in().to_seconds()),
- ContentTime::from_seconds (subs.front().out().to_seconds())
+ ContentTime::from_seconds (subs.front().in().as_seconds()),
+ ContentTime::from_seconds (subs.front().out().as_seconds())
);
}
#include <dcp/dcp.h>
#include <dcp/cpl.h>
#include <dcp/reel.h>
-#include <dcp/mono_picture_mxf.h>
-#include <dcp/stereo_picture_mxf.h>
+#include <dcp/mono_picture_asset.h>
+#include <dcp/stereo_picture_asset.h>
#include <dcp/reel_picture_asset.h>
#include <dcp/reel_sound_asset.h>
#include <dcp/mono_picture_frame.h>
int64_t const frame = _next.frames (vfr);
if ((*_reel)->main_picture ()) {
- shared_ptr<dcp::PictureMXF> mxf = (*_reel)->main_picture()->mxf ();
- shared_ptr<dcp::MonoPictureMXF> mono = dynamic_pointer_cast<dcp::MonoPictureMXF> (mxf);
- shared_ptr<dcp::StereoPictureMXF> stereo = dynamic_pointer_cast<dcp::StereoPictureMXF> (mxf);
+ shared_ptr<dcp::PictureAsset> asset = (*_reel)->main_picture()->asset ();
+ shared_ptr<dcp::MonoPictureAsset> mono = dynamic_pointer_cast<dcp::MonoPictureAsset> (asset);
+ shared_ptr<dcp::StereoPictureAsset> stereo = dynamic_pointer_cast<dcp::StereoPictureAsset> (asset);
int64_t const entry_point = (*_reel)->main_picture()->entry_point ();
if (mono) {
- video (shared_ptr<ImageProxy> (new J2KImageProxy (mono->get_frame (entry_point + frame), mxf->size())), frame);
+ video (shared_ptr<ImageProxy> (new J2KImageProxy (mono->get_frame (entry_point + frame), asset->size())), frame);
} else {
video (
- shared_ptr<ImageProxy> (new J2KImageProxy (stereo->get_frame (entry_point + frame), mxf->size(), dcp::EYE_LEFT)),
+ shared_ptr<ImageProxy> (new J2KImageProxy (stereo->get_frame (entry_point + frame), asset->size(), dcp::EYE_LEFT)),
frame
);
video (
- shared_ptr<ImageProxy> (new J2KImageProxy (stereo->get_frame (entry_point + frame), mxf->size(), dcp::EYE_RIGHT)),
+ shared_ptr<ImageProxy> (new J2KImageProxy (stereo->get_frame (entry_point + frame), asset->size(), dcp::EYE_RIGHT)),
frame
);
}
if ((*_reel)->main_sound ()) {
int64_t const entry_point = (*_reel)->main_sound()->entry_point ();
- shared_ptr<const dcp::SoundFrame> sf = (*_reel)->main_sound()->mxf()->get_frame (entry_point + frame);
+ shared_ptr<const dcp::SoundFrame> sf = (*_reel)->main_sound()->asset()->get_frame (entry_point + frame);
uint8_t const * from = sf->data ();
int const channels = _dcp_content->audio_stream()->channels ();
#include <dcp/reel.h>
#include <dcp/reel_picture_asset.h>
#include <dcp/reel_sound_asset.h>
-#include <dcp/mono_picture_mxf.h>
+#include <dcp/mono_picture_asset.h>
#include <dcp/mono_picture_frame.h>
-#include <dcp/stereo_picture_mxf.h>
+#include <dcp/stereo_picture_asset.h>
#include <dcp/stereo_picture_frame.h>
-#include <dcp/sound_mxf.h>
+#include <dcp/sound_asset.h>
#include "i18n.h"
throw DCPError (_("Mismatched frame rates in DCP"));
}
- shared_ptr<dcp::PictureMXF> mxf = (*i)->main_picture()->mxf ();
+ shared_ptr<dcp::PictureAsset> asset = (*i)->main_picture()->asset ();
if (!_video_size) {
- _video_size = mxf->size ();
- } else if (_video_size.get() != mxf->size ()) {
+ _video_size = asset->size ();
+ } else if (_video_size.get() != asset->size ()) {
throw DCPError (_("Mismatched video sizes in DCP"));
}
}
if ((*i)->main_sound ()) {
- shared_ptr<dcp::SoundMXF> mxf = (*i)->main_sound()->mxf ();
+ shared_ptr<dcp::SoundAsset> asset = (*i)->main_sound()->asset ();
if (!_audio_channels) {
- _audio_channels = mxf->channels ();
- } else if (_audio_channels.get() != mxf->channels ()) {
+ _audio_channels = asset->channels ();
+ } else if (_audio_channels.get() != asset->channels ()) {
throw DCPError (_("Mismatched audio channel counts in DCP"));
}
if (!_audio_frame_rate) {
- _audio_frame_rate = mxf->sampling_rate ();
- } else if (_audio_frame_rate.get() != mxf->sampling_rate ()) {
+ _audio_frame_rate = asset->sampling_rate ();
+ } else if (_audio_frame_rate.get() != asset->sampling_rate ()) {
throw DCPError (_("Mismatched audio frame rates in DCP"));
}
/* Check that we can read the first picture frame */
try {
if (!dcp.cpls().empty () && !dcp.cpls().front()->reels().empty ()) {
- shared_ptr<dcp::PictureMXF> mxf = dcp.cpls().front()->reels().front()->main_picture()->mxf ();
- shared_ptr<dcp::MonoPictureMXF> mono = dynamic_pointer_cast<dcp::MonoPictureMXF> (mxf);
- shared_ptr<dcp::StereoPictureMXF> stereo = dynamic_pointer_cast<dcp::StereoPictureMXF> (mxf);
+ shared_ptr<dcp::PictureAsset> asset = dcp.cpls().front()->reels().front()->main_picture()->asset ();
+ shared_ptr<dcp::MonoPictureAsset> mono = dynamic_pointer_cast<dcp::MonoPictureAsset> (asset);
+ shared_ptr<dcp::StereoPictureAsset> stereo = dynamic_pointer_cast<dcp::StereoPictureAsset> (asset);
if (mono) {
mono->get_frame(0)->xyz_image ();
#include "dcp_subtitle.h"
#include "exceptions.h"
-#include <dcp/interop_subtitle_content.h>
-#include <dcp/smpte_subtitle_content.h>
+#include <dcp/interop_subtitle_asset.h>
+#include <dcp/smpte_subtitle_asset.h>
#include "i18n.h"
using boost::shared_ptr;
-shared_ptr<dcp::SubtitleContent>
+shared_ptr<dcp::SubtitleAsset>
DCPSubtitle::load (boost::filesystem::path file) const
{
- shared_ptr<dcp::SubtitleContent> sc;
+ shared_ptr<dcp::SubtitleAsset> sc;
try {
- sc.reset (new dcp::InteropSubtitleContent (file));
+ sc.reset (new dcp::InteropSubtitleAsset (file));
} catch (...) {
}
if (!sc) {
try {
- sc.reset (new dcp::SMPTESubtitleContent (file, true));
+ sc.reset (new dcp::SMPTESubtitleAsset (file, true));
} catch (...) {
}
if (!sc) {
try {
- sc.reset (new dcp::SMPTESubtitleContent (file, false));
+ sc.reset (new dcp::SMPTESubtitleAsset (file, false));
} catch (...) {
}
#include <boost/filesystem.hpp>
namespace dcp {
- class SubtitleContent;
+ class SubtitleAsset;
}
class DCPSubtitle
{
protected:
- boost::shared_ptr<dcp::SubtitleContent> load (boost::filesystem::path) const;
+ boost::shared_ptr<dcp::SubtitleAsset> load (boost::filesystem::path) const;
};
#endif
#include "font.h"
#include "dcp_subtitle_content.h"
#include "raw_convert.h"
-#include <dcp/interop_subtitle_content.h>
-#include <dcp/smpte_subtitle_content.h>
+#include <dcp/interop_subtitle_asset.h>
+#include <dcp/smpte_subtitle_asset.h>
#include <dcp/interop_load_font_node.h>
#include <boost/foreach.hpp>
using std::string;
using std::list;
using boost::shared_ptr;
+using boost::dynamic_pointer_cast;
DCPSubtitleContent::DCPSubtitleContent (shared_ptr<const Film> film, boost::filesystem::path path)
: Content (film, path)
{
Content::examine (job);
- shared_ptr<dcp::SubtitleContent> sc = load (path (0));
+ shared_ptr<dcp::SubtitleAsset> sc = load (path (0));
boost::mutex::scoped_lock lm (_mutex);
-
- _subtitle_language = sc->language ();
- _length = DCPTime::from_seconds (sc->latest_subtitle_out().to_seconds ());
+
+ shared_ptr<dcp::InteropSubtitleAsset> iop = dynamic_pointer_cast<dcp::InteropSubtitleAsset> (sc);
+ if (iop) {
+ _subtitle_language = iop->language ();
+ }
+ shared_ptr<dcp::SMPTESubtitleAsset> smpte = dynamic_pointer_cast<dcp::SMPTESubtitleAsset> (sc);
+ if (smpte) {
+ _subtitle_language = smpte->language().get_value_or ("");
+ }
+
+ _length = DCPTime::from_seconds (sc->latest_subtitle_out().as_seconds ());
BOOST_FOREACH (shared_ptr<dcp::LoadFontNode> i, sc->load_font_nodes ()) {
_fonts.push_back (shared_ptr<Font> (new Font (i->id)));
#include "dcp_subtitle_decoder.h"
#include "dcp_subtitle_content.h"
-#include <dcp/interop_subtitle_content.h>
+#include <dcp/interop_subtitle_asset.h>
using std::list;
using std::cout;
DCPSubtitleDecoder::DCPSubtitleDecoder (shared_ptr<const DCPSubtitleContent> content)
: SubtitleDecoder (content)
{
- shared_ptr<dcp::SubtitleContent> c (load (content->path (0)));
+ shared_ptr<dcp::SubtitleAsset> c (load (content->path (0)));
_subtitles = c->subtitles ();
_next = _subtitles.begin ();
}
_next = _subtitles.begin ();
list<dcp::SubtitleString>::const_iterator i = _subtitles.begin ();
- while (i != _subtitles.end() && ContentTime::from_seconds (_next->in().to_seconds()) < time) {
+ while (i != _subtitles.end() && ContentTime::from_seconds (_next->in().as_seconds()) < time) {
++i;
}
}
for (list<dcp::SubtitleString>::const_iterator i = _subtitles.begin(); i != _subtitles.end(); ++i) {
ContentTimePeriod period (
- ContentTime::from_seconds (i->in().to_seconds ()),
- ContentTime::from_seconds (i->out().to_seconds ())
+ ContentTime::from_seconds (i->in().as_seconds ()),
+ ContentTime::from_seconds (i->out().as_seconds ())
);
if ((starting && p.contains (period.from)) || (!starting && p.overlaps (period))) {
*/
#include "util.h"
-#include <dcp/picture_mxf_writer.h>
+#include <dcp/picture_asset_writer.h>
#include <libcxml/cxml.h>
/** @file src/dcp_video_frame.h
*/
#include "types.h"
-#include <dcp/picture_mxf_writer.h>
+#include <dcp/picture_asset_writer.h>
#include <boost/noncopyable.hpp>
#include <boost/filesystem.hpp>
}
boost::filesystem::path
-Film::internal_video_mxf_dir () const
+Film::internal_video_asset_dir () const
{
return dir ("video");
}
boost::filesystem::path
-Film::internal_video_mxf_filename () const
+Film::internal_video_asset_filename () const
{
return video_identifier() + ".mxf";
}
Film::should_be_enough_disk_space (double& required, double& available, bool& can_hard_link) const
{
/* Create a test file and see if we can hard-link it */
- boost::filesystem::path test = internal_video_mxf_dir() / "test";
- boost::filesystem::path test2 = internal_video_mxf_dir() / "test2";
+ boost::filesystem::path test = internal_video_asset_dir() / "test";
+ boost::filesystem::path test2 = internal_video_asset_dir() / "test2";
can_hard_link = true;
FILE* f = fopen_boost (test, "w");
if (f) {
boost::filesystem::remove (test2);
}
- boost::filesystem::space_info s = boost::filesystem::space (internal_video_mxf_dir ());
+ boost::filesystem::space_info s = boost::filesystem::space (internal_video_asset_dir ());
required = double (required_disk_space ()) / 1073741824.0f;
if (!can_hard_link) {
required *= 2;
boost::filesystem::path info_file () const;
boost::filesystem::path j2c_path (int, Eyes, bool) const;
- boost::filesystem::path internal_video_mxf_dir () const;
- boost::filesystem::path internal_video_mxf_filename () const;
+ boost::filesystem::path internal_video_asset_dir () const;
+ boost::filesystem::path internal_video_asset_filename () const;
boost::filesystem::path audio_analysis_path (boost::shared_ptr<const Playlist>) const;
#include "safe_stringstream.h"
#include <dcp/util.h>
#include <dcp/signer.h>
-#include <dcp/picture_mxf.h>
-#include <dcp/sound_mxf.h>
-#include <dcp/subtitle_content.h>
+#include <dcp/picture_asset.h>
+#include <dcp/sound_asset.h>
+#include <dcp/subtitle_asset.h>
#include <glib.h>
#include <pangomm/init.h>
#include <boost/algorithm/string.hpp>
}
string
-video_mxf_filename (shared_ptr<dcp::PictureMXF> mxf)
+video_asset_filename (shared_ptr<dcp::PictureAsset> asset)
{
- return "j2c_" + mxf->id() + ".mxf";
+ return "j2c_" + asset->id() + ".mxf";
}
string
-audio_mxf_filename (shared_ptr<dcp::SoundMXF> mxf)
+audio_asset_filename (shared_ptr<dcp::SoundAsset> asset)
{
- return "pcm_" + mxf->id() + ".mxf";
+ return "pcm_" + asset->id() + ".mxf";
}
string
-subtitle_content_filename (shared_ptr<dcp::SubtitleContent> content)
+subtitle_content_filename (shared_ptr<dcp::SubtitleAsset> asset)
{
- return "sub_" + content->id() + ".xml";
+ return "sub_" + asset->id() + ".xml";
}
#include "exceptions.h"
#include "dcpomatic_time.h"
#include <dcp/util.h>
-#include <dcp/picture_mxf_writer.h>
+#include <dcp/picture_asset_writer.h>
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavfilter/avfilter.h>
#undef check
namespace dcp {
- class PictureMXF;
- class SoundMXF;
- class SubtitleContent;
+ class PictureAsset;
+ class SoundAsset;
+ class SubtitleAsset;
}
/** The maximum number of audio channels that we can have in a DCP */
extern dcp::FrameInfo read_frame_info (FILE* file, int frame, Eyes eyes);
extern void write_frame_info (FILE* file, int frame, Eyes eyes, dcp::FrameInfo info);
extern std::map<std::string, std::string> split_get_request (std::string url);
-extern std::string video_mxf_filename (boost::shared_ptr<dcp::PictureMXF> mxf);
-extern std::string audio_mxf_filename (boost::shared_ptr<dcp::SoundMXF> mxf);
-extern std::string subtitle_content_filename (boost::shared_ptr<dcp::SubtitleContent> content);
+extern std::string video_asset_filename (boost::shared_ptr<dcp::PictureAsset> asset);
+extern std::string audio_asset_filename (boost::shared_ptr<dcp::SoundAsset> asset);
+extern std::string subtitle_content_filename (boost::shared_ptr<dcp::SubtitleAsset> content);
#endif
#include "version.h"
#include "font.h"
#include "util.h"
-#include <dcp/mono_picture_mxf.h>
-#include <dcp/stereo_picture_mxf.h>
-#include <dcp/sound_mxf.h>
-#include <dcp/sound_mxf_writer.h>
+#include <dcp/mono_picture_asset.h>
+#include <dcp/stereo_picture_asset.h>
+#include <dcp/sound_asset.h>
+#include <dcp/sound_asset_writer.h>
#include <dcp/reel.h>
#include <dcp/reel_mono_picture_asset.h>
#include <dcp/reel_stereo_picture_asset.h>
#include <dcp/dcp.h>
#include <dcp/cpl.h>
#include <dcp/signer.h>
-#include <dcp/interop_subtitle_content.h>
+#include <dcp/interop_subtitle_asset.h>
#include <dcp/font.h>
#include <boost/foreach.hpp>
#include <fstream>
*/
if (_film->three_d ()) {
- _picture_mxf.reset (new dcp::StereoPictureMXF (dcp::Fraction (_film->video_frame_rate (), 1)));
+ _picture_asset.reset (new dcp::StereoPictureAsset (dcp::Fraction (_film->video_frame_rate (), 1)));
} else {
- _picture_mxf.reset (new dcp::MonoPictureMXF (dcp::Fraction (_film->video_frame_rate (), 1)));
+ _picture_asset.reset (new dcp::MonoPictureAsset (dcp::Fraction (_film->video_frame_rate (), 1)));
}
- _picture_mxf->set_size (_film->frame_size ());
+ _picture_asset->set_size (_film->frame_size ());
if (_film->encrypted ()) {
- _picture_mxf->set_key (_film->key ());
+ _picture_asset->set_key (_film->key ());
}
- _picture_mxf->set_file (
- _film->internal_video_mxf_dir() / _film->internal_video_mxf_filename()
+ _picture_asset->set_file (
+ _film->internal_video_asset_dir() / _film->internal_video_asset_filename()
);
job->sub (_("Checking existing image data"));
- check_existing_picture_mxf ();
+ check_existing_picture_asset ();
- _picture_mxf_writer = _picture_mxf->start_write (
- _film->internal_video_mxf_dir() / _film->internal_video_mxf_filename(),
+ _picture_asset_writer = _picture_asset->start_write (
+ _film->internal_video_asset_dir() / _film->internal_video_asset_filename(),
_film->interop() ? dcp::INTEROP : dcp::SMPTE,
_first_nonexistant_frame > 0
);
if (_film->audio_channels ()) {
- _sound_mxf.reset (new dcp::SoundMXF (dcp::Fraction (_film->video_frame_rate(), 1), _film->audio_frame_rate (), _film->audio_channels ()));
+ _sound_asset.reset (
+ new dcp::SoundAsset (dcp::Fraction (_film->video_frame_rate(), 1), _film->audio_frame_rate (), _film->audio_channels ())
+ );
if (_film->encrypted ()) {
- _sound_mxf->set_key (_film->key ());
+ _sound_asset->set_key (_film->key ());
}
- /* Write the sound MXF into the film directory so that we leave the creation
+ /* Write the sound asset into the film directory so that we leave the creation
of the DCP directory until the last minute.
*/
- _sound_mxf_writer = _sound_mxf->start_write (_film->directory() / audio_mxf_filename (_sound_mxf), _film->interop() ? dcp::INTEROP : dcp::SMPTE);
+ _sound_asset_writer = _sound_asset->start_write (
+ _film->directory() / audio_asset_filename (_sound_asset),
+ _film->interop() ? dcp::INTEROP : dcp::SMPTE
+ );
}
/* Check that the signer is OK if we need one */
void
Writer::write (shared_ptr<const AudioBuffers> audio)
{
- if (_sound_mxf_writer) {
- _sound_mxf_writer->write (audio->data(), audio->frames());
+ if (_sound_asset_writer) {
+ _sound_asset_writer->write (audio->data(), audio->frames());
}
}
switch (qi.type) {
case QueueItem::FULL:
{
- LOG_GENERAL (N_("Writer FULL-writes %1 (%2) to MXF"), qi.frame, qi.eyes);
+ LOG_GENERAL (N_("Writer FULL-writes %1 (%2)"), qi.frame, qi.eyes);
if (!qi.encoded) {
qi.encoded.reset (new EncodedData (_film->j2c_path (qi.frame, qi.eyes, false)));
}
- dcp::FrameInfo fin = _picture_mxf_writer->write (qi.encoded->data(), qi.encoded->size());
+ dcp::FrameInfo fin = _picture_asset_writer->write (qi.encoded->data(), qi.encoded->size());
qi.encoded->write_info (_film, qi.frame, qi.eyes, fin);
_last_written[qi.eyes] = qi.encoded;
++_full_written;
break;
}
case QueueItem::FAKE:
- LOG_GENERAL (N_("Writer FAKE-writes %1 to MXF"), qi.frame);
- _picture_mxf_writer->fake_write (qi.size);
+ LOG_GENERAL (N_("Writer FAKE-writes %1"), qi.frame);
+ _picture_asset_writer->fake_write (qi.size);
_last_written[qi.eyes].reset ();
++_fake_written;
break;
terminate_thread (true);
- _picture_mxf_writer->finalize ();
- if (_sound_mxf_writer) {
- _sound_mxf_writer->finalize ();
+ _picture_asset_writer->finalize ();
+ if (_sound_asset_writer) {
+ _sound_asset_writer->finalize ();
}
- /* Hard-link the video MXF into the DCP */
- boost::filesystem::path video_from = _picture_mxf->file ();
+ /* Hard-link the video asset into the DCP */
+ boost::filesystem::path video_from = _picture_asset->file ();
boost::filesystem::path video_to;
video_to /= _film->dir (_film->dcp_name());
- video_to /= video_mxf_filename (_picture_mxf);
+ video_to /= video_asset_filename (_picture_asset);
boost::system::error_code ec;
boost::filesystem::create_hard_link (video_from, video_to, ec);
}
}
- _picture_mxf->set_file (video_to);
+ _picture_asset->set_file (video_to);
- /* Move the audio MXF into the DCP */
+ /* Move the audio asset into the DCP */
- if (_sound_mxf) {
+ if (_sound_asset) {
boost::filesystem::path audio_to;
audio_to /= _film->dir (_film->dcp_name ());
- audio_to /= audio_mxf_filename (_sound_mxf);
+ audio_to /= audio_asset_filename (_sound_asset);
- boost::filesystem::rename (_film->file (audio_mxf_filename (_sound_mxf)), audio_to, ec);
+ boost::filesystem::rename (_film->file (audio_asset_filename (_sound_asset)), audio_to, ec);
if (ec) {
throw FileError (
- String::compose (_("could not move audio MXF into the DCP (%1)"), ec.value ()), audio_mxf_filename (_sound_mxf)
+ String::compose (_("could not move audio asset into the DCP (%1)"), ec.value ()), audio_asset_filename (_sound_asset)
);
}
- _sound_mxf->set_file (audio_to);
+ _sound_asset->set_file (audio_to);
}
dcp::DCP dcp (_film->dir (_film->dcp_name()));
shared_ptr<dcp::Reel> reel (new dcp::Reel ());
- shared_ptr<dcp::MonoPictureMXF> mono = dynamic_pointer_cast<dcp::MonoPictureMXF> (_picture_mxf);
+ shared_ptr<dcp::MonoPictureAsset> mono = dynamic_pointer_cast<dcp::MonoPictureAsset> (_picture_asset);
if (mono) {
reel->add (shared_ptr<dcp::ReelPictureAsset> (new dcp::ReelMonoPictureAsset (mono, 0)));
dcp.add (mono);
}
- shared_ptr<dcp::StereoPictureMXF> stereo = dynamic_pointer_cast<dcp::StereoPictureMXF> (_picture_mxf);
+ shared_ptr<dcp::StereoPictureAsset> stereo = dynamic_pointer_cast<dcp::StereoPictureAsset> (_picture_asset);
if (stereo) {
reel->add (shared_ptr<dcp::ReelPictureAsset> (new dcp::ReelStereoPictureAsset (stereo, 0)));
dcp.add (stereo);
}
- if (_sound_mxf) {
- reel->add (shared_ptr<dcp::ReelSoundAsset> (new dcp::ReelSoundAsset (_sound_mxf, 0)));
- dcp.add (_sound_mxf);
+ if (_sound_asset) {
+ reel->add (shared_ptr<dcp::ReelSoundAsset> (new dcp::ReelSoundAsset (_sound_asset, 0)));
+ dcp.add (_sound_asset);
}
- if (_subtitle_content) {
+ if (_subtitle_asset) {
boost::filesystem::path const liberation = shared_path () / "LiberationSans-Regular.ttf";
/* Add all the fonts to the subtitle content and as assets to the DCP */
BOOST_FOREACH (shared_ptr<Font> i, _fonts) {
boost::filesystem::path const from = i->file.get_value_or (liberation);
- _subtitle_content->add_font (i->id, from.leaf().string ());
+ _subtitle_asset->add_font (i->id, from.leaf().string ());
- boost::filesystem::path to = _film->dir (_film->dcp_name ()) / _subtitle_content->id ();
+ boost::filesystem::path to = _film->dir (_film->dcp_name ()) / _subtitle_asset->id ();
boost::filesystem::create_directories (to, ec);
if (ec) {
throw FileError (_("Could not create directory"), to);
dcp.add (shared_ptr<dcp::Font> (new dcp::Font (to)));
}
- _subtitle_content->write_xml (_film->dir (_film->dcp_name ()) / _subtitle_content->id () / subtitle_content_filename (_subtitle_content));
+ _subtitle_asset->write (
+ _film->dir (_film->dcp_name ()) / _subtitle_asset->id () / subtitle_content_filename (_subtitle_asset)
+ );
+
reel->add (shared_ptr<dcp::ReelSubtitleAsset> (
new dcp::ReelSubtitleAsset (
- _subtitle_content,
+ _subtitle_asset,
dcp::Fraction (_film->video_frame_rate(), 1),
- _picture_mxf->intrinsic_duration (),
+ _picture_asset->intrinsic_duration (),
0
)
));
- dcp.add (_subtitle_content);
+ dcp.add (_subtitle_asset);
}
cpl->add (reel);
DCPOMATIC_ASSERT (job);
job->sub (_("Computing image digest"));
- _picture_mxf->hash (boost::bind (&Job::set_progress, job.get(), _1, false));
+ _picture_asset->hash (boost::bind (&Job::set_progress, job.get(), _1, false));
- if (_sound_mxf) {
+ if (_sound_asset) {
job->sub (_("Computing audio digest"));
- _sound_mxf->hash (boost::bind (&Job::set_progress, job.get(), _1, false));
+ _sound_asset->hash (boost::bind (&Job::set_progress, job.get(), _1, false));
}
dcp::XMLMetadata meta;
}
bool
-Writer::check_existing_picture_mxf_frame (FILE* mxf, int f, Eyes eyes)
+Writer::check_existing_picture_asset_frame (FILE* asset, int f, Eyes eyes)
{
/* Read the frame info as written */
FILE* file = fopen_boost (_film->info_file (), "rb");
return false;
}
- /* Read the data from the MXF and hash it */
- dcpomatic_fseek (mxf, info.offset, SEEK_SET);
+ /* Read the data from the asset and hash it */
+ dcpomatic_fseek (asset, info.offset, SEEK_SET);
EncodedData data (info.size);
- size_t const read = fread (data.data(), 1, data.size(), mxf);
+ size_t const read = fread (data.data(), 1, data.size(), asset);
if (read != static_cast<size_t> (data.size ())) {
LOG_GENERAL ("Existing frame %1 is incomplete", f);
return false;
}
void
-Writer::check_existing_picture_mxf ()
+Writer::check_existing_picture_asset ()
{
- /* Try to open the existing MXF */
- FILE* mxf = fopen_boost (_picture_mxf->file(), "rb");
- if (!mxf) {
- LOG_GENERAL ("Could not open existing MXF at %1 (errno=%2)", _picture_mxf->file().string(), errno);
+ /* Try to open the existing asset */
+ FILE* asset = fopen_boost (_picture_asset->file(), "rb");
+ if (!asset) {
+ LOG_GENERAL ("Could not open existing asset at %1 (errno=%2)", _picture_asset->file().string(), errno);
return;
}
job->set_progress_unknown ();
if (_film->three_d ()) {
- if (!check_existing_picture_mxf_frame (mxf, _first_nonexistant_frame, EYES_LEFT)) {
+ if (!check_existing_picture_asset_frame (asset, _first_nonexistant_frame, EYES_LEFT)) {
break;
}
- if (!check_existing_picture_mxf_frame (mxf, _first_nonexistant_frame, EYES_RIGHT)) {
+ if (!check_existing_picture_asset_frame (asset, _first_nonexistant_frame, EYES_RIGHT)) {
break;
}
} else {
- if (!check_existing_picture_mxf_frame (mxf, _first_nonexistant_frame, EYES_BOTH)) {
+ if (!check_existing_picture_asset_frame (asset, _first_nonexistant_frame, EYES_BOTH)) {
break;
}
}
++_first_nonexistant_frame;
}
- fclose (mxf);
+ fclose (asset);
}
/** @param frame Frame index.
Writer::can_fake_write (int frame) const
{
/* We have to do a proper write of the first frame so that we can set up the JPEG2000
- parameters in the MXF writer.
+ parameters in the asset writer.
*/
return (frame != 0 && frame < _first_nonexistant_frame);
}
return;
}
- if (!_subtitle_content) {
+ if (!_subtitle_asset) {
string lang = _film->subtitle_language ();
if (lang.empty ()) {
lang = "Unknown";
}
- _subtitle_content.reset (new dcp::InteropSubtitleContent (_film->name(), lang));
+ _subtitle_asset.reset (new dcp::InteropSubtitleAsset (_film->name(), lang));
}
for (list<dcp::SubtitleString>::const_iterator i = subs.text.begin(); i != subs.text.end(); ++i) {
- _subtitle_content->add (*i);
+ _subtitle_asset->add (*i);
}
}
/*
- Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
class Font;
namespace dcp {
- class MonoPictureMXF;
- class MonoPictureMXFWriter;
- class StereoPictureMXF;
- class StereoPictureMXFWriter;
- class PictureMXF;
- class PictureMXFWriter;
- class SoundMXF;
- class SoundMXFWriter;
- class InteropSubtitleContent;
+ class MonoPictureAsset;
+ class MonoPictureAssetWriter;
+ class StereoPictureAsset;
+ class StereoPictureAssetWriter;
+ class PictureAsset;
+ class PictureAssetWriter;
+ class SoundAsset;
+ class SoundAssetWriter;
+ class InteropSubtitleAsset;
}
struct QueueItem
bool operator== (QueueItem const & a, QueueItem const & b);
/** @class Writer
- * @brief Class to manage writing JPEG2000 and audio data to MXFs on disk.
+ * @brief Class to manage writing JPEG2000 and audio data to assets on disk.
*
- * This class creates sound and picture MXFs, then takes EncodedData
+ * This class creates sound and picture assets, then takes EncodedData
* or AudioBuffers objects (containing image or sound data respectively)
- * and writes them to the MXFs.
+ * and writes them to the assets.
*
* ::write() for EncodedData can be called out of order, and the Writer
* will sort it out. write() for AudioBuffers must be called in order.
void thread ();
void terminate_thread (bool);
- void check_existing_picture_mxf ();
- bool check_existing_picture_mxf_frame (FILE *, int, Eyes);
+ void check_existing_picture_asset ();
+ bool check_existing_picture_asset_frame (FILE *, int, Eyes);
bool have_sequenced_image_at_queue_head ();
/** our Film */
*/
int _pushed_to_disk;
- boost::shared_ptr<dcp::PictureMXF> _picture_mxf;
- boost::shared_ptr<dcp::PictureMXFWriter> _picture_mxf_writer;
- boost::shared_ptr<dcp::SoundMXF> _sound_mxf;
- boost::shared_ptr<dcp::SoundMXFWriter> _sound_mxf_writer;
- boost::shared_ptr<dcp::InteropSubtitleContent> _subtitle_content;
+ boost::shared_ptr<dcp::PictureAsset> _picture_asset;
+ boost::shared_ptr<dcp::PictureAssetWriter> _picture_asset_writer;
+ boost::shared_ptr<dcp::SoundAsset> _sound_asset;
+ boost::shared_ptr<dcp::SoundAssetWriter> _sound_asset_writer;
+ boost::shared_ptr<dcp::InteropSubtitleAsset> _subtitle_asset;
std::list<boost::shared_ptr<Font> > _fonts;
};
#include <dcp/sound_frame.h>
#include <dcp/cpl.h>
#include <dcp/reel.h>
-#include <dcp/sound_mxf.h>
+#include <dcp/sound_asset.h>
#include <dcp/reel_sound_asset.h>
#include "lib/sndfile_content.h"
#include "lib/dcp_content_type.h"
/* Delay in frames */
int const delay_in_frames = delay_in_ms * 48000 / 1000;
- while (n < sound_asset->mxf()->intrinsic_duration()) {
- shared_ptr<const dcp::SoundFrame> sound_frame = sound_asset->mxf()->get_frame (frame++);
+ while (n < sound_asset->asset()->intrinsic_duration()) {
+ shared_ptr<const dcp::SoundFrame> sound_frame = sound_asset->asset()->get_frame (frame++);
uint8_t const * d = sound_frame->data ();
- for (int i = 0; i < sound_frame->size(); i += (3 * sound_asset->mxf()->channels())) {
+ for (int i = 0; i < sound_frame->size(); i += (3 * sound_asset->asset()->channels())) {
/* Mono input so it will appear on centre */
int const sample = d[i + 7] | (d[i + 8] << 8);
#include <boost/test/unit_test.hpp>
#include <dcp/cpl.h>
#include <dcp/dcp.h>
-#include <dcp/sound_mxf.h>
+#include <dcp/sound_asset.h>
#include <dcp/sound_frame.h>
#include <dcp/reel_sound_asset.h>
#include <dcp/reel.h>
shared_ptr<const dcp::ReelSoundAsset> sound_asset = check.cpls().front()->reels().front()->main_sound ();
BOOST_CHECK (sound_asset);
- BOOST_CHECK_EQUAL (sound_asset->mxf()->channels (), 6);
+ BOOST_CHECK_EQUAL (sound_asset->asset()->channels (), 6);
/* Sample index in the DCP */
int n = 0;
/* DCP sound asset frame */
int frame = 0;
- while (n < sound_asset->mxf()->intrinsic_duration()) {
- shared_ptr<const dcp::SoundFrame> sound_frame = sound_asset->mxf()->get_frame (frame++);
+ while (n < sound_asset->asset()->intrinsic_duration()) {
+ shared_ptr<const dcp::SoundFrame> sound_frame = sound_asset->asset()->get_frame (frame++);
uint8_t const * d = sound_frame->data ();
- for (int i = 0; i < sound_frame->size(); i += (3 * sound_asset->mxf()->channels())) {
+ for (int i = 0; i < sound_frame->size(); i += (3 * sound_asset->asset()->channels())) {
- if (sound_asset->mxf()->channels() > 0) {
+ if (sound_asset->asset()->channels() > 0) {
/* L should be silent */
int const sample = d[i + 0] | (d[i + 1] << 8);
BOOST_CHECK_EQUAL (sample, 0);
}
- if (sound_asset->mxf()->channels() > 1) {
+ if (sound_asset->asset()->channels() > 1) {
/* R should be silent */
int const sample = d[i + 2] | (d[i + 3] << 8);
BOOST_CHECK_EQUAL (sample, 0);
}
- if (sound_asset->mxf()->channels() > 2) {
+ if (sound_asset->asset()->channels() > 2) {
/* Mono input so it will appear on centre */
int const sample = d[i + 7] | (d[i + 8] << 8);
BOOST_CHECK_EQUAL (sample, n);
}
- if (sound_asset->mxf()->channels() > 3) {
+ if (sound_asset->asset()->channels() > 3) {
/* Lfe should be silent */
int const sample = d[i + 9] | (d[i + 10] << 8);
BOOST_CHECK_EQUAL (sample, 0);
}
- if (sound_asset->mxf()->channels() > 4) {
+ if (sound_asset->asset()->channels() > 4) {
/* Ls should be silent */
int const sample = d[i + 11] | (d[i + 12] << 8);
BOOST_CHECK_EQUAL (sample, 0);
}
- if (sound_asset->mxf()->channels() > 5) {
+ if (sound_asset->asset()->channels() > 5) {
/* Rs should be silent */
int const sample = d[i + 13] | (d[i + 14] << 8);
BOOST_CHECK_EQUAL (sample, 0);
/*
- Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
*/
#include <boost/test/unit_test.hpp>
-#include <dcp/stereo_picture_mxf.h>
+#include <dcp/stereo_picture_asset.h>
#include "lib/film.h"
#include "lib/dcp_content_type.h"
#include "lib/image_content.h"
film->make_dcp ();
wait_for_jobs ();
- shared_ptr<dcp::StereoPictureMXF> A (new dcp::StereoPictureMXF ("build/test/recover_test/original.mxf"));
- shared_ptr<dcp::StereoPictureMXF> B (new dcp::StereoPictureMXF (video));
+ shared_ptr<dcp::StereoPictureAsset> A (new dcp::StereoPictureAsset ("build/test/recover_test/original.mxf"));
+ shared_ptr<dcp::StereoPictureAsset> B (new dcp::StereoPictureAsset (video));
dcp::EqualityOptions eq;
- eq.mxf_filenames_can_differ = true;
BOOST_CHECK (A->equals (B, eq, boost::bind (¬e, _1, _2)));
}
#include <boost/test/unit_test.hpp>
#include <dcp/cpl.h>
#include <dcp/dcp.h>
-#include <dcp/sound_mxf.h>
+#include <dcp/sound_asset.h>
#include <dcp/sound_frame.h>
#include <dcp/reel.h>
#include <dcp/reel_sound_asset.h>
shared_ptr<const dcp::ReelSoundAsset> sound_asset = check.cpls().front()->reels().front()->main_sound ();
BOOST_CHECK (sound_asset);
- BOOST_CHECK_EQUAL (sound_asset->mxf()->channels (), channels);
+ BOOST_CHECK_EQUAL (sound_asset->asset()->channels (), channels);
/* Sample index in the DCP */
int n = 0;
/* DCP sound asset frame */
int frame = 0;
- while (n < sound_asset->mxf()->intrinsic_duration()) {
- shared_ptr<const dcp::SoundFrame> sound_frame = sound_asset->mxf()->get_frame (frame++);
+ while (n < sound_asset->asset()->intrinsic_duration()) {
+ shared_ptr<const dcp::SoundFrame> sound_frame = sound_asset->asset()->get_frame (frame++);
uint8_t const * d = sound_frame->data ();
- for (int i = 0; i < sound_frame->size(); i += (3 * sound_asset->mxf()->channels())) {
+ for (int i = 0; i < sound_frame->size(); i += (3 * sound_asset->asset()->channels())) {
- if (sound_asset->mxf()->channels() > 0) {
+ if (sound_asset->asset()->channels() > 0) {
/* L should be silent */
int const sample = d[i + 0] | (d[i + 1] << 8);
BOOST_CHECK_EQUAL (sample, 0);
}
- if (sound_asset->mxf()->channels() > 1) {
+ if (sound_asset->asset()->channels() > 1) {
/* R should be silent */
int const sample = d[i + 2] | (d[i + 3] << 8);
BOOST_CHECK_EQUAL (sample, 0);
}
- if (sound_asset->mxf()->channels() > 2) {
+ if (sound_asset->asset()->channels() > 2) {
/* Mono input so it will appear on centre */
int const sample = d[i + 7] | (d[i + 8] << 8);
BOOST_CHECK_EQUAL (sample, n);
}
- if (sound_asset->mxf()->channels() > 3) {
+ if (sound_asset->asset()->channels() > 3) {
/* Lfe should be silent */
int const sample = d[i + 9] | (d[i + 10] << 8);
BOOST_CHECK_EQUAL (sample, 0);
}
- if (sound_asset->mxf()->channels() > 4) {
+ if (sound_asset->asset()->channels() > 4) {
/* Ls should be silent */
int const sample = d[i + 11] | (d[i + 12] << 8);
BOOST_CHECK_EQUAL (sample, 0);
}
- if (sound_asset->mxf()->channels() > 5) {
+ if (sound_asset->asset()->channels() > 5) {
/* Rs should be silent */
int const sample = d[i + 13] | (d[i + 14] << 8);
BOOST_CHECK_EQUAL (sample, 0);
options.max_std_dev_pixel_error = 5;
options.max_audio_sample_error = 255;
options.cpl_annotation_texts_can_differ = true;
- options.mxf_filenames_can_differ = true;
options.reel_annotation_texts_can_differ = true;
options.reel_hashes_can_differ = true;