Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(450)

Side by Side Diff: webkit/media/crypto/ppapi/content_decryption_module.h

Issue 11189082: Update PluginInstance for audio support for content decryption. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix tests Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/media/crypto/ppapi/clear_key_cdm.cc ('k') | webkit/media/crypto/ppapi_decryptor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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;
11 typedef int int32_t; 11 typedef int int32_t;
12 typedef __int64 int64_t; 12 typedef __int64 int64_t;
13 #else 13 #else
14 #include <stdint.h> 14 #include <stdint.h>
15 #endif 15 #endif
16 16
17 #include "webkit/media/crypto/ppapi/cdm_export.h" 17 #include "webkit/media/crypto/ppapi/cdm_export.h"
18 18
19 namespace cdm { 19 namespace cdm {
20 class Allocator; 20 class Allocator;
21 class Buffer;
22 class CdmHost; 21 class CdmHost;
23 class ContentDecryptionModule; 22 class ContentDecryptionModule;
24 class DecryptedBlock;
25 class KeyMessage;
26 class VideoFrame;
27 } 23 }
28 24
29 extern "C" { 25 extern "C" {
30 // Caller retains ownership of arguments, which must outlive the call to 26 // Caller retains ownership of arguments, which must outlive the call to
31 // DestroyCdmInstance below. 27 // DestroyCdmInstance below.
32 CDM_EXPORT cdm::ContentDecryptionModule* CreateCdmInstance( 28 CDM_EXPORT cdm::ContentDecryptionModule* CreateCdmInstance(
33 cdm::Allocator* allocator, cdm::CdmHost* host); 29 cdm::Allocator* allocator, cdm::CdmHost* host);
34 CDM_EXPORT void DestroyCdmInstance(cdm::ContentDecryptionModule* instance); 30 CDM_EXPORT void DestroyCdmInstance(cdm::ContentDecryptionModule* instance);
35 CDM_EXPORT const char* GetCdmVersion(); 31 CDM_EXPORT const char* GetCdmVersion();
36 } 32 }
37 33
38 namespace cdm { 34 namespace cdm {
39 35
36 class AudioFrames;
37 class Buffer;
38 class DecryptedBlock;
39 class KeyMessage;
40 class VideoFrame;
41
40 enum Status { 42 enum Status {
41 kSuccess = 0, 43 kSuccess = 0,
42 kNeedMoreData, // Decoder needs more data to produce a decoded frame/sample. 44 kNeedMoreData, // Decoder needs more data to produce a decoded frame/sample.
43 kNoKey, // The required decryption key is not available. 45 kNoKey, // The required decryption key is not available.
44 kSessionError, // Session management error. 46 kSessionError, // Session management error.
45 kDecryptError, // Decryption failed. 47 kDecryptError, // Decryption failed.
46 kDecodeError // Error decoding audio or video. 48 kDecodeError // Error decoding audio or video.
47 }; 49 };
48 50
49 // An input buffer can be split into several continuous subsamples. 51 // An input buffer can be split into several continuous subsamples.
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 // the callee will have filled |audio_frames| and passed the ownership of 310 // the callee will have filled |audio_frames| and passed the ownership of
309 // |data| in |audio_frames| to the caller. 311 // |data| in |audio_frames| to the caller.
310 // Returns kNoKey if the CDM did not have the necessary decryption key 312 // Returns kNoKey if the CDM did not have the necessary decryption key
311 // to decrypt. 313 // to decrypt.
312 // Returns kNeedMoreData if more data was needed by the decoder to generate 314 // Returns kNeedMoreData if more data was needed by the decoder to generate
313 // audio samples (e.g. during initialization and end-of-stream). 315 // audio samples (e.g. during initialization and end-of-stream).
314 // Returns kDecryptError if any decryption error happened. 316 // Returns kDecryptError if any decryption error happened.
315 // Returns kDecodeError if any decoding error happened. 317 // Returns kDecodeError if any decoding error happened.
316 // If the return value is not kSuccess, |audio_frames| should be ignored by 318 // If the return value is not kSuccess, |audio_frames| should be ignored by
317 // the caller. 319 // the caller.
318 //
319 // |audio_frames| can contain multiple audio output buffers. Each buffer must
320 // be serialized in this format:
321 //
322 // |<------------------- serialized audio buffer ------------------->|
323 // | int64_t timestamp | int64_t length | length bytes of audio data |
324 //
325 // For example, with three audio output buffers, |audio_frames| will look
326 // like this:
327 //
328 // |<---------------- audio_frames ------------------>|
329 // | audio buffer 0 | audio buffer 1 | audio buffer 2 |
330 virtual Status DecryptAndDecodeSamples(const InputBuffer& encrypted_buffer, 320 virtual Status DecryptAndDecodeSamples(const InputBuffer& encrypted_buffer,
331 Buffer* audio_frames) = 0; 321 AudioFrames* audio_frames) = 0;
332 322
333 virtual ~ContentDecryptionModule() {} 323 virtual ~ContentDecryptionModule() {}
334 }; 324 };
335 325
336 // Represents a buffer created by Allocator implementations. 326 // Represents a buffer created by Allocator implementations.
337 class Buffer { 327 class Buffer {
338 public: 328 public:
339 // Destroys the buffer in the same context as it was created. 329 // Destroys the buffer in the same context as it was created.
340 virtual void Destroy() = 0; 330 virtual void Destroy() = 0;
341 331
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 virtual int32_t default_url_length() const = 0; 398 virtual int32_t default_url_length() const = 0;
409 399
410 protected: 400 protected:
411 KeyMessage() {} 401 KeyMessage() {}
412 virtual ~KeyMessage() {} 402 virtual ~KeyMessage() {}
413 }; 403 };
414 404
415 class VideoFrame { 405 class VideoFrame {
416 public: 406 public:
417 enum VideoPlane { 407 enum VideoPlane {
418 kYPlane = 0, 408 kYPlane = 0,
419 kUPlane = 1, 409 kUPlane = 1,
420 kVPlane = 2, 410 kVPlane = 2,
421 kMaxPlanes = 3, 411 kMaxPlanes = 3,
422 }; 412 };
423 413
424 virtual void set_format(VideoFormat format) = 0; 414 virtual void set_format(VideoFormat format) = 0;
425 virtual VideoFormat format() const = 0; 415 virtual VideoFormat format() const = 0;
426 416
427 virtual void set_size(cdm::Size size) = 0; 417 virtual void set_size(cdm::Size size) = 0;
428 virtual cdm::Size size() const = 0; 418 virtual cdm::Size size() const = 0;
429 419
430 virtual void set_frame_buffer(Buffer* frame_buffer) = 0; 420 virtual void set_frame_buffer(Buffer* frame_buffer) = 0;
431 virtual Buffer* frame_buffer() = 0; 421 virtual Buffer* frame_buffer() = 0;
432 422
433 virtual void set_plane_offset(VideoPlane plane, int32_t offset) = 0; 423 virtual void set_plane_offset(VideoPlane plane, int32_t offset) = 0;
434 virtual int32_t plane_offset(VideoPlane plane) = 0; 424 virtual int32_t plane_offset(VideoPlane plane) = 0;
435 425
436 virtual void set_stride(VideoPlane plane, int32_t stride) = 0; 426 virtual void set_stride(VideoPlane plane, int32_t stride) = 0;
437 virtual int32_t stride(VideoPlane plane) = 0; 427 virtual int32_t stride(VideoPlane plane) = 0;
438 428
439 virtual void set_timestamp(int64_t timestamp) = 0; 429 virtual void set_timestamp(int64_t timestamp) = 0;
440 virtual int64_t timestamp() const = 0; 430 virtual int64_t timestamp() const = 0;
441 431
442 protected: 432 protected:
443 VideoFrame() {} 433 VideoFrame() {}
444 virtual ~VideoFrame() {} 434 virtual ~VideoFrame() {}
435 };
436
437 // Represents decrypted and decoded audio frames. AudioFrames can contain
438 // multiple audio output buffers, which are serialized into this format:
439 //
440 // |<------------------- serialized audio buffer ------------------->|
441 // | int64_t timestamp | int64_t length | length bytes of audio data |
442 //
443 // For example, with three audio output buffers, the AudioFrames will look
444 // like this:
445 //
446 // |<----------------- AudioFrames ------------------>|
447 // | audio buffer 0 | audio buffer 1 | audio buffer 2 |
448 class AudioFrames {
449 public:
450 virtual void set_buffer(Buffer* buffer) = 0;
451 virtual Buffer* buffer() = 0;
452
453 protected:
454 AudioFrames() {}
455 virtual ~AudioFrames() {}
445 }; 456 };
446 457
447 } // namespace cdm 458 } // namespace cdm
448 459
449 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_CONTENT_DECRYPTION_MODULE_H_ 460 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_CONTENT_DECRYPTION_MODULE_H_
OLDNEW
« no previous file with comments | « webkit/media/crypto/ppapi/clear_key_cdm.cc ('k') | webkit/media/crypto/ppapi_decryptor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698