1 /*
2  * Copyright (C) 2022 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 #include <aidl/android/hardware/cas/BnDescrambler.h>
18 #include <media/stagefright/foundation/ABase.h>
19 
20 namespace aidl {
21 namespace android {
22 namespace hardware {
23 namespace cas {
24 
25 using namespace ::android;
26 using namespace std;
27 using ndk::ScopedAStatus;
28 
29 class DescramblerImpl : public BnDescrambler {
30   public:
31     DescramblerImpl(DescramblerPlugin* plugin);
32     virtual ~DescramblerImpl();
33 
34     virtual ScopedAStatus setMediaCasSession(const vector<uint8_t>& in_sessionId) override;
35 
36     virtual ScopedAStatus requiresSecureDecoderComponent(const string& in_mime,
37                                                          bool* _aidl_return) override;
38 
39     virtual ScopedAStatus descramble(ScramblingControl in_scramblingControl,
40                                      const vector<SubSample>& in_subSamples,
41                                      const SharedBuffer& in_srcBuffer, int64_t in_srcOffset,
42                                      const DestinationBuffer& in_dstBuffer, int64_t in_dstOffset,
43                                      int32_t* _aidl_return) override;
44 
45     virtual ScopedAStatus release() override;
46 
47   private:
48     shared_ptr<DescramblerPlugin> mPluginHolder;
49 
50     DISALLOW_EVIL_CONSTRUCTORS(DescramblerImpl);
51 };
52 
53 }  // namespace cas
54 }  // namespace hardware
55 }  // namespace android
56 }  // namespace aidl
57