| 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 // If the return value is not kSuccess, |decrypted_buffer| should be ignored | 201 // If the return value is not kSuccess, |decrypted_buffer| should be ignored |
| 202 // by the caller. | 202 // by the caller. |
| 203 // | 203 // |
| 204 // TODO(xhwang): It's not safe to pass the ownership of the dynamically | 204 // TODO(xhwang): It's not safe to pass the ownership of the dynamically |
| 205 // allocated memory over library boundaries. Fix it after related PPAPI change | 205 // allocated memory over library boundaries. Fix it after related PPAPI change |
| 206 // and sample CDM are landed. | 206 // and sample CDM are landed. |
| 207 virtual Status Decrypt(const InputBuffer& encrypted_buffer, | 207 virtual Status Decrypt(const InputBuffer& encrypted_buffer, |
| 208 DecryptedBlock* decrypted_buffer) = 0; | 208 DecryptedBlock* decrypted_buffer) = 0; |
| 209 | 209 |
| 210 // Initializes the CDM video decoder with |video_decoder_config|. This | 210 // Initializes the CDM video decoder with |video_decoder_config|. This |
| 211 // function must be called before DecryptAndDecodeVideo() is called. | 211 // function must be called before DecryptAndDecodeFrame() is called. |
| 212 // | 212 // |
| 213 // Returns kSuccess if the |video_decoder_config| is supported and the CDM | 213 // Returns kSuccess if the |video_decoder_config| is supported and the CDM |
| 214 // video decoder is successfully initialized. | 214 // video decoder is successfully initialized. |
| 215 // Returns kError if |video_decoder_config| is not supported. The CDM may | 215 // Returns kError if |video_decoder_config| is not supported. The CDM may |
| 216 // still be able to do Decrypt(). | 216 // still be able to do Decrypt(). |
| 217 // | 217 // |
| 218 // TODO(xhwang): Add stream ID here and in the following video decoder | 218 // TODO(xhwang): Add stream ID here and in the following video decoder |
| 219 // functions when we need to support multiple video streams in one CDM. | 219 // functions when we need to support multiple video streams in one CDM. |
| 220 virtual Status InitializeVideoDecoder( | 220 virtual Status InitializeVideoDecoder( |
| 221 const VideoDecoderConfig& video_decoder_config) = 0; | 221 const VideoDecoderConfig& video_decoder_config) = 0; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 232 // to decrypt. | 232 // to decrypt. |
| 233 // Returns kNeedMoreData if more data was needed by the decoder to generate | 233 // Returns kNeedMoreData if more data was needed by the decoder to generate |
| 234 // a decoded frame (e.g. during initialization). | 234 // a decoded frame (e.g. during initialization). |
| 235 // Returns kError if any other (decryption or decoding) error happened. | 235 // Returns kError if any other (decryption or decoding) error happened. |
| 236 // If the return value is not kSuccess, |video_frame| should be ignored by | 236 // If the return value is not kSuccess, |video_frame| should be ignored by |
| 237 // the caller. | 237 // the caller. |
| 238 // | 238 // |
| 239 // TODO(xhwang): It's not safe to pass the ownership of the dynamically | 239 // 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 | 240 // allocated memory over library boundaries. Fix it after related PPAPI change |
| 241 // and sample CDM are landed. | 241 // and sample CDM are landed. |
| 242 virtual Status DecryptAndDecodeVideo(const InputBuffer& encrypted_buffer, | 242 virtual Status DecryptAndDecodeFrame(const InputBuffer& encrypted_buffer, |
| 243 VideoFrame* video_frame) = 0; | 243 VideoFrame* video_frame) = 0; |
| 244 | 244 |
| 245 // Resets the CDM video decoder to an initialized clean state. All internal | 245 // Resets the CDM video decoder to an initialized clean state. All internal |
| 246 // buffers will be flushed. | 246 // buffers will be flushed. |
| 247 virtual void ResetVideoDecoder() = 0; | 247 virtual void ResetVideoDecoder() = 0; |
| 248 | 248 |
| 249 // Stops the CDM video decoder and sets it to an uninitialized state. The | 249 // Stops the CDM video decoder and sets it to an uninitialized state. The |
| 250 // caller can call InitializeVideoDecoder() again after this call to | 250 // caller can call InitializeVideoDecoder() again after this call to |
| 251 // re-initialize the video decoder. This can be used to reconfigure the | 251 // re-initialize the video decoder. This can be used to reconfigure the |
| 252 // video decoder if the config changes. | 252 // video decoder if the config changes. |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 virtual int64_t timestamp() const = 0; | 346 virtual int64_t timestamp() const = 0; |
| 347 | 347 |
| 348 protected: | 348 protected: |
| 349 VideoFrame() {} | 349 VideoFrame() {} |
| 350 virtual ~VideoFrame() {} | 350 virtual ~VideoFrame() {} |
| 351 }; | 351 }; |
| 352 | 352 |
| 353 } // namespace cdm | 353 } // namespace cdm |
| 354 | 354 |
| 355 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_CONTENT_DECRYPTION_MODULE_H_ | 355 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_CONTENT_DECRYPTION_MODULE_H_ |
| OLD | NEW |