More licence fixups.
[libdcp.git] / src / sound_asset.h
1 /*
2     Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
3
4     This file is part of libdcp.
5
6     libdcp is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     libdcp is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with libdcp.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 /** @file  src/sound_asset.h
21  *  @brief SoundAsset class
22  */
23
24 #ifndef LIBDCP_SOUND_ASSET_H
25 #define LIBDCP_SOUND_ASSET_H
26
27 #include "mxf.h"
28 #include "types.h"
29 #include "metadata.h"
30
31 namespace dcp
32 {
33
34 class SoundFrame;
35 class SoundAssetWriter;
36 class SoundAssetReader;
37
38 /** @class SoundAsset
39  *  @brief Representation of a sound asset
40  */
41 class SoundAsset : public Asset, public MXF
42 {
43 public:
44         SoundAsset (boost::filesystem::path file);
45         SoundAsset (Fraction edit_rate, int sampling_rate, int channels);
46
47         boost::shared_ptr<SoundAssetWriter> start_write (boost::filesystem::path file, Standard standard);
48         boost::shared_ptr<SoundAssetReader> start_read () const;
49
50         bool equals (
51                 boost::shared_ptr<const Asset> other,
52                 EqualityOptions opt,
53                 NoteHandler note
54                 ) const;
55
56         /** @return number of channels */
57         int channels () const {
58                 return _channels;
59         }
60
61         /** @return sampling rate in Hz */
62         int sampling_rate () const {
63                 return _sampling_rate;
64         }
65
66         Fraction edit_rate () const {
67                 return _edit_rate;
68         }
69
70         int64_t intrinsic_duration () const {
71                 return _intrinsic_duration;
72         }
73
74         static bool valid_mxf (boost::filesystem::path);
75
76 private:
77         friend class SoundAssetWriter;
78
79         std::string pkl_type (Standard standard) const;
80
81         Fraction _edit_rate;
82         /** The total length of this content in video frames.  The amount of
83          *  content presented may be less than this.
84          */
85         int64_t _intrinsic_duration;
86         int _channels;      ///< number of channels
87         int _sampling_rate; ///< sampling rate in Hz
88 };
89
90 }
91
92 #endif