DASH Media Packaging SDK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
webvtt_timestamp.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_TIMESTAMP_H_
8 #define PACKAGER_MEDIA_FORMATS_WEBVTT_TIMESTAMP_H_
9 
10 #include <stdint.h>
11 
12 #include <string>
13 
14 #include "packager/base/strings/string_piece.h"
15 
16 namespace shaka {
17 namespace media {
18 // Parse a timestamp into milliseconds using the two patterns defined by WebVtt:
19 // LONG : ##:##:##.### (long can have 2 or more hour digits)
20 // SHORT : ##:##:###
21 bool WebVttTimestampToMs(const base::StringPiece& source, uint64_t* out);
22 
23 // Create a long form timestamp encoded as a string.
24 std::string MsToWebVttTimestamp(uint64_t ms);
25 } // namespace media
26 } // namespace shaka
27 
28 #endif // PACKAGER_MEDIA_FORMATS_WEBVTT_TIMESTAMP_H_