7 #include "packager/media/formats/ttml/ttml_muxer.h"
9 #include "packager/file/file.h"
10 #include "packager/status_macros.h"
16 TtmlMuxer::TtmlMuxer(
const MuxerOptions& options) : TextMuxer(options) {}
17 TtmlMuxer::~TtmlMuxer() {}
19 Status TtmlMuxer::InitializeStream(TextStreamInfo* stream) {
20 stream->set_codec(kCodecTtml);
21 stream->set_codec_string(
"ttml");
22 generator_.Initialize(stream->regions(), stream->language(),
23 stream->time_scale());
27 Status TtmlMuxer::AddTextSampleInternal(
const TextSample& sample) {
28 generator_.AddSample(sample);
32 Status TtmlMuxer::WriteToFile(
const std::string& filename, uint64_t* size) {
34 if (!generator_.Dump(&data))
35 return Status(error::INTERNAL_ERROR,
"Error generating XML");
40 return Status(error::FILE_FAILURE,
"Failed to write " + filename);