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

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: comments resolved Created 8 years, 1 month 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
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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 // the callee will have filled |audio_frames| and passed the ownership of 311 // the callee will have filled |audio_frames| and passed the ownership of
310 // |data| in |audio_frames| to the caller. 312 // |data| in |audio_frames| to the caller.
311 // Returns kNoKey if the CDM did not have the necessary decryption key 313 // Returns kNoKey if the CDM did not have the necessary decryption key
312 // to decrypt. 314 // to decrypt.
313 // Returns kNeedMoreData if more data was needed by the decoder to generate 315 // Returns kNeedMoreData if more data was needed by the decoder to generate
314 // audio samples (e.g. during initialization). 316 // audio samples (e.g. during initialization).
315 // Returns kDecryptError if any decryption error happened. 317 // Returns kDecryptError if any decryption error happened.
316 // Returns kDecodeError if any decoding error happened. 318 // Returns kDecodeError if any decoding error happened.
317 // If the return value is not kSuccess, |sample_buffer| should be ignored by 319 // If the return value is not kSuccess, |sample_buffer| should be ignored by
318 // the caller. 320 // the caller.
319 //
320 // |audio_frames| can contain multiple audio output buffers. Each buffer must
321 // be serialized in this format:
322 //
323 // |<------------------- serialized audio buffer ------------------->|
324 // | int64_t timestamp | int64_t length | length bytes of audio data |
325 //
326 // For example, with three audio output buffers, |audio_frames| will look
327 // like this:
328 //
329 // |<---------------- audio_frames ------------------>|
330 // | audio buffer 0 | audio buffer 1 | audio buffer 2 |
331 virtual Status DecryptAndDecodeSamples(const InputBuffer& encrypted_buffer, 321 virtual Status DecryptAndDecodeSamples(const InputBuffer& encrypted_buffer,
332 Buffer* audio_frames) = 0; 322 AudioFrames* audio_frames) = 0;
333 323
334 virtual ~ContentDecryptionModule() {} 324 virtual ~ContentDecryptionModule() {}
335 }; 325 };
336 326
337 // Represents a buffer created by Allocator implementations. 327 // Represents a buffer created by Allocator implementations.
338 class Buffer { 328 class Buffer {
339 public: 329 public:
340 // Destroys the buffer in the same context as it was created. 330 // Destroys the buffer in the same context as it was created.
341 virtual void Destroy() = 0; 331 virtual void Destroy() = 0;
342 332
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 virtual int32_t stride(VideoPlane plane) = 0; 428 virtual int32_t stride(VideoPlane plane) = 0;
439 429
440 virtual void set_timestamp(int64_t timestamp) = 0; 430 virtual void set_timestamp(int64_t timestamp) = 0;
441 virtual int64_t timestamp() const = 0; 431 virtual int64_t timestamp() const = 0;
442 432
443 protected: 433 protected:
444 VideoFrame() {} 434 VideoFrame() {}
445 virtual ~VideoFrame() {} 435 virtual ~VideoFrame() {}
446 }; 436 };
447 437
438 // Represents decrypted and decoded audio frames. AudioFrames can contain
439 // multiple audio output buffers, which are serialized into this format:
440 //
441 // |<------------------- serialized audio buffer ------------------->|
442 // | int64_t timestamp | int64_t length | length bytes of audio data |
443 //
444 // For example, with three audio output buffers, the AudioFrames will look
445 // like this:
446 //
447 // |<----------------- AudioFrames ------------------>|
448 // | audio buffer 0 | audio buffer 1 | audio buffer 2 |
449 class AudioFrames {
450 public:
451 virtual void set_buffer(Buffer* buffer) = 0;
452 virtual Buffer* buffer() = 0;
453
454 protected:
455 AudioFrames() {}
456 virtual ~AudioFrames() {}
457 };
458
448 } // namespace cdm 459 } // namespace cdm
449 460
450 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_CONTENT_DECRYPTION_MODULE_H_ 461 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_CONTENT_DECRYPTION_MODULE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698