2 Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
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.
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.
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.
20 #ifndef DCPOMATIC_LIB_DECODED_H
21 #define DCPOMATIC_LIB_DECODED_H
23 #include <dcp/subtitle_string.h>
38 Decoded (ContentTime t)
43 virtual ~Decoded () {}
45 virtual void set_dcp_times (FrameRateChange frc, DCPTime offset)
47 dcp_time = DCPTime (content_time, frc) + offset;
50 ContentTime content_time;
54 /** One frame of video from a VideoDecoder */
55 class DecodedVideo : public Decoded
63 DecodedVideo (ContentTime t, boost::shared_ptr<const Image> im, Eyes e, bool s)
70 boost::shared_ptr<const Image> image;
75 class DecodedAudio : public Decoded
78 DecodedAudio (ContentTime t, boost::shared_ptr<const AudioBuffers> d)
83 boost::shared_ptr<const AudioBuffers> data;
86 class DecodedImageSubtitle : public Decoded
89 DecodedImageSubtitle ()
94 DecodedImageSubtitle (ContentTime f, ContentTime t, boost::shared_ptr<Image> im, dcpomatic::Rect<double> r)
102 void set_dcp_times (FrameRateChange frc, DCPTime offset)
104 Decoded::set_dcp_times (frc, offset);
105 dcp_time_to = DCPTime (content_time_to, frc) + offset;
108 ContentTime content_time_to;
110 boost::shared_ptr<Image> image;
111 dcpomatic::Rect<double> rect;
114 class DecodedTextSubtitle : public Decoded
117 DecodedTextSubtitle ()
118 : content_time_to (0)
122 /* Assuming that all subs are at the same time */
123 DecodedTextSubtitle (std::list<dcp::SubtitleString> s)
124 : Decoded (ContentTime::from_seconds (s.front().in().to_ticks() * 4 / 1000.0))
125 , content_time_to (ContentTime::from_seconds (s.front().out().to_ticks() * 4 / 1000.0))
131 void set_dcp_times (FrameRateChange frc, DCPTime offset)
133 Decoded::set_dcp_times (frc, offset);
134 dcp_time_to = DCPTime (content_time_to, frc) + offset;
137 ContentTime content_time_to;
139 std::list<dcp::SubtitleString> subs;