1/*
2 * Copyright 2021 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.2;
18
19import android.hardware.media.bufferpool@2.0::IClientManager;
20import android.hardware.media.c2@1.0::IComponentListener;
21import android.hardware.media.c2@1.1::IComponentStore;
22import android.hardware.media.c2@1.0::Status;
23
24import IComponent;
25
26/**
27 * Entry point for Codec2 HAL.
28 *
29 * All methods in `IComponentStore` must not block. If a method call cannot be
30 * completed in a timely manner, it must return `TIMED_OUT` in the return
31 * status. The only exceptions are getPoolClientManager() and getConfigurable(),
32 * which must always return immediately.
33 *
34 * @note This is an extension of version 1.1 of `IComponentStore`. The purpose
35 * of the extension is to add support for blocking output buffer allocator.
36 */
37interface IComponentStore extends @1.1::IComponentStore {
38    /**
39     * Creates a component by name.
40     *
41     * @param name Name of the component to create. This must match one of the
42     *     names returned by listComponents().
43     * @param listener Callback receiver.
44     * @param pool `IClientManager` object of the BufferPool in the client
45     *     process. This may be null if the client does not own a BufferPool.
46     * @return status Status of the call, which may be
47     *   - `OK`        - The component was created successfully.
48     *   - `NOT_FOUND` - There is no component with the given name.
49     *   - `NO_MEMORY` - Not enough memory to create the component.
50     *   - `TIMED_OUT` - The operation cannot be finished in a timely manner.
51     *   - `CORRUPTED` - Some unknown error occurred.
52     * @return comp The created component if @p status is `OK`.
53     *
54     * @sa IComponentListener.
55     */
56    createComponent_1_2(
57            string name,
58            IComponentListener listener,
59            IClientManager pool
60        ) generates (
61            Status status,
62            IComponent comp
63        );
64};
65