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_TV_TUNER_V1_0_DESCRAMBLER_H_
18 #define ANDROID_HARDWARE_TV_TUNER_V1_0_DESCRAMBLER_H_
19 
20 #include <android/hardware/tv/tuner/1.0/IDescrambler.h>
21 #include <android/hardware/tv/tuner/1.0/ITuner.h>
22 
23 using namespace std;
24 
25 namespace android {
26 namespace hardware {
27 namespace tv {
28 namespace tuner {
29 namespace V1_0 {
30 namespace implementation {
31 
32 using ::android::hardware::tv::tuner::V1_0::IDescrambler;
33 using ::android::hardware::tv::tuner::V1_0::Result;
34 
35 class Descrambler : public IDescrambler {
36   public:
37     Descrambler();
38 
39     virtual Return<Result> setDemuxSource(uint32_t demuxId) override;
40 
41     virtual Return<Result> setKeyToken(const hidl_vec<uint8_t>& keyToken) override;
42 
43     virtual Return<Result> addPid(const DemuxPid& pid,
44                                   const sp<IFilter>& optionalSourceFilter) override;
45 
46     virtual Return<Result> removePid(const DemuxPid& pid,
47                                      const sp<IFilter>& optionalSourceFilter) override;
48 
49     virtual Return<Result> close() override;
50 
51   private:
52     virtual ~Descrambler();
53     uint32_t mSourceDemuxId;
54     bool mDemuxSet = false;
55 };
56 
57 }  // namespace implementation
58 }  // namespace V1_0
59 }  // namespace tuner
60 }  // namespace tv
61 }  // namespace hardware
62 }  // namespace android
63 
64 #endif  // ANDROID_HARDWARE_TV_TUNER_V1_DESCRAMBLER_H_
65