Shaka Packager SDK
webvtt_utils.h
1 // Copyright 2017 Google Inc. 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_UTILS_H_
8 #define PACKAGER_MEDIA_FORMATS_WEBVTT_UTILS_H_
9 
10 #include <stdint.h>
11 
12 #include <list>
13 #include <memory>
14 #include <string>
15 
16 #include "packager/base/strings/string_piece.h"
17 #include "packager/media/base/text_sample.h"
18 #include "packager/media/base/text_stream_info.h"
19 
20 namespace shaka {
21 namespace media {
22 
23 // Parse a timestamp into milliseconds using the two patterns defined by WebVtt:
24 // LONG : ##:##:##.### (long can have 2 or more hour digits)
25 // SHORT : ##:##:###
26 bool WebVttTimestampToMs(const base::StringPiece& source, uint64_t* out);
27 
28 // Create a long form timestamp encoded as a string.
29 std::string MsToWebVttTimestamp(uint64_t ms);
30 
32 std::string WebVttSettingsToString(const TextSettings& settings);
33 
35 std::string WebVttFragmentToString(const TextFragment& fragment);
36 
39 std::string WebVttGetPreamble(const TextStreamInfo& stream_info);
40 
41 } // namespace media
42 } // namespace shaka
43 
44 #endif // PACKAGER_MEDIA_FORMATS_WEBVTT_UTILS_H_
shaka
All the methods that are virtual are virtual for mocking.
Definition: gflags_hex_bytes.cc:11