Shaka Packager SDK
packager
media
formats
webm
webm_webvtt_parser.h
1
// Copyright 2014 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 PACKAGER_MEDIA_FORMATS_WEBM_WEBM_WEBVTT_PARSER_H_
6
#define PACKAGER_MEDIA_FORMATS_WEBM_WEBM_WEBVTT_PARSER_H_
7
8
#include <stdint.h>
9
10
#include <string>
11
12
#include "packager/base/macros.h"
13
14
namespace
shaka
{
15
namespace
media {
16
17
class
WebMWebVTTParser
{
18
public
:
20
static
void
Parse
(
const
uint8_t* payload,
21
int
payload_size,
22
std::string*
id
,
23
std::string* settings,
24
std::string* content);
25
26
private
:
27
// The payload is the embedded WebVTT cue, stored in a WebM block.
28
// The parser treats this as a UTF-8 byte stream.
29
WebMWebVTTParser
(
const
uint8_t* payload,
int
payload_size);
30
31
// Parse the cue identifier, settings, and content from the stream.
32
void
Parse
(std::string*
id
, std::string* settings, std::string* content);
33
// Remove a byte from the stream, advancing the stream pointer.
34
// Returns true if a character was returned; false means "end of stream".
35
bool
GetByte(uint8_t*
byte
);
36
37
// Backup the stream pointer.
38
void
UngetByte();
39
40
// Parse a line of text from the stream.
41
void
ParseLine(std::string* line);
42
43
// Represents the portion of the stream that has not been consumed yet.
44
const
uint8_t* ptr_;
45
const
uint8_t*
const
ptr_end_;
46
47
DISALLOW_COPY_AND_ASSIGN(
WebMWebVTTParser
);
48
};
49
50
}
// namespace media
51
}
// namespace shaka
52
53
#endif // PACKAGER_MEDIA_FORMATS_WEBM_WEBM_WEBVTT_PARSER_H_
shaka
All the methods that are virtual are virtual for mocking.
Definition:
gflags_hex_bytes.cc:11
shaka::media::WebMWebVTTParser
Definition:
webm_webvtt_parser.h:17
shaka::media::WebMWebVTTParser::Parse
static void Parse(const uint8_t *payload, int payload_size, std::string *id, std::string *settings, std::string *content)
Utility function to parse the WebVTT cue from a byte stream.
Definition:
webm_webvtt_parser.cc:10
Generated on Tue Jun 22 2021 00:16:04 for Shaka Packager SDK by
1.8.17