Home | History | Annotate | Download | only in 1.0
      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 
     19 import android.hardware.graphics.bufferqueue@2.0::IGraphicBufferProducer;
     20 
     21 import IConfigurable;
     22 import IInputSink;
     23 import IInputSurfaceConnection;
     24 
     25 /**
     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().
     36  */
     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);
     45 
     46     /**
     47      * Returns the @ref IConfigurable instance associated to this input surface.
     48      *
     49      * @return configurable `IConfigurable` instance. This must not be null.
     50      */
     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
     70         ) generates (
     71             Status status,
     72             IInputSurfaceConnection connection
     73         );
     74 };
     75 
     76