7 #include "packager/media/formats/webm/mkv_writer.h"
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()) {
34 "Cannot close file " + file_name +
35 ", possibly file permission issue or running out of disk space.");
43 const char* data =
reinterpret_cast<const char*
>(buf);
44 int64_t total_bytes_written = 0;
45 while (total_bytes_written < len) {
46 const int64_t written =
47 file_->Write(data + total_bytes_written, len - total_bytes_written);
51 total_bytes_written += written;
54 DCHECK_EQ(total_bytes_written, len);
66 const int64_t size =
File::CopyFile(source, file_.get(), max_copy);
81 if (file_->Seek(position)) {
94 mkvmuxer::int64 position) {}
Define an abstract file interface.
static int64_t CopyFile(File *source, File *destination)
virtual bool Open()=0
Internal open. Should not be used directly.