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/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "media/base/media_export.h" | 10 #include "media/base/media_export.h" |
11 #include "media/base/preload.h" | |
12 | 11 |
13 namespace media { | 12 namespace media { |
14 | 13 |
15 class MEDIA_EXPORT DataSourceHost { | 14 class MEDIA_EXPORT DataSourceHost { |
16 public: | 15 public: |
17 virtual ~DataSourceHost(); | 16 virtual ~DataSourceHost(); |
18 | 17 |
19 // Set the total size of the media file. | 18 // Set the total size of the media file. |
20 virtual void SetTotalBytes(int64 total_bytes) = 0; | 19 virtual void SetTotalBytes(int64 total_bytes) = 0; |
21 | 20 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 virtual void Stop(const base::Closure& callback) = 0; | 53 virtual void Stop(const base::Closure& callback) = 0; |
55 | 54 |
56 // Returns true and the file size, false if the file size could not be | 55 // Returns true and the file size, false if the file size could not be |
57 // retrieved. | 56 // retrieved. |
58 virtual bool GetSize(int64* size_out) = 0; | 57 virtual bool GetSize(int64* size_out) = 0; |
59 | 58 |
60 // Returns true if we are performing streaming. In this case seeking is | 59 // Returns true if we are performing streaming. In this case seeking is |
61 // not possible. | 60 // not possible. |
62 virtual bool IsStreaming() = 0; | 61 virtual bool IsStreaming() = 0; |
63 | 62 |
64 // Alert the DataSource that the video preload value has been changed. | |
65 virtual void SetPreload(Preload preload) = 0; | |
66 | |
67 // Notify the DataSource of the bitrate of the media. | 63 // Notify the DataSource of the bitrate of the media. |
68 // Values of |bitrate| <= 0 are invalid and should be ignored. | 64 // Values of |bitrate| <= 0 are invalid and should be ignored. |
69 virtual void SetBitrate(int bitrate) = 0; | 65 virtual void SetBitrate(int bitrate) = 0; |
70 | 66 |
71 protected: | 67 protected: |
72 // Only allow scoped_refptr<> to delete DataSource. | 68 // Only allow scoped_refptr<> to delete DataSource. |
73 friend class base::RefCountedThreadSafe<DataSource>; | 69 friend class base::RefCountedThreadSafe<DataSource>; |
74 virtual ~DataSource(); | 70 virtual ~DataSource(); |
75 | 71 |
76 DataSourceHost* host(); | 72 DataSourceHost* host(); |
77 | 73 |
78 private: | 74 private: |
79 DataSourceHost* host_; | 75 DataSourceHost* host_; |
80 | 76 |
81 DISALLOW_COPY_AND_ASSIGN(DataSource); | 77 DISALLOW_COPY_AND_ASSIGN(DataSource); |
82 }; | 78 }; |
83 | 79 |
84 } // namespace media | 80 } // namespace media |
85 | 81 |
86 #endif // MEDIA_BASE_DATA_SOURCE_H_ | 82 #endif // MEDIA_BASE_DATA_SOURCE_H_ |
OLD | NEW |