OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_BASE_DATA_SOURCE_H_ | 5 #ifndef MEDIA_BASE_DATA_SOURCE_H_ |
6 #define MEDIA_BASE_DATA_SOURCE_H_ | 6 #define MEDIA_BASE_DATA_SOURCE_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "media/base/media_export.h" | 10 #include "media/base/media_export.h" |
11 | 11 |
12 namespace media { | 12 namespace media { |
13 | 13 |
14 // TODO(sandersd): Rename to BufferedDataSourceHost and move to | |
15 // content/renderer/media/. | |
16 class MEDIA_EXPORT DataSourceHost { | |
17 public: | |
18 // Set the total size of the media file. | |
19 virtual void SetTotalBytes(int64 total_bytes) = 0; | |
20 | |
21 // Notify the host that byte range [start,end] has been buffered. | |
22 // TODO(fischman): remove this method when demuxing is push-based instead of | |
23 // pull-based. http://crbug.com/131444 | |
24 virtual void AddBufferedByteRange(int64 start, int64 end) = 0; | |
25 | |
26 protected: | |
27 virtual ~DataSourceHost(); | |
28 }; | |
29 | |
30 class MEDIA_EXPORT DataSource { | 14 class MEDIA_EXPORT DataSource { |
31 public: | 15 public: |
32 typedef base::Callback<void(int64, int64)> StatusCallback; | 16 typedef base::Callback<void(int64, int64)> StatusCallback; |
33 typedef base::Callback<void(int)> ReadCB; | 17 typedef base::Callback<void(int)> ReadCB; |
34 static const int kReadError; | 18 static const int kReadError; |
35 | 19 |
36 DataSource(); | 20 DataSource(); |
37 virtual ~DataSource(); | 21 virtual ~DataSource(); |
38 | 22 |
39 // Reads |size| bytes from |position| into |data|. And when the read is done | 23 // Reads |size| bytes from |position| into |data|. And when the read is done |
(...skipping 18 matching lines...) Expand all Loading... |
58 // Values of |bitrate| <= 0 are invalid and should be ignored. | 42 // Values of |bitrate| <= 0 are invalid and should be ignored. |
59 virtual void SetBitrate(int bitrate) = 0; | 43 virtual void SetBitrate(int bitrate) = 0; |
60 | 44 |
61 private: | 45 private: |
62 DISALLOW_COPY_AND_ASSIGN(DataSource); | 46 DISALLOW_COPY_AND_ASSIGN(DataSource); |
63 }; | 47 }; |
64 | 48 |
65 } // namespace media | 49 } // namespace media |
66 | 50 |
67 #endif // MEDIA_BASE_DATA_SOURCE_H_ | 51 #endif // MEDIA_BASE_DATA_SOURCE_H_ |
OLD | NEW |