Inspect J2K data in MXFs.
[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 #include "types.h"
30
31 namespace ASDCP {
32         class WriterInfo;
33 }
34
35 namespace libdcp
36 {
37
38 /** @brief Parent class for assets of DCPs
39  *
40  *  These are collections of pictures or sound.
41  */
42 class Asset
43 {
44 public:
45         /** Construct an Asset.
46          *  @param directory Directory where MXF file is.
47          *  @param mxf_name Name of MXF file.
48          *  @param progress Signal to inform of progress.
49          *  @param fps Frames per second.
50          *  @param length Length in frames.
51          */
52         Asset (std::string directory, std::string mxf_path, sigc::signal1<void, float>* progress, int fps, int length);
53
54         /** Write details of the asset to a CPL stream.
55          *  @param s Stream.
56          */
57         virtual void write_to_cpl (std::ostream& s) const = 0;
58
59         /** Write details of the asset to a PKL stream.
60          *  @param s Stream.
61          */
62         void write_to_pkl (std::ostream& s) const;
63
64         /** Write details of the asset to a ASSETMAP stream.
65          *  @param s Stream.
66          */
67         void write_to_assetmap (std::ostream& s) const;
68
69         virtual std::list<std::string> equals (boost::shared_ptr<const Asset> other, EqualityFlags flags) const;
70
71 protected:
72         friend class PictureAsset;
73         
74         /** Fill in a ADSCP::WriteInfo struct.
75          *  @param w struct to fill in.
76          */
77         void fill_writer_info (ASDCP::WriterInfo* w) const;
78
79         boost::filesystem::path mxf_path () const;
80
81         /** Directory that our MXF file is in */
82         std::string _directory;
83         /** Name of our MXF file */
84         std::string _mxf_name;
85         /** Signal to emit to report progress */
86         sigc::signal1<void, float>* _progress;
87         /** Frames per second */
88         int _fps;
89         /** Length in frames */
90         int _length;
91         /** Our UUID */
92         std::string _uuid;
93         /** Digest of our MXF */
94         std::string _digest;
95 };
96
97 }
98
99 #endif