X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fsubtitle_decoder.h;h=d7faaa0145900658edb2441597a47b0d5e3af968;hb=8acffb9e32b1b608c32768f5c6efafa8d250ede0;hp=efa90fd92c7950280e8c900b42ccf3ce591a1b1d;hpb=034feb503b0a38eb82c21ae8d9f83522fc63a25c;p=dcpomatic.git diff --git a/src/lib/subtitle_decoder.h b/src/lib/subtitle_decoder.h index efa90fd92..d7faaa014 100644 --- a/src/lib/subtitle_decoder.h +++ b/src/lib/subtitle_decoder.h @@ -20,11 +20,11 @@ #ifndef DCPOMATIC_SUBTITLE_DECODER_H #define DCPOMATIC_SUBTITLE_DECODER_H -#include #include "decoder.h" #include "rect.h" #include "types.h" #include "content_subtitle.h" +#include class Film; class DCPTimedSubtitle; @@ -33,17 +33,30 @@ class Image; class SubtitleDecoder : public virtual Decoder { public: - SubtitleDecoder (); + SubtitleDecoder (boost::shared_ptr); - std::list > get_image_subtitles (ContentTime from, ContentTime to); - std::list > get_text_subtitles (ContentTime from, ContentTime to); + std::list get_image_subtitles (ContentTimePeriod period, bool starting); + std::list get_text_subtitles (ContentTimePeriod period, bool starting); protected: - void image_subtitle (ContentTime from, ContentTime to, boost::shared_ptr, dcpomatic::Rect); + void seek (ContentTime, bool); + + void image_subtitle (ContentTimePeriod period, boost::shared_ptr, dcpomatic::Rect); void text_subtitle (std::list); - std::list > _decoded_image_subtitles; - std::list > _decoded_text_subtitles; + std::list _decoded_image_subtitles; + std::list _decoded_text_subtitles; + +private: + template + std::list get (std::list const & subs, ContentTimePeriod period, bool starting); + + /** @param starting true if we want only subtitles that start during the period, otherwise + * we want subtitles that overlap the period. + */ + virtual std::list subtitles_during (ContentTimePeriod period, bool starting) const = 0; + + boost::shared_ptr _subtitle_content; }; #endif