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