Home | History | Annotate | Download | only in private
      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
      3  * found in the LICENSE file.
      4  */
      5 
      6 /* From private/ppp_content_decryptor_private.idl,
      7  *   modified Fri Oct 26 15:36:54 2012.
      8  */
      9 
     10 #ifndef PPAPI_C_PRIVATE_PPP_CONTENT_DECRYPTOR_PRIVATE_H_
     11 #define PPAPI_C_PRIVATE_PPP_CONTENT_DECRYPTOR_PRIVATE_H_
     12 
     13 #include "ppapi/c/pp_bool.h"
     14 #include "ppapi/c/pp_instance.h"
     15 #include "ppapi/c/pp_macros.h"
     16 #include "ppapi/c/pp_resource.h"
     17 #include "ppapi/c/pp_stdint.h"
     18 #include "ppapi/c/pp_var.h"
     19 #include "ppapi/c/private/pp_content_decryptor.h"
     20 
     21 #define PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_6 \
     22     "PPP_ContentDecryptor_Private;0.6"
     23 #define PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE \
     24     PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_6
     25 
     26 /**
     27  * @file
     28  * This file defines the <code>PPP_ContentDecryptor_Private</code>
     29  * interface. Note: This is a special interface, only to be used for Content
     30  * Decryption Modules, not normal plugins.
     31  */
     32 
     33 
     34 /**
     35  * @addtogroup Interfaces
     36  * @{
     37  */
     38 /**
     39  * <code>PPP_ContentDecryptor_Private</code> structure contains the function
     40  * pointers the decryption plugin must implement to provide services needed by
     41  * the browser. This interface provides the plugin side support for the Content
     42  * Decryption Module (CDM) for v0.1 of the proposed Encrypted Media Extensions:
     43  * http://goo.gl/rbdnR
     44  */
     45 struct PPP_ContentDecryptor_Private_0_6 {
     46   /**
     47    * Generates a key request. key_system specifies the key or licensing system
     48    * to use. type contains the MIME type of init_data. init_data is a data
     49    * buffer containing data for use in generating the request.
     50    *
     51    * Note: <code>GenerateKeyRequest()</code> must create the session ID used in
     52    * other methods on this interface. The session ID must be provided to the
     53    * browser by the CDM via <code>KeyMessage()</code> on the
     54    * <code>PPB_ContentDecryptor_Private</code> interface.
     55    *
     56    * @param[in] key_system A <code>PP_Var</code> of type
     57    * <code>PP_VARTYPE_STRING</code> containing the name of the key system.
     58    *
     59    * @param[in] type A <code>PP_Var</code> of type
     60    * <code>PP_VARTYPE_STRING</code> containing the MIME type for init_data.
     61    *
     62    * @param[in] init_data A <code>PP_Var</code> of type
     63    * <code>PP_VARTYPE_ARRAYBUFFER</code> containing container specific
     64    * initialization data.
     65    */
     66   void (*GenerateKeyRequest)(PP_Instance instance,
     67                              struct PP_Var key_system,
     68                              struct PP_Var type,
     69                              struct PP_Var init_data);
     70   /**
     71    * Provides a key or license to the decryptor for decrypting media data.
     72    *
     73    * When the CDM needs more information to complete addition of the key it
     74    * will call <code>KeyMessage()</code> on the
     75    * <code>PPB_ContentDecryptor_Private</code> interface, which the browser
     76    * passes to the application. When the key is ready to use, the CDM
     77    * must call call <code>KeyAdded()</code> on the
     78    * <code>PPB_ContentDecryptor_Private</code> interface, and the browser
     79    * must notify the web application.
     80    *
     81    * @param[in] session_id A <code>PP_Var</code> of type
     82    * <code>PP_VARTYPE_STRING</code> containing the session ID.
     83    *
     84    * @param[in] key A <code>PP_Var</code> of type
     85    * <code>PP_VARTYPE_ARRAYBUFFER</code> containing the decryption key, license,
     86    * or other message for the given session ID.
     87    *
     88    * @param[in] init_data A <code>PP_Var</code> of type
     89    * <code>PP_VARTYPE_ARRAYBUFFER</code> containing container specific
     90    * initialization data.
     91    */
     92   void (*AddKey)(PP_Instance instance,
     93                  struct PP_Var session_id,
     94                  struct PP_Var key,
     95                  struct PP_Var init_data);
     96   /**
     97    * Cancels a pending key request for the specified session ID.
     98    *
     99    * @param[in] session_id A <code>PP_Var</code> of type
    100    * <code>PP_VARTYPE_STRING</code> containing the session ID.
    101    */
    102   void (*CancelKeyRequest)(PP_Instance instance, struct PP_Var session_id);
    103   /**
    104    * Decrypts the block and returns the unencrypted block via
    105    * <code>DeliverBlock()</code> on the
    106    * <code>PPB_ContentDecryptor_Private</code> interface. The returned block
    107    * contains encoded data.
    108    *
    109    * @param[in] resource A <code>PP_Resource</code> corresponding to a
    110    * <code>PPB_Buffer_Dev</code> resource that contains an encrypted data
    111    * block.
    112    *
    113    * @param[in] encrypted_block_info A <code>PP_EncryptedBlockInfo</code> that
    114    * contains all auxiliary information needed for decryption of the
    115    * <code>encrypted_block</code>.
    116    */
    117   void (*Decrypt)(PP_Instance instance,
    118                   PP_Resource encrypted_block,
    119                   const struct PP_EncryptedBlockInfo* encrypted_block_info);
    120   /**
    121    * Initializes the audio decoder using codec and settings in
    122    * <code>decoder_config</code>, and returns the result of the initialization
    123    * request to the browser using the <code>DecoderInitializeDone(
    124       )</code> method
    125    * on the <code>PPB_ContentDecryptor_Private</code> interface.
    126    *
    127    * @param[in] decoder_config A <code>PP_AudioDecoderConfig</code> that
    128    * contains audio decoder settings and a request ID. The request ID is passed
    129    * to the <code>DecoderInitializeDone()</code> method on the
    130    * <code>PPB_ContentDecryptor_Private</code> interface to allow clients to
    131    * associate the result with a audio decoder initialization request.
    132    *
    133    * @param[in] codec_extra_data A <code>PP_Resource</code> corresponding to a
    134    * <code>PPB_Buffer_Dev</code> resource containing codec setup data required
    135    * by some codecs. It should be set to 0 when the codec being initialized
    136    * does not require it.
    137    */
    138   void (*InitializeAudioDecoder)(
    139       PP_Instance instance,
    140       const struct PP_AudioDecoderConfig* decoder_config,
    141       PP_Resource codec_extra_data);
    142   /**
    143    * Initializes the video decoder using codec and settings in
    144    * <code>decoder_config</code>, and returns the result of the initialization
    145    * request to the browser using the <code>DecoderInitializeDone()</code>
    146    * method on the <code>PPB_ContentDecryptor_Private</code> interface.
    147    *
    148    * @param[in] decoder_config A <code>PP_VideoDecoderConfig</code> that
    149    * contains video decoder settings and a request ID. The request ID is passed
    150    * to the <code>DecoderInitializeDone()</code> method on the
    151    * <code>PPB_ContentDecryptor_Private</code> interface to allow clients to
    152    * associate the result with a video decoder initialization request.
    153    *
    154    * @param[in] codec_extra_data A <code>PP_Resource</code> corresponding to a
    155    * <code>PPB_Buffer_Dev</code> resource containing codec setup data required
    156    * by some codecs. It should be set to 0 when the codec being initialized
    157    * does not require it.
    158    */
    159   void (*InitializeVideoDecoder)(
    160       PP_Instance instance,
    161       const struct PP_VideoDecoderConfig* decoder_config,
    162       PP_Resource codec_extra_data);
    163   /**
    164    * De-initializes the decoder for the <code>PP_DecryptorStreamType</code>
    165    * specified by <code>decoder_type</code> and sets it to an uninitialized
    166    * state. The decoder can be re-initialized after de-initialization completes
    167    * by calling <code>InitializeAudioDecoder</code> or
    168    * <code>InitializeVideoDecoder</code>.
    169    *
    170    * De-initialization completion is reported to the browser using the
    171    * <code>DecoderDeinitializeDone()</code> method on the
    172    * <code>PPB_ContentDecryptor_Private</code> interface.
    173    *
    174    * @param[in] decoder_type A <code>PP_DecryptorStreamType</code> that
    175    * specifies the decoder to de-initialize.
    176    *
    177    * @param[in] request_id A request ID that allows the browser to associate a
    178    * request to de-initialize a decoder with the corresponding call to the
    179    * <code>DecoderDeinitializeDone()</code> method on the
    180    * <code>PPB_ContentDecryptor_Private</code> interface.
    181    */
    182   void (*DeinitializeDecoder)(PP_Instance instance,
    183                               PP_DecryptorStreamType decoder_type,
    184                               uint32_t request_id);
    185   /**
    186    * Resets the decoder for the <code>PP_DecryptorStreamType</code> specified
    187    * by <code>decoder_type</code> to an initialized clean state. Reset
    188    * completion is reported to the browser using the
    189    * <code>DecoderResetDone()</code> method on the
    190    * <code>PPB_ContentDecryptor_Private</code> interface. This method can be
    191    * used to signal a discontinuity in the encoded data stream, and is safe to
    192    * call multiple times.
    193    *
    194    * @param[in] decoder_type A <code>PP_DecryptorStreamType</code> that
    195    * specifies the decoder to reset.
    196    *
    197    * @param[in] request_id A request ID that allows the browser to associate a
    198    * request to reset the decoder with a corresponding call to the
    199    * <code>DecoderResetDone()</code> method on the
    200    * <code>PPB_ContentDecryptor_Private</code> interface.
    201    */
    202   void (*ResetDecoder)(PP_Instance instance,
    203                        PP_DecryptorStreamType decoder_type,
    204                        uint32_t request_id);
    205   /**
    206    * Decrypts encrypted_buffer, decodes it, and returns the unencrypted
    207    * uncompressed (decoded) data to the browser via the
    208    * <code>DeliverFrame()</code> or <code>DeliverSamples()</code> method on the
    209    * <code>PPB_ContentDecryptor_Private</code> interface.
    210    *
    211    * @param[in] decoder_type A <code>PP_DecryptorStreamType</code> that
    212    * specifies the decoder to use after <code>encrypted_buffer</code> is
    213    * decrypted.
    214    *
    215    * @param[in] encrypted_buffer A <code>PP_Resource</code> corresponding to a
    216    * <code>PPB_Buffer_Dev</code> resource that contains encrypted media data.
    217    *
    218    * @param[in] encrypted_block_info A <code>PP_EncryptedBlockInfo</code> that
    219    * contains all auxiliary information needed for decryption of the
    220    * <code>encrypted_block</code>.
    221    */
    222   void (*DecryptAndDecode)(
    223       PP_Instance instance,
    224       PP_DecryptorStreamType decoder_type,
    225       PP_Resource encrypted_buffer,
    226       const struct PP_EncryptedBlockInfo* encrypted_block_info);
    227 };
    228 
    229 typedef struct PPP_ContentDecryptor_Private_0_6 PPP_ContentDecryptor_Private;
    230 /**
    231  * @}
    232  */
    233 
    234 #endif  /* PPAPI_C_PRIVATE_PPP_CONTENT_DECRYPTOR_PRIVATE_H_ */
    235 
    236