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 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 typedef base::Callback<void(bool)> DecoderInitCB; | 98 typedef base::Callback<void(bool)> DecoderInitCB; |
99 | 99 |
100 // Initializes a decoder with the given |config|, executing the |init_cb| | 100 // Initializes a decoder with the given |config|, executing the |init_cb| |
101 // upon completion. | 101 // upon completion. |
102 virtual void InitializeAudioDecoder(const AudioDecoderConfig& config, | 102 virtual void InitializeAudioDecoder(const AudioDecoderConfig& config, |
103 const DecoderInitCB& init_cb) = 0; | 103 const DecoderInitCB& init_cb) = 0; |
104 virtual void InitializeVideoDecoder(const VideoDecoderConfig& config, | 104 virtual void InitializeVideoDecoder(const VideoDecoderConfig& config, |
105 const DecoderInitCB& init_cb) = 0; | 105 const DecoderInitCB& init_cb) = 0; |
106 | 106 |
107 // Helper structure for managing multiple decoded audio buffers per input. | 107 // Helper structure for managing multiple decoded audio buffers per input. |
108 // TODO(xhwang): Rename this to AudioFrames. | 108 typedef std::list<scoped_refptr<AudioBuffer> > AudioFrames; |
109 typedef std::list<scoped_refptr<AudioBuffer> > AudioBuffers; | |
110 | 109 |
111 // Indicates completion of audio/video decrypt-and-decode operation. | 110 // Indicates completion of audio/video decrypt-and-decode operation. |
112 // | 111 // |
113 // First parameter: The status of the decrypt-and-decode operation. | 112 // First parameter: The status of the decrypt-and-decode operation. |
114 // - Set to kSuccess if the encrypted buffer is successfully decrypted and | 113 // - Set to kSuccess if the encrypted buffer is successfully decrypted and |
115 // decoded. In this case, the decoded frame/buffers can be/contain: | 114 // decoded. In this case, the decoded frame/buffers can be/contain: |
116 // 1) NULL, which means the operation has been aborted. | 115 // 1) NULL, which means the operation has been aborted. |
117 // 2) End-of-stream (EOS) frame, which means that the decoder has hit EOS, | 116 // 2) End-of-stream (EOS) frame, which means that the decoder has hit EOS, |
118 // flushed all internal buffers and cannot produce more video frames. | 117 // flushed all internal buffers and cannot produce more video frames. |
119 // 3) Decrypted and decoded video frame or audio buffer. | 118 // 3) Decrypted and decoded video frame or audio buffer. |
120 // - Set to kNoKey if no decryption key is available to decrypt the encrypted | 119 // - Set to kNoKey if no decryption key is available to decrypt the encrypted |
121 // buffer. In this case the returned frame(s) must be NULL/empty. | 120 // buffer. In this case the returned frame(s) must be NULL/empty. |
122 // - Set to kNeedMoreData if more data is needed to produce a video frame. In | 121 // - Set to kNeedMoreData if more data is needed to produce a video frame. In |
123 // this case the returned frame(s) must be NULL/empty. | 122 // this case the returned frame(s) must be NULL/empty. |
124 // - Set to kError if unexpected error has occurred. In this case the | 123 // - Set to kError if unexpected error has occurred. In this case the |
125 // returned frame(s) must be NULL/empty. | 124 // returned frame(s) must be NULL/empty. |
126 // Second parameter: The decoded video frame or audio buffers. | 125 // Second parameter: The decoded video frame or audio buffers. |
127 typedef base::Callback<void(Status, const AudioBuffers&)> AudioDecodeCB; | 126 typedef base::Callback<void(Status, const AudioFrames&)> AudioDecodeCB; |
128 typedef base::Callback<void(Status, | 127 typedef base::Callback<void(Status, |
129 const scoped_refptr<VideoFrame>&)> VideoDecodeCB; | 128 const scoped_refptr<VideoFrame>&)> VideoDecodeCB; |
130 | 129 |
131 // Decrypts and decodes the |encrypted| buffer. The status and the decrypted | 130 // Decrypts and decodes the |encrypted| buffer. The status and the decrypted |
132 // buffer are returned via the provided callback. | 131 // buffer are returned via the provided callback. |
133 // The |encrypted| buffer must not be NULL. | 132 // The |encrypted| buffer must not be NULL. |
134 // At end-of-stream, this method should be called repeatedly with | 133 // At end-of-stream, this method should be called repeatedly with |
135 // end-of-stream DecoderBuffer until no frame/buffer can be produced. | 134 // end-of-stream DecoderBuffer until no frame/buffer can be produced. |
136 // These methods can only be called after the corresponding decoder has | 135 // These methods can only be called after the corresponding decoder has |
137 // been successfully initialized. | 136 // been successfully initialized. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 // notification. When the decryptor is ready, notification will be sent | 177 // notification. When the decryptor is ready, notification will be sent |
179 // through the provided callback. | 178 // through the provided callback. |
180 // Calling this callback with a null callback cancels previously registered | 179 // Calling this callback with a null callback cancels previously registered |
181 // decryptor ready notification. Any previously provided callback will be | 180 // decryptor ready notification. Any previously provided callback will be |
182 // fired immediately with NULL. | 181 // fired immediately with NULL. |
183 typedef base::Callback<void(const DecryptorReadyCB&)> SetDecryptorReadyCB; | 182 typedef base::Callback<void(const DecryptorReadyCB&)> SetDecryptorReadyCB; |
184 | 183 |
185 } // namespace media | 184 } // namespace media |
186 | 185 |
187 #endif // MEDIA_BASE_DECRYPTOR_H_ | 186 #endif // MEDIA_BASE_DECRYPTOR_H_ |
OLD | NEW |