blob: d11ce15e0ee05bc02cee8293e130919dd6600980 [file] [log] [blame]
Pawin Vongmasac80bf212018-09-06 05:22:36 -07001/*
2 * Copyright (C) 2018 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.0;
18
Pawin Vongmasa7570e3c2018-11-11 19:30:19 -080019import android.hardware.graphics.bufferqueue@1.0::IGraphicBufferProducer;
Pawin Vongmasac80bf212018-09-06 05:22:36 -070020
21import IConfigurable;
Pawin Vongmasa6c9e7842018-11-14 17:16:10 -080022import IInputSink;
Pawin Vongmasa9d1cf2a2018-11-14 13:40:40 -080023import IInputSurfaceConnection;
Pawin Vongmasac80bf212018-09-06 05:22:36 -070024
25/**
Pawin Vongmasa6c9e7842018-11-14 17:16:10 -080026 * Input surface for a Codec2 component.
27 *
28 * An <em>input surface</em> is an instance of `IInputSurface`, which may be
29 * created by calling IComponentStore::createInputSurface(). Once created, the
30 * client may
31 * 1. write data to it via the `IGraphicBufferProducer` interface; and
32 * 2. use it as input to a Codec2 encoder.
33 *
34 * @sa IInputSurfaceConnection, IComponentStore::createInputSurface(),
35 * IComponent::connectToInputSurface().
Pawin Vongmasac80bf212018-09-06 05:22:36 -070036 */
Pawin Vongmasa6c9e7842018-11-14 17:16:10 -080037interface IInputSurface {
38 /**
39 * Returns the producer interface into the internal buffer queue.
40 *
41 * @return producer `IGraphicBufferProducer` instance. This must not be
42 * null.
43 */
44 getGraphicBufferProducer() generates (IGraphicBufferProducer producer);
Pawin Vongmasac80bf212018-09-06 05:22:36 -070045
46 /**
Pawin Vongmasa6c9e7842018-11-14 17:16:10 -080047 * Returns the @ref IConfigurable instance associated to this input surface.
Pawin Vongmasac80bf212018-09-06 05:22:36 -070048 *
Pawin Vongmasa6c9e7842018-11-14 17:16:10 -080049 * @return configurable `IConfigurable` instance. This must not be null.
Pawin Vongmasa9d1cf2a2018-11-14 13:40:40 -080050 */
Pawin Vongmasa6c9e7842018-11-14 17:16:10 -080051 getConfigurable() generates (IConfigurable configurable);
52
53 /**
54 * Connects the input surface to an input sink.
55 *
56 * This function is generally called from inside the implementation of
57 * IComponent::connectToInputSurface(), where @p sink is a thin wrapper of
58 * the component that consumes buffers from this surface.
59 *
60 * @param sink Input sink. See `IInputSink` for more information.
61 * @return status Status of the call, which may be
62 * - `OK` - Configuration successful.
63 * - `BAD_VALUE` - @p sink is invalid.
64 * - `CORRUPTED` - Some unknown error occurred.
65 * @return connection `IInputSurfaceConnection` object. This must not be
66 * null if @p status is `OK`.
67 */
68 connect(
69 IInputSink sink
Pawin Vongmasa9d1cf2a2018-11-14 13:40:40 -080070 ) generates (
71 Status status,
72 IInputSurfaceConnection connection
73 );
Pawin Vongmasac80bf212018-09-06 05:22:36 -070074};
75