1/*
2 * Copyright (C) 2017 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 */
16package android.hardware.cas.native@1.0;
17
18import android.hardware.cas@1.0::IDescramblerBase;
19import android.hardware.cas@1.0::Status;
20
21/**
22 * IDescrambler is the native plugin API for descrambling operations.
23 */
24
25interface IDescrambler extends IDescramblerBase {
26    /**
27     * Descramble the data in a source SharedBuffer, described by an array of
28     * SubSample structures.
29     *
30     * @param scramblingControl an enumeration indicating the key that the subsamples
31     * were scrambled with.
32     * @param subSamples an array of SubSample structures describing the number of
33     * clear and scrambled bytes within each subsample.
34     * @param srcBuffer the SharedBuffer containing the source scrambled data.
35     * @param srcOffset the position where the source scrambled data starts at.
36     * @param dstBuffer the DestinationBuffer to hold the descrambled data.
37     * @param dstOffset the position where the descrambled data should start at.
38     *
39     * @return status the status of the call.
40     * @return bytesWritten number of bytes that have been successfully descrambled.
41     * @return detailedError a detailed message describing the error (if any).
42     */
43    descramble(ScramblingControl scramblingControl, vec<SubSample> subSamples,
44        SharedBuffer srcBuffer, uint64_t srcOffset, DestinationBuffer dstBuffer, uint64_t dstOffset)
45        generates(Status status, uint32_t bytesWritten, string detailedError);
46};
47