diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-06-09 00:30:08 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-06-09 00:30:08 +0100 |
| commit | 3e7b4caf9be417bc1c80f1389d01e9dc98a25f21 (patch) | |
| tree | 714072185cfe525e716d752869748856e1b77f2d | |
| parent | a0a34108fbab331ed25c3f1291b8fcfadec6407e (diff) | |
| parent | 89b3ab9210af0888f7b4ce558869051a731d17e2 (diff) | |
Merge.
| -rw-r--r-- | src/lib/content_factory.cc | 4 | ||||
| -rw-r--r-- | src/lib/content_subtitle.cc | 4 | ||||
| -rw-r--r-- | src/lib/dcp_decoder.cc | 18 | ||||
| -rw-r--r-- | src/lib/dcp_examiner.cc | 28 | ||||
| -rw-r--r-- | src/lib/dcp_subtitle.cc | 14 | ||||
| -rw-r--r-- | src/lib/dcp_subtitle.h | 4 | ||||
| -rw-r--r-- | src/lib/dcp_subtitle_content.cc | 24 | ||||
| -rw-r--r-- | src/lib/dcp_subtitle_decoder.cc | 10 | ||||
| -rw-r--r-- | src/lib/dcp_video.h | 2 | ||||
| -rw-r--r-- | src/lib/encoded_data.h | 2 | ||||
| -rw-r--r-- | src/lib/film.cc | 10 | ||||
| -rw-r--r-- | src/lib/film.h | 4 | ||||
| -rw-r--r-- | src/lib/image_proxy.cc | 6 | ||||
| -rw-r--r-- | src/lib/image_proxy.h | 4 | ||||
| -rw-r--r-- | src/lib/player.cc | 12 | ||||
| -rw-r--r-- | src/lib/player.h | 4 | ||||
| -rw-r--r-- | src/lib/player_video.cc | 4 | ||||
| -rw-r--r-- | src/lib/subrip_content.cc | 3 | ||||
| -rw-r--r-- | src/lib/util.cc | 18 | ||||
| -rw-r--r-- | src/lib/util.h | 14 | ||||
| -rw-r--r-- | src/lib/writer.cc | 160 | ||||
| -rw-r--r-- | src/lib/writer.h | 40 | ||||
| -rw-r--r-- | src/wx/film_viewer.cc | 5 | ||||
| -rw-r--r-- | test/audio_delay_test.cc | 8 | ||||
| -rw-r--r-- | test/ffmpeg_audio_test.cc | 22 | ||||
| -rw-r--r-- | test/recover_test.cc | 9 | ||||
| -rw-r--r-- | test/silence_padding_test.cc | 22 | ||||
| -rw-r--r-- | test/test.cc | 1 |
28 files changed, 257 insertions, 199 deletions
diff --git a/src/lib/content_factory.cc b/src/lib/content_factory.cc index f4d9fe4e9..db3a30500 100644 --- a/src/lib/content_factory.cc +++ b/src/lib/content_factory.cc @@ -29,7 +29,7 @@ #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; @@ -87,7 +87,7 @@ content_factory (shared_ptr<const Film> film, boost::filesystem::path path) 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)); } diff --git a/src/lib/content_subtitle.cc b/src/lib/content_subtitle.cc index c4cfafad5..4eed8b4b2 100644 --- a/src/lib/content_subtitle.cc +++ b/src/lib/content_subtitle.cc @@ -25,7 +25,7 @@ ContentTextSubtitle::period () const /* 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()) ); } diff --git a/src/lib/dcp_decoder.cc b/src/lib/dcp_decoder.cc index 0411ad941..8b2765d44 100644 --- a/src/lib/dcp_decoder.cc +++ b/src/lib/dcp_decoder.cc @@ -25,8 +25,8 @@ #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> @@ -65,20 +65,20 @@ DCPDecoder::pass (PassReason) 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 ); } @@ -86,7 +86,7 @@ DCPDecoder::pass (PassReason) 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 (); diff --git a/src/lib/dcp_examiner.cc b/src/lib/dcp_examiner.cc index a0d13a722..21ffeda29 100644 --- a/src/lib/dcp_examiner.cc +++ b/src/lib/dcp_examiner.cc @@ -27,11 +27,11 @@ #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" @@ -74,10 +74,10 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content) 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")); } @@ -85,17 +85,17 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content) } 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")); } @@ -113,9 +113,9 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content) /* 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 (); diff --git a/src/lib/dcp_subtitle.cc b/src/lib/dcp_subtitle.cc index 17874c27e..66cee4ad8 100644 --- a/src/lib/dcp_subtitle.cc +++ b/src/lib/dcp_subtitle.cc @@ -19,27 +19,27 @@ #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 (...) { } @@ -47,7 +47,7 @@ DCPSubtitle::load (boost::filesystem::path file) const if (!sc) { try { - sc.reset (new dcp::SMPTESubtitleContent (file, false)); + sc.reset (new dcp::SMPTESubtitleAsset (file, false)); } catch (...) { } diff --git a/src/lib/dcp_subtitle.h b/src/lib/dcp_subtitle.h index e15acca44..4b4d4c92a 100644 --- a/src/lib/dcp_subtitle.h +++ b/src/lib/dcp_subtitle.h @@ -24,13 +24,13 @@ #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 diff --git a/src/lib/dcp_subtitle_content.cc b/src/lib/dcp_subtitle_content.cc index 3f9772d59..742773043 100644 --- a/src/lib/dcp_subtitle_content.cc +++ b/src/lib/dcp_subtitle_content.cc @@ -20,8 +20,8 @@ #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> @@ -30,6 +30,7 @@ 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) @@ -51,12 +52,23 @@ DCPSubtitleContent::examine (shared_ptr<Job> job) { Content::examine (job); - shared_ptr<dcp::SubtitleContent> sc = load (path (0)); + shared_ptr<dcp::SubtitleAsset> sc = load (path (0)); + + /* Default to turning these subtitles on */ + set_use_subtitles (true); 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))); diff --git a/src/lib/dcp_subtitle_decoder.cc b/src/lib/dcp_subtitle_decoder.cc index 93a122590..95d7bdca4 100644 --- a/src/lib/dcp_subtitle_decoder.cc +++ b/src/lib/dcp_subtitle_decoder.cc @@ -19,7 +19,7 @@ #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; @@ -28,7 +28,7 @@ using boost::shared_ptr; 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 (); } @@ -40,7 +40,7 @@ DCPSubtitleDecoder::seek (ContentTime time, bool accurate) _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; } } @@ -75,8 +75,8 @@ DCPSubtitleDecoder::text_subtitles_during (ContentTimePeriod p, bool starting) c 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))) { diff --git a/src/lib/dcp_video.h b/src/lib/dcp_video.h index af4712b2b..125e2c818 100644 --- a/src/lib/dcp_video.h +++ b/src/lib/dcp_video.h @@ -19,7 +19,7 @@ */ #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 diff --git a/src/lib/encoded_data.h b/src/lib/encoded_data.h index 245a888dd..368f267f1 100644 --- a/src/lib/encoded_data.h +++ b/src/lib/encoded_data.h @@ -18,7 +18,7 @@ */ #include "types.h" -#include <dcp/picture_mxf_writer.h> +#include <dcp/picture_asset_writer.h> #include <boost/noncopyable.hpp> #include <boost/filesystem.hpp> diff --git a/src/lib/film.cc b/src/lib/film.cc index 590acedfd..d67182022 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -220,13 +220,13 @@ Film::info_file () const } 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"; } @@ -1132,8 +1132,8 @@ bool 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) { @@ -1147,7 +1147,7 @@ Film::should_be_enough_disk_space (double& required, double& available, bool& ca 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; diff --git a/src/lib/film.h b/src/lib/film.h index b0f1a8685..f9dc0ed9c 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -66,8 +66,8 @@ public: 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; diff --git a/src/lib/image_proxy.cc b/src/lib/image_proxy.cc index c803e6bd0..0b079725d 100644 --- a/src/lib/image_proxy.cc +++ b/src/lib/image_proxy.cc @@ -46,3 +46,9 @@ image_proxy_factory (shared_ptr<cxml::Node> xml, shared_ptr<Socket> socket) throw NetworkError (_("Unexpected image type received by server")); } + +bool +ImageProxy::same (shared_ptr<const ImageProxy> other) const +{ + return image()->digest() == other->image()->digest(); +} diff --git a/src/lib/image_proxy.h b/src/lib/image_proxy.h index 39cbda27d..9367bc0a7 100644 --- a/src/lib/image_proxy.h +++ b/src/lib/image_proxy.h @@ -64,9 +64,7 @@ public: virtual void add_metadata (xmlpp::Node *) const = 0; virtual void send_binary (boost::shared_ptr<Socket>) const = 0; /** @return true if our image is definitely the same as another, false if it is probably not */ - virtual bool same (boost::shared_ptr<const ImageProxy>) const { - return false; - } + virtual bool same (boost::shared_ptr<const ImageProxy>) const; }; boost::shared_ptr<ImageProxy> image_proxy_factory (boost::shared_ptr<cxml::Node> xml, boost::shared_ptr<Socket> socket); diff --git a/src/lib/player.cc b/src/lib/player.cc index 0ddd835ad..215b48ee4 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -74,6 +74,7 @@ Player::Player (shared_ptr<const Film> f, shared_ptr<const Playlist> p) , _playlist (p) , _have_valid_pieces (false) , _ignore_video (false) + , _burn_subtitles (f->burn_subtitles ()) { _playlist_changed_connection = _playlist->Changed.connect (bind (&Player::playlist_changed, this)); _playlist_content_changed_connection = _playlist->ContentChanged.connect (bind (&Player::content_changed, this, _1, _2, _3)); @@ -385,7 +386,7 @@ Player::get_video (DCPTime time, bool accurate) copy (c.begin(), c.end(), back_inserter (sub_images)); /* Text subtitles (rendered to an image) */ - if (!ps.text.empty ()) { + if (_burn_subtitles && !ps.text.empty ()) { list<PositionImage> s = render_subtitles (ps.text, _video_container_size); copy (s.begin (), s.end (), back_inserter (sub_images)); } @@ -631,3 +632,12 @@ Player::set_ignore_video () { _ignore_video = true; } + +/** Set whether or not this player should burn text subtitles into the image. + * @param burn true to burn subtitles, false to not. + */ +void +Player::set_burn_subtitles (bool burn) +{ + _burn_subtitles = burn; +} diff --git a/src/lib/player.h b/src/lib/player.h index 14aee002a..52dffec24 100644 --- a/src/lib/player.h +++ b/src/lib/player.h @@ -93,6 +93,8 @@ public: void set_video_container_size (dcp::Size); void set_ignore_video (); + void set_enable_subtitles (bool enable); + void set_burn_subtitles (bool burn); PlayerStatistics const & statistics () const; @@ -158,6 +160,8 @@ private: /** true if the player should ignore all video; i.e. never produce any */ bool _ignore_video; + /** true if the player should burn subtitles into the video */ + bool _burn_subtitles; boost::shared_ptr<AudioProcessor> _audio_processor; diff --git a/src/lib/player_video.cc b/src/lib/player_video.cc index 81e01329a..0375fa01b 100644 --- a/src/lib/player_video.cc +++ b/src/lib/player_video.cc @@ -197,8 +197,7 @@ PlayerVideo::inter_position () const bool PlayerVideo::same (shared_ptr<const PlayerVideo> other) const { - if (_in != other->_in || - _crop != other->_crop || + if (_crop != other->_crop || _fade.get_value_or(0) != other->_fade.get_value_or(0) || _inter_size != other->_inter_size || _out_size != other->_out_size || @@ -206,6 +205,7 @@ PlayerVideo::same (shared_ptr<const PlayerVideo> other) const _part != other->_part || _colour_conversion != other->_colour_conversion || !_subtitle.same (other->_subtitle)) { + return false; } diff --git a/src/lib/subrip_content.cc b/src/lib/subrip_content.cc index f9d184b9d..8becbc4d0 100644 --- a/src/lib/subrip_content.cc +++ b/src/lib/subrip_content.cc @@ -59,6 +59,9 @@ SubRipContent::examine (boost::shared_ptr<Job> job) DCPTime len (s.length (), film->active_frame_rate_change (position ())); + /* Default to turning these subtitles on */ + set_use_subtitles (true); + boost::mutex::scoped_lock lm (_mutex); _length = len; _fonts.push_back (shared_ptr<Font> (new Font (font_id))); diff --git a/src/lib/util.cc b/src/lib/util.cc index dccf32f4d..b662f8679 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -37,9 +37,9 @@ #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> @@ -676,19 +676,19 @@ write_frame_info (FILE* file, int frame, Eyes eyes, dcp::FrameInfo info) } 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"; } diff --git a/src/lib/util.h b/src/lib/util.h index 51770c288..957453fb7 100644 --- a/src/lib/util.h +++ b/src/lib/util.h @@ -29,7 +29,7 @@ #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> @@ -43,9 +43,9 @@ extern "C" { #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 */ @@ -102,9 +102,9 @@ extern void set_backtrace_file (boost::filesystem::path); 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 diff --git a/src/lib/writer.cc b/src/lib/writer.cc index 650f8ac47..7091930f4 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -34,10 +34,10 @@ #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> @@ -46,7 +46,8 @@ #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/smpte_subtitle_asset.h> #include <dcp/font.h> #include <boost/foreach.hpp> #include <fstream> @@ -100,41 +101,46 @@ Writer::Writer (shared_ptr<const Film> f, weak_ptr<Job> j) */ 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 */ @@ -224,8 +230,8 @@ Writer::fake_write (int frame, Eyes eyes) 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()); } } @@ -321,20 +327,20 @@ try 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; @@ -441,17 +447,17 @@ Writer::finish () 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); @@ -464,23 +470,23 @@ Writer::finish () } } - _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())); @@ -496,32 +502,32 @@ Writer::finish () 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); @@ -538,17 +544,20 @@ Writer::finish () 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); @@ -557,11 +566,11 @@ Writer::finish () 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; @@ -586,7 +595,7 @@ Writer::finish () } 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"); @@ -602,10 +611,10 @@ Writer::check_existing_picture_mxf_frame (FILE* mxf, int f, Eyes eyes) 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; @@ -622,12 +631,12 @@ Writer::check_existing_picture_mxf_frame (FILE* mxf, int f, Eyes eyes) } 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; } @@ -639,14 +648,14 @@ Writer::check_existing_picture_mxf () 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; } } @@ -655,7 +664,7 @@ Writer::check_existing_picture_mxf () ++_first_nonexistant_frame; } - fclose (mxf); + fclose (asset); } /** @param frame Frame index. @@ -665,7 +674,7 @@ bool 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); } @@ -677,16 +686,29 @@ Writer::write (PlayerSubtitles subs) 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)); + if (_film->interop ()) { + shared_ptr<dcp::InteropSubtitleAsset> s (new dcp::InteropSubtitleAsset ()); + s->set_movie_title (_film->name ()); + s->set_language (lang); + s->set_reel_number ("1"); + _subtitle_asset = s; + } else { + shared_ptr<dcp::SMPTESubtitleAsset> s (new dcp::SMPTESubtitleAsset ()); + s->set_content_title_text (_film->name ()); + s->set_language (lang); + s->set_edit_rate (dcp::Fraction (_film->video_frame_rate (), 1)); + s->set_time_code_rate (_film->video_frame_rate ()); + _subtitle_asset = s; + } } for (list<dcp::SubtitleString>::const_iterator i = subs.text.begin(); i != subs.text.end(); ++i) { - _subtitle_content->add (*i); + _subtitle_asset->add (*i); } } diff --git a/src/lib/writer.h b/src/lib/writer.h index e63591a8a..a176eb191 100644 --- a/src/lib/writer.h +++ b/src/lib/writer.h @@ -1,5 +1,5 @@ /* - 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 @@ -37,15 +37,15 @@ class Job; 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 SubtitleAsset; } struct QueueItem @@ -74,11 +74,11 @@ bool operator< (QueueItem const & a, QueueItem const & b); 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. @@ -106,8 +106,8 @@ private: 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 */ @@ -149,11 +149,11 @@ private: */ 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::SubtitleAsset> _subtitle_asset; std::list<boost::shared_ptr<Font> > _fonts; }; diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index 0938d52a4..e33a3c118 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -144,6 +144,11 @@ FilmViewer::set_film (shared_ptr<Film> f) _film.reset (); return; } + + /* Always burn in subtitles, even if we are set not to, otherwise we won't see them + in the preview. + */ + _player->set_burn_subtitles (true); _film_connection = _film->Changed.connect (boost::bind (&FilmViewer::film_changed, this, _1)); diff --git a/test/audio_delay_test.cc b/test/audio_delay_test.cc index 63f363114..05384873f 100644 --- a/test/audio_delay_test.cc +++ b/test/audio_delay_test.cc @@ -27,7 +27,7 @@ #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" @@ -75,11 +75,11 @@ void test_audio_delay (int delay_in_ms) /* 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); diff --git a/test/ffmpeg_audio_test.cc b/test/ffmpeg_audio_test.cc index 1e2bbb377..2c34c437d 100644 --- a/test/ffmpeg_audio_test.cc +++ b/test/ffmpeg_audio_test.cc @@ -24,7 +24,7 @@ #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> @@ -66,51 +66,51 @@ BOOST_AUTO_TEST_CASE (ffmpeg_audio_test) 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); diff --git a/test/recover_test.cc b/test/recover_test.cc index d76c2f716..317b45520 100644 --- a/test/recover_test.cc +++ b/test/recover_test.cc @@ -1,5 +1,5 @@ /* - 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 @@ -22,7 +22,7 @@ */ #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" @@ -69,10 +69,9 @@ BOOST_AUTO_TEST_CASE (recover_test) 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))); } diff --git a/test/silence_padding_test.cc b/test/silence_padding_test.cc index d876a0228..9a797aab5 100644 --- a/test/silence_padding_test.cc +++ b/test/silence_padding_test.cc @@ -24,7 +24,7 @@ #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> @@ -63,51 +63,51 @@ test_silence_padding (int channels) 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); diff --git a/test/test.cc b/test/test.cc index b7ae1dec9..5dd591ddc 100644 --- a/test/test.cc +++ b/test/test.cc @@ -210,7 +210,6 @@ check_dcp (boost::filesystem::path ref, boost::filesystem::path check) 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; |
