// Copyright 2020 Google LLC. All rights reserved. // // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd #ifndef PACKAGER_MEDIA_FORMATS_TTML_TTML_GENERATOR_H_ #define PACKAGER_MEDIA_FORMATS_TTML_TTML_GENERATOR_H_ #include #include #include #include "packager/media/base/text_sample.h" #include "packager/media/base/text_stream_info.h" #include "packager/mpd/base/xml/xml_node.h" namespace shaka { namespace media { namespace ttml { class TtmlGenerator { public: explicit TtmlGenerator(); ~TtmlGenerator(); void Initialize(const std::map& regions, const std::string& language, uint32_t time_scale); void AddSample(const TextSample& sample); void Reset(); bool Dump(std::string* result) const; private: bool AddSampleToXml(const TextSample& sample, xml::XmlNode* body) const; bool ConvertFragmentToXml(const TextFragment& fragment, xml::XmlNode* parent) const; std::list samples_; std::map regions_; std::string language_; uint32_t time_scale_; }; } // namespace ttml } // namespace media } // namespace shaka #endif // PACKAGER_MEDIA_FORMATS_TTML_TTML_GENERATOR_H_