#ifndef DCPOMATIC_LIB_DECODED_H
#define DCPOMATIC_LIB_DECODED_H
+#include <dcp/subtitle_string.h>
#include "types.h"
#include "rect.h"
+#include "util.h"
class Image;
, dcp_time (0)
{}
- Decoded (DCPTime ct)
- : content_time (ct)
+ Decoded (ContentTime t)
+ : content_time (t)
, dcp_time (0)
{}
virtual ~Decoded () {}
- virtual void set_dcp_times (float speed_up, DCPTime offset) = 0;
+ virtual void set_dcp_times (FrameRateChange frc, DCPTime offset)
+ {
+ dcp_time = DCPTime (content_time, frc) + offset;
+ }
ContentTime content_time;
DCPTime dcp_time;
, same (false)
{}
- DecodedVideo (boost::shared_ptr<const Image> im, Eyes e, bool s, ContentTime ct)
- : Decoded (ct)
+ DecodedVideo (ContentTime t, boost::shared_ptr<const Image> im, Eyes e, bool s)
+ : Decoded (t)
, image (im)
, eyes (e)
, same (s)
{}
- void set_dcp_times (float speed_up, DCPTime offset) {
- dcp_time = rint (content_time / speed_up) + offset;
- }
-
boost::shared_ptr<const Image> image;
Eyes eyes;
bool same;
class DecodedAudio : public Decoded
{
public:
- DecodedAudio (boost::shared_ptr<const AudioBuffers> d, ContentTime ct)
- : Decoded (ct)
+ DecodedAudio (ContentTime t, boost::shared_ptr<const AudioBuffers> d)
+ : Decoded (t)
, data (d)
{}
-
- void set_dcp_times (float speed_up, DCPTime offset) {
- dcp_time = rint (content_time / speed_up) + offset;
- }
boost::shared_ptr<const AudioBuffers> data;
};
-class DecodedSubtitle : public Decoded
+class DecodedImageSubtitle : public Decoded
{
public:
- DecodedSubtitle ()
+ DecodedImageSubtitle ()
: content_time_to (0)
, dcp_time_to (0)
{}
- DecodedSubtitle (boost::shared_ptr<Image> im, dcpomatic::Rect<double> r, ContentTime f, ContentTime t)
+ DecodedImageSubtitle (ContentTime f, ContentTime t, boost::shared_ptr<Image> im, dcpomatic::Rect<double> r)
: Decoded (f)
- , image (im)
- , rect (r)
, content_time_to (t)
, dcp_time_to (0)
+ , image (im)
+ , rect (r)
{}
- void set_dcp_times (float speed_up, DCPTime offset) {
- dcp_time = rint (content_time / speed_up) + offset;
- dcp_time_to = rint (content_time_to / speed_up) + offset;
+ void set_dcp_times (FrameRateChange frc, DCPTime offset)
+ {
+ Decoded::set_dcp_times (frc, offset);
+ dcp_time_to = DCPTime (content_time_to, frc) + offset;
}
+ ContentTime content_time_to;
+ DCPTime dcp_time_to;
boost::shared_ptr<Image> image;
dcpomatic::Rect<double> rect;
+};
+
+class DecodedTextSubtitle : public Decoded
+{
+public:
+ DecodedTextSubtitle ()
+ : content_time_to (0)
+ , dcp_time_to (0)
+ {}
+
+ /* Assuming that all subs are at the same time */
+ DecodedTextSubtitle (std::list<dcp::SubtitleString> s)
+ : Decoded (ContentTime::from_seconds (subs.front().in().to_ticks() * 4 / 1000.0))
+ , content_time_to (ContentTime::from_seconds (subs.front().out().to_ticks() * 4 / 1000.0))
+ , subs (s)
+ {
+
+ }
+
+ void set_dcp_times (FrameRateChange frc, DCPTime offset)
+ {
+ Decoded::set_dcp_times (frc, offset);
+ dcp_time_to = DCPTime (content_time_to, frc) + offset;
+ }
+
ContentTime content_time_to;
DCPTime dcp_time_to;
+ std::list<dcp::SubtitleString> subs;
};
#endif