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 #ifndef MEDIA_BASE_DECRYPTOR_H_ | 5 #ifndef MEDIA_BASE_DECRYPTOR_H_ |
| 6 #define MEDIA_BASE_DECRYPTOR_H_ | 6 #define MEDIA_BASE_DECRYPTOR_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 // upon completion. | 124 // upon completion. |
| 125 // |key_added_cb| should be called when a key is added to the decryptor. | 125 // |key_added_cb| should be called when a key is added to the decryptor. |
| 126 virtual void InitializeAudioDecoder(scoped_ptr<AudioDecoderConfig> config, | 126 virtual void InitializeAudioDecoder(scoped_ptr<AudioDecoderConfig> config, |
| 127 const DecoderInitCB& init_cb, | 127 const DecoderInitCB& init_cb, |
| 128 const KeyAddedCB& key_added_cb) = 0; | 128 const KeyAddedCB& key_added_cb) = 0; |
| 129 virtual void InitializeVideoDecoder(scoped_ptr<VideoDecoderConfig> config, | 129 virtual void InitializeVideoDecoder(scoped_ptr<VideoDecoderConfig> config, |
| 130 const DecoderInitCB& init_cb, | 130 const DecoderInitCB& init_cb, |
| 131 const KeyAddedCB& key_added_cb) = 0; | 131 const KeyAddedCB& key_added_cb) = 0; |
| 132 | 132 |
| 133 // Helper structure for managing multiple decoded audio buffers per input. | 133 // Helper structure for managing multiple decoded audio buffers per input. |
| 134 struct QueuedAudioBuffer { | 134 typedef std::list<scoped_refptr<Buffer> > AudioBuffers; |
|
xhwang
2012/10/18 02:14:10
This cl is based on 11144036, so the changes in th
| |
| 135 AudioDecoder::Status status; | |
| 136 scoped_refptr<Buffer> buffer; | |
| 137 }; | |
| 138 typedef std::list<QueuedAudioBuffer> AudioBuffers; | |
| 139 | 135 |
| 140 // Indicates completion of audio/video decrypt-and-decode operation. | 136 // Indicates completion of audio/video decrypt-and-decode operation. |
| 141 // | 137 // |
| 142 // First parameter: The status of the decrypt-and-decode operation. | 138 // First parameter: The status of the decrypt-and-decode operation. |
| 143 // - Set to kSuccess if the encrypted buffer is successfully decrypted and | 139 // - Set to kSuccess if the encrypted buffer is successfully decrypted and |
| 144 // decoded. In this case, the decoded frame/buffers can be/contain: | 140 // decoded. In this case, the decoded frame/buffers can be/contain: |
| 145 // 1) NULL, which means the operation has been aborted. | 141 // 1) NULL, which means the operation has been aborted. |
| 146 // 2) End-of-stream (EOS) frame, which means that the decoder has hit EOS, | 142 // 2) End-of-stream (EOS) frame, which means that the decoder has hit EOS, |
| 147 // flushed all internal buffers and cannot produce more video frames. | 143 // flushed all internal buffers and cannot produce more video frames. |
| 148 // 3) Decrypted and decoded video frame or audio buffer. | 144 // 3) Decrypted and decoded video frame or audio buffer. |
| 149 // - Set to kNoKey if no decryption key is available to decrypt the encrypted | 145 // - Set to kNoKey if no decryption key is available to decrypt the encrypted |
| 150 // buffer. In this case the second parameter must be NULL. | 146 // buffer. In this case the second parameter must be NULL. |
| 151 // - Set to kNeedMoreData if more data is needed to produce a video frame. In | 147 // - Set to kNeedMoreData if more data is needed to produce a video frame. In |
| 152 // this case the second parameter must be NULL. | 148 // this case the second parameter must be NULL. |
| 153 // - Set to kError if unexpected error has occurred. In this case the | 149 // - Set to kError if unexpected error has occurred. In this case the |
| 154 // second parameter must be NULL. | 150 // second parameter must be NULL. |
| 155 // Second parameter: The decoded video frame or audio buffers. | 151 // Second parameter: The decoded video frame or audio buffers. |
| 156 typedef base::Callback<void(Status, | 152 typedef base::Callback<void(Status, const AudioBuffers&)> AudioDecodeCB; |
| 157 const scoped_ptr<AudioBuffers>&)> AudioDecodeCB; | |
| 158 typedef base::Callback<void(Status, | 153 typedef base::Callback<void(Status, |
| 159 const scoped_refptr<VideoFrame>&)> VideoDecodeCB; | 154 const scoped_refptr<VideoFrame>&)> VideoDecodeCB; |
| 160 | 155 |
| 161 // Decrypts and decodes the |encrypted| buffer. The status and the decrypted | 156 // Decrypts and decodes the |encrypted| buffer. The status and the decrypted |
| 162 // buffer are returned via the provided callback. | 157 // buffer are returned via the provided callback. |
| 163 // The |encrypted| buffer must not be NULL. | 158 // The |encrypted| buffer must not be NULL. |
| 164 // At end-of-stream, this method should be called repeatedly with | 159 // At end-of-stream, this method should be called repeatedly with |
| 165 // end-of-stream DecoderBuffer until no frame/buffer can be produced. | 160 // end-of-stream DecoderBuffer until no frame/buffer can be produced. |
| 166 // These two methods can only be called after the corresponding decoder has | 161 // These two methods can only be called after the corresponding decoder has |
| 167 // been successfully initialized. | 162 // been successfully initialized. |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 188 // The decoder can be reinitialized after it is uninitialized. | 183 // The decoder can be reinitialized after it is uninitialized. |
| 189 virtual void DeinitializeDecoder(StreamType stream_type) = 0; | 184 virtual void DeinitializeDecoder(StreamType stream_type) = 0; |
| 190 | 185 |
| 191 private: | 186 private: |
| 192 DISALLOW_COPY_AND_ASSIGN(Decryptor); | 187 DISALLOW_COPY_AND_ASSIGN(Decryptor); |
| 193 }; | 188 }; |
| 194 | 189 |
| 195 } // namespace media | 190 } // namespace media |
| 196 | 191 |
| 197 #endif // MEDIA_BASE_DECRYPTOR_H_ | 192 #endif // MEDIA_BASE_DECRYPTOR_H_ |
| OLD | NEW |