Chromium Code Reviews| 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 // 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 virtual ~Filter(); | 100 virtual ~Filter(); |
| 101 | 101 |
| 102 FilterHost* host() const { return host_; } | 102 FilterHost* host() const { return host_; } |
| 103 | 103 |
| 104 private: | 104 private: |
| 105 FilterHost* host_; | 105 FilterHost* host_; |
| 106 | 106 |
| 107 DISALLOW_COPY_AND_ASSIGN(Filter); | 107 DISALLOW_COPY_AND_ASSIGN(Filter); |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 class MEDIA_EXPORT VideoDecoder : public Filter { | 110 class MEDIA_EXPORT VideoDecoder : public Filter { |
|
Ami GONE FROM CHROMIUM
2012/04/27 16:49:14
Can you override Filter::set_host() here to LOG(FA
xhwang
2012/04/27 23:22:30
Done.
| |
| 111 public: | 111 public: |
| 112 // Status codes for read operations on VideoDecoder. | |
| 113 enum Status { | |
| 114 kOk, // Everything went as planned. | |
| 115 kDecodeError, // Decoding error happened. | |
| 116 kDecryptError // Decrypting error happened. | |
| 117 }; | |
| 118 | |
| 112 // Initialize a VideoDecoder with the given DemuxerStream, executing the | 119 // Initialize a VideoDecoder with the given DemuxerStream, executing the |
| 113 // callback upon completion. | 120 // callback upon completion. |
| 114 // statistics_cb is used to update global pipeline statistics. | 121 // statistics_cb is used to update global pipeline statistics. |
| 115 virtual void Initialize(DemuxerStream* stream, | 122 virtual void Initialize(DemuxerStream* stream, |
| 116 const PipelineStatusCB& status_cb, | 123 const PipelineStatusCB& status_cb, |
| 117 const StatisticsCB& statistics_cb) = 0; | 124 const StatisticsCB& statistics_cb) = 0; |
| 118 | 125 |
| 119 // Request a frame to be decoded and returned via the provided callback. | 126 // Request a frame to be decoded and returned via the provided callback. |
| 120 // Only one read may be in flight at any given time. | 127 // Only one read may be in flight at any given time. |
| 121 // | 128 // |
| 122 // Implementations guarantee that the callback will not be called from within | 129 // Implementations guarantee that the callback will not be called from within |
| 123 // this method. | 130 // this method. |
| 124 // | 131 // |
| 125 // Non-NULL frames contain decoded video data or may indicate the end of | 132 // Non-NULL frames contain decoded video data or may indicate the end of |
| 126 // the stream. NULL video frames indicate an aborted read. This can happen if | 133 // the stream. NULL video frames indicate an aborted read. This can happen if |
| 127 // the DemuxerStream gets flushed and doesn't have any more data to return. | 134 // the DemuxerStream gets flushed and doesn't have any more data to return. |
| 128 typedef base::Callback<void(scoped_refptr<VideoFrame>)> ReadCB; | 135 typedef base::Callback<void(scoped_refptr<VideoFrame>, Status)> ReadCB; |
|
Ami GONE FROM CHROMIUM
2012/04/27 16:49:14
Typically dependent args follow their dependencies
scherkus (not reviewing)
2012/04/27 18:27:56
Building on top of that -- the docs should be upda
xhwang
2012/04/27 23:22:30
Done.
xhwang
2012/04/27 23:22:30
Done.
| |
| 129 virtual void Read(const ReadCB& read_cb) = 0; | 136 virtual void Read(const ReadCB& read_cb) = 0; |
| 130 | 137 |
| 131 // Returns the natural width and height of decoded video in pixels. | 138 // Returns the natural width and height of decoded video in pixels. |
| 132 // | 139 // |
| 133 // Clients should NOT rely on these values to remain constant. Instead, use | 140 // Clients should NOT rely on these values to remain constant. Instead, use |
| 134 // the width/height from decoded video frames themselves. | 141 // the width/height from decoded video frames themselves. |
| 135 // | 142 // |
| 136 // TODO(scherkus): why not rely on prerolling and decoding a single frame to | 143 // TODO(scherkus): why not rely on prerolling and decoding a single frame to |
| 137 // get dimensions? | 144 // get dimensions? |
| 138 virtual const gfx::Size& natural_size() = 0; | 145 virtual const gfx::Size& natural_size() = 0; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 210 | 217 |
| 211 // Resumes playback after underflow occurs. | 218 // Resumes playback after underflow occurs. |
| 212 // |buffer_more_audio| is set to true if you want to increase the size of the | 219 // |buffer_more_audio| is set to true if you want to increase the size of the |
| 213 // decoded audio buffer. | 220 // decoded audio buffer. |
| 214 virtual void ResumeAfterUnderflow(bool buffer_more_audio) = 0; | 221 virtual void ResumeAfterUnderflow(bool buffer_more_audio) = 0; |
| 215 }; | 222 }; |
| 216 | 223 |
| 217 } // namespace media | 224 } // namespace media |
| 218 | 225 |
| 219 #endif // MEDIA_BASE_FILTERS_H_ | 226 #endif // MEDIA_BASE_FILTERS_H_ |
| OLD | NEW |