xref: /aosp_15_r20/hardware/interfaces/media/c2/1.1/IComponent.hal (revision 4d7e907c777eeecc4c5bd7cf640a754fac206ff7)
1*4d7e907cSAndroid Build Coastguard Worker/*
2*4d7e907cSAndroid Build Coastguard Worker * Copyright 2019 The Android Open Source Project
3*4d7e907cSAndroid Build Coastguard Worker *
4*4d7e907cSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License");
5*4d7e907cSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License.
6*4d7e907cSAndroid Build Coastguard Worker * You may obtain a copy of the License at
7*4d7e907cSAndroid Build Coastguard Worker *
8*4d7e907cSAndroid Build Coastguard Worker *      http://www.apache.org/licenses/LICENSE-2.0
9*4d7e907cSAndroid Build Coastguard Worker *
10*4d7e907cSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software
11*4d7e907cSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS,
12*4d7e907cSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*4d7e907cSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and
14*4d7e907cSAndroid Build Coastguard Worker * limitations under the License.
15*4d7e907cSAndroid Build Coastguard Worker */
16*4d7e907cSAndroid Build Coastguard Worker
17*4d7e907cSAndroid Build Coastguard Workerpackage [email protected];
18*4d7e907cSAndroid Build Coastguard Worker
19*4d7e907cSAndroid Build Coastguard Workerimport [email protected]::IComponent;
20*4d7e907cSAndroid Build Coastguard Workerimport [email protected]::Status;
21*4d7e907cSAndroid Build Coastguard Worker
22*4d7e907cSAndroid Build Coastguard Worker/**
23*4d7e907cSAndroid Build Coastguard Worker * Interface for a Codec2 component corresponding to API level 1.0 or below.
24*4d7e907cSAndroid Build Coastguard Worker * Components have two states: stopped and running. The running state has three
25*4d7e907cSAndroid Build Coastguard Worker * sub-states: executing, tripped and error.
26*4d7e907cSAndroid Build Coastguard Worker *
27*4d7e907cSAndroid Build Coastguard Worker * All methods in `IComponent` must not block. If a method call cannot be
28*4d7e907cSAndroid Build Coastguard Worker * completed in a timely manner, it must return `TIMED_OUT` in the return
29*4d7e907cSAndroid Build Coastguard Worker * status.
30*4d7e907cSAndroid Build Coastguard Worker *
31*4d7e907cSAndroid Build Coastguard Worker * @note This is an extension of version 1.0 of `IComponent`. The purpose of the
32*4d7e907cSAndroid Build Coastguard Worker * extension is to add support for tunneling.
33*4d7e907cSAndroid Build Coastguard Worker */
34*4d7e907cSAndroid Build Coastguard Workerinterface IComponent extends @1.0::IComponent {
35*4d7e907cSAndroid Build Coastguard Worker    /**
36*4d7e907cSAndroid Build Coastguard Worker      * Configures a component for a tunneled playback mode.
37*4d7e907cSAndroid Build Coastguard Worker      *
38*4d7e907cSAndroid Build Coastguard Worker      * A successful call to this method puts the component in the *tunneled*
39*4d7e907cSAndroid Build Coastguard Worker      * mode. In this mode, the output `Worklet`s returned in
40*4d7e907cSAndroid Build Coastguard Worker      * IComponentListener::onWorkDone() may not contain any buffers. The output
41*4d7e907cSAndroid Build Coastguard Worker      * buffers are passed directly to the consumer end of a buffer queue whose
42*4d7e907cSAndroid Build Coastguard Worker      * producer side is configured with the returned @p sidebandStream passed
43*4d7e907cSAndroid Build Coastguard Worker      * to IGraphicBufferProducer::setSidebandStream().
44*4d7e907cSAndroid Build Coastguard Worker      *
45*4d7e907cSAndroid Build Coastguard Worker      * The component is initially in the non-tunneled mode by default. The
46*4d7e907cSAndroid Build Coastguard Worker      * tunneled mode can be toggled on only before the component starts
47*4d7e907cSAndroid Build Coastguard Worker      * processing. Once the component is put into the tunneled mode, it shall
48*4d7e907cSAndroid Build Coastguard Worker      * stay in the tunneled mode until and only until reset() is called.
49*4d7e907cSAndroid Build Coastguard Worker      *
50*4d7e907cSAndroid Build Coastguard Worker      * @param avSyncHwId A resource ID for hardware sync. The generator of sync
51*4d7e907cSAndroid Build Coastguard Worker      *     IDs must ensure that this number is unique among all services at any
52*4d7e907cSAndroid Build Coastguard Worker      *     given time. For example, if both the audio HAL and the tuner HAL
53*4d7e907cSAndroid Build Coastguard Worker      *     support this feature, sync IDs from the audio HAL must not clash
54*4d7e907cSAndroid Build Coastguard Worker      *     with sync IDs from the tuner HAL.
55*4d7e907cSAndroid Build Coastguard Worker      * @return status Status of the call, which may be
56*4d7e907cSAndroid Build Coastguard Worker      *   - `OK`        - The operation completed successfully. In this case,
57*4d7e907cSAndroid Build Coastguard Worker      *                   @p sidebandHandle shall not be a null handle.
58*4d7e907cSAndroid Build Coastguard Worker      *   - `OMITTED`   - The component does not support video tunneling.
59*4d7e907cSAndroid Build Coastguard Worker      *   - `BAD_STATE` - The component is already running.
60*4d7e907cSAndroid Build Coastguard Worker      *   - `TIMED_OUT` - The operation cannot be finished in a timely manner.
61*4d7e907cSAndroid Build Coastguard Worker      *   - `CORRUPTED` - Some unknown error occurred.
62*4d7e907cSAndroid Build Coastguard Worker      * @return sidebandHandle Codec-allocated sideband stream handle. This can
63*4d7e907cSAndroid Build Coastguard Worker      *     be passed to IGraphicBufferProducer::setSidebandStream() to
64*4d7e907cSAndroid Build Coastguard Worker      *     establish a direct channel to the consumer.
65*4d7e907cSAndroid Build Coastguard Worker      */
66*4d7e907cSAndroid Build Coastguard Worker     configureVideoTunnel(
67*4d7e907cSAndroid Build Coastguard Worker             uint32_t avSyncHwId
68*4d7e907cSAndroid Build Coastguard Worker         ) generates (
69*4d7e907cSAndroid Build Coastguard Worker             Status status,
70*4d7e907cSAndroid Build Coastguard Worker             handle sidebandHandle
71*4d7e907cSAndroid Build Coastguard Worker         );
72*4d7e907cSAndroid Build Coastguard Worker};
73