X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fsubtitle_decoder.h;h=ef62d8b88355f73c6a6f4e308e036664296fce1c;hb=cc76b517f6a74f813ae38137bdc88ff3bafa6dd9;hp=efa90fd92c7950280e8c900b42ccf3ce591a1b1d;hpb=854f2e5bbb7ffb9758b823af87034033033f3cb8;p=dcpomatic.git diff --git a/src/lib/subtitle_decoder.h b/src/lib/subtitle_decoder.h index efa90fd92..ef62d8b88 100644 --- a/src/lib/subtitle_decoder.h +++ b/src/lib/subtitle_decoder.h @@ -20,30 +20,41 @@ #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; 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, bool accurate); + std::list get_text_subtitles (ContentTimePeriod period, bool starting, bool accurate); protected: - void image_subtitle (ContentTime from, ContentTime to, boost::shared_ptr, dcpomatic::Rect); - void text_subtitle (std::list); + void seek (ContentTime, bool); + + void image_subtitle (ContentTimePeriod period, boost::shared_ptr, dcpomatic::Rect); + void text_subtitle (ContentTimePeriod period, std::list); + + std::list _decoded_image_subtitles; + std::list _decoded_text_subtitles; + boost::shared_ptr _subtitle_content; + +private: + template + std::list get (std::list const & subs, std::list const & sp, ContentTimePeriod period, bool starting, bool accurate); - std::list > _decoded_image_subtitles; - std::list > _decoded_text_subtitles; + /** @param starting true if we want only subtitles that start during the period, otherwise + * we want subtitles that overlap the period. + */ + virtual std::list image_subtitles_during (ContentTimePeriod period, bool starting) const = 0; + virtual std::list text_subtitles_during (ContentTimePeriod period, bool starting) const = 0; }; #endif