Rename SafeStringStream -> locked_stringstream. Bump deps for removal of stringstream.
[dcpomatic.git] / src / lib / content_subtitle.h
1 /*
2     Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
3
4     This file is part of DCP-o-matic.
5
6     DCP-o-matic 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     DCP-o-matic 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 DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
18
19 */
20
21 #ifndef DCPOMATIC_CONTENT_SUBTITLE_H
22 #define DCPOMATIC_CONTENT_SUBTITLE_H
23
24 #include "dcpomatic_time.h"
25 #include "rect.h"
26 #include "image_subtitle.h"
27 #include <dcp/subtitle_string.h>
28 #include <list>
29
30 class Image;
31
32 class ContentSubtitle
33 {
34 public:
35         ContentSubtitle (ContentTimePeriod p)
36                 : _period (p)
37         {}
38
39         ContentTimePeriod period () const {
40                 return _period;
41         }
42
43 private:
44         ContentTimePeriod _period;
45 };
46
47 class ContentImageSubtitle : public ContentSubtitle
48 {
49 public:
50         ContentImageSubtitle (ContentTimePeriod p, boost::shared_ptr<Image> im, dcpomatic::Rect<double> r)
51                 : ContentSubtitle (p)
52                 , sub (im, r)
53         {}
54
55         /* Our subtitle, with its rectangle unmodified by any offsets or scales that the content specifies */
56         ImageSubtitle sub;
57 };
58
59 /** A text subtitle.  We store the time period separately (as well as in the dcp::SubtitleStrings)
60  *  as the dcp::SubtitleString timings are sometimes quite heavily quantised and this causes problems
61  *  when we want to compare the quantised periods to the unquantised ones.
62  */
63 class ContentTextSubtitle : public ContentSubtitle
64 {
65 public:
66         ContentTextSubtitle (ContentTimePeriod p, std::list<dcp::SubtitleString> s)
67                 : ContentSubtitle (p)
68                 , subs (s)
69         {}
70
71         std::list<dcp::SubtitleString> subs;
72 };
73
74 #endif