Shaka Packager SDK
Loading...
Searching...
No Matches
text_readers.h
1// Copyright 2017 Google LLC. All rights reserved.
2//
3// Use of this source code is governed by a BSD-style
4// license that can be found in the LICENSE file or at
5// https://developers.google.com/open-source/licenses/bsd
6
7#ifndef PACKAGER_MEDIA_FORMATS_WEBVTT_TEXT_READERS_H_
8#define PACKAGER_MEDIA_FORMATS_WEBVTT_TEXT_READERS_H_
9
10#include <cstdint>
11#include <memory>
12#include <string>
13#include <vector>
14
15#include <packager/media/base/byte_queue.h>
16#include <packager/status.h>
17
18namespace shaka {
19class File;
20
21namespace media {
22
24 public:
25 LineReader();
26
28 void PushData(const uint8_t* data, size_t data_size);
31 bool Next(std::string* out);
34 void Flush();
35
36 private:
37 LineReader(const LineReader&) = delete;
38 LineReader operator=(const LineReader&) = delete;
39
40 ByteQueue buffer_;
41 bool should_flush_;
42};
43
45 public:
47
49 void PushData(const uint8_t* data, size_t data_size);
52 bool Next(std::vector<std::string>* out);
55 void Flush();
56
57 private:
58 BlockReader(const BlockReader&) = delete;
59 BlockReader operator=(const BlockReader&) = delete;
60
61 LineReader source_;
62 std::vector<std::string> temp_;
63 bool should_flush_;
64};
65
66} // namespace media
67} // namespace shaka
68
69#endif // MEDIA_FORMATS_WEBVTT_TEXT_READERS_H_
void PushData(const uint8_t *data, size_t data_size)
Pushes data onto the end of the buffer.
bool Next(std::vector< std::string > *out)
bool Next(std::string *out)
void PushData(const uint8_t *data, size_t data_size)
Pushes data onto the end of the buffer.
All the methods that are virtual are virtual for mocking.