blob: c60c2e01fa1b218129e8524990cd5b10bcfca1c9 [file] [log] [blame]
Andreas Huber1b19c9d2012-08-29 11:34:22 -07001/*
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#ifndef HDCP_H_
18
19#define HDCP_H_
20
21#include <media/IHDCP.h>
Andreas Huberef7d3792012-09-27 14:13:05 -070022#include <utils/Mutex.h>
Andreas Huber1b19c9d2012-08-29 11:34:22 -070023
24namespace android {
25
26struct HDCP : public BnHDCP {
Andreas Hubera6a88d92013-01-30 10:41:25 -080027 HDCP(bool createEncryptionModule);
Andreas Huber1b19c9d2012-08-29 11:34:22 -070028 virtual ~HDCP();
29
30 virtual status_t setObserver(const sp<IHDCPObserver> &observer);
31 virtual status_t initAsync(const char *host, unsigned port);
32 virtual status_t shutdownAsync();
33
34 virtual status_t encrypt(
35 const void *inData, size_t size, uint32_t streamCTR,
36 uint64_t *outInputCTR, void *outData);
37
Chong Zhang308bcaa2013-05-03 21:54:17 -070038 virtual status_t encryptNative(
39 const sp<GraphicBuffer> &graphicBuffer,
40 size_t offset, size_t size, uint32_t streamCTR,
41 uint64_t *outInputCTR, void *outData);
42
Andreas Hubera6a88d92013-01-30 10:41:25 -080043 virtual status_t decrypt(
44 const void *inData, size_t size,
45 uint32_t streamCTR, uint64_t outInputCTR, void *outData);
46
Andreas Huber1b19c9d2012-08-29 11:34:22 -070047private:
Andreas Huberef7d3792012-09-27 14:13:05 -070048 Mutex mLock;
49
Andreas Hubera6a88d92013-01-30 10:41:25 -080050 bool mIsEncryptionModule;
51
Andreas Huber1b19c9d2012-08-29 11:34:22 -070052 void *mLibHandle;
53 HDCPModule *mHDCPModule;
54 sp<IHDCPObserver> mObserver;
55
Andreas Huberefbb7812012-09-18 10:36:32 -070056 static void ObserveWrapper(void *me, int msg, int ext1, int ext2);
57 void observe(int msg, int ext1, int ext2);
58
Andreas Huber1b19c9d2012-08-29 11:34:22 -070059 DISALLOW_EVIL_CONSTRUCTORS(HDCP);
60};
61
62} // namespace android
63
64#endif // HDCP_H_
65