Pawin Vongmasa | c80bf21 | 2018-09-06 05:22:36 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package android.hardware.media.c2@1.0; |
| 18 | |
Pawin Vongmasa | 7570e3c | 2018-11-11 19:30:19 -0800 | [diff] [blame] | 19 | import android.hardware.graphics.bufferqueue@1.0::IGraphicBufferProducer; |
Pawin Vongmasa | c80bf21 | 2018-09-06 05:22:36 -0700 | [diff] [blame] | 20 | |
| 21 | import IConfigurable; |
Pawin Vongmasa | 6c9e784 | 2018-11-14 17:16:10 -0800 | [diff] [blame] | 22 | import IInputSink; |
Pawin Vongmasa | 9d1cf2a | 2018-11-14 13:40:40 -0800 | [diff] [blame] | 23 | import IInputSurfaceConnection; |
Pawin Vongmasa | c80bf21 | 2018-09-06 05:22:36 -0700 | [diff] [blame] | 24 | |
| 25 | /** |
Pawin Vongmasa | 6c9e784 | 2018-11-14 17:16:10 -0800 | [diff] [blame] | 26 | * 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 Vongmasa | c80bf21 | 2018-09-06 05:22:36 -0700 | [diff] [blame] | 36 | */ |
Pawin Vongmasa | 6c9e784 | 2018-11-14 17:16:10 -0800 | [diff] [blame] | 37 | interface 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 Vongmasa | c80bf21 | 2018-09-06 05:22:36 -0700 | [diff] [blame] | 45 | |
| 46 | /** |
Pawin Vongmasa | 6c9e784 | 2018-11-14 17:16:10 -0800 | [diff] [blame] | 47 | * Returns the @ref IConfigurable instance associated to this input surface. |
Pawin Vongmasa | c80bf21 | 2018-09-06 05:22:36 -0700 | [diff] [blame] | 48 | * |
Pawin Vongmasa | 6c9e784 | 2018-11-14 17:16:10 -0800 | [diff] [blame] | 49 | * @return configurable `IConfigurable` instance. This must not be null. |
Pawin Vongmasa | 9d1cf2a | 2018-11-14 13:40:40 -0800 | [diff] [blame] | 50 | */ |
Pawin Vongmasa | 6c9e784 | 2018-11-14 17:16:10 -0800 | [diff] [blame] | 51 | 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 Vongmasa | 9d1cf2a | 2018-11-14 13:40:40 -0800 | [diff] [blame] | 70 | ) generates ( |
| 71 | Status status, |
| 72 | IInputSurfaceConnection connection |
| 73 | ); |
Pawin Vongmasa | c80bf21 | 2018-09-06 05:22:36 -0700 | [diff] [blame] | 74 | }; |
| 75 | |