No-op: whitespace.
[libdcp.git] / src / smpte_subtitle_asset.h
1 /*
2     Copyright (C) 2012-2015 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/smpte_subtitle_asset.h
21  *  @brief SMPTESubtitleAsset class.
22  */
23
24 #include "subtitle_asset.h"
25 #include "local_time.h"
26 #include "mxf.h"
27 #include <boost/filesystem.hpp>
28
29 namespace dcp {
30
31 class SMPTELoadFontNode;
32
33 /** @class SMPTESubtitleAsset
34  *  @brief A set of subtitles to be read and/or written in the SMPTE format.
35  */
36 class SMPTESubtitleAsset : public SubtitleAsset, public MXF
37 {
38 public:
39         SMPTESubtitleAsset ();
40
41         /** @param file File name
42          */
43         SMPTESubtitleAsset (boost::filesystem::path file);
44
45         bool equals (
46                 boost::shared_ptr<const Asset>,
47                 EqualityOptions,
48                 NoteHandler note
49                 ) const;
50
51         std::list<boost::shared_ptr<LoadFontNode> > load_font_nodes () const;
52
53         Glib::ustring xml_as_string () const;
54         void write (boost::filesystem::path path) const;
55         void add_font (std::string id, boost::filesystem::path file);
56
57         void set_content_title_text (std::string t) {
58                 _content_title_text = t;
59         }
60
61         void set_language (std::string l) {
62                 _language = l;
63         }
64
65         void set_edit_rate (Fraction e) {
66                 _edit_rate = e;
67         }
68
69         void set_time_code_rate (int t) {
70                 _time_code_rate = t;
71         }
72
73         /** @return title of the film that these subtitles are for,
74          *  to be presented to the user.
75          */
76         std::string content_title_text () const {
77                 return _content_title_text;
78         }
79
80         /** @return language as a xs:language, if one was specified */
81         boost::optional<std::string> language () const {
82                 return _language;
83         }
84
85         /** @return annotation text, to be presented to the user */
86         boost::optional<std::string> annotation_text () const {
87                 return _annotation_text;
88         }
89
90         /** @return file creation time and date */
91         LocalTime issue_date () const {
92                 return _issue_date;
93         }
94
95         boost::optional<int> reel_number () const {
96                 return _reel_number;
97         }
98
99         Fraction edit_rate () const {
100                 return _edit_rate;
101         }
102
103         /** @return subdivision of 1 second that is used for subtitle times;
104          *  e.g. a time_code_rate of 250 means that a subtitle time of 0:0:0:001
105          *  represents 4ms.
106          */
107         int time_code_rate () const {
108                 return _time_code_rate;
109         }
110
111         boost::optional<Time> start_time () const {
112                 return _start_time;
113         }
114
115         static bool valid_mxf (boost::filesystem::path);
116
117 protected:
118
119         std::string pkl_type (Standard) const {
120                 return "application/mxf";
121         }
122
123 private:
124         std::string _content_title_text;
125         boost::optional<std::string> _language;
126         boost::optional<std::string> _annotation_text;
127         LocalTime _issue_date;
128         boost::optional<int> _reel_number;
129         Fraction _edit_rate;
130         int _time_code_rate;
131         boost::optional<Time> _start_time;
132
133         std::list<boost::shared_ptr<SMPTELoadFontNode> > _load_font_nodes;
134 };
135
136 }