1 #ifndef HIDL_GENERATED_ANDROID_HARDWARE_MEDIA_C2_V1_2_ICOMPONENTSTORE_H
2 #define HIDL_GENERATED_ANDROID_HARDWARE_MEDIA_C2_V1_2_ICOMPONENTSTORE_H
3
4 #include <android/hardware/media/bufferpool/2.0/IClientManager.h>
5 #include <android/hardware/media/c2/1.0/IComponentListener.h>
6 #include <android/hardware/media/c2/1.0/types.h>
7 #include <android/hardware/media/c2/1.1/IComponentStore.h>
8 #include <android/hardware/media/c2/1.2/IComponent.h>
9
10 #include <android/hidl/manager/1.0/IServiceNotification.h>
11
12 #include <hidl/HidlSupport.h>
13 #include <hidl/MQDescriptor.h>
14 #include <hidl/Status.h>
15 #include <utils/NativeHandle.h>
16 #include <utils/misc.h>
17
18 namespace android {
19 namespace hardware {
20 namespace media {
21 namespace c2 {
22 namespace V1_2 {
23
24 /**
25 * Entry point for Codec2 HAL.
26 *
27 * All methods in `IComponentStore` must not block. If a method call cannot be
28 * completed in a timely manner, it must return `TIMED_OUT` in the return
29 * status. The only exceptions are getPoolClientManager() and getConfigurable(),
30 * which must always return immediately.
31 *
32 * @note This is an extension of version 1.1 of `IComponentStore`. The purpose
33 * of the extension is to add support for blocking output buffer allocator.
34 */
35 struct IComponentStore : public ::android::hardware::media::c2::V1_1::IComponentStore {
36 /**
37 * Type tag for use in template logic that indicates this is a 'pure' class.
38 */
39 typedef ::android::hardware::details::i_tag _hidl_tag;
40
41 /**
42 * Fully qualified interface name: "[email protected]::IComponentStore"
43 */
44 static const char* descriptor;
45
46 /**
47 * Returns whether this object's implementation is outside of the current process.
48 */
isRemoteIComponentStore49 virtual bool isRemote() const override { return false; }
50
51 /**
52 * Return callback for createComponent
53 */
54 using createComponent_cb = std::function<void(::android::hardware::media::c2::V1_0::Status status, const ::android::sp<::android::hardware::media::c2::V1_0::IComponent>& comp)>;
55 /**
56 * Creates a component by name.
57 *
58 * @param name Name of the component to create. This must match one of the
59 * names returned by listComponents().
60 * @param listener Callback receiver.
61 * @param pool `IClientManager` object of the BufferPool in the client
62 * process. This may be null if the client does not own a BufferPool.
63 * @return status Status of the call, which may be
64 * - `OK` - The component was created successfully.
65 * - `NOT_FOUND` - There is no component with the given name.
66 * - `NO_MEMORY` - Not enough memory to create the component.
67 * - `TIMED_OUT` - The operation cannot be finished in a timely manner.
68 * - `CORRUPTED` - Some unknown error occurred.
69 * @return comp The created component if @p status is `OK`.
70 *
71 * @sa IComponentListener.
72 */
73 virtual ::android::hardware::Return<void> createComponent(const ::android::hardware::hidl_string& name, const ::android::sp<::android::hardware::media::c2::V1_0::IComponentListener>& listener, const ::android::sp<::android::hardware::media::bufferpool::V2_0::IClientManager>& pool, createComponent_cb _hidl_cb) override = 0;
74
75 /**
76 * Return callback for createInterface
77 */
78 using createInterface_cb = std::function<void(::android::hardware::media::c2::V1_0::Status status, const ::android::sp<::android::hardware::media::c2::V1_0::IComponentInterface>& compIntf)>;
79 /**
80 * Creates a component interface by name.
81 *
82 * @param name Name of the component interface to create. This should match
83 * one of the names returned by listComponents().
84 * @return status Status of the call, which may be
85 * - `OK` - The component interface was created successfully.
86 * - `NOT_FOUND` - There is no component interface with the given name.
87 * - `NO_MEMORY` - Not enough memory to create the component interface.
88 * - `TIMED_OUT` - The operation cannot be finished in a timely manner.
89 * - `CORRUPTED` - Some unknown error occurred.
90 * @return compIntf The created component interface if @p status is `OK`.
91 */
92 virtual ::android::hardware::Return<void> createInterface(const ::android::hardware::hidl_string& name, createInterface_cb _hidl_cb) override = 0;
93
94 /**
95 * Return callback for listComponents
96 */
97 using listComponents_cb = std::function<void(::android::hardware::media::c2::V1_0::Status status, const ::android::hardware::hidl_vec<::android::hardware::media::c2::V1_0::IComponentStore::ComponentTraits>& traits)>;
98 /**
99 * Returns the list of components supported by this component store.
100 *
101 * @return status Status of the call, which may be
102 * - `OK` - The operation was successful.
103 * - `NO_MEMORY` - Not enough memory to complete this method.
104 * - `TIMED_OUT` - The operation cannot be finished in a timely manner.
105 * - `CORRUPTED` - Some unknown error occurred.
106 * @return traits List of component traits for all components supported by
107 * this store (in no particular order).
108 */
109 virtual ::android::hardware::Return<void> listComponents(listComponents_cb _hidl_cb) override = 0;
110
111 /**
112 * Return callback for createInputSurface
113 */
114 using createInputSurface_cb = std::function<void(::android::hardware::media::c2::V1_0::Status status, const ::android::sp<::android::hardware::media::c2::V1_0::IInputSurface>& surface)>;
115 /**
116 * Creates a persistent input surface that can be used as an input surface
117 * for any IComponent instance
118 *
119 * @return status Status of the call, which may be
120 * - `OK` - The operation was successful.
121 * - `NO_MEMORY` - Not enough memory to complete this method.
122 * - `TIMED_OUT` - The operation cannot be finished in a timely manner.
123 * - `CORRUPTED` - Some unknown error occurred.
124 * @return surface A persistent input surface. This may be null to indicate
125 * an error.
126 */
127 virtual ::android::hardware::Return<void> createInputSurface(createInputSurface_cb _hidl_cb) override = 0;
128
129 /**
130 * Return callback for getStructDescriptors
131 */
132 using getStructDescriptors_cb = std::function<void(::android::hardware::media::c2::V1_0::Status status, const ::android::hardware::hidl_vec<::android::hardware::media::c2::V1_0::StructDescriptor>& structs)>;
133 /**
134 * Returns a list of `StructDescriptor` objects for a set of requested
135 * C2Param structure indices that this store is aware of.
136 *
137 * This operation must be performed at best effort, e.g. the component
138 * store must simply ignore all struct indices that it is not aware of.
139 *
140 * @param indices Indices of C2Param structures to describe.
141 * @return status Status of the call, which may be
142 * - `OK` - The operation completed successfully.
143 * - `NOT_FOUND` - Some indices were not known.
144 * - `NO_MEMORY` - Not enough memory to complete this method.
145 * - `TIMED_OUT` - The operation cannot be finished in a timely manner.
146 * - `CORRUPTED` - Some unknown error occurred.
147 * @return structs List of `StructDescriptor` objects.
148 */
149 virtual ::android::hardware::Return<void> getStructDescriptors(const ::android::hardware::hidl_vec<uint32_t>& indices, getStructDescriptors_cb _hidl_cb) override = 0;
150
151 /**
152 * Copies the contents of @p src into @p dst without changing the format of
153 * @p dst.
154 *
155 * @param src Source buffer.
156 * @param dst Destination buffer.
157 * @return status Status of the call, which may be
158 * - `OK` - The copy is successful.
159 * - `CANNOT_DO` - @p src and @p dst are not compatible.
160 * - `REFUSED` - No permission to copy.
161 * - `TIMED_OUT` - The operation cannot be finished in a timely manner.
162 * - `CORRUPTED` - Some unknown error occurred.
163 */
164 virtual ::android::hardware::Return<::android::hardware::media::c2::V1_0::Status> copyBuffer(const ::android::hardware::media::c2::V1_0::Buffer& src, const ::android::hardware::media::c2::V1_0::Buffer& dst) override = 0;
165
166 /**
167 * Returns the `IClientManager` object for the component's BufferPool.
168 *
169 * @return pool If the component store supports receiving buffers via
170 * BufferPool API, @p pool must be a valid `IClientManager` instance.
171 * Otherwise, @p pool must be null.
172 */
173 virtual ::android::hardware::Return<::android::sp<::android::hardware::media::bufferpool::V2_0::IClientManager>> getPoolClientManager() override = 0;
174
175 /**
176 * Returns the @ref IConfigurable instance associated to this component
177 * store.
178 *
179 * @return configurable `IConfigurable` instance. This must not be null.
180 */
181 virtual ::android::hardware::Return<::android::sp<::android::hardware::media::c2::V1_0::IConfigurable>> getConfigurable() override = 0;
182
183 /**
184 * Return callback for createComponent_1_1
185 */
186 using createComponent_1_1_cb = std::function<void(::android::hardware::media::c2::V1_0::Status status, const ::android::sp<::android::hardware::media::c2::V1_1::IComponent>& comp)>;
187 /**
188 * Creates a component by name.
189 *
190 * @param name Name of the component to create. This must match one of the
191 * names returned by listComponents().
192 * @param listener Callback receiver.
193 * @param pool `IClientManager` object of the BufferPool in the client
194 * process. This may be null if the client does not own a BufferPool.
195 * @return status Status of the call, which may be
196 * - `OK` - The component was created successfully.
197 * - `NOT_FOUND` - There is no component with the given name.
198 * - `NO_MEMORY` - Not enough memory to create the component.
199 * - `TIMED_OUT` - The operation cannot be finished in a timely manner.
200 * - `CORRUPTED` - Some unknown error occurred.
201 * @return comp The created component if @p status is `OK`.
202 *
203 * @sa IComponentListener.
204 */
205 virtual ::android::hardware::Return<void> createComponent_1_1(const ::android::hardware::hidl_string& name, const ::android::sp<::android::hardware::media::c2::V1_0::IComponentListener>& listener, const ::android::sp<::android::hardware::media::bufferpool::V2_0::IClientManager>& pool, createComponent_1_1_cb _hidl_cb) override = 0;
206
207 /**
208 * Return callback for createComponent_1_2
209 */
210 using createComponent_1_2_cb = std::function<void(::android::hardware::media::c2::V1_0::Status status, const ::android::sp<::android::hardware::media::c2::V1_2::IComponent>& comp)>;
211 /**
212 * Creates a component by name.
213 *
214 * @param name Name of the component to create. This must match one of the
215 * names returned by listComponents().
216 * @param listener Callback receiver.
217 * @param pool `IClientManager` object of the BufferPool in the client
218 * process. This may be null if the client does not own a BufferPool.
219 * @return status Status of the call, which may be
220 * - `OK` - The component was created successfully.
221 * - `NOT_FOUND` - There is no component with the given name.
222 * - `NO_MEMORY` - Not enough memory to create the component.
223 * - `TIMED_OUT` - The operation cannot be finished in a timely manner.
224 * - `CORRUPTED` - Some unknown error occurred.
225 * @return comp The created component if @p status is `OK`.
226 *
227 * @sa IComponentListener.
228 */
229 virtual ::android::hardware::Return<void> createComponent_1_2(const ::android::hardware::hidl_string& name, const ::android::sp<::android::hardware::media::c2::V1_0::IComponentListener>& listener, const ::android::sp<::android::hardware::media::bufferpool::V2_0::IClientManager>& pool, createComponent_1_2_cb _hidl_cb) = 0;
230
231 /**
232 * Return callback for interfaceChain
233 */
234 using interfaceChain_cb = std::function<void(const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& descriptors)>;
235 /*
236 * Provides run-time type information for this object.
237 * For example, for the following interface definition:
238 * package [email protected];
239 * interface IParent {};
240 * interface IChild extends IParent {};
241 * Calling interfaceChain on an IChild object must yield the following:
242 * ["[email protected]::IChild",
243 * "[email protected]::IParent"
244 * "[email protected]::IBase"]
245 *
246 * @return descriptors a vector of descriptors of the run-time type of the
247 * object.
248 */
249 virtual ::android::hardware::Return<void> interfaceChain(interfaceChain_cb _hidl_cb) override;
250
251 /*
252 * Emit diagnostic information to the given file.
253 *
254 * Optionally overriden.
255 *
256 * @param fd File descriptor to dump data to.
257 * Must only be used for the duration of this call.
258 * @param options Arguments for debugging.
259 * Must support empty for default debug information.
260 */
261 virtual ::android::hardware::Return<void> debug(const ::android::hardware::hidl_handle& fd, const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& options) override;
262
263 /**
264 * Return callback for interfaceDescriptor
265 */
266 using interfaceDescriptor_cb = std::function<void(const ::android::hardware::hidl_string& descriptor)>;
267 /*
268 * Provides run-time type information for this object.
269 * For example, for the following interface definition:
270 * package [email protected];
271 * interface IParent {};
272 * interface IChild extends IParent {};
273 * Calling interfaceDescriptor on an IChild object must yield
274 * "[email protected]::IChild"
275 *
276 * @return descriptor a descriptor of the run-time type of the
277 * object (the first element of the vector returned by
278 * interfaceChain())
279 */
280 virtual ::android::hardware::Return<void> interfaceDescriptor(interfaceDescriptor_cb _hidl_cb) override;
281
282 /**
283 * Return callback for getHashChain
284 */
285 using getHashChain_cb = std::function<void(const ::android::hardware::hidl_vec<::android::hardware::hidl_array<uint8_t, 32>>& hashchain)>;
286 /*
287 * Returns hashes of the source HAL files that define the interfaces of the
288 * runtime type information on the object.
289 * For example, for the following interface definition:
290 * package [email protected];
291 * interface IParent {};
292 * interface IChild extends IParent {};
293 * Calling interfaceChain on an IChild object must yield the following:
294 * [(hash of IChild.hal),
295 * (hash of IParent.hal)
296 * (hash of IBase.hal)].
297 *
298 * SHA-256 is used as the hashing algorithm. Each hash has 32 bytes
299 * according to SHA-256 standard.
300 *
301 * @return hashchain a vector of SHA-1 digests
302 */
303 virtual ::android::hardware::Return<void> getHashChain(getHashChain_cb _hidl_cb) override;
304
305 /*
306 * This method trigger the interface to enable/disable instrumentation based
307 * on system property hal.instrumentation.enable.
308 */
309 virtual ::android::hardware::Return<void> setHALInstrumentation() override;
310
311 /*
312 * Registers a death recipient, to be called when the process hosting this
313 * interface dies.
314 *
315 * @param recipient a hidl_death_recipient callback object
316 * @param cookie a cookie that must be returned with the callback
317 * @return success whether the death recipient was registered successfully.
318 */
319 virtual ::android::hardware::Return<bool> linkToDeath(const ::android::sp<::android::hardware::hidl_death_recipient>& recipient, uint64_t cookie) override;
320
321 /*
322 * Provides way to determine if interface is running without requesting
323 * any functionality.
324 */
325 virtual ::android::hardware::Return<void> ping() override;
326
327 /**
328 * Return callback for getDebugInfo
329 */
330 using getDebugInfo_cb = std::function<void(const ::android::hidl::base::V1_0::DebugInfo& info)>;
331 /*
332 * Get debug information on references on this interface.
333 * @return info debugging information. See comments of DebugInfo.
334 */
335 virtual ::android::hardware::Return<void> getDebugInfo(getDebugInfo_cb _hidl_cb) override;
336
337 /*
338 * This method notifies the interface that one or more system properties
339 * have changed. The default implementation calls
340 * (C++) report_sysprop_change() in libcutils or
341 * (Java) android.os.SystemProperties.reportSyspropChanged,
342 * which in turn calls a set of registered callbacks (eg to update trace
343 * tags).
344 */
345 virtual ::android::hardware::Return<void> notifySyspropsChanged() override;
346
347 /*
348 * Unregisters the registered death recipient. If this service was registered
349 * multiple times with the same exact death recipient, this unlinks the most
350 * recently registered one.
351 *
352 * @param recipient a previously registered hidl_death_recipient callback
353 * @return success whether the death recipient was unregistered successfully.
354 */
355 virtual ::android::hardware::Return<bool> unlinkToDeath(const ::android::sp<::android::hardware::hidl_death_recipient>& recipient) override;
356
357 // cast static functions
358 /**
359 * This performs a checked cast based on what the underlying implementation actually is.
360 */
361 static ::android::hardware::Return<::android::sp<::android::hardware::media::c2::V1_2::IComponentStore>> castFrom(const ::android::sp<::android::hardware::media::c2::V1_2::IComponentStore>& parent, bool emitError = false);
362 /**
363 * This performs a checked cast based on what the underlying implementation actually is.
364 */
365 static ::android::hardware::Return<::android::sp<::android::hardware::media::c2::V1_2::IComponentStore>> castFrom(const ::android::sp<::android::hardware::media::c2::V1_1::IComponentStore>& parent, bool emitError = false);
366 /**
367 * This performs a checked cast based on what the underlying implementation actually is.
368 */
369 static ::android::hardware::Return<::android::sp<::android::hardware::media::c2::V1_2::IComponentStore>> castFrom(const ::android::sp<::android::hardware::media::c2::V1_0::IComponentStore>& parent, bool emitError = false);
370 /**
371 * This performs a checked cast based on what the underlying implementation actually is.
372 */
373 static ::android::hardware::Return<::android::sp<::android::hardware::media::c2::V1_2::IComponentStore>> castFrom(const ::android::sp<::android::hidl::base::V1_0::IBase>& parent, bool emitError = false);
374
375 // helper methods for interactions with the hwservicemanager
376 /**
377 * This gets the service of this type with the specified instance name. If the
378 * service is currently not available or not in the VINTF manifest on a Trebilized
379 * device, this will return nullptr. This is useful when you don't want to block
380 * during device boot. If getStub is true, this will try to return an unwrapped
381 * passthrough implementation in the same process. This is useful when getting an
382 * implementation from the same partition/compilation group.
383 *
384 * In general, prefer getService(std::string,bool)
385 */
386 static ::android::sp<IComponentStore> tryGetService(const std::string &serviceName="default", bool getStub=false);
387 /**
388 * Deprecated. See tryGetService(std::string, bool)
389 */
390 static ::android::sp<IComponentStore> tryGetService(const char serviceName[], bool getStub=false) { std::string str(serviceName ? serviceName : ""); return tryGetService(str, getStub); }
391 /**
392 * Deprecated. See tryGetService(std::string, bool)
393 */
394 static ::android::sp<IComponentStore> tryGetService(const ::android::hardware::hidl_string& serviceName, bool getStub=false) { std::string str(serviceName.c_str()); return tryGetService(str, getStub); }
395 /**
396 * Calls tryGetService("default", bool). This is the recommended instance name for singleton services.
397 */
tryGetServiceIComponentStore398 static ::android::sp<IComponentStore> tryGetService(bool getStub) { return tryGetService("default", getStub); }
399 /**
400 * This gets the service of this type with the specified instance name. If the
401 * service is not in the VINTF manifest on a Trebilized device, this will return
402 * nullptr. If the service is not available, this will wait for the service to
403 * become available. If the service is a lazy service, this will start the service
404 * and return when it becomes available. If getStub is true, this will try to
405 * return an unwrapped passthrough implementation in the same process. This is
406 * useful when getting an implementation from the same partition/compilation group.
407 */
408 static ::android::sp<IComponentStore> getService(const std::string &serviceName="default", bool getStub=false);
409 /**
410 * Deprecated. See getService(std::string, bool)
411 */
412 static ::android::sp<IComponentStore> getService(const char serviceName[], bool getStub=false) { std::string str(serviceName ? serviceName : ""); return getService(str, getStub); }
413 /**
414 * Deprecated. See getService(std::string, bool)
415 */
416 static ::android::sp<IComponentStore> getService(const ::android::hardware::hidl_string& serviceName, bool getStub=false) { std::string str(serviceName.c_str()); return getService(str, getStub); }
417 /**
418 * Calls getService("default", bool). This is the recommended instance name for singleton services.
419 */
getServiceIComponentStore420 static ::android::sp<IComponentStore> getService(bool getStub) { return getService("default", getStub); }
421 /**
422 * Registers a service with the service manager. For Trebilized devices, the service
423 * must also be in the VINTF manifest.
424 */
425 __attribute__ ((warn_unused_result))::android::status_t registerAsService(const std::string &serviceName="default");
426 /**
427 * Registers for notifications for when a service is registered.
428 */
429 static bool registerForNotifications(
430 const std::string &serviceName,
431 const ::android::sp<::android::hidl::manager::V1_0::IServiceNotification> ¬ification);
432 };
433
434 //
435 // type declarations for package
436 //
437
438 static inline std::string toString(const ::android::sp<::android::hardware::media::c2::V1_2::IComponentStore>& o);
439
440 //
441 // type header definitions for package
442 //
443
toString(const::android::sp<::android::hardware::media::c2::V1_2::IComponentStore> & o)444 static inline std::string toString(const ::android::sp<::android::hardware::media::c2::V1_2::IComponentStore>& o) {
445 std::string os = "[class or subclass of ";
446 os += ::android::hardware::media::c2::V1_2::IComponentStore::descriptor;
447 os += "]";
448 os += o->isRemote() ? "@remote" : "@local";
449 return os;
450 }
451
452
453 } // namespace V1_2
454 } // namespace c2
455 } // namespace media
456 } // namespace hardware
457 } // namespace android
458
459 //
460 // global type declarations for package
461 //
462
463
464 #endif // HIDL_GENERATED_ANDROID_HARDWARE_MEDIA_C2_V1_2_ICOMPONENTSTORE_H
465