1/* 2 * Copyright (C) 2012 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17#include <binder/IInterface.h> 18#include <media/hardware/HDCPAPI.h> 19#include <media/stagefright/foundation/ABase.h> 20 21namespace android { 22 23struct IHDCPObserver : public IInterface { 24 DECLARE_META_INTERFACE(HDCPObserver); 25 26 virtual void notify( 27 int msg, int ext1, int ext2, const Parcel *obj) = 0; 28 29private: 30 DISALLOW_EVIL_CONSTRUCTORS(IHDCPObserver); 31}; 32 33struct IHDCP : public IInterface { 34 DECLARE_META_INTERFACE(HDCP); 35 36 // Called to specify the observer that receives asynchronous notifications 37 // from the HDCP implementation to signal completion/failure of asynchronous 38 // operations (such as initialization) or out of band events. 39 virtual status_t setObserver(const sp<IHDCPObserver> &observer) = 0; 40 41 // Request to setup an HDCP session with the specified host listening 42 // on the specified port. 43 virtual status_t initAsync(const char *host, unsigned port) = 0; 44 45 // Request to shutdown the active HDCP session. 46 virtual status_t shutdownAsync() = 0; 47 48 // Encrypt a data according to the HDCP spec. The data is to be 49 // encrypted in-place, only size bytes of data should be read/write, 50 // even if the size is not a multiple of 128 bit (16 bytes). 51 // This operation is to be synchronous, i.e. this call does not return 52 // until outData contains size bytes of encrypted data. 53 // streamCTR will be assigned by the caller (to 0 for the first PES stream, 54 // 1 for the second and so on) 55 // inputCTR will be maintained by the callee for each PES stream. 56 virtual status_t encrypt( 57 const void *inData, size_t size, uint32_t streamCTR, 58 uint64_t *outInputCTR, void *outData) = 0; 59 60private: 61 DISALLOW_EVIL_CONSTRUCTORS(IHDCP); 62}; 63 64struct BnHDCPObserver : public BnInterface<IHDCPObserver> { 65 virtual status_t onTransact( 66 uint32_t code, const Parcel &data, Parcel *reply, 67 uint32_t flags = 0); 68}; 69 70struct BnHDCP : public BnInterface<IHDCP> { 71 virtual status_t onTransact( 72 uint32_t code, const Parcel &data, Parcel *reply, 73 uint32_t flags = 0); 74}; 75 76} // namespace android 77 78 79