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
17package android.hardware.media.c2@1.2;
18
19import android.hardware.graphics.bufferqueue@2.0::IGraphicBufferProducer;
20import android.hardware.media.c2@1.1::IComponent;
21import android.hardware.media.c2@1.0::Status;
22
23
24/**
25 * Interface for a Codec2 component corresponding to API level 1.2 or below.
26 * Components have two states: stopped and running. The running state has three
27 * sub-states: executing, tripped and error.
28 *
29 * All methods in `IComponent` must not block. If a method call cannot be
30 * completed in a timely manner, it must return `TIMED_OUT` in the return
31 * status.
32 *
33 * @note This is an extension of version 1.1 of `IComponent`. The purpose of the
34 * extension is to add blocking allocation of output buffer from surface.
35 */
36interface IComponent extends @1.1::IComponent {
37    /**
38     * Starts using a surface for output with a synchronization object
39     *
40     * This method must not block.
41     *
42     * @param blockPoolId Id of the `C2BlockPool` to be associated with the
43     *     output surface.
44     * @param surface Output surface.
45     * @param syncObject synchronization object for buffer allocation between
46     *     Framework and Component.
47     * @return status Status of the call, which may be
48     *   - `OK`        - The operation completed successfully.
49     *   - `CANNOT_DO` - The component does not support an output surface.
50     *   - `REFUSED`   - The output surface cannot be accessed.
51     *   - `TIMED_OUT` - The operation cannot be finished in a timely manner.
52     *   - `CORRUPTED` - Some unknown error occurred.
53     */
54    setOutputSurfaceWithSyncObj(
55            uint64_t blockPoolId,
56            @2.0::IGraphicBufferProducer surface,
57            SurfaceSyncObj syncObject
58        ) generates (
59            Status status
60        );
61};
62