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 29 matching lines...) Expand all Loading... |
51 virtual void Stop(const base::Closure& callback) = 0; | 50 virtual void Stop(const base::Closure& callback) = 0; |
52 | 51 |
53 // Returns true and the file size, false if the file size could not be | 52 // Returns true and the file size, false if the file size could not be |
54 // retrieved. | 53 // retrieved. |
55 virtual bool GetSize(int64* size_out) = 0; | 54 virtual bool GetSize(int64* size_out) = 0; |
56 | 55 |
57 // Returns true if we are performing streaming. In this case seeking is | 56 // Returns true if we are performing streaming. In this case seeking is |
58 // not possible. | 57 // not possible. |
59 virtual bool IsStreaming() = 0; | 58 virtual bool IsStreaming() = 0; |
60 | 59 |
61 // Alert the DataSource that the video preload value has been changed. | |
62 virtual void SetPreload(Preload preload) = 0; | |
63 | |
64 // Notify the DataSource of the bitrate of the media. | 60 // Notify the DataSource of the bitrate of the media. |
65 // Values of |bitrate| <= 0 are invalid and should be ignored. | 61 // Values of |bitrate| <= 0 are invalid and should be ignored. |
66 virtual void SetBitrate(int bitrate) = 0; | 62 virtual void SetBitrate(int bitrate) = 0; |
67 | 63 |
68 protected: | 64 protected: |
69 // Only allow scoped_refptr<> to delete DataSource. | 65 // Only allow scoped_refptr<> to delete DataSource. |
70 friend class base::RefCountedThreadSafe<DataSource>; | 66 friend class base::RefCountedThreadSafe<DataSource>; |
71 virtual ~DataSource(); | 67 virtual ~DataSource(); |
72 | 68 |
73 DataSourceHost* host(); | 69 DataSourceHost* host(); |
74 | 70 |
75 private: | 71 private: |
76 DataSourceHost* host_; | 72 DataSourceHost* host_; |
77 | 73 |
78 DISALLOW_COPY_AND_ASSIGN(DataSource); | 74 DISALLOW_COPY_AND_ASSIGN(DataSource); |
79 }; | 75 }; |
80 | 76 |
81 } // namespace media | 77 } // namespace media |
82 | 78 |
83 #endif // MEDIA_BASE_DATA_SOURCE_H_ | 79 #endif // MEDIA_BASE_DATA_SOURCE_H_ |
OLD | NEW |