diff options
Diffstat (limited to 'src/lib/decoded.h')
| -rw-r--r-- | src/lib/decoded.h | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/src/lib/decoded.h b/src/lib/decoded.h index ff32e43f2..f4ebe0dbd 100644 --- a/src/lib/decoded.h +++ b/src/lib/decoded.h @@ -20,6 +20,7 @@ #ifndef DCPOMATIC_LIB_DECODED_H #define DCPOMATIC_LIB_DECODED_H +#include <libdcp/subtitle_asset.h> #include "types.h" #include "rect.h" #include "util.h" @@ -85,16 +86,16 @@ public: 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) @@ -115,4 +116,30 @@ public: 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 |
