diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-06-01 23:53:06 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-06-01 23:53:06 +0100 |
| commit | a68b877d96a9e9f366f27752e071bc0e895e9dc7 (patch) | |
| tree | 11a32d1efd6abf182b03ce22f1f1fe84258bb7de /src/mono_picture_asset.cc | |
| parent | f9cba324c8160a70b108d9e5b60a4ccad6ee9be2 (diff) | |
Add Reader classes to permit much more efficient DCP reading.
Diffstat (limited to 'src/mono_picture_asset.cc')
| -rw-r--r-- | src/mono_picture_asset.cc | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/mono_picture_asset.cc b/src/mono_picture_asset.cc index 9d0d1497..1a3656cc 100644 --- a/src/mono_picture_asset.cc +++ b/src/mono_picture_asset.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net> + Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net> This file is part of libdcp. @@ -20,6 +20,7 @@ #include "mono_picture_asset.h" #include "mono_picture_asset_writer.h" +#include "mono_picture_asset_reader.h" #include "AS_DCP.h" #include "KM_fileio.h" #include "exceptions.h" @@ -65,12 +66,6 @@ MonoPictureAsset::MonoPictureAsset (Fraction edit_rate) } -shared_ptr<const MonoPictureFrame> -MonoPictureAsset::get_frame (int n) const -{ - return shared_ptr<const MonoPictureFrame> (new MonoPictureFrame (_file, n, _decryption_context)); -} - static void storing_note_handler (list<pair<NoteType, string> >& notes, NoteType t, string s) { @@ -118,6 +113,9 @@ MonoPictureAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt, No #pragma omp parallel for #endif + shared_ptr<MonoPictureAssetReader> reader = start_read (); + shared_ptr<MonoPictureAssetReader> other_reader = other_picture->start_read (); + for (int i = 0; i < _intrinsic_duration; ++i) { if (i >= other_picture->intrinsic_duration()) { result = false; @@ -125,8 +123,8 @@ MonoPictureAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt, No if (result || opt.keep_going) { - shared_ptr<const MonoPictureFrame> frame_A = get_frame (i); - shared_ptr<const MonoPictureFrame> frame_B = other_picture->get_frame (i); + shared_ptr<const MonoPictureFrame> frame_A = reader->get_frame (i); + shared_ptr<const MonoPictureFrame> frame_B = other_reader->get_frame (i); list<pair<NoteType, string> > notes; @@ -160,6 +158,12 @@ MonoPictureAsset::start_write (boost::filesystem::path file, Standard standard, return shared_ptr<MonoPictureAssetWriter> (new MonoPictureAssetWriter (this, file, standard, overwrite)); } +shared_ptr<MonoPictureAssetReader> +MonoPictureAsset::start_read () const +{ + return shared_ptr<MonoPictureAssetReader> (new MonoPictureAssetReader (this)); +} + string MonoPictureAsset::cpl_node_name () const { |
