1 /** 2 * Copyright 2021, 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_MEDIA_TUNERHIDLDESCRAMBLER_H 18 #define ANDROID_MEDIA_TUNERHIDLDESCRAMBLER_H 19 20 #include <aidl/android/hardware/tv/tuner/IDescrambler.h> 21 #include <aidl/android/media/tv/tuner/BnTunerDescrambler.h> 22 #include <android/hardware/tv/tuner/1.0/IDescrambler.h> 23 #include <android/hardware/tv/tuner/1.0/ITuner.h> 24 25 using ::aidl::android::hardware::tv::tuner::DemuxPid; 26 using ::android::sp; 27 using ::android::hardware::Return; 28 using ::android::hardware::Void; 29 30 using HidlDemuxPid = ::android::hardware::tv::tuner::V1_0::DemuxPid; 31 using HidlIDescrambler = ::android::hardware::tv::tuner::V1_0::IDescrambler; 32 33 namespace aidl { 34 namespace android { 35 namespace media { 36 namespace tv { 37 namespace tuner { 38 39 class TunerHidlDescrambler : public BnTunerDescrambler { 40 public: 41 TunerHidlDescrambler(sp<HidlIDescrambler> descrambler); 42 virtual ~TunerHidlDescrambler(); 43 44 ::ndk::ScopedAStatus setDemuxSource(const std::shared_ptr<ITunerDemux>& in_tunerDemux) override; 45 ::ndk::ScopedAStatus setKeyToken(const std::vector<uint8_t>& in_keyToken) override; 46 ::ndk::ScopedAStatus addPid( 47 const DemuxPid& in_pid, 48 const std::shared_ptr<ITunerFilter>& in_optionalSourceFilter) override; 49 ::ndk::ScopedAStatus removePid( 50 const DemuxPid& in_pid, 51 const std::shared_ptr<ITunerFilter>& in_optionalSourceFilter) override; 52 ::ndk::ScopedAStatus close() override; 53 54 private: 55 HidlDemuxPid getHidlDemuxPid(const DemuxPid& pid); 56 57 sp<HidlIDescrambler> mDescrambler; 58 }; 59 60 } // namespace tuner 61 } // namespace tv 62 } // namespace media 63 } // namespace android 64 } // namespace aidl 65 66 #endif // ANDROID_MEDIA_TUNERHIDLDESCRAMBLER_H 67