Andreas Huber | 1b19c9d | 2012-08-29 11:34:22 -0700 | [diff] [blame] | 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 | #ifndef HDCP_H_ |
| 18 | |
| 19 | #define HDCP_H_ |
| 20 | |
| 21 | #include <media/IHDCP.h> |
Andreas Huber | ef7d379 | 2012-09-27 14:13:05 -0700 | [diff] [blame] | 22 | #include <utils/Mutex.h> |
Andreas Huber | 1b19c9d | 2012-08-29 11:34:22 -0700 | [diff] [blame] | 23 | |
| 24 | namespace android { |
| 25 | |
| 26 | struct HDCP : public BnHDCP { |
Andreas Huber | a6a88d9 | 2013-01-30 10:41:25 -0800 | [diff] [blame] | 27 | HDCP(bool createEncryptionModule); |
Andreas Huber | 1b19c9d | 2012-08-29 11:34:22 -0700 | [diff] [blame] | 28 | 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(); |
Chong Zhang | ec3acca | 2013-09-03 14:35:37 -0700 | [diff] [blame] | 33 | virtual uint32_t getCaps(); |
Andreas Huber | 1b19c9d | 2012-08-29 11:34:22 -0700 | [diff] [blame] | 34 | |
| 35 | virtual status_t encrypt( |
| 36 | const void *inData, size_t size, uint32_t streamCTR, |
| 37 | uint64_t *outInputCTR, void *outData); |
| 38 | |
Chong Zhang | 308bcaa | 2013-05-03 21:54:17 -0700 | [diff] [blame] | 39 | virtual status_t encryptNative( |
| 40 | const sp<GraphicBuffer> &graphicBuffer, |
| 41 | size_t offset, size_t size, uint32_t streamCTR, |
| 42 | uint64_t *outInputCTR, void *outData); |
| 43 | |
Andreas Huber | a6a88d9 | 2013-01-30 10:41:25 -0800 | [diff] [blame] | 44 | virtual status_t decrypt( |
| 45 | const void *inData, size_t size, |
| 46 | uint32_t streamCTR, uint64_t outInputCTR, void *outData); |
| 47 | |
Andreas Huber | 1b19c9d | 2012-08-29 11:34:22 -0700 | [diff] [blame] | 48 | private: |
Andreas Huber | ef7d379 | 2012-09-27 14:13:05 -0700 | [diff] [blame] | 49 | Mutex mLock; |
| 50 | |
Andreas Huber | a6a88d9 | 2013-01-30 10:41:25 -0800 | [diff] [blame] | 51 | bool mIsEncryptionModule; |
| 52 | |
Andreas Huber | 1b19c9d | 2012-08-29 11:34:22 -0700 | [diff] [blame] | 53 | void *mLibHandle; |
| 54 | HDCPModule *mHDCPModule; |
| 55 | sp<IHDCPObserver> mObserver; |
| 56 | |
Andreas Huber | efbb781 | 2012-09-18 10:36:32 -0700 | [diff] [blame] | 57 | static void ObserveWrapper(void *me, int msg, int ext1, int ext2); |
| 58 | void observe(int msg, int ext1, int ext2); |
| 59 | |
Andreas Huber | 1b19c9d | 2012-08-29 11:34:22 -0700 | [diff] [blame] | 60 | DISALLOW_EVIL_CONSTRUCTORS(HDCP); |
| 61 | }; |
| 62 | |
| 63 | } // namespace android |
| 64 | |
| 65 | #endif // HDCP_H_ |
| 66 | |