/* Copyright (c) 2012 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ /** * This file defines the PPP_ContentDecryptor_Private * interface. Note: This is a special interface, only to be used for Content * Decryption Modules, not normal plugins. */ label Chrome { M44 = 0.15 }; /** * PPP_ContentDecryptor_Private structure contains the function * pointers the decryption plugin must implement to provide services needed by * the browser. This interface provides the plugin side support for the Content * Decryption Module (CDM) for Encrypted Media Extensions: * http://www.w3.org/TR/encrypted-media/ */ interface PPP_ContentDecryptor_Private { /** * Initialize for the specified key system. * * @param[in] promise_id A reference for the promise that gets resolved or * rejected depending upon the success or failure of initialization. * * @param[in] key_system A PP_Var of type * PP_VARTYPE_STRING containing the name of the key system. * @param[in] allow_distinctive_identifier Inform the CDM that it may use a * distinctive identifier. * @param[in] allow_persistent_state Inform the CDM that it may use persistent * state. */ void Initialize( [in] PP_Instance instance, [in] uint32_t promise_id, [in] PP_Var key_system, [in] PP_Bool allow_distinctive_identifier, [in] PP_Bool allow_persistent_state); /** * Provides a server certificate to be used to encrypt messages to the * license server. * * @param[in] promise_id A reference for the promise that gets resolved or * rejected depending upon the success or failure of setting the certificate. * * @param[in] server_certificate A PP_Var of type * PP_VARTYPE_ARRAYBUFFER containing the certificate to be used. */ void SetServerCertificate( [in] PP_Instance instance, [in] uint32_t promise_id, [in] PP_Var server_certificate); /** * Creates a session and subsequently generates a request for a license. * init_data_type contains the MIME type of * init_data. init_data is a data buffer * containing data for use in generating the request. * * Note: CreateSessionAndGenerateRequest() must create a * session ID and provide it to the browser via SessionCreated() * on the PPB_ContentDecryptor_Private interface. * * @param[in] promise_id A reference for the promise that gets resolved or * rejected depending upon the success or failure when creating the session. * * @param[in] session_type A PP_SessionType that indicates the * type of session to be created. * * @param[in] init_data_type A PP_InitDataType that indicates * the Initialization Data Type for init_data. * * @param[in] init_data A PP_Var of type * PP_VARTYPE_ARRAYBUFFER containing container specific * initialization data. */ void CreateSessionAndGenerateRequest( [in] PP_Instance instance, [in] uint32_t promise_id, [in] PP_SessionType session_type, [in] PP_InitDataType init_data_type, [in] PP_Var init_data); /** * Loads a session whose session ID is session_id. * * Note: After the session is successfully loaded, the CDM must call * SessionCreated() with session_id on the * PPB_ContentDecryptor_Private interface. * * @param[in] promise_id A reference for the promise that gets resolved or * rejected depending upon the success or failure of loading the session. * * @param[in] session_type A PP_SessionType that indicates the * type of session to be loaded. * * @param[in] session_id A PP_Var of type * PP_VARTYPE_STRING containing the session ID of the session * to load. */ void LoadSession( [in] PP_Instance instance, [in] uint32_t promise_id, [in] PP_SessionType session_type, [in] PP_Var session_id); /** * Provides a license or other message to the decryptor. * * When the CDM needs more information, it must call * SessionMessage() on the * PPB_ContentDecryptor_Private interface, and the browser * must notify the web application. When the CDM has finished processing * response and needs no more information, it must call * SessionReady() on the * PPB_ContentDecryptor_Private interface, and the browser * must notify the web application. * * @param[in] promise_id A reference for the promise that gets resolved or * rejected depending upon the success or failure of updating the session. * * @param[in] session_id A PP_Var of type * PP_VARTYPE_STRING containing the session ID of the session * to be updated. * * @param[in] response A PP_Var of type * PP_VARTYPE_ARRAYBUFFER containing the license or other * message for the given session ID. */ void UpdateSession( [in] PP_Instance instance, [in] uint32_t promise_id, [in] PP_Var session_id, [in] PP_Var response); /** * Close the specified session and related resources. * * @param[in] promise_id A reference for the promise that gets resolved or * rejected depending upon the success or failure of closing the session. * * @param[in] session_id A PP_Var of type * PP_VARTYPE_STRING containing the session ID of the session * to be closed. * */ void CloseSession( [in] PP_Instance instance, [in] uint32_t promise_id, [in] PP_Var session_id); /** * Remove stored data associated with this session. * * @param[in] promise_id A reference for the promise that gets resolved or * rejected depending upon the success or failure of removing the session * data. * * @param[in] session_id A PP_Var of type * PP_VARTYPE_STRING containing the session ID of the session * to be removed. * */ void RemoveSession( [in] PP_Instance instance, [in] uint32_t promise_id, [in] PP_Var session_id); /** * Decrypts the block and returns the unencrypted block via * DeliverBlock() on the * PPB_ContentDecryptor_Private interface. The returned block * contains encoded data. * * @param[in] resource A PP_Resource corresponding to a * PPB_Buffer_Dev resource that contains an encrypted data * block. * * @param[in] encrypted_block_info A PP_EncryptedBlockInfo that * contains all auxiliary information needed for decryption of the * encrypted_block. */ void Decrypt( [in] PP_Instance instance, [in] PP_Resource encrypted_block, [in] PP_EncryptedBlockInfo encrypted_block_info); /** * Initializes the audio decoder using codec and settings in * decoder_config, and returns the result of the initialization * request to the browser using the DecoderInitializeDone() method * on the PPB_ContentDecryptor_Private interface. * * @param[in] decoder_config A PP_AudioDecoderConfig that * contains audio decoder settings and a request ID. The request ID is passed * to the DecoderInitializeDone() method on the * PPB_ContentDecryptor_Private interface to allow clients to * associate the result with a audio decoder initialization request. * * @param[in] codec_extra_data A PP_Resource corresponding to a * PPB_Buffer_Dev resource containing codec setup data required * by some codecs. It should be set to 0 when the codec being initialized * does not require it. */ void InitializeAudioDecoder( [in] PP_Instance instance, [in] PP_AudioDecoderConfig decoder_config, [in] PP_Resource codec_extra_data); /** * Initializes the video decoder using codec and settings in * decoder_config, and returns the result of the initialization * request to the browser using the DecoderInitializeDone() * method on the PPB_ContentDecryptor_Private interface. * * @param[in] decoder_config A PP_VideoDecoderConfig that * contains video decoder settings and a request ID. The request ID is passed * to the DecoderInitializeDone() method on the * PPB_ContentDecryptor_Private interface to allow clients to * associate the result with a video decoder initialization request. * * @param[in] codec_extra_data A PP_Resource corresponding to a * PPB_Buffer_Dev resource containing codec setup data required * by some codecs. It should be set to 0 when the codec being initialized * does not require it. */ void InitializeVideoDecoder( [in] PP_Instance instance, [in] PP_VideoDecoderConfig decoder_config, [in] PP_Resource codec_extra_data); /** * De-initializes the decoder for the PP_DecryptorStreamType * specified by decoder_type and sets it to an uninitialized * state. The decoder can be re-initialized after de-initialization completes * by calling InitializeAudioDecoder or * InitializeVideoDecoder. * * De-initialization completion is reported to the browser using the * DecoderDeinitializeDone() method on the * PPB_ContentDecryptor_Private interface. * * @param[in] decoder_type A PP_DecryptorStreamType that * specifies the decoder to de-initialize. * * @param[in] request_id A request ID that allows the browser to associate a * request to de-initialize a decoder with the corresponding call to the * DecoderDeinitializeDone() method on the * PPB_ContentDecryptor_Private interface. */ void DeinitializeDecoder( [in] PP_Instance instance, [in] PP_DecryptorStreamType decoder_type, [in] uint32_t request_id); /** * Resets the decoder for the PP_DecryptorStreamType specified * by decoder_type to an initialized clean state. Reset * completion is reported to the browser using the * DecoderResetDone() method on the * PPB_ContentDecryptor_Private interface. This method can be * used to signal a discontinuity in the encoded data stream, and is safe to * call multiple times. * * @param[in] decoder_type A PP_DecryptorStreamType that * specifies the decoder to reset. * * @param[in] request_id A request ID that allows the browser to associate a * request to reset the decoder with a corresponding call to the * DecoderResetDone() method on the * PPB_ContentDecryptor_Private interface. */ void ResetDecoder( [in] PP_Instance instance, [in] PP_DecryptorStreamType decoder_type, [in] uint32_t request_id); /** * Decrypts encrypted_buffer, decodes it, and returns the unencrypted * uncompressed (decoded) data to the browser via the * DeliverFrame() or DeliverSamples() method on the * PPB_ContentDecryptor_Private interface. * * @param[in] decoder_type A PP_DecryptorStreamType that * specifies the decoder to use after encrypted_buffer is * decrypted. * * @param[in] encrypted_buffer A PP_Resource corresponding to a * PPB_Buffer_Dev resource that contains encrypted media data. * * @param[in] encrypted_block_info A PP_EncryptedBlockInfo that * contains all auxiliary information needed for decryption of the * encrypted_block. */ void DecryptAndDecode( [in] PP_Instance instance, [in] PP_DecryptorStreamType decoder_type, [in] PP_Resource encrypted_buffer, [in] PP_EncryptedBlockInfo encrypted_block_info); };