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