Files.app: Remove wait for startup animation.
[chromium-blink-merge.git] / media / blink / buffered_data_source_host_impl.h
blob8dd2ab7c306497380ab94de7be267a3d2ba5e07a
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef MEDIA_BLINK_BUFFERED_DATA_SOURCE_HOST_IMPL_H_
6 #define MEDIA_BLINK_BUFFERED_DATA_SOURCE_HOST_IMPL_H_
8 #include "base/time/time.h"
9 #include "media/base/media_export.h"
10 #include "media/base/ranges.h"
11 #include "media/blink/buffered_data_source.h"
13 namespace media {
15 // Provides an implementation of BufferedDataSourceHost that translates the
16 // buffered byte ranges into estimated time ranges.
17 class MEDIA_EXPORT BufferedDataSourceHostImpl
18 : public BufferedDataSourceHost {
19 public:
20 BufferedDataSourceHostImpl();
21 ~BufferedDataSourceHostImpl() override;
23 // BufferedDataSourceHost implementation.
24 void SetTotalBytes(int64 total_bytes) override;
25 void AddBufferedByteRange(int64 start, int64 end) override;
27 // Translate the byte ranges to time ranges and append them to the list.
28 // TODO(sandersd): This is a confusing name, find something better.
29 void AddBufferedTimeRanges(
30 Ranges<base::TimeDelta>* buffered_time_ranges,
31 base::TimeDelta media_duration) const;
33 bool DidLoadingProgress();
35 private:
36 // Total size of the data source.
37 int64 total_bytes_;
39 // List of buffered byte ranges for estimating buffered time.
40 Ranges<int64> buffered_byte_ranges_;
42 // True when AddBufferedByteRange() has been called more recently than
43 // DidLoadingProgress().
44 bool did_loading_progress_;
46 DISALLOW_COPY_AND_ASSIGN(BufferedDataSourceHostImpl);
49 } // namespace media
51 #endif // MEDIA_BLINK_BUFFERED_DATA_SOURCE_HOST_IMPL_H_