OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Filters are connected in a strongly typed manner, with downstream filters | 5 // Filters are connected in a strongly typed manner, with downstream filters |
6 // always reading data from upstream filters. Upstream filters have no clue | 6 // always reading data from upstream filters. Upstream filters have no clue |
7 // who is actually reading from them, and return the results via callbacks. | 7 // who is actually reading from them, and return the results via callbacks. |
8 // | 8 // |
9 // DemuxerStream(Video) <- VideoDecoder <- VideoRenderer | 9 // DemuxerStream(Video) <- VideoDecoder <- VideoRenderer |
10 // DataSource <- Demuxer < | 10 // DataSource <- Demuxer < |
(...skipping 27 matching lines...) Expand all Loading... |
38 namespace media { | 38 namespace media { |
39 | 39 |
40 class Buffer; | 40 class Buffer; |
41 class Decoder; | 41 class Decoder; |
42 class DemuxerStream; | 42 class DemuxerStream; |
43 class Filter; | 43 class Filter; |
44 class FilterHost; | 44 class FilterHost; |
45 | 45 |
46 struct PipelineStatistics; | 46 struct PipelineStatistics; |
47 | 47 |
| 48 // Used to specify video preload states. They are "hints" to the browser about |
| 49 // how aggressively the browser should load and buffer data. |
| 50 // Please see the HTML5 spec for the descriptions of these values: |
| 51 // http://www.w3.org/TR/html5/video.html#attr-media-preload |
| 52 // |
| 53 // Enum values must match the values in WebCore::MediaPlayer::Preload and |
| 54 // there will be assertions at compile time if they do not match. |
| 55 enum Preload { |
| 56 NONE, |
| 57 METADATA, |
| 58 AUTO, |
| 59 }; |
| 60 |
48 // Used for completing asynchronous methods. | 61 // Used for completing asynchronous methods. |
49 typedef Callback0::Type FilterCallback; | 62 typedef Callback0::Type FilterCallback; |
50 | 63 |
51 // Used for updating pipeline statistics. | 64 // Used for updating pipeline statistics. |
52 typedef Callback1<const PipelineStatistics&>::Type StatisticsCallback; | 65 typedef Callback1<const PipelineStatistics&>::Type StatisticsCallback; |
53 | 66 |
54 class Filter : public base::RefCountedThreadSafe<Filter> { | 67 class Filter : public base::RefCountedThreadSafe<Filter> { |
55 public: | 68 public: |
56 Filter(); | 69 Filter(); |
57 | 70 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 virtual void Read(int64 position, size_t size, | 135 virtual void Read(int64 position, size_t size, |
123 uint8* data, ReadCallback* read_callback) = 0; | 136 uint8* data, ReadCallback* read_callback) = 0; |
124 | 137 |
125 // Returns true and the file size, false if the file size could not be | 138 // Returns true and the file size, false if the file size could not be |
126 // retrieved. | 139 // retrieved. |
127 virtual bool GetSize(int64* size_out) = 0; | 140 virtual bool GetSize(int64* size_out) = 0; |
128 | 141 |
129 // Returns true if we are performing streaming. In this case seeking is | 142 // Returns true if we are performing streaming. In this case seeking is |
130 // not possible. | 143 // not possible. |
131 virtual bool IsStreaming() = 0; | 144 virtual bool IsStreaming() = 0; |
| 145 |
| 146 // Alert the DataSource that the video preload value has been changed. |
| 147 virtual void SetPreload(Preload preload) = 0; |
132 }; | 148 }; |
133 | 149 |
134 class DemuxerStream : public base::RefCountedThreadSafe<DemuxerStream> { | 150 class DemuxerStream : public base::RefCountedThreadSafe<DemuxerStream> { |
135 public: | 151 public: |
136 enum Type { | 152 enum Type { |
137 UNKNOWN, | 153 UNKNOWN, |
138 AUDIO, | 154 AUDIO, |
139 VIDEO, | 155 VIDEO, |
140 NUM_TYPES, // Always keep this entry as the last one! | 156 NUM_TYPES, // Always keep this entry as the last one! |
141 }; | 157 }; |
(...skipping 17 matching lines...) Expand all Loading... |
159 | 175 |
160 protected: | 176 protected: |
161 friend class base::RefCountedThreadSafe<DemuxerStream>; | 177 friend class base::RefCountedThreadSafe<DemuxerStream>; |
162 virtual ~DemuxerStream(); | 178 virtual ~DemuxerStream(); |
163 }; | 179 }; |
164 | 180 |
165 class Demuxer : public Filter { | 181 class Demuxer : public Filter { |
166 public: | 182 public: |
167 // Returns the given stream type, or NULL if that type is not present. | 183 // Returns the given stream type, or NULL if that type is not present. |
168 virtual scoped_refptr<DemuxerStream> GetStream(DemuxerStream::Type type) = 0; | 184 virtual scoped_refptr<DemuxerStream> GetStream(DemuxerStream::Type type) = 0; |
| 185 |
| 186 // Alert the Demuxer that the video preload value has been changed. |
| 187 virtual void SetPreload(Preload preload) = 0; |
169 }; | 188 }; |
170 | 189 |
171 | 190 |
172 class VideoDecoder : public Filter { | 191 class VideoDecoder : public Filter { |
173 public: | 192 public: |
174 // Initialize a VideoDecoder with the given DemuxerStream, executing the | 193 // Initialize a VideoDecoder with the given DemuxerStream, executing the |
175 // callback upon completion. | 194 // callback upon completion. |
176 // stats_callback is used to update global pipeline statistics. | 195 // stats_callback is used to update global pipeline statistics. |
177 virtual void Initialize(DemuxerStream* stream, FilterCallback* callback, | 196 virtual void Initialize(DemuxerStream* stream, FilterCallback* callback, |
178 StatisticsCallback* stats_callback) = 0; | 197 StatisticsCallback* stats_callback) = 0; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 // buffer. | 290 // buffer. |
272 virtual bool HasEnded() = 0; | 291 virtual bool HasEnded() = 0; |
273 | 292 |
274 // Sets the output volume. | 293 // Sets the output volume. |
275 virtual void SetVolume(float volume) = 0; | 294 virtual void SetVolume(float volume) = 0; |
276 }; | 295 }; |
277 | 296 |
278 } // namespace media | 297 } // namespace media |
279 | 298 |
280 #endif // MEDIA_BASE_FILTERS_H_ | 299 #endif // MEDIA_BASE_FILTERS_H_ |
OLD | NEW |