blob: d2474cc1c9b81d05ac5a94a33ea0b16846bd693e [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.media.bufferpool@1.0::IClientManager;
Pawin Vongmasac80bf212018-09-06 05:22:36 -070020import IComponentInterface;
21import IComponentListener;
22import IComponent;
23import IConfigurable;
24import IInputSurface;
25
Pawin Vongmasa9d1cf2a2018-11-14 13:40:40 -080026interface IComponentStore extends IConfigurable {
Pawin Vongmasac80bf212018-09-06 05:22:36 -070027
28 /**
29 * Creates a component by name.
30 *
Pawin Vongmasa9d1cf2a2018-11-14 13:40:40 -080031 * This method must return within 100ms.
Pawin Vongmasac80bf212018-09-06 05:22:36 -070032 *
Pawin Vongmasa9d1cf2a2018-11-14 13:40:40 -080033 * @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`.
Pawin Vongmasac80bf212018-09-06 05:22:36 -070047 */
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 *
Pawin Vongmasa9d1cf2a2018-11-14 13:40:40 -080060 * This method must return within 100ms.
61 *
Pawin Vongmasac80bf212018-09-06 05:22:36 -070062 * @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
Pawin Vongmasa9d1cf2a2018-11-14 13:40:40 -080065 * - 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`.
Pawin Vongmasac80bf212018-09-06 05:22:36 -070073 */
74 createInterface(
75 string name
76 ) generates (
77 Status status,
78 IComponentInterface compIntf
79 );
80
81 /**
82 * Component traits.
83 */
84 struct ComponentTraits {
85 /**
Pawin Vongmasa9d1cf2a2018-11-14 13:40:40 -080086 * Name of the component.
Pawin Vongmasac80bf212018-09-06 05:22:36 -070087 */
88 string name;
89
90 enum Domain : uint32_t {
Pawin Vongmasac80bf212018-09-06 05:22:36 -070091 AUDIO,
Pawin Vongmasa9d1cf2a2018-11-14 13:40:40 -080092 VIDEO,
93 OTHER = 0xffffffff,
Pawin Vongmasac80bf212018-09-06 05:22:36 -070094 };
95 /**
Pawin Vongmasa9d1cf2a2018-11-14 13:40:40 -080096 * Component domain. The framework may not recognize `OTHER`.
Pawin Vongmasac80bf212018-09-06 05:22:36 -070097 */
98 Domain domain;
Pawin Vongmasa9d1cf2a2018-11-14 13:40:40 -080099 /**
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;
Pawin Vongmasac80bf212018-09-06 05:22:36 -0700105
106 enum Kind : uint32_t {
Pawin Vongmasac80bf212018-09-06 05:22:36 -0700107 DECODER,
108 ENCODER,
Pawin Vongmasa9d1cf2a2018-11-14 13:40:40 -0800109 OTHER = 0xffffffff,
Pawin Vongmasac80bf212018-09-06 05:22:36 -0700110 };
111 /**
Pawin Vongmasa9d1cf2a2018-11-14 13:40:40 -0800112 * Component kind. The framework may not recognize `OTHER`.
Pawin Vongmasac80bf212018-09-06 05:22:36 -0700113 */
114 Kind kind;
Pawin Vongmasa9d1cf2a2018-11-14 13:40:40 -0800115 /**
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;
Pawin Vongmasac80bf212018-09-06 05:22:36 -0700121
122 /**
Pawin Vongmasa9d1cf2a2018-11-14 13:40:40 -0800123 * Rank used by MediaCodecList to determine component ordering. Lower
Pawin Vongmasac80bf212018-09-06 05:22:36 -0700124 * value means higher priority.
125 */
126 uint32_t rank;
127
128 /**
Pawin Vongmasa9d1cf2a2018-11-14 13:40:40 -0800129 * Media type.
Pawin Vongmasac80bf212018-09-06 05:22:36 -0700130 */
131 string mediaType;
132
133 /**
134 * Aliases for component name for backward compatibility.
135 *
Pawin Vongmasa9d1cf2a2018-11-14 13:40:40 -0800136 * \note Multiple components can have the same alias (but not the same
Pawin Vongmasac80bf212018-09-06 05:22:36 -0700137 * 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 *
Pawin Vongmasa9d1cf2a2018-11-14 13:40:40 -0800145 * 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.
Pawin Vongmasac80bf212018-09-06 05:22:36 -0700149 */
Pawin Vongmasa9d1cf2a2018-11-14 13:40:40 -0800150 listComponents() generates (vec<ComponentTraits> traits);
Pawin Vongmasac80bf212018-09-06 05:22:36 -0700151
152 /**
153 * Creates a persistent input surface that can be used as an input surface
154 * for any IComponent instance
155 *
Pawin Vongmasa9d1cf2a2018-11-14 13:40:40 -0800156 * This method must return within 100ms.
157 *
158 * @return surface A persistent input surface
Pawin Vongmasac80bf212018-09-06 05:22:36 -0700159 */
Pawin Vongmasa9d1cf2a2018-11-14 13:40:40 -0800160 createInputSurface() generates (IInputSurface surface);
Pawin Vongmasac80bf212018-09-06 05:22:36 -0700161
162 /**
Pawin Vongmasa9d1cf2a2018-11-14 13:40:40 -0800163 * Returns a list of StructDescriptor object for a set of requested
164 * structures that this store is aware of.
Pawin Vongmasac80bf212018-09-06 05:22:36 -0700165 *
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 *
Pawin Vongmasa9d1cf2a2018-11-14 13:40:40 -0800169 * @param indices struct indices to return des
Pawin Vongmasac80bf212018-09-06 05:22:36 -0700170 * @return status Status of the call, which may be
Pawin Vongmasa9d1cf2a2018-11-14 13:40:40 -0800171 * - 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.
Pawin Vongmasac80bf212018-09-06 05:22:36 -0700175 */
176 getStructDescriptors(
177 vec<ParamIndex> indices
178 ) generates (
179 Status status,
180 vec<StructDescriptor> structs
181 );
182
183 /**
Pawin Vongmasa9d1cf2a2018-11-14 13:40:40 -0800184 * 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.
Pawin Vongmasac80bf212018-09-06 05:22:36 -0700201 *
202 * @param src Source buffer.
203 * @param dst Destination buffer.
204 * @return status Status of the call, which may be
Pawin Vongmasa9d1cf2a2018-11-14 13:40:40 -0800205 * - 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)
Pawin Vongmasac80bf212018-09-06 05:22:36 -0700209 */
210 copyBuffer(Buffer src, Buffer dst) generates (Status status);
211
Pawin Vongmasac80bf212018-09-06 05:22:36 -0700212};
213