| 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 WEBKIT_MEDIA_CRYPTO_PPAPI_CONTENT_DECRYPTION_MODULE_H_ | 5 #ifndef WEBKIT_MEDIA_CRYPTO_PPAPI_CONTENT_DECRYPTION_MODULE_H_ |
| 6 #define WEBKIT_MEDIA_CRYPTO_PPAPI_CONTENT_DECRYPTION_MODULE_H_ | 6 #define WEBKIT_MEDIA_CRYPTO_PPAPI_CONTENT_DECRYPTION_MODULE_H_ |
| 7 | 7 |
| 8 #if defined(_MSC_VER) | 8 #if defined(_MSC_VER) |
| 9 typedef unsigned char uint8_t; | 9 typedef unsigned char uint8_t; |
| 10 typedef unsigned int uint32_t; | 10 typedef unsigned int uint32_t; |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 // Width and height of video frame immediately post-decode. Not all pixels | 147 // Width and height of video frame immediately post-decode. Not all pixels |
| 148 // in this region are valid. | 148 // in this region are valid. |
| 149 Size coded_size; | 149 Size coded_size; |
| 150 | 150 |
| 151 // Optional byte data required to initialize video decoders, such as H.264 | 151 // Optional byte data required to initialize video decoders, such as H.264 |
| 152 // AAVC data. | 152 // AAVC data. |
| 153 uint8_t* extra_data; | 153 uint8_t* extra_data; |
| 154 int32_t extra_data_size; | 154 int32_t extra_data_size; |
| 155 }; | 155 }; |
| 156 | 156 |
| 157 enum StreamType { |
| 158 kStreamTypeUnknown = 0, |
| 159 kStreamTypeAudio = 1, |
| 160 kStreamTypeVideo = 2 |
| 161 }; |
| 162 |
| 157 class ContentDecryptionModule { | 163 class ContentDecryptionModule { |
| 158 public: | 164 public: |
| 159 // Generates a |key_request| given the |init_data|. | 165 // Generates a |key_request| given the |init_data|. |
| 160 // | 166 // |
| 161 // Returns kSuccess if the key request was successfully generated, | 167 // Returns kSuccess if the key request was successfully generated, |
| 162 // in which case the callee should have allocated memory for the output | 168 // in which case the callee should have allocated memory for the output |
| 163 // parameters (e.g |session_id| in |key_request|) and passed the ownership | 169 // parameters (e.g |session_id| in |key_request|) and passed the ownership |
| 164 // to the caller. | 170 // to the caller. |
| 165 // Returns kError if any error happened, in which case the |key_request| | 171 // Returns kError if any error happened, in which case the |key_request| |
| 166 // should not be used by the caller. | 172 // should not be used by the caller. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 // Returns kError if any other (decryption or decoding) error happened. | 241 // Returns kError if any other (decryption or decoding) error happened. |
| 236 // If the return value is not kSuccess, |video_frame| should be ignored by | 242 // If the return value is not kSuccess, |video_frame| should be ignored by |
| 237 // the caller. | 243 // the caller. |
| 238 // | 244 // |
| 239 // TODO(xhwang): It's not safe to pass the ownership of the dynamically | 245 // TODO(xhwang): It's not safe to pass the ownership of the dynamically |
| 240 // allocated memory over library boundaries. Fix it after related PPAPI change | 246 // allocated memory over library boundaries. Fix it after related PPAPI change |
| 241 // and sample CDM are landed. | 247 // and sample CDM are landed. |
| 242 virtual Status DecryptAndDecodeFrame(const InputBuffer& encrypted_buffer, | 248 virtual Status DecryptAndDecodeFrame(const InputBuffer& encrypted_buffer, |
| 243 VideoFrame* video_frame) = 0; | 249 VideoFrame* video_frame) = 0; |
| 244 | 250 |
| 245 // Resets the CDM video decoder to an initialized clean state. All internal | 251 // De-initializes the CDM decoder and sets it to an uninitialized state. The |
| 246 // buffers will be flushed. | 252 // caller can initialize the decoder again after this call to re-initialize |
| 247 virtual void ResetVideoDecoder() = 0; | 253 // it. This can be used to reconfigure the decoder if the configuration |
| 254 // changes. |
| 255 virtual void DeinitializeDecoder(StreamType decoder_type) = 0; |
| 248 | 256 |
| 249 // Stops the CDM video decoder and sets it to an uninitialized state. The | 257 // Resets the CDM decoder to an initialized clean state. All internal buffers |
| 250 // caller can call InitializeVideoDecoder() again after this call to | 258 // MUST be flushed. |
| 251 // re-initialize the video decoder. This can be used to reconfigure the | 259 virtual void ResetDecoder(StreamType decoder_type) = 0; |
| 252 // video decoder if the config changes. | |
| 253 virtual void StopVideoDecoder() = 0; | |
| 254 | 260 |
| 255 virtual ~ContentDecryptionModule() {} | 261 virtual ~ContentDecryptionModule() {} |
| 256 }; | 262 }; |
| 257 | 263 |
| 258 // Represents a buffer created by Allocator implementations. | 264 // Represents a buffer created by Allocator implementations. |
| 259 class Buffer { | 265 class Buffer { |
| 260 public: | 266 public: |
| 261 // Destroys the buffer in the same context as it was created. | 267 // Destroys the buffer in the same context as it was created. |
| 262 virtual void Destroy() = 0; | 268 virtual void Destroy() = 0; |
| 263 | 269 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 virtual int64_t timestamp() const = 0; | 352 virtual int64_t timestamp() const = 0; |
| 347 | 353 |
| 348 protected: | 354 protected: |
| 349 VideoFrame() {} | 355 VideoFrame() {} |
| 350 virtual ~VideoFrame() {} | 356 virtual ~VideoFrame() {} |
| 351 }; | 357 }; |
| 352 | 358 |
| 353 } // namespace cdm | 359 } // namespace cdm |
| 354 | 360 |
| 355 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_CONTENT_DECRYPTION_MODULE_H_ | 361 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_CONTENT_DECRYPTION_MODULE_H_ |
| OLD | NEW |