7 #include "packager/media/formats/webm/mkv_writer.h"
9 namespace edash_packager {
12 MkvWriter::MkvWriter() : position_(0) {}
14 MkvWriter::~MkvWriter() {}
20 return Status(error::FILE_FAILURE,
"Unable to open file for writing.");
24 seekable_ = file_->Seek(0);
30 const std::string file_name = file_->file_name();
31 if (!file_.release()->Close()) {
32 return Status(error::FILE_FAILURE,
"Cannot close file " + file_name);
40 const char* data =
reinterpret_cast<const char*
>(buf);
41 int64_t total_bytes_written = 0;
42 while (total_bytes_written < len) {
43 const int64_t written =
44 file_->Write(data + total_bytes_written, len - total_bytes_written);
48 total_bytes_written += written;
51 DCHECK_EQ(total_bytes_written, len);
57 return WriteFromFile(source, kWholeFile);
63 const int64_t size =
File::CopyFile(source, file_.get(), max_copy);
78 if (file_->Seek(position)) {
91 mkvmuxer::int64 position) {}