Install test_mode.h
[libdcp.git] / src / asset.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/asset.h
21  *  @brief Parent class for assets of DCPs.
22  */
23
24 #ifndef LIBDCP_ASSET_H
25 #define LIBDCP_ASSET_H
26
27 #include <string>
28 #include <sigc++/sigc++.h>
29
30 namespace ASDCP {
31         class WriterInfo;
32 }
33
34 namespace libdcp
35 {
36
37 /** @brief Parent class for assets of DCPs
38  *
39  *  These are collections of pictures or sound.
40  */
41 class Asset
42 {
43 public:
44         /** Construct an Asset.
45          *  @param mxf_path Pathname of MXF file.
46          *  @param progress Signal to inform of progress.
47          *  @param fps Frames per second.
48          *  @param length Length in frames.
49          */
50         Asset (std::string mxf_path, sigc::signal1<void, float>* progress, int fps, int length);
51
52         /** Write details of the asset to a CPL stream.
53          *  @param s Stream.
54          */
55         virtual void write_to_cpl (std::ostream& s) const = 0;
56
57         /** Write details of the asset to a PKL stream.
58          *  @param s Stream.
59          */
60         void write_to_pkl (std::ostream& s) const;
61
62         /** Write details of the asset to a ASSETMAP stream.
63          *  @param s Stream.
64          */
65         void write_to_assetmap (std::ostream& s) const;
66
67 protected:
68         /** Fill in a ADSCP::WriteInfo struct.
69          *  @param w struct to fill in.
70          */
71         void fill_writer_info (ASDCP::WriterInfo* w) const;
72
73         /** Path to our MXF file */
74         std::string _mxf_path;
75         /** Signal to emit to report progress */
76         sigc::signal1<void, float>* _progress;
77         /** Frames per second */
78         int _fps;
79         /** Length in frames */
80         int _length;
81         /** Our UUID */
82         std::string _uuid;
83         /** Digest of our MXF */
84         std::string _digest;
85 };
86
87 }
88
89 #endif