Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MEDIA_WEBM_WEBM_WEBVTT_PARSER_H_ | |
| 6 #define MEDIA_WEBM_WEBM_WEBVTT_PARSER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 | |
| 12 namespace media { | |
| 13 | |
| 14 class WebMWebVTTParser { | |
| 15 public: | |
| 16 // Utility function to parse the WebVTT cue from a byte stream. | |
| 17 static void Parse(const uint8* payload, int payload_size, | |
| 18 std::string* id, | |
| 19 std::string* settings, | |
| 20 std::string* content); | |
| 21 | |
| 22 // The payload is the embedded WebVTT cue, stored in a WebM block. | |
| 23 // The parser treats this as a UTF-8 byte stream. | |
| 24 WebMWebVTTParser(const uint8* payload, int payload_size); | |
|
acolwell GONE FROM CHROMIUM
2013/05/10 18:41:39
Make these private since we don't want external co
Matthew Heaney (Chromium)
2013/05/11 07:29:13
Done.
| |
| 25 | |
| 26 // Parse the cue identifier, settings, and content from the stream. | |
| 27 void operator()(std::string* id, std::string* settings, std::string* content); | |
| 28 private: | |
| 29 // Remove a byte from the stream, advancing the stream pointer. | |
| 30 // Returns true if a character was returned; false means "end of stream". | |
| 31 bool GetByte(uint8* byte); | |
| 32 | |
| 33 // Backup the stream pointer. | |
| 34 void UngetByte(); | |
| 35 | |
| 36 // Parse a line of text from the stream. | |
| 37 void ParseLine(std::string* line); | |
| 38 | |
| 39 // Represents the portion of the stream that has not been consumed yet. | |
| 40 const uint8* ptr_; | |
| 41 const uint8* const ptr_end_; | |
| 42 | |
| 43 DISALLOW_COPY_AND_ASSIGN(WebMWebVTTParser); | |
| 44 }; | |
| 45 | |
| 46 } // namespace media | |
| 47 | |
| 48 #endif // MEDIA_WEBM_WEBM_WEBVTT_PARSER_H_ | |
| OLD | NEW |