1/*
2 * Copyright (C) 2016 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#ifndef C2COMPONENT_H_
18
19#define C2COMPONENT_H_
20
21#include <stdbool.h>
22#include <stdint.h>
23
24#include <list>
25#include <memory>
26#include <vector>
27#include <functional>
28
29#include <C2Param.h>
30#include <C2Work.h>
31
32namespace android {
33
34/// \defgroup components Components
35/// @{
36
37class C2Component;
38
39class C2ComponentListener {
40public:
41    virtual void onWorkDone(std::weak_ptr<C2Component> component,
42                            std::vector<std::unique_ptr<C2Work>> workItems) = 0;
43
44    virtual void onTripped(std::weak_ptr<C2Component> component,
45                           std::vector<std::shared_ptr<C2SettingResult>> settingResult) = 0;
46
47    virtual void onError(std::weak_ptr<C2Component> component,
48                         uint32_t errorCode) = 0;
49
50    // virtual void onTunnelReleased(<from>, <to>) = 0;
51
52    // virtual void onComponentReleased(<id>) = 0;
53
54protected:
55    virtual ~C2ComponentListener();
56};
57
58/**
59 * Component interface object. This object contains all of the configuration of a potential or
60 * actual component. It can be created and used independently of an actual C2Component instance to
61 * query support and parameters for various component settings and configurations for a potential
62 * component. Actual components also expose this interface.
63 */
64
65class C2ComponentInterface {
66public:
67    // ALWAYS AVAILABLE METHODS
68    // =============================================================================================
69
70    /**
71     * Returns the name of this component or component interface object.
72     * This is a unique name for this component or component interface 'class'; however, multiple
73     * instances of this component SHALL have the same name.
74     *
75     * This method MUST be supported in any state. This call does not change the state nor the
76     * internal states of the component.
77     *
78     * This method MUST be "non-blocking" and return within 1ms.
79     *
80     * \return the name of this component or component interface object.
81     * \retval an empty string if there was not enough memory to allocate the actual name.
82     */
83    virtual C2String getName() const = 0;
84
85    /**
86     * Returns a unique ID for this component or interface object.
87     * This ID is used as work targets, unique work IDs, and when configuring tunneling.
88     *
89     * This method MUST be supported in any state. This call does not change the state nor the
90     * internal states of the component.
91     *
92     * This method MUST be "non-blocking" and return within 1ms.
93     *
94     * \return a unique node ID for this component or component interface instance.
95     */
96    virtual node_id getId() const = 0;
97
98    /**
99     * Queries a set of parameters from the component or interface object.
100     * Querying is performed at best effort: the component SHALL query all supported parameters and
101     * skip unsupported ones, or heap allocated parameters that could not be allocated. Any errors
102     * are communicated in the return value. Additionally, preallocated (e.g. stack) parameters that
103     * could not be queried are invalidated. Parameters to be allocated on the heap are omitted from
104     * the result.
105     *
106     * \note Parameter values do not depend on the order of query.
107     *
108     * \todo This method cannot be used to query info-buffers. Is that a problem?
109     *
110     * This method MUST be supported in any state. This call does not change the state nor the
111     * internal states of the component.
112     *
113     * This method MUST be "non-blocking" and return within 1ms.
114     *
115     * \param[in,out] stackParams   a list of params queried. These are initialized specific to each
116     *                      setting; e.g. size and index are set and rest of the members are
117     *                      cleared.
118     *                      \note Flexible settings that are of incorrect size will be invalidated.
119     * \param[in] heapParamIndices a vector of param indices for params to be queried and returned on the
120     *                      heap. These parameters will be returned in heapParams. Unsupported param
121     *                      indices will be ignored.
122     * \param[out] heapParams    a list of params where to which the supported heap parameters will be
123     *                      appended in the order they appear in heapParamIndices.
124     *
125     * \retval C2_OK        all parameters could be queried
126     * \retval C2_BAD_INDEX all supported parameters could be queried, but some parameters were not
127     *                      supported
128     * \retval C2_NO_MEMORY could not allocate memory for a supported parameter
129     * \retval C2_CORRUPTED some unknown error prevented the querying of the parameters
130     *                      (unexpected)
131     */
132    virtual status_t query_nb(
133        const std::vector<C2Param* const> &stackParams,
134        const std::vector<C2Param::Index> &heapParamIndices,
135        std::vector<std::unique_ptr<C2Param>>* const heapParams) const = 0;
136
137    /**
138     * Sets a set of parameters for the component or interface object.
139     * Tuning is performed at best effort: the component SHALL update all supported configuration at
140     * best effort (unless configured otherwise) and skip unsupported ones. Any errors are
141     * communicated in the return value and in |failures|.
142     *
143     * \note Parameter tuning DOES depend on the order of the tuning parameters. E.g. some parameter
144     * update may allow some subsequent parameter update.
145     *
146     * This method MUST be supported in any state.
147     *
148     * This method MUST be "non-blocking" and return within 1ms.
149     *
150     * \param[in,out] params          a list of parameter updates. These will be updated to the actual
151     *                      parameter values after the updates (this is because tuning is performed
152     *                      at best effort).
153     *                      \todo params that could not be updated are not marked here, so are
154     *                      confusing - are they "existing" values or intended to be configured
155     *                      values?
156     * \param[out] failures        a list of parameter failures
157     *
158     * \retval C2_OK        all parameters could be updated successfully
159     * \retval C2_BAD_INDEX all supported parameters could be updated successfully, but some
160     *                      parameters were not supported
161     * \retval C2_BAD_VALUE some supported parameters could not be updated successfully because
162     *                      they contained unsupported values. These are returned in |failures|.
163     * \retval C2_NO_MEMORY some supported parameters could not be updated successfully because
164     *                      they contained unsupported values, but could not allocate a failure
165     *                      object for them.
166     * \retval C2_CORRUPTED some unknown error prevented the update of the parameters
167     *                      (unexpected)
168     */
169    virtual status_t config_nb(
170            const std::vector<C2Param* const> &params,
171            std::vector<std::unique_ptr<C2SettingResult>>* const failures) = 0;
172
173    /**
174     * Atomically sets a set of parameters for the component or interface object.
175     *
176     * \note This method is used mainly for reserving resources for a component.
177     *
178     * The component SHALL update all supported configuration at
179     * best effort(TBD) (unless configured otherwise) and skip unsupported ones. Any errors are
180     * communicated in the return value and in |failures|.
181     *
182     * \note Parameter tuning DOES depend on the order of the tuning parameters. E.g. some parameter
183     * update may allow some subsequent parameter update.
184     *
185     * This method MUST be supported in any state.
186     *
187     * This method may be momentarily blocking, but MUST return within 5ms.
188     *
189     * \param params[in,out]          a list of parameter updates. These will be updated to the actual
190     *                      parameter values after the updates (this is because tuning is performed
191     *                      at best effort).
192     *                      \todo params that could not be updated are not marked here, so are
193     *                      confusing - are they "existing" values or intended to be configured
194     *                      values?
195     * \param failures[out]        a list of parameter failures
196     *
197     * \retval C2_OK        all parameters could be updated successfully
198     * \retval C2_BAD_INDEX all supported parameters could be updated successfully, but some
199     *                      parameters were not supported
200     * \retval C2_BAD_VALUE some supported parameters could not be updated successfully because
201     *                      they contained unsupported values. These are returned in |failures|.
202     * \retval C2_NO_MEMORY some supported parameters could not be updated successfully because
203     *                      they contained unsupported values, but could not allocate a failure
204     *                      object for them.
205     * \retval C2_CORRUPTED some unknown error prevented the update of the parameters
206     *                      (unexpected)
207     */
208    virtual status_t commit_sm(
209            const std::vector<C2Param* const> &params,
210            std::vector<std::unique_ptr<C2SettingResult>>* const failures) = 0;
211
212    // TUNNELING
213    // =============================================================================================
214
215    /**
216     * Creates a tunnel from this component to the target component.
217     *
218     * If the component is successfully created, subsequent work items queued may include a
219     * tunneled path between these components.
220     *
221     * This method MUST be supported in any state.
222     *
223     * This method may be momentarily blocking, but MUST return within 5ms.
224     *
225     * \retval C2_OK        the tunnel was successfully created
226     * \retval C2_BAD_INDEX the target component does not exist
227     * \retval C2_ALREADY_EXIST the tunnel already exists
228     * \retval C2_UNSUPPORTED  the tunnel is not supported
229     *
230     * \retval C2_TIMED_OUT could not create the tunnel within the time limit (unexpected)
231     * \retval C2_CORRUPTED some unknown error prevented the creation of the tunnel (unexpected)
232     */
233    virtual status_t createTunnel_sm(node_id targetComponent) = 0;
234
235    /**
236     * Releases a tunnel from this component to the target component.
237     *
238     * The release of a tunnel is delayed while there are pending work items for the tunnel.
239     * After releasing a tunnel, subsequent work items queued MUST NOT include a tunneled
240     * path between these components.
241     *
242     * This method MUST be supported in any state.
243     *
244     * This method may be momentarily blocking, but MUST return within 5ms.
245     *
246     * \retval C2_OK        the tunnel was marked for release successfully
247     * \retval C2_BAD_INDEX the target component does not exist
248     * \retval C2_NOT_FOUND the tunnel does not exist
249     *
250     * \retval C2_TIMED_OUT could not mark the tunnel for release within the time limit (unexpected)
251     * \retval C2_CORRUPTED some unknown error prevented the release of the tunnel (unexpected)
252     */
253    virtual status_t releaseTunnel_sm(node_id targetComponent) = 0;
254
255
256    // REFLECTION MECHANISM (USED FOR EXTENSION)
257    // =============================================================================================
258
259    /**
260     * Returns the parameter reflector.
261     *
262     * This is used to describe parameter fields.
263     *
264     * \return a shared parameter reflector object.
265     */
266    virtual std::shared_ptr<C2ParamReflector> getParamReflector() const = 0;
267
268    /**
269     * Returns the set of supported parameters.
270     *
271     * \param[out] params a vector of supported parameters will be appended to this vector.
272     *
273     * \retval C2_OK        the operation completed successfully.
274     * \retval C2_NO_MEMORY not enough memory to complete this method.
275     */
276    virtual status_t getSupportedParams(
277            std::vector<std::shared_ptr<C2ParamDescriptor>> * const params) const = 0;
278
279    /**
280     *
281     * \todo should this take a list considering that setting some fields may further limit other
282     * fields in the same list?
283     */
284    virtual status_t getSupportedValues(
285            const std::vector<const C2ParamField> fields,
286            std::vector<C2FieldSupportedValues>* const values) const = 0;
287
288    virtual ~C2ComponentInterface() = default;
289};
290
291class C2Component {
292public:
293    // METHODS AVAILABLE WHEN RUNNING
294    // =============================================================================================
295
296    /**
297     * Queues up work for the component.
298     *
299     * This method MUST be supported in running (including tripped) states.
300     *
301     * This method MUST be "non-blocking" and return within 1ms
302     *
303     * It is acceptable for this method to return OK and return an error value using the
304     * onWorkDone() callback.
305     *
306     * \retval C2_OK        the work was successfully queued
307     * \retval C2_BAD_INDEX some component(s) in the work do(es) not exist
308     * \retval C2_UNSUPPORTED  the components are not tunneled
309     *
310     * \retval C2_NO_MEMORY not enough memory to queue the work
311     * \retval C2_CORRUPTED some unknown error prevented queuing the work (unexpected)
312     */
313    virtual status_t queue_nb(std::list<std::unique_ptr<C2Work>>* const items) = 0;
314
315    /**
316     * Announces a work to be queued later for the component. This reserves a slot for the queue
317     * to ensure correct work ordering even if the work is queued later.
318     *
319     * This method MUST be supported in running (including tripped) states.
320     *
321     * This method MUST be "non-blocking" and return within 1 ms
322     *
323     * \retval C2_OK        the work announcement has been successfully recorded
324     * \retval C2_BAD_INDEX some component(s) in the work outline do(es) not exist
325     * \retval C2_UNSUPPORTED  the componentes are not tunneled
326     *
327     * \retval C2_NO_MEMORY not enough memory to record the work announcement
328     * \retval C2_CORRUPTED some unknown error prevented recording the announcement (unexpected)
329     *
330     * \todo Can this be rolled into queue_nb?
331     */
332    virtual status_t announce_nb(const std::vector<C2WorkOutline> &items) = 0;
333
334    /**
335     * Discards and abandons any pending work for the component, and optionally any component
336     * downstream.
337     *
338     * \todo define this: we could flush all work before last item queued for component across all
339     *                    components linked to this; flush only work items that are queued to this
340     *                    component
341     * \todo return work # of last flushed item; or all flushed (but not returned items)
342     * \todo we could make flush take a work item and flush all work before/after that item to allow
343     *       TBD (slicing/seek?)
344     * \todo we could simply take a list of numbers and flush those... this is bad for decoders
345     *       also, what would happen to fine grade references?
346     *
347     * This method MUST be supported in running (including tripped) states.
348     *
349     * This method may be momentarily blocking, but must return within 5ms.
350     *
351     * Work that could be immediately abandoned/discarded SHALL be returned in |flushedWork|; this
352     * can be done in an arbitrary order.
353     *
354     * Work that could not be abandoned or discarded immediately SHALL be marked to be
355     * discarded at the earliest opportunity, and SHALL be returned via the onWorkDone() callback.
356     *
357     * \param flushThrough    flush work from this component and all components connected downstream
358     *                      from it via tunneling.
359     *
360     * \retval C2_OK        the work announcement has been successfully recorded
361     * \retval C2_TIMED_OUT the flush could not be completed within the time limit (unexpected)
362     * \retval C2_CORRUPTED some unknown error prevented flushing from completion (unexpected)
363     */
364    virtual status_t flush_sm(bool flushThrough, std::list<std::unique_ptr<C2Work>>* const flushedWork) = 0;
365
366    /**
367     * Drains the component, and optionally downstream components
368     *
369     * \todo define this; we could place EOS to all upstream components, just this component, or
370     *       all upstream and downstream component.
371     * \todo should EOS carry over to downstream components?
372     *
373     * Marks last work item as "end-of-stream", so component is notified not to wait for further
374     * work before it processes work already queued. This method is called to set the end-of-stream
375     * flag after work has been queued. Client can continue to queue further work immediately after
376     * this method returns.
377     *
378     * This method MUST be supported in running (including tripped) states.
379     *
380     * This method MUST be "non-blocking" and return within 1ms.
381     *
382     * Work that is completed SHALL be returned via the onWorkDone() callback.
383     *
384     * \param drainThrough    marks the last work item with a persistent "end-of-stream" marker that
385     *                      will drain downstream components.
386     *
387     * \todo this may confuse work-ordering downstream; could be an mode enum
388     *
389     * \retval C2_OK        the work announcement has been successfully recorded
390     * \retval C2_TIMED_OUT the flush could not be completed within the time limit (unexpected)
391     * \retval C2_CORRUPTED some unknown error prevented flushing from completion (unexpected)
392     */
393    virtual status_t drain_nb(bool drainThrough) = 0;
394
395    // STATE CHANGE METHODS
396    // =============================================================================================
397
398    /**
399     * Starts the component.
400     *
401     * This method MUST be supported in stopped state.
402     *
403     * \todo This method MUST return within 500ms. Seems this should be able to return quickly, as
404     * there are no immediate guarantees. Though there are guarantees for responsiveness immediately
405     * after start returns.
406     *
407     * \todo Could we just start a ComponentInterface to get a Component?
408     *
409     * \retval C2_OK        the work announcement has been successfully recorded
410     * \retval C2_NO_MEMORY not enough memory to start the component
411     * \retval C2_TIMED_OUT the component could not be started within the time limit (unexpected)
412     * \retval C2_CORRUPTED some unknown error prevented starting the component (unexpected)
413     */
414    virtual status_t start() = 0;
415
416    /**
417     * Stops the component.
418     *
419     * This method MUST be supported in running (including tripped) state.
420     *
421     * This method MUST return withing 500ms.
422     *
423     * Upon this call, all pending work SHALL be abandoned.
424     *
425     * \todo should this return completed work, since client will just free it? Perhaps just to
426     * verify accounting.
427     *
428     * This does not alter any settings and tunings that may have resulted in a tripped state.
429     * (Is this material given the definition? Perhaps in case we want to start again.)
430     */
431    virtual status_t stop() = 0;
432
433    /**
434     * Resets the component.
435     *
436     * This method MUST be supported in running (including tripped) state.
437     *
438     * This method MUST be supported during any other call (\todo or just blocking ones?)
439     *
440     * This method MUST return withing 500ms.
441     *
442     * After this call returns all work is/must be abandoned, all references should be released.
443     *
444     * \todo should this return completed work, since client will just free it? Also, if it unblocks
445     * a stop, where should completed work be returned?
446     *
447     * This brings settings back to their default - "guaranteeing" no tripped space.
448     *
449     * \todo reclaim support - it seems that since ownership is passed, this will allow reclaiming stuff.
450     */
451    virtual void reset() = 0;
452
453    /**
454     * Releases the component.
455     *
456     * This method MUST be supported in any state. (\todo Or shall we force reset() first to bring
457     * to a known state?)
458     *
459     * This method MUST return withing 500ms.
460     *
461     * \todo should this return completed work, since client will just free it? Also, if it unblocks
462     * a stop, where should completed work be returned?
463     *
464     * TODO: does it matter if this call has a short time limit? Yes, as upon return all references
465     * shall be abandoned.
466     */
467    virtual void release() = 0;
468
469    /**
470     * Returns the interface for this component.
471     *
472     * \return the component interface
473     */
474    virtual std::shared_ptr<C2ComponentInterface> intf() = 0;
475
476protected:
477    virtual ~C2Component() = default;
478};
479
480class C2FrameInfoParser {
481public:
482    /**
483     * \return the content type supported by this info parser.
484     *
485     * \todo this may be redundant
486     */
487    virtual C2StringLiteral getType() const = 0;
488
489    /**
490     * \return a vector of supported parameter indices parsed by this info parser.
491     *
492     * \todo sticky vs. non-sticky params? this may be communicated by param-reflector.
493     */
494    virtual const std::vector<C2Param::Index> getParsedParams() const = 0;
495
496    /**
497     * Resets this info parser. This brings this parser to its initial state after creation.
498     *
499     * This method SHALL return within 5ms.
500     *
501     * \retval C2_OK        the info parser was reset
502     * \retval C2_TIMED_OUT could not reset the parser within the time limit (unexpected)
503     * \retval C2_CORRUPTED some unknown error prevented the resetting of the parser (unexpected)
504     */
505    virtual status_t reset() { return C2_OK; }
506
507    virtual status_t parseFrame(C2BufferPack &frame);
508
509    virtual ~C2FrameInfoParser() = default;
510};
511
512struct C2ComponentInfo {
513    // TBD
514
515};
516
517class C2AllocatorStore {
518public:
519    // TBD
520
521    enum Type {
522        LINEAR,     ///< basic linear allocator type
523        GRALLOC,    ///< basic gralloc allocator type
524    };
525
526    /**
527     * Creates an allocator.
528     *
529     * \param type      the type of allocator to create
530     * \param allocator shared pointer where the created allocator is stored. Cleared on failure
531     *                  and updated on success.
532     *
533     * \retval C2_OK        the allocator was created successfully
534     * \retval C2_TIMED_OUT could not create the allocator within the time limit (unexpected)
535     * \retval C2_CORRUPTED some unknown error prevented the creation of the allocator (unexpected)
536     *
537     * \retval C2_NOT_FOUND no such allocator
538     * \retval C2_NO_MEMORY not enough memory to create the allocator
539     */
540    virtual status_t createAllocator(Type type, std::shared_ptr<C2Allocator>* const allocator) = 0;
541
542    virtual ~C2AllocatorStore() = default;
543};
544
545class C2ComponentStore {
546    /**
547     * Creates a component.
548     *
549     * This method SHALL return within 100ms.
550     *
551     * \param name          name of the component to create
552     * \param component     shared pointer where the created component is stored. Cleared on
553     *                      failure and updated on success.
554     *
555     * \retval C2_OK        the component was created successfully
556     * \retval C2_TIMED_OUT could not create the component within the time limit (unexpected)
557     * \retval C2_CORRUPTED some unknown error prevented the creation of the component (unexpected)
558     *
559     * \retval C2_NOT_FOUND no such component
560     * \retval C2_NO_MEMORY not enough memory to create the component
561     */
562    virtual status_t createComponent(C2String name, std::shared_ptr<C2Component>* const component);
563
564    /**
565     * Creates a component interface.
566     *
567     * This method SHALL return within 100ms.
568     *
569     * \param name          name of the component interface to create
570     * \param interface     shared pointer where the created interface is stored
571     *
572     * \retval C2_OK        the component interface was created successfully
573     * \retval C2_TIMED_OUT could not create the component interface within the time limit
574     *                      (unexpected)
575     * \retval C2_CORRUPTED some unknown error prevented the creation of the component interface
576     *                      (unexpected)
577     *
578     * \retval C2_NOT_FOUND no such component interface
579     * \retval C2_NO_MEMORY not enough memory to create the component interface
580     *
581     * \todo Do we need an interface, or could this just be a component that is never started?
582     */
583    virtual status_t createInterface(C2String name, std::shared_ptr<C2ComponentInterface>* const interface);
584
585    /**
586     * Returns the list of components supported by this component store.
587     *
588     * This method SHALL return within 1ms.
589     *
590     * \retval vector of component information.
591     */
592    virtual std::vector<std::unique_ptr<const C2ComponentInfo>> getComponents();
593
594    // -------------------------------------- UTILITY METHODS --------------------------------------
595
596    // on-demand buffer layout conversion (swizzling)
597    virtual status_t copyBuffer(std::shared_ptr<C2GraphicBuffer> src, std::shared_ptr<C2GraphicBuffer> dst);
598
599    // status_t selectPreferredColor(formats<A>, formats<B>);
600
601    // GLOBAL SETTINGS
602    // system-wide stride & slice-height (???)
603
604    /**
605     * Queries a set of system-wide parameters.
606     * Querying is performed at best effort: the store SHALL query all supported parameters and
607     * skip unsupported ones, or heap allocated parameters that could not be allocated. Any errors
608     * are communicated in the return value. Additionally, preallocated (e.g. stack) parameters that
609     * could not be queried are invalidated. Parameters to be allocated on the heap are omitted from
610     * the result.
611     *
612     * \note Parameter values do not depend on the order of query.
613     *
614     * This method MUST be "non-blocking" and return within 1ms.
615     *
616     * \param stackParams     a list of params queried. These are initialized specific to each
617     *                      setting; e.g. size and index are set and rest of the members are
618     *                      cleared.
619     *                      NOTE: Flexible settings that are of incorrect size will be invalidated.
620     * \param heapParamIndices a vector of param indices for params to be queried and returned on the
621     *                      heap. These parameters will be returned in heapParams. Unsupported param
622     *                      indices will be ignored.
623     * \param heapParams      a list of params where to which the supported heap parameters will be
624     *                      appended in the order they appear in heapParamIndices.
625     *
626     * \retval C2_OK        all parameters could be queried
627     * \retval C2_BAD_INDEX all supported parameters could be queried, but some parameters were not
628     *                      supported
629     * \retval C2_NO_MEMORY could not allocate memory for a supported parameter
630     * \retval C2_CORRUPTED some unknown error prevented the querying of the parameters
631     *                      (unexpected)
632     */
633    virtual status_t query_nb(
634        const std::vector<C2Param* const> &stackParams,
635        const std::vector<C2Param::Index> &heapParamIndices,
636        std::vector<std::unique_ptr<C2Param>>* const heapParams) = 0;
637
638    /**
639     * Sets a set of system-wide parameters.
640     *
641     * \note There are no settable system-wide parameters defined thus far, but may be added in the
642     * future.
643     *
644     * Tuning is performed at best effort: the store SHALL update all supported configuration at
645     * best effort (unless configured otherwise) and skip unsupported ones. Any errors are
646     * communicated in the return value and in |failures|.
647     *
648     * \note Parameter tuning DOES depend on the order of the tuning parameters. E.g. some parameter
649     * update may allow some subsequent parameter update.
650     *
651     * This method MUST be "non-blocking" and return within 1ms.
652     *
653     * \param params          a list of parameter updates. These will be updated to the actual
654     *                      parameter values after the updates (this is because tuning is performed
655     *                      at best effort).
656     *                      \todo params that could not be updated are not marked here, so are
657     *                      confusing - are they "existing" values or intended to be configured
658     *                      values?
659     * \param failures        a list of parameter failures
660     *
661     * \retval C2_OK        all parameters could be updated successfully
662     * \retval C2_BAD_INDEX all supported parameters could be updated successfully, but some
663     *                      parameters were not supported
664     * \retval C2_BAD_VALUE some supported parameters could not be updated successfully because
665     *                      they contained unsupported values. These are returned in |failures|.
666     * \retval C2_NO_MEMORY some supported parameters could not be updated successfully because
667     *                      they contained unsupported values, but could not allocate a failure
668     *                      object for them.
669     * \retval C2_CORRUPTED some unknown error prevented the update of the parameters
670     *                      (unexpected)
671     */
672    virtual status_t config_nb(
673            const std::vector<C2Param* const> &params,
674            std::list<std::unique_ptr<C2SettingResult>>* const failures) = 0;
675
676    virtual ~C2ComponentStore() = default;
677};
678
679// ================================================================================================
680
681/// @}
682
683}  // namespace android
684
685#endif  // C2COMPONENT_H_
686