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 <string>
12#include <string_view>
13
14#include <packager/media/base/text_sample.h>
15#include <packager/media/base/text_stream_info.h>
16
17namespace shaka {
18namespace media {
19
20// Parse a timestamp into milliseconds using the two patterns defined by WebVtt:
21// LONG : ##:##:##.### (long can have 2 or more hour digits)
22// SHORT : ##:##:###
23bool WebVttTimestampToMs(const std::string_view& source, int64_t* out);
24
25// Create a long form timestamp encoded as a string.
26std::string MsToWebVttTimestamp(uint64_t ms);
27
29std::string WebVttSettingsToString(const TextSettings& settings);
30
32std::string WebVttFragmentToString(const TextFragment& fragment);
33
36std::string WebVttGetPreamble(const TextStreamInfo& stream_info);
37
38} // namespace media
39} // namespace shaka
40
41#endif // PACKAGER_MEDIA_FORMATS_WEBVTT_UTILS_H_
All the methods that are virtual are virtual for mocking.