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 hardware.google.media.c2@1.0;
     18 
     19 import android.hardware.media.bufferpool@1.0::IClientManager;
     20 import IComponentInterface;
     21 import IComponentListener;
     22 import IComponent;
     23 import IConfigurable;
     24 import IInputSurface;
     25 
     26 interface IComponentStore extends IConfigurable {
     27 
     28     /**
     29      * Creates a component by name.
     30      *
     31      * This method must return within 100ms.
     32      *
     33      * @param name Name of the component to create. This should match one of the
     34      *     names returned by listComponents().
     35      * @param listener The component listener to use for the component.
     36      * @param pool The buffer pool client manager of the component listener.
     37      *     This must be null if the listener process does not own a buffer pool.
     38      * @return status Status of the call, which may be
     39      *   - OK        - The component was created successfully.
     40      *   - NOT_FOUND - There is no component with the given name.
     41      *   - NO_MEMORY - Not enough memory to create the component.
     42      *   - TIMED_OUT - The component could not be created within the time limit.
     43      *                 (unexpected)
     44      *   - CORRUPTED - Some unknown error prevented the creation of the
     45      *                 component. (unexpected)
     46      * @return comp The created component if `Status = OK`.
     47      */
     48     createComponent(
     49             string name,
     50             IComponentListener listener,
     51             IClientManager pool
     52         ) generates (
     53             Status status,
     54             IComponent comp
     55         );
     56 
     57     /**
     58      * Creates a component interface by name.
     59      *
     60      * This method must return within 100ms.
     61      *
     62      * @param name Name of the component interface to create. This should match
     63      *     one of the names returned by listComponents().
     64      * @return status Status of the call, which may be
     65      *   - OK        - The component interface was created successfully.
     66      *   - NOT_FOUND - There is no component interface with the given name.
     67      *   - NO_MEMORY - Not enough memory to create the component interface.
     68      *   - TIMED_OUT - The component interface could not be created within the
     69      *                 time limit. (unexpected)
     70      *   - CORRUPTED - Some unknown error prevented the creation of the
     71      *                 component interface. (unexpected)
     72      * @return compIntf The created component interface if `Status = OK`.
     73      */
     74     createInterface(
     75             string name
     76         ) generates (
     77             Status status,
     78             IComponentInterface compIntf
     79         );
     80 
     81     /**
     82      * Component traits.
     83      */
     84     struct ComponentTraits {
     85         /**
     86          * Name of the component.
     87          */
     88         string name;
     89 
     90         enum Domain : uint32_t {
     91             AUDIO,
     92             VIDEO,
     93             OTHER = 0xffffffff,
     94         };
     95         /**
     96          * Component domain. The framework may not recognize `OTHER`.
     97          */
     98         Domain domain;
     99         /**
    100          * If #domain is `OTHER`, #domainOther can be used to provide additional
    101          * information. Otherwise, #domainOther is ignored. The framework may
    102          * not inspect this value.
    103          */
    104         uint32_t domainOther;
    105 
    106         enum Kind : uint32_t {
    107             DECODER,
    108             ENCODER,
    109             OTHER = 0xffffffff,
    110         };
    111         /**
    112          * Component kind. The framework may not recognize `OTHER`.
    113          */
    114         Kind kind;
    115         /**
    116          * If #kind is `OTHER`, #kindOther can be used to provide additional
    117          * information. Otherwise, #kindOther is ignored. The framework may not
    118          * inspect this value.
    119          */
    120         uint32_t kindOther;
    121 
    122         /**
    123          * Rank used by MediaCodecList to determine component ordering. Lower
    124          * value means higher priority.
    125          */
    126         uint32_t rank;
    127 
    128         /**
    129          * Media type.
    130          */
    131         string mediaType;
    132 
    133         /**
    134          * Aliases for component name for backward compatibility.
    135          *
    136          * \note Multiple components can have the same alias (but not the same
    137          * component name) as long as their media types differ.
    138          */
    139         vec<string> aliases;
    140     };
    141 
    142     /**
    143      * Returns the list of components supported by this component store.
    144      *
    145      * This method must return within 500ms.
    146      *
    147      * @return traits List of component traits for all components supported by this store in no
    148      * particular order.
    149      */
    150     listComponents() generates (vec<ComponentTraits> traits);
    151 
    152     /**
    153      * Creates a persistent input surface that can be used as an input surface
    154      * for any IComponent instance
    155      *
    156      * This method must return within 100ms.
    157      *
    158      * @return surface A persistent input surface
    159      */
    160     createInputSurface() generates (IInputSurface surface);
    161 
    162     /**
    163      * Returns a list of StructDescriptor object for a set of requested
    164      * structures that this store is aware of.
    165      *
    166      * This operation must be performed at best effort, e.g. the component
    167      * store must simply ignore all struct indices that it is not aware of.
    168      *
    169      * @param indices struct indices to return des
    170      * @return status Status of the call, which may be
    171      *   - OK        - The operation completed successfully.
    172      *   - NOT_FOUND - Some indices were not known.
    173      *   - NO_MEMORY - Not enough memory to complete this method.
    174      * @return structs List of StructDescriptor objects.
    175      */
    176     getStructDescriptors(
    177             vec<ParamIndex> indices
    178         ) generates (
    179             Status status,
    180             vec<StructDescriptor> structs
    181         );
    182 
    183     /**
    184      * Returns information required for using BufferPool API in buffer passing.
    185      * If the returned pool is not null, the client can call registerSender() to
    186      * register its IAccessor instance, hence allowing the client to send
    187      * buffers to components hosted by this process.
    188      *
    189      * @return pool If the component store supports receiving buffers via
    190      *     BufferPool API, \p pool must be a valid `IClientManager` instance.
    191      *     Otherwise, \p pool must be null.
    192      */
    193     getPoolClientManager(
    194         ) generates (
    195             IClientManager pool
    196         );
    197 
    198     /**
    199      * The store must copy the contents of \p src into \p dst without changing
    200      * the format of \p dst.
    201      *
    202      * @param src Source buffer.
    203      * @param dst Destination buffer.
    204      * @return status Status of the call, which may be
    205      *   - OK        - The copy is successful.
    206      *   - CANNOT_DO - \p src and \p dst are not compatible.
    207      *   - REFUSED   - No permission to copy.
    208      *   - CORRUPTED - The copy cannot be done. (unexpected)
    209      */
    210     copyBuffer(Buffer src, Buffer dst) generates (Status status);
    211 
    212 };
    213 
    214