2 Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 /** @file src/asset.cc
21 * @brief Parent class for assets of DCPs made up of MXF files.
26 #include <boost/filesystem.hpp>
29 #include "mxf_asset.h"
35 using boost::shared_ptr;
36 using boost::dynamic_pointer_cast;
37 using namespace libdcp;
39 MXFAsset::MXFAsset (string directory, string file_name)
40 : Asset (directory, file_name)
46 MXFAsset::MXFAsset (string directory, string file_name, boost::signals2::signal<void (float)>* progress, int edit_rate, int intrinsic_duration)
47 : Asset (directory, file_name, edit_rate, intrinsic_duration)
48 , _progress (progress)
53 MXFAsset::fill_writer_info (ASDCP::WriterInfo* writer_info, string uuid, MXFMetadata const & metadata)
55 writer_info->ProductVersion = metadata.product_version;
56 writer_info->CompanyName = metadata.company_name;
57 writer_info->ProductName = metadata.product_name.c_str();
59 writer_info->LabelSetType = ASDCP::LS_MXF_SMPTE;
61 Kumu::hex2bin (uuid.c_str(), writer_info->AssetUUID, Kumu::UUID_Length, &c);
62 assert (c == Kumu::UUID_Length);
66 MXFAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt, boost::function<void (NoteType, string)> note) const
68 if (!Asset::equals (other, opt, note)) {
72 shared_ptr<const MXFAsset> other_mxf = dynamic_pointer_cast<const MXFAsset> (other);
74 note (ERROR, "comparing an MXF asset with a non-MXF asset");
78 if (_file_name != other_mxf->_file_name) {
79 note (ERROR, "MXF names differ");
80 if (!opt.mxf_names_can_differ) {