It builds again.
[libdcp.git] / src / dcp.h
1 /*
2     Copyright (C) 2012 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 /** @file  src/dcp.h
21  *  @brief A class to create or read a DCP.
22  */
23
24 #ifndef LIBDCP_DCP_H
25 #define LIBDCP_DCP_H
26
27 #include "types.h"
28 #include "certificates.h"
29 #include "metadata.h"
30 #include <boost/shared_ptr.hpp>
31 #include <boost/signals2.hpp>
32 #include <string>
33 #include <vector>
34
35 namespace xmlpp {
36         class Document;
37         class Element;
38 }
39
40 /** @brief Namespace for everything in libdcp */
41 namespace dcp
42 {
43
44 class Content;  
45 class Reel;
46 class CPL;
47 class XMLMetadata;
48 class Signer;
49 class KDM;
50 class Asset;
51
52 namespace parse {
53         class AssetMap;
54 }
55
56 /** @class DCP
57  *  @brief A class to create or read a DCP.
58  */
59         
60 class DCP : public boost::noncopyable
61 {
62 public:
63         /** Construct a DCP.  You can pass an existing DCP's directory
64          *  as the parameter, or a non-existant folder to create a new
65          *  DCP in.
66          *
67          *  @param directory Directory containing the DCP's files.
68          */
69         DCP (boost::filesystem::path directory);
70
71         void read ();
72
73         /** Compare this DCP with another, according to various options.
74          *  @param other DCP to compare this one to.
75          *  @param options Options to define what "equality" means.
76          *  @return true if the DCPs are equal according to EqualityOptions, otherwise false.
77          */
78         bool equals (DCP const & other, EqualityOptions options, boost::function<void (NoteType, std::string)> note) const;
79
80         void add (boost::shared_ptr<Asset> asset);
81
82         std::list<boost::shared_ptr<CPL> > cpls () const;
83
84         bool encrypted () const;
85
86         void add (KDM const &);
87
88         void write_xml (
89                 Standard standard,
90                 XMLMetadata metadata = XMLMetadata (),
91                 boost::shared_ptr<const Signer> signer = boost::shared_ptr<const Signer> ()
92         );
93
94         /** Emitted with a parameter between 0 and 1 to indicate progress
95          *  for long jobs.
96          */
97         boost::signals2::signal<void (float)> Progress;
98
99 private:
100
101         /** Write the PKL file.
102          *  @param pkl_uuid UUID to use.
103          */
104         boost::filesystem::path write_pkl (Standard standard, std::string pkl_uuid, XMLMetadata metadata, boost::shared_ptr<const Signer> signer) const;
105         
106         void write_volindex (Standard standard) const;
107
108         /** Write the ASSETMAP file.
109          *  @param pkl_uuid UUID of our PKL.
110          *  @param pkl_length Length of our PKL in bytes.
111          */
112         void write_assetmap (Standard standard, std::string pkl_uuid, int pkl_length, XMLMetadata metadata) const;
113
114         /** the directory that we are writing to */
115         boost::filesystem::path _directory;
116         std::list<boost::shared_ptr<Asset> > _assets;
117 };
118
119 }
120
121 #endif