#ifndef DCPOMATIC_LIB_DECODED_H
#define DCPOMATIC_LIB_DECODED_H
+#include <libdcp/subtitle_asset.h>
#include "types.h"
#include "rect.h"
#include "util.h"
AudioFrame frame;
};
-class DecodedSubtitle : public Decoded
+class DecodedImageSubtitle : public Decoded
{
public:
- DecodedSubtitle ()
+ DecodedImageSubtitle ()
: content_time (0)
, content_time_to (0)
, dcp_time_to (0)
{}
- DecodedSubtitle (boost::shared_ptr<Image> im, dcpomatic::Rect<double> r, ContentTime f, ContentTime t)
+ DecodedImageSubtitle (boost::shared_ptr<Image> im, dcpomatic::Rect<double> r, ContentTime f, ContentTime t)
: image (im)
, rect (r)
, content_time (f)
DCPTime dcp_time_to;
};
+class DecodedTextSubtitle : public Decoded
+{
+public:
+ DecodedTextSubtitle ()
+ : dcp_time_to (0)
+ {}
+
+ DecodedTextSubtitle (std::list<libdcp::Subtitle> s)
+ : subs (s)
+ {}
+
+ void set_dcp_times (VideoFrame, AudioFrame, FrameRateChange frc, DCPTime offset)
+ {
+ if (subs.empty ()) {
+ return;
+ }
+
+ /* Assuming that all subs are at the same time */
+ dcp_time = rint (subs.front().in().to_ticks() * 4 * TIME_HZ / frc.speed_up) + offset;
+ dcp_time_to = rint (subs.front().out().to_ticks() * 4 * TIME_HZ / frc.speed_up) + offset;
+ }
+
+ std::list<libdcp::Subtitle> subs;
+ DCPTime dcp_time_to;
+};
+
#endif