Shaka Player Embedded
time_ranges.h
Go to the documentation of this file.
1 // Copyright 2016 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef SHAKA_EMBEDDED_JS_MSE_TIME_RANGES_H_
16 #define SHAKA_EMBEDDED_JS_MSE_TIME_RANGES_H_
17 
21 #include "src/media/types.h"
22 
23 namespace shaka {
24 namespace js {
25 namespace mse {
26 
27 class TimeRanges : public BackingObject {
28  DECLARE_TYPE_INFO(TimeRanges);
29 
30  public:
31  explicit TimeRanges(media::BufferedRanges ranges);
32 
33  bool IsShortLived() const override;
34 
35  uint32_t length() const {
36  return ranges_.size();
37  }
38 
39  ExceptionOr<double> Start(uint32_t index) const;
40  ExceptionOr<double> End(uint32_t index) const;
41 
42  private:
43  media::BufferedRanges ranges_;
44 };
45 
46 class TimeRangesFactory : public BackingObjectFactory<TimeRanges> {
47  public:
49 };
50 
51 } // namespace mse
52 } // namespace js
53 } // namespace shaka
54 
55 #endif // SHAKA_EMBEDDED_JS_MSE_TIME_RANGES_H_
ExceptionOr< double > Start(uint32_t index) const
Definition: time_ranges.cc:46
std::vector< BufferedRange > BufferedRanges
Definition: types.h:26
bool IsShortLived() const override
Definition: time_ranges.cc:42
TimeRanges(media::BufferedRanges ranges)
Definition: time_ranges.cc:37
uint32_t length() const
Definition: time_ranges.h:35
ExceptionOr< double > End(uint32_t index) const
Definition: time_ranges.cc:52