1 /* 2 * Copyright (C) 2019 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 ANDROID_HARDWARE_CAS_V1_1_DESCRAMBLER_IMPL_H_ 18 #define ANDROID_HARDWARE_CAS_V1_1_DESCRAMBLER_IMPL_H_ 19 20 #include <android/hardware/cas/native/1.0/IDescrambler.h> 21 #include <media/stagefright/foundation/ABase.h> 22 23 namespace android { 24 struct DescramblerPlugin; 25 using namespace hardware::cas::native::V1_0; 26 27 namespace hardware { 28 namespace cas { 29 namespace V1_1 { 30 namespace implementation { 31 32 using ::android::hardware::cas::V1_0::HidlCasSessionId; 33 using ::android::hardware::cas::V1_0::Status; 34 35 class SharedLibrary; 36 37 class DescramblerImpl : public IDescrambler { 38 public: 39 DescramblerImpl(const sp<SharedLibrary>& library, DescramblerPlugin* plugin); 40 virtual ~DescramblerImpl(); 41 42 virtual Return<Status> setMediaCasSession(const HidlCasSessionId& sessionId) override; 43 44 virtual Return<bool> requiresSecureDecoderComponent(const hidl_string& mime) override; 45 46 virtual Return<void> descramble(ScramblingControl scramblingControl, 47 const hidl_vec<SubSample>& subSamples, 48 const SharedBuffer& srcBuffer, uint64_t srcOffset, 49 const DestinationBuffer& dstBuffer, uint64_t dstOffset, 50 descramble_cb _hidl_cb) override; 51 52 virtual Return<Status> release() override; 53 54 private: 55 sp<SharedLibrary> mLibrary; 56 std::shared_ptr<DescramblerPlugin> mPluginHolder; 57 58 DISALLOW_EVIL_CONSTRUCTORS(DescramblerImpl); 59 }; 60 61 } // namespace implementation 62 } // namespace V1_1 63 } // namespace cas 64 } // namespace hardware 65 } // namespace android 66 67 #endif // ANDROID_HARDWARE_CAS_V1_1_DESCRAMBLER_IMPL_H_ 68