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 25 matching lines...) Expand all Loading... |
36 namespace media { | 36 namespace media { |
37 | 37 |
38 class Buffer; | 38 class Buffer; |
39 class Decoder; | 39 class Decoder; |
40 class DemuxerStream; | 40 class DemuxerStream; |
41 class Filter; | 41 class Filter; |
42 class FilterHost; | 42 class FilterHost; |
43 | 43 |
44 struct PipelineStatistics; | 44 struct PipelineStatistics; |
45 | 45 |
| 46 // Used to specify video preload states. They are "hints" to the browser about |
| 47 // how aggressively the browser should load and buffer data. |
| 48 // Please see the HTML5 spec for the descriptions of these values: |
| 49 // http://www.w3.org/TR/html5/video.html#attr-media-preload |
| 50 // |
| 51 // Enum values must match the values in WebCore::MediaPlayer::Preload and |
| 52 // there will be assertions at compile time if they do not match. |
| 53 enum Preload { |
| 54 NONE, |
| 55 METADATA, |
| 56 AUTO, |
| 57 }; |
| 58 |
46 // Used for completing asynchronous methods. | 59 // Used for completing asynchronous methods. |
47 typedef Callback0::Type FilterCallback; | 60 typedef Callback0::Type FilterCallback; |
48 | 61 |
49 // Used for updating pipeline statistics. | 62 // Used for updating pipeline statistics. |
50 typedef Callback1<const PipelineStatistics&>::Type StatisticsCallback; | 63 typedef Callback1<const PipelineStatistics&>::Type StatisticsCallback; |
51 | 64 |
52 class Filter : public base::RefCountedThreadSafe<Filter> { | 65 class Filter : public base::RefCountedThreadSafe<Filter> { |
53 public: | 66 public: |
54 Filter(); | 67 Filter(); |
55 | 68 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 virtual void Read(int64 position, size_t size, | 133 virtual void Read(int64 position, size_t size, |
121 uint8* data, ReadCallback* read_callback) = 0; | 134 uint8* data, ReadCallback* read_callback) = 0; |
122 | 135 |
123 // Returns true and the file size, false if the file size could not be | 136 // Returns true and the file size, false if the file size could not be |
124 // retrieved. | 137 // retrieved. |
125 virtual bool GetSize(int64* size_out) = 0; | 138 virtual bool GetSize(int64* size_out) = 0; |
126 | 139 |
127 // Returns true if we are performing streaming. In this case seeking is | 140 // Returns true if we are performing streaming. In this case seeking is |
128 // not possible. | 141 // not possible. |
129 virtual bool IsStreaming() = 0; | 142 virtual bool IsStreaming() = 0; |
| 143 |
| 144 // Alert the DataSource that the video preload value has been changed. |
| 145 virtual void SetPreload(Preload preload) = 0; |
130 }; | 146 }; |
131 | 147 |
132 class DemuxerStream : public base::RefCountedThreadSafe<DemuxerStream> { | 148 class DemuxerStream : public base::RefCountedThreadSafe<DemuxerStream> { |
133 public: | 149 public: |
134 enum Type { | 150 enum Type { |
135 UNKNOWN, | 151 UNKNOWN, |
136 AUDIO, | 152 AUDIO, |
137 VIDEO, | 153 VIDEO, |
138 NUM_TYPES, // Always keep this entry as the last one! | 154 NUM_TYPES, // Always keep this entry as the last one! |
139 }; | 155 }; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 virtual void* QueryInterface(const char* interface_id); | 189 virtual void* QueryInterface(const char* interface_id); |
174 | 190 |
175 friend class base::RefCountedThreadSafe<DemuxerStream>; | 191 friend class base::RefCountedThreadSafe<DemuxerStream>; |
176 virtual ~DemuxerStream(); | 192 virtual ~DemuxerStream(); |
177 }; | 193 }; |
178 | 194 |
179 class Demuxer : public Filter { | 195 class Demuxer : public Filter { |
180 public: | 196 public: |
181 // Returns the given stream type, or NULL if that type is not present. | 197 // Returns the given stream type, or NULL if that type is not present. |
182 virtual scoped_refptr<DemuxerStream> GetStream(DemuxerStream::Type type) = 0; | 198 virtual scoped_refptr<DemuxerStream> GetStream(DemuxerStream::Type type) = 0; |
| 199 |
| 200 // Alert the Demuxer that the video preload value has been changed. |
| 201 virtual void SetPreload(Preload preload) = 0; |
183 }; | 202 }; |
184 | 203 |
185 | 204 |
186 class VideoDecoder : public Filter { | 205 class VideoDecoder : public Filter { |
187 public: | 206 public: |
188 // Initialize a VideoDecoder with the given DemuxerStream, executing the | 207 // Initialize a VideoDecoder with the given DemuxerStream, executing the |
189 // callback upon completion. | 208 // callback upon completion. |
190 // stats_callback is used to update global pipeline statistics. | 209 // stats_callback is used to update global pipeline statistics. |
191 virtual void Initialize(DemuxerStream* stream, FilterCallback* callback, | 210 virtual void Initialize(DemuxerStream* stream, FilterCallback* callback, |
192 StatisticsCallback* stats_callback) = 0; | 211 StatisticsCallback* stats_callback) = 0; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 // buffer. | 304 // buffer. |
286 virtual bool HasEnded() = 0; | 305 virtual bool HasEnded() = 0; |
287 | 306 |
288 // Sets the output volume. | 307 // Sets the output volume. |
289 virtual void SetVolume(float volume) = 0; | 308 virtual void SetVolume(float volume) = 0; |
290 }; | 309 }; |
291 | 310 |
292 } // namespace media | 311 } // namespace media |
293 | 312 |
294 #endif // MEDIA_BASE_FILTERS_H_ | 313 #endif // MEDIA_BASE_FILTERS_H_ |
OLD | NEW |