shaka-packager/packager/media/formats/webvtt/webvtt_file_buffer.h

44 lines
1.1 KiB
C++

// Copyright 2018 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_WEBVTT_WEBVTT_FILE_BUFFER_H_
#define PACKAGER_MEDIA_FORMATS_WEBVTT_WEBVTT_FILE_BUFFER_H_
#include <string>
#include "packager/file/file.h"
namespace shaka {
namespace media {
class TextSample;
// A class to abstract writing a webvtt file to disk. This class will handle
// all the formatting requirements for a webvtt file.
class WebVttFileBuffer {
public:
WebVttFileBuffer();
virtual ~WebVttFileBuffer() = default;
void Reset();
void Append(const TextSample& sample);
bool WriteTo(File* file);
// Get the number of samples that have been appended to this file.
size_t sample_count() const { return sample_count_; }
private:
// TODO(vaage): Add missing deleted copy and assign constructors.
std::string buffer_;
size_t sample_count_ = 0;
};
} // namespace media
} // namespace shaka
#endif // PACKAGER_MEDIA_FORMATS_WEBVTT_WEBVTT_FILE_BUFFER_H_