X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Flib%2Fsubtitle_decoder.h;h=c1f171b1fbb799ebe0a128ff606b1932df5f0e68;hp=d01c4e45b0ba5480567818d3f53809d1683fa325;hb=00ae2c28501bb757a6a45ba47ad4ecbe32412933;hpb=dd8a7d1bbb8f2afb1b98d2be856ff0a9920e180d diff --git a/src/lib/subtitle_decoder.h b/src/lib/subtitle_decoder.h index d01c4e45b..c1f171b1f 100644 --- a/src/lib/subtitle_decoder.h +++ b/src/lib/subtitle_decoder.h @@ -1,19 +1,20 @@ /* - Copyright (C) 2013 Carl Hetherington + Copyright (C) 2013-2017 Carl Hetherington - This program is free software; you can redistribute it and/or modify + This file is part of DCP-o-matic. + + DCP-o-matic is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + DCP-o-matic is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with DCP-o-matic. If not, see . */ @@ -24,38 +25,50 @@ #include "rect.h" #include "types.h" #include "content_subtitle.h" +#include "decoder_part.h" #include +#include + +namespace sub { + class Subtitle; +} class Image; -class SubtitleDecoder : public virtual Decoder +class SubtitleDecoder : public DecoderPart { public: - SubtitleDecoder (boost::shared_ptr); - - std::list get_image_subtitles (ContentTimePeriod period, bool starting); - std::list get_text_subtitles (ContentTimePeriod period, bool starting); - -protected: - 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; + SubtitleDecoder ( + Decoder* parent, + boost::shared_ptr, + boost::shared_ptr log, + ContentTime first + ); + + ContentTime position () const { + return _position; + } + + void emit_image_start (ContentTime from, boost::shared_ptr image, dcpomatic::Rect rect); + void emit_text_start (ContentTime from, std::list s); + void emit_text_start (ContentTime from, sub::Subtitle const & subtitle); + void emit_text (ContentTimePeriod period, std::list s); + void emit_text (ContentTimePeriod period, sub::Subtitle const & subtitle); + void emit_stop (ContentTime to); + + void seek (); + + boost::shared_ptr content () const { + return _content; + } + + boost::signals2::signal ImageStart; + boost::signals2::signal TextStart; + boost::signals2::signal Stop; private: - template - std::list get (std::list const & subs, std::list const & sp, 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 image_subtitles_during (ContentTimePeriod period, bool starting) const = 0; - virtual std::list text_subtitles_during (ContentTimePeriod period, bool starting) const = 0; - - boost::shared_ptr _subtitle_content; + boost::shared_ptr _content; + ContentTime _position; }; #endif