2 Copyright (C) 2012-2014 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.
26 #include <boost/signals2.hpp>
39 * @brief Parent class for classes which represent MXF files.
41 class MXF : public Content
44 MXF (Fraction edit_rate);
45 MXF (boost::filesystem::path file);
48 /** @return the 4-character key type for this MXF (MDIK, MDAK, etc.) */
49 virtual std::string key_type () const = 0;
52 boost::shared_ptr<const Content> other,
54 boost::function<void (NoteType, std::string)> note
57 /** Fill in a ADSCP::WriteInfo struct.
58 * @param w struct to fill in.
59 * @param standard INTEROP or SMPTE.
61 void fill_writer_info (ASDCP::WriterInfo* w, Standard standard);
63 /** @return true if the data is encrypted */
64 bool encrypted () const {
65 return !_key_id.empty ();
68 /** Set the ID of the key that is used for encryption/decryption.
71 void set_key_id (std::string i) {
75 /** @return the ID of the key used for encryption/decryption, or an empty string */
76 std::string key_id () const {
82 /** @return encryption/decryption key, if one has been set */
83 boost::optional<Key> key () const {
87 /** @return encryption context, set up with any key that has been passed to set_key() */
88 ASDCP::AESEncContext* encryption_context () const {
89 return _encryption_context;
92 /** Set the metadata that is written to the MXF file.
95 void set_metadata (MXFMetadata m) {
99 /** @return metadata from the MXF file */
100 MXFMetadata metadata () const {
105 std::string pkl_type (Standard standard) const;
106 void read_writer_info (ASDCP::WriterInfo const &);
108 ASDCP::AESEncContext* _encryption_context;
109 ASDCP::AESDecContext* _decryption_context;
110 /** ID of the key used for encryption/decryption, or an empty string */
112 /** Key used for encryption/decryption, if there is one */
113 boost::optional<Key> _key;
114 MXFMetadata _metadata;