Copy from the old version of Codec2 HAL
This CL makes transitioning of Codec2 HAL from private to public
smoother. The CL will be reverted later.
Test: Builds
Bug: 112362730
Change-Id: Id0e199112e968e35ed3b27413baae810f1ecb2df
diff --git a/media/c2/1.0/IComponentStore.hal b/media/c2/1.0/IComponentStore.hal
index a027afe..d2474cc 100644
--- a/media/c2/1.0/IComponentStore.hal
+++ b/media/c2/1.0/IComponentStore.hal
@@ -23,33 +23,27 @@
import IConfigurable;
import IInputSurface;
-/**
- * Entry point for Codec2 HAL.
- *
- * All methods in `IComponentStore` must not block. If a method call cannot be
- * completed in a timely manner, it must return `TIMED_OUT` in the return
- * status. The only exceptions are getPoolClientManager() and getConfigurable(),
- * which must always return immediately.
- */
-interface IComponentStore {
+interface IComponentStore extends IConfigurable {
/**
* Creates a component by name.
*
- * @param name Name of the component to create. This must match one of the
- * names returned by listComponents().
- * @param listener Callback receiver.
- * @param pool `IClientManager` object of the BufferPool in the client
- * process. This may be null if the client does not own a BufferPool.
- * @return status Status of the call, which may be
- * - `OK` - The component was created successfully.
- * - `NOT_FOUND` - There is no component with the given name.
- * - `NO_MEMORY` - Not enough memory to create the component.
- * - `TIMED_OUT` - The operation cannot be finished in a timely manner.
- * - `CORRUPTED` - Some unknown error occurred.
- * @return comp The created component if @p status is `OK`.
+ * This method must return within 100ms.
*
- * @sa IComponentListener.
+ * @param name Name of the component to create. This should match one of the
+ * names returned by listComponents().
+ * @param listener The component listener to use for the component.
+ * @param pool The buffer pool client manager of the component listener.
+ * This must be null if the listener process does not own a buffer pool.
+ * @return status Status of the call, which may be
+ * - OK - The component was created successfully.
+ * - NOT_FOUND - There is no component with the given name.
+ * - NO_MEMORY - Not enough memory to create the component.
+ * - TIMED_OUT - The component could not be created within the time limit.
+ * (unexpected)
+ * - CORRUPTED - Some unknown error prevented the creation of the
+ * component. (unexpected)
+ * @return comp The created component if `Status = OK`.
*/
createComponent(
string name,
@@ -63,15 +57,19 @@
/**
* Creates a component interface by name.
*
+ * This method must return within 100ms.
+ *
* @param name Name of the component interface to create. This should match
* one of the names returned by listComponents().
* @return status Status of the call, which may be
- * - `OK - The component interface was created successfully.
- * - `NOT_FOUND` - There is no component interface with the given name.
- * - `NO_MEMORY` - Not enough memory to create the component interface.
- * - `TIMED_OUT` - The operation cannot be finished in a timely manner.
- * - `CORRUPTED` - Some unknown error occurred.
- * @return compIntf The created component interface if @p status is `OK`.
+ * - OK - The component interface was created successfully.
+ * - NOT_FOUND - There is no component interface with the given name.
+ * - NO_MEMORY - Not enough memory to create the component interface.
+ * - TIMED_OUT - The component interface could not be created within the
+ * time limit. (unexpected)
+ * - CORRUPTED - Some unknown error prevented the creation of the
+ * component interface. (unexpected)
+ * @return compIntf The created component interface if `Status = OK`.
*/
createInterface(
string name
@@ -85,49 +83,57 @@
*/
struct ComponentTraits {
/**
- * Name of the component. This must be unique for each component.
- *
- * This name is use to identify the component to create in
- * createComponent() and createComponentInterface().
+ * Name of the component.
*/
string name;
enum Domain : uint32_t {
- OTHER = 0,
- VIDEO,
AUDIO,
- IMAGE,
+ VIDEO,
+ OTHER = 0xffffffff,
};
/**
- * Component domain.
+ * Component domain. The framework may not recognize `OTHER`.
*/
Domain domain;
+ /**
+ * If #domain is `OTHER`, #domainOther can be used to provide additional
+ * information. Otherwise, #domainOther is ignored. The framework may
+ * not inspect this value.
+ */
+ uint32_t domainOther;
enum Kind : uint32_t {
- OTHER = 0,
DECODER,
ENCODER,
+ OTHER = 0xffffffff,
};
/**
- * Component kind.
+ * Component kind. The framework may not recognize `OTHER`.
*/
Kind kind;
+ /**
+ * If #kind is `OTHER`, #kindOther can be used to provide additional
+ * information. Otherwise, #kindOther is ignored. The framework may not
+ * inspect this value.
+ */
+ uint32_t kindOther;
/**
- * Rank used by `MediaCodecList` to determine component ordering. Lower
+ * Rank used by MediaCodecList to determine component ordering. Lower
* value means higher priority.
*/
uint32_t rank;
/**
- * MIME type.
+ * Media type.
*/
string mediaType;
/**
* Aliases for component name for backward compatibility.
*
- * Multiple components can have the same alias (but not the same
+ * \note Multiple components can have the same alias (but not the same
* component name) as long as their media types differ.
*/
vec<string> aliases;
@@ -136,51 +142,36 @@
/**
* Returns the list of components supported by this component store.
*
- * @return status Status of the call, which may be
- * - `OK - The operation was successful.
- * - `NO_MEMORY` - Not enough memory to complete this method.
- * - `TIMED_OUT` - The operation cannot be finished in a timely manner.
- * - `CORRUPTED` - Some unknown error occurred.
- * @return traits List of component traits for all components supported by
- * this store (in no particular order).
+ * This method must return within 500ms.
+ *
+ * @return traits List of component traits for all components supported by this store in no
+ * particular order.
*/
- listComponents() generates (
- Status status,
- vec<ComponentTraits> traits
- );
+ listComponents() generates (vec<ComponentTraits> traits);
/**
* Creates a persistent input surface that can be used as an input surface
* for any IComponent instance
*
- * @return status Status of the call, which may be
- * - `OK - The operation was successful.
- * - `NO_MEMORY` - Not enough memory to complete this method.
- * - `TIMED_OUT` - The operation cannot be finished in a timely manner.
- * - `CORRUPTED` - Some unknown error occurred.
- * @return surface A persistent input surface. This may be null to indicate
- * an error.
+ * This method must return within 100ms.
+ *
+ * @return surface A persistent input surface
*/
- createInputSurface() generates (
- Status status,
- IInputSurface surface
- );
+ createInputSurface() generates (IInputSurface surface);
/**
- * Returns a list of `StructDescriptor` objects for a set of requested
- * C2Param structure indices that this store is aware of.
+ * Returns a list of StructDescriptor object for a set of requested
+ * structures that this store is aware of.
*
* This operation must be performed at best effort, e.g. the component
* store must simply ignore all struct indices that it is not aware of.
*
- * @param indices Indices of C2Param structures to describe.
+ * @param indices struct indices to return des
* @return status Status of the call, which may be
- * - `OK` - The operation completed successfully.
- * - `NOT_FOUND` - Some indices were not known.
- * - `NO_MEMORY` - Not enough memory to complete this method.
- * - `TIMED_OUT` - The operation cannot be finished in a timely manner.
- * - `CORRUPTED` - Some unknown error occurred.
- * @return structs List of `StructDescriptor` objects.
+ * - OK - The operation completed successfully.
+ * - NOT_FOUND - Some indices were not known.
+ * - NO_MEMORY - Not enough memory to complete this method.
+ * @return structs List of StructDescriptor objects.
*/
getStructDescriptors(
vec<ParamIndex> indices
@@ -190,35 +181,33 @@
);
/**
- * Copies the contents of @p src into @p dst without changing the format of
- * @p dst.
+ * Returns information required for using BufferPool API in buffer passing.
+ * If the returned pool is not null, the client can call registerSender() to
+ * register its IAccessor instance, hence allowing the client to send
+ * buffers to components hosted by this process.
+ *
+ * @return pool If the component store supports receiving buffers via
+ * BufferPool API, \p pool must be a valid `IClientManager` instance.
+ * Otherwise, \p pool must be null.
+ */
+ getPoolClientManager(
+ ) generates (
+ IClientManager pool
+ );
+
+ /**
+ * The store must copy the contents of \p src into \p dst without changing
+ * the format of \p dst.
*
* @param src Source buffer.
* @param dst Destination buffer.
* @return status Status of the call, which may be
- * - `OK` - The copy is successful.
- * - `CANNOT_DO` - @p src and @p dst are not compatible.
- * - `REFUSED` - No permission to copy.
- * - `TIMED_OUT` - The operation cannot be finished in a timely manner.
- * - `CORRUPTED` - Some unknown error occurred.
+ * - OK - The copy is successful.
+ * - CANNOT_DO - \p src and \p dst are not compatible.
+ * - REFUSED - No permission to copy.
+ * - CORRUPTED - The copy cannot be done. (unexpected)
*/
copyBuffer(Buffer src, Buffer dst) generates (Status status);
- /**
- * Returns the `IClientManager` object for the component's BufferPool.
- *
- * @return pool If the component store supports receiving buffers via
- * BufferPool API, @p pool must be a valid `IClientManager` instance.
- * Otherwise, @p pool must be null.
- */
- getPoolClientManager() generates (IClientManager pool);
-
- /**
- * Returns the @ref IConfigurable instance associated to this component
- * store.
- *
- * @return configurable `IConfigurable` instance. This must not be null.
- */
- getConfigurable() generates (IConfigurable configurable);
};