No-op: whitespace.
[libdcp.git] / src / mxf.h
1 /*
2     Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
3
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.
8
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.
13
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.
17
18 */
19
20 #ifndef LIBDCP_MXF_H
21 #define LIBDCP_MXF_H
22
23 #include "asset.h"
24 #include "key.h"
25 #include "metadata.h"
26
27 #include <boost/signals2.hpp>
28
29 namespace ASDCP {
30         class AESDecContext;
31         class WriterInfo;
32 }
33
34 /* Undefine some stuff that the OS X 10.5 SDK defines */
35 #undef Key
36 #undef set_key
37
38 namespace dcp
39 {
40
41 class MXFMetadata;
42 class PictureAssetWriter;
43
44 /** @class MXF
45  *  @brief Parent for classes which represent MXF files.
46  */
47 class MXF
48 {
49 public:
50         MXF ();
51         virtual ~MXF ();
52
53         /** @return true if the data is encrypted */
54         bool encrypted () const {
55                 return _key_id;
56         }
57
58         /** Set the ID of the key that is used for encryption/decryption.
59          *  @param i key ID.
60          */
61         void set_key_id (std::string i) {
62                 _key_id = i;
63         }
64
65         /** @return the ID of the key used for encryption/decryption, if there is one */
66         boost::optional<std::string> key_id () const {
67                 return _key_id;
68         }
69
70         void set_key (Key);
71
72         /** @return encryption/decryption key, if one has been set */
73         boost::optional<Key> key () const {
74                 return _key;
75         }
76
77         /** Set the metadata that is written to the MXF file.
78          *  @param m Metadata.
79          */
80         void set_metadata (MXFMetadata m) {
81                 _metadata = m;
82         }
83
84         /** @return metadata from the MXF file */
85         MXFMetadata metadata () const {
86                 return _metadata;
87         }
88
89 protected:
90         template <class P, class Q>
91         friend void start (PictureAssetWriter* writer, boost::shared_ptr<P> state, Standard standard, Q* mxf, uint8_t* data, int size);
92
93         std::string read_writer_info (ASDCP::WriterInfo const &);
94         /** Fill in a ADSCP::WriteInfo struct.
95          *  @param w struct to fill in.
96          *  @param standard INTEROP or SMPTE.
97          */
98         void fill_writer_info (ASDCP::WriterInfo* w, std::string id, Standard standard) const;
99
100         ASDCP::AESDecContext* _decryption_context;
101         /** ID of the key used for encryption/decryption, if there is one */
102         boost::optional<std::string> _key_id;
103         /** Key used for encryption/decryption, if there is one */
104         boost::optional<Key> _key;
105         MXFMetadata _metadata;
106 };
107
108 }
109
110 #endif