Missing files from previous.
[dcpomatic.git] / src / lib / content_subtitle.h
1 /*
2     Copyright (C) 2014 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 #ifndef DCPOMATIC_CONTENT_SUBTITLE_H
21 #define DCPOMATIC_CONTENT_SUBTITLE_H
22
23 #include <list>
24 #include <dcp/subtitle_string.h>
25 #include "dcpomatic_time.h"
26 #include "rect.h"
27
28 class Image;
29
30 class ContentSubtitle
31 {
32 public:
33         virtual ContentTime from () const = 0;
34         virtual ContentTime to () const = 0;
35 };
36
37 class ContentImageSubtitle : public ContentSubtitle
38 {
39 public:
40         ContentImageSubtitle (ContentTime f, ContentTime t, boost::shared_ptr<Image> im, dcpomatic::Rect<double> r)
41                 : image (im)
42                 , rectangle (r)
43                 , _from (f)
44                 , _to (t)
45         {}
46
47         ContentTime from () const {
48                 return _from;
49         }
50
51         ContentTime to () const {
52                 return _to;
53         }
54         
55         boost::shared_ptr<Image> image;
56         dcpomatic::Rect<double> rectangle;
57
58 private:
59         ContentTime _from;
60         ContentTime _to;
61 };
62
63 class ContentTextSubtitle : public ContentSubtitle
64 {
65 public:
66         ContentTextSubtitle (std::list<dcp::SubtitleString> s)
67                 : subs (s)
68         {}
69
70         ContentTime from () const;
71         ContentTime to () const;
72         
73         std::list<dcp::SubtitleString> subs;
74 };
75
76 #endif