X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Ftext_decoder.h;h=1a7632fd82b8448366dddc0676531c8b04fd9a27;hb=HEAD;hp=ed276391698e86140a49ec35663e3f7996aa32f0;hpb=9cb73fbc0fa4643612f01665bc6d9fc430656f32;p=dcpomatic.git diff --git a/src/lib/text_decoder.h b/src/lib/text_decoder.h index ed2763916..1a7632fd8 100644 --- a/src/lib/text_decoder.h +++ b/src/lib/text_decoder.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2017 Carl Hetherington + Copyright (C) 2013-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -18,57 +18,64 @@ */ -#ifndef DCPOMATIC_SUBTITLE_DECODER_H -#define DCPOMATIC_SUBTITLE_DECODER_H +#ifndef DCPOMATIC_CAPTION_DECODER_H +#define DCPOMATIC_CAPTION_DECODER_H + + +#include "content_text.h" #include "decoder.h" +#include "decoder_part.h" #include "rect.h" -#include "types.h" #include "content_text.h" -#include "decoder_part.h" +#include "types.h" +#include #include #include + namespace sub { class Subtitle; } class Image; + class TextDecoder : public DecoderPart { public: - TextDecoder ( - Decoder* parent, - boost::shared_ptr, - boost::shared_ptr log, - ContentTime first - ); - - ContentTime position () const { + TextDecoder (Decoder* parent, std::shared_ptr); + + boost::optional position (std::shared_ptr) const override { return _position; } - void emit_bitmap_start (ContentTime from, boost::shared_ptr image, dcpomatic::Rect rect); - void emit_plain_start (ContentTime from, std::list s); - void emit_plain_start (ContentTime from, sub::Subtitle const & subtitle); - void emit_plain (ContentTimePeriod period, std::list s); - void emit_plain (ContentTimePeriod period, sub::Subtitle const & subtitle); - void emit_stop (ContentTime to); + void emit_bitmap_start (ContentBitmapText const& bitmap); + void emit_bitmap (dcpomatic::ContentTimePeriod period, std::shared_ptr image, dcpomatic::Rect rect); + void emit_plain_start(dcpomatic::ContentTime from, std::vector s, dcp::SubtitleStandard valign_standard); + void emit_plain_start (dcpomatic::ContentTime from, sub::Subtitle const & subtitle); + void emit_plain(dcpomatic::ContentTimePeriod period, std::vector s, dcp::SubtitleStandard valign_standard); + void emit_plain (dcpomatic::ContentTimePeriod period, sub::Subtitle const & subtitle); + void emit_stop (dcpomatic::ContentTime to); - void seek (); + void maybe_set_position (dcpomatic::ContentTime position); - boost::shared_ptr content () const { + void seek () override; + + std::shared_ptr content () const { return _content; } - boost::signals2::signal BitmapStart; - boost::signals2::signal PlainStart; - boost::signals2::signal Stop; + static std::string remove_invalid_characters_for_xml(std::string text); + + boost::signals2::signal BitmapStart; + boost::signals2::signal PlainStart; + boost::signals2::signal Stop; private: - boost::shared_ptr _content; - ContentTime _position; + std::shared_ptr _content; + boost::optional _position; }; + #endif