Loading media/libstagefright/codec2/include/C2.h +3 −3 Original line number Original line Diff line number Diff line Loading @@ -66,7 +66,7 @@ enum { * mitigate binary breaks by adhering to the following conventions: * mitigate binary breaks by adhering to the following conventions: * * * - at most one vtable with placeholder virtual methods * - at most one vtable with placeholder virtual methods * - all optional/placeholder virtual methods returning a C2Status, with C2_OMITTED not requiring * - all optional/placeholder virtual methods returning a c2_status_t, with C2_OMITTED not requiring * any update to input/output arguments. * any update to input/output arguments. * - limiting symbol export of inline methods * - limiting symbol export of inline methods * - use of pimpl (or shared-pimpl) * - use of pimpl (or shared-pimpl) Loading Loading @@ -106,9 +106,9 @@ typedef std::string C2String; typedef const char *C2StringLiteral; typedef const char *C2StringLiteral; /** /** * C2Status: status codes used. * c2_status_t: status codes used. */ */ enum C2Status : int32_t { enum c2_status_t : int32_t { /* /* * Use android status constants if available. Otherwise, define the android status constants as * Use android status constants if available. Otherwise, define the android status constants as Loading media/libstagefright/codec2/include/C2Buffer.h +41 −37 Original line number Original line Diff line number Diff line Loading @@ -91,7 +91,7 @@ public: * \retval C2_REFUSED no permission to wait for the fence (unexpected - system) * \retval C2_REFUSED no permission to wait for the fence (unexpected - system) * \retval C2_CORRUPTED some unknown error prevented waiting for the fence (unexpected) * \retval C2_CORRUPTED some unknown error prevented waiting for the fence (unexpected) */ */ C2Status wait(nsecs_t timeoutNs); c2_status_t wait(nsecs_t timeoutNs); /** /** * Used to check if this fence is valid (if there is a chance for it to be signaled.) * Used to check if this fence is valid (if there is a chance for it to be signaled.) Loading Loading @@ -158,7 +158,7 @@ public: * \retval C2_REFUSED no permission to signal the fence (unexpected - system) * \retval C2_REFUSED no permission to signal the fence (unexpected - system) * \retval C2_CORRUPTED some unknown error prevented signaling the fence(s) (unexpected) * \retval C2_CORRUPTED some unknown error prevented signaling the fence(s) (unexpected) */ */ C2Status fire(); c2_status_t fire(); /** /** * Trigger this event from the merging of the supplied fences. This means that it will be * Trigger this event from the merging of the supplied fences. This means that it will be Loading @@ -172,7 +172,7 @@ public: * \retval C2_REFUSED no permission to merge the fence (unexpected - system) * \retval C2_REFUSED no permission to merge the fence (unexpected - system) * \retval C2_CORRUPTED some unknown error prevented merging the fence(s) (unexpected) * \retval C2_CORRUPTED some unknown error prevented merging the fence(s) (unexpected) */ */ C2Status merge(std::vector<C2Fence> fences); c2_status_t merge(std::vector<C2Fence> fences); /** /** * Abandons the event and any associated fence(s). * Abandons the event and any associated fence(s). Loading @@ -186,7 +186,7 @@ public: * \retval C2_REFUSED no permission to abandon the fence (unexpected - system) * \retval C2_REFUSED no permission to abandon the fence (unexpected - system) * \retval C2_CORRUPTED some unknown error prevented signaling the fence(s) (unexpected) * \retval C2_CORRUPTED some unknown error prevented signaling the fence(s) (unexpected) */ */ C2Status abandon(); c2_status_t abandon(); private: private: class Impl; class Impl; Loading @@ -200,12 +200,12 @@ private: * Interface for objects that encapsulate an updatable status value. * Interface for objects that encapsulate an updatable status value. */ */ struct _C2InnateStatus { struct _C2InnateStatus { inline C2Status status() const { return mStatus; } inline c2_status_t status() const { return mStatus; } protected: protected: _C2InnateStatus(C2Status status) : mStatus(status) { } _C2InnateStatus(c2_status_t status) : mStatus(status) { } C2Status mStatus; // this status is updatable by the object c2_status_t mStatus; // this status is updatable by the object }; }; /// @} /// @} Loading @@ -230,10 +230,10 @@ public: } } protected: protected: C2Acquirable(C2Status error, C2Fence fence, T t) : C2Fence(fence), mInitialError(error), mT(t) { } C2Acquirable(c2_status_t error, C2Fence fence, T t) : C2Fence(fence), mInitialError(error), mT(t) { } private: private: C2Status mInitialError; c2_status_t mInitialError; T mT; // TODO: move instead of copy T mT; // TODO: move instead of copy }; }; Loading Loading @@ -449,11 +449,11 @@ public: /** /** * \return error during the creation/mapping of this view. * \return error during the creation/mapping of this view. */ */ C2Status error() const; c2_status_t error() const; protected: protected: C2ReadView(const _C2LinearCapacityAspect *parent, const uint8_t *data); C2ReadView(const _C2LinearCapacityAspect *parent, const uint8_t *data); explicit C2ReadView(C2Status error); explicit C2ReadView(c2_status_t error); private: private: class Impl; class Impl; Loading Loading @@ -482,11 +482,11 @@ public: /** /** * \return error during the creation/mapping of this view. * \return error during the creation/mapping of this view. */ */ C2Status error() const; c2_status_t error() const; protected: protected: C2WriteView(const _C2LinearRangeAspect *parent, uint8_t *base); C2WriteView(const _C2LinearRangeAspect *parent, uint8_t *base); explicit C2WriteView(C2Status error); explicit C2WriteView(c2_status_t error); private: private: class Impl; class Impl; Loading Loading @@ -631,7 +631,7 @@ public: * \retval C2_TIMED_OUT the reservation timed out \todo when? * \retval C2_TIMED_OUT the reservation timed out \todo when? * \retval C2_CORRUPTED some unknown error prevented reserving space. (unexpected) * \retval C2_CORRUPTED some unknown error prevented reserving space. (unexpected) */ */ C2Status reserve(size_t size, C2Fence *fence /* nullable */); c2_status_t reserve(size_t size, C2Fence *fence /* nullable */); /** /** * Abandons a portion of this segment. This will move to the beginning of this segment. * Abandons a portion of this segment. This will move to the beginning of this segment. Loading @@ -644,7 +644,7 @@ public: * \retval C2_TIMED_OUT the operation timed out (unexpected) * \retval C2_TIMED_OUT the operation timed out (unexpected) * \retval C2_CORRUPTED some unknown error prevented abandoning the data (unexpected) * \retval C2_CORRUPTED some unknown error prevented abandoning the data (unexpected) */ */ C2Status abandon(size_t size); c2_status_t abandon(size_t size); /** /** * Share a portion as block(s) with consumers (these are moved to the used section). * Share a portion as block(s) with consumers (these are moved to the used section). Loading @@ -661,7 +661,7 @@ public: * \retval C2_TIMED_OUT the operation timed out (unexpected) * \retval C2_TIMED_OUT the operation timed out (unexpected) * \retval C2_CORRUPTED some unknown error prevented sharing the data (unexpected) * \retval C2_CORRUPTED some unknown error prevented sharing the data (unexpected) */ */ C2Status share(size_t size, C2Fence fence, std::list<C2ConstLinearBlock> &blocks); c2_status_t share(size_t size, C2Fence fence, std::list<C2ConstLinearBlock> &blocks); /** /** * Returns the beginning offset of this segment from the start of this circular block. * Returns the beginning offset of this segment from the start of this circular block. Loading Loading @@ -695,7 +695,7 @@ public: /** /** * \return error during the creation/mapping of this view. * \return error during the creation/mapping of this view. */ */ C2Status error() const; c2_status_t error() const; }; }; /** /** Loading @@ -716,7 +716,7 @@ public: * \param size number of bytes to commit to the next segment * \param size number of bytes to commit to the next segment * \param fence fence used for the commit (the fence must signal before the data is committed) * \param fence fence used for the commit (the fence must signal before the data is committed) */ */ C2Status commit(size_t size, C2Fence fence); c2_status_t commit(size_t size, C2Fence fence); /** /** * Maps this block into memory and returns a write view for it. * Maps this block into memory and returns a write view for it. Loading Loading @@ -1016,14 +1016,14 @@ public: /** /** * \return error during the creation/mapping of this view. * \return error during the creation/mapping of this view. */ */ C2Status error() const; c2_status_t error() const; protected: protected: C2GraphicView( C2GraphicView( const _C2PlanarCapacityAspect *parent, const _C2PlanarCapacityAspect *parent, uint8_t *const *data, uint8_t *const *data, const C2PlaneLayout& layout); const C2PlaneLayout& layout); explicit C2GraphicView(C2Status error); explicit C2GraphicView(c2_status_t error); private: private: class Impl; class Impl; Loading Loading @@ -1224,7 +1224,7 @@ public: * \retval C2_NO_MEMORY not enough memory to register for this callback * \retval C2_NO_MEMORY not enough memory to register for this callback * \retval C2_CORRUPTED an unknown error prevented the registration (unexpected) * \retval C2_CORRUPTED an unknown error prevented the registration (unexpected) */ */ C2Status registerOnDestroyNotify(OnDestroyNotify onDestroyNotify, void *arg = nullptr); c2_status_t registerOnDestroyNotify(OnDestroyNotify onDestroyNotify, void *arg = nullptr); /** /** * Unregisters a previously registered pre-destroy notification. * Unregisters a previously registered pre-destroy notification. Loading @@ -1236,7 +1236,7 @@ public: * \retval C2_NOT_FOUND the notification was not found * \retval C2_NOT_FOUND the notification was not found * \retval C2_CORRUPTED an unknown error prevented the registration (unexpected) * \retval C2_CORRUPTED an unknown error prevented the registration (unexpected) */ */ C2Status unregisterOnDestroyNotify(OnDestroyNotify onDestroyNotify, void *arg = nullptr); c2_status_t unregisterOnDestroyNotify(OnDestroyNotify onDestroyNotify, void *arg = nullptr); ///@} ///@} Loading @@ -1262,7 +1262,7 @@ public: * \retval C2_NO_MEMORY not enough memory to attach the metadata (this return value is not * \retval C2_NO_MEMORY not enough memory to attach the metadata (this return value is not * used if the same kind of metadata is already attached to the buffer). * used if the same kind of metadata is already attached to the buffer). */ */ C2Status setInfo(const std::shared_ptr<C2Info> &info); c2_status_t setInfo(const std::shared_ptr<C2Info> &info); /** /** * Checks if there is a certain type of metadata attached to this buffer. * Checks if there is a certain type of metadata attached to this buffer. Loading Loading @@ -1385,7 +1385,7 @@ public: * the usage flags are invalid (caller error) * the usage flags are invalid (caller error) * \retval C2_CORRUPTED some unknown error prevented the operation from completing (unexpected) * \retval C2_CORRUPTED some unknown error prevented the operation from completing (unexpected) */ */ virtual C2Status map( virtual c2_status_t map( size_t offset, size_t size, C2MemoryUsage usage, int *fenceFd /* nullable */, size_t offset, size_t size, C2MemoryUsage usage, int *fenceFd /* nullable */, void **addr /* nonnull */) = 0; void **addr /* nonnull */) = 0; Loading @@ -1409,7 +1409,7 @@ public: * \retval C2_CORRUPTED some unknown error prevented the operation from completing (unexpected) * \retval C2_CORRUPTED some unknown error prevented the operation from completing (unexpected) * \retval C2_REFUSED no permission to unmap the portion (unexpected - system) * \retval C2_REFUSED no permission to unmap the portion (unexpected - system) */ */ virtual C2Status unmap(void *addr, size_t size, int *fenceFd /* nullable */) = 0; virtual c2_status_t unmap(void *addr, size_t size, int *fenceFd /* nullable */) = 0; /** /** * Returns true if this is a valid allocation. * Returns true if this is a valid allocation. Loading Loading @@ -1472,7 +1472,7 @@ public: * \retval C2_CORRUPTED some unknown error prevented the operation from completing (unexpected) * \retval C2_CORRUPTED some unknown error prevented the operation from completing (unexpected) */ */ virtual C2Status map( virtual c2_status_t map( C2Rect rect, C2MemoryUsage usage, int *fenceFd, C2Rect rect, C2MemoryUsage usage, int *fenceFd, // TODO: return <addr, size> buffers with plane sizes // TODO: return <addr, size> buffers with plane sizes C2PlaneLayout *layout /* nonnull */, uint8_t **addr /* nonnull */) = 0; C2PlaneLayout *layout /* nonnull */, uint8_t **addr /* nonnull */) = 0; Loading @@ -1492,7 +1492,7 @@ public: * \retval C2_CORRUPTED some unknown error prevented the operation from completing (unexpected) * \retval C2_CORRUPTED some unknown error prevented the operation from completing (unexpected) * \retval C2_REFUSED no permission to unmap the section (unexpected - system) * \retval C2_REFUSED no permission to unmap the section (unexpected - system) */ */ virtual C2Status unmap(C2Fence *fenceFd /* nullable */) = 0; virtual c2_status_t unmap(C2Fence *fenceFd /* nullable */) = 0; /** /** * Returns true if this is a valid allocation. * Returns true if this is a valid allocation. Loading Loading @@ -1544,8 +1544,10 @@ public: /** /** * Information about an allocator. * Information about an allocator. * * Allocators don't have a query API so all queriable information is stored here. */ */ struct Info { struct Traits { C2String name; ///< allocator name C2String name; ///< allocator name id_t id; ///< allocator ID id_t id; ///< allocator ID type_t supportedTypes; ///< supported allocation types type_t supportedTypes; ///< supported allocation types Loading Loading @@ -1574,13 +1576,15 @@ public: virtual id_t getId() const = 0; virtual id_t getId() const = 0; /** /** * Returns the allocator information. * Returns the allocator traits. * * * This method MUST be "non-blocking" and return within 1ms. * This method MUST be "non-blocking" and return within 1ms. * * * Allocators don't have a full-fledged query API, only this method. * * \return allocator information * \return allocator information */ */ virtual std::shared_ptr<const Info> getInfo() const = 0; virtual std::shared_ptr<const Traits> getTraits() const = 0; /** /** * Allocates a 1D allocation of given |capacity| and |usage|. If successful, the allocation is * Allocates a 1D allocation of given |capacity| and |usage|. If successful, the allocation is Loading @@ -1604,7 +1608,7 @@ public: * \retval C2_OMITTED this allocator does not support 1D allocations * \retval C2_OMITTED this allocator does not support 1D allocations * \retval C2_CORRUPTED some unknown, unrecoverable error occured during allocation (unexpected) * \retval C2_CORRUPTED some unknown, unrecoverable error occured during allocation (unexpected) */ */ virtual C2Status newLinearAllocation( virtual c2_status_t newLinearAllocation( uint32_t capacity __unused, C2MemoryUsage usage __unused, uint32_t capacity __unused, C2MemoryUsage usage __unused, std::shared_ptr<C2LinearAllocation> *allocation /* nonnull */) { std::shared_ptr<C2LinearAllocation> *allocation /* nonnull */) { *allocation = nullptr; *allocation = nullptr; Loading @@ -1627,7 +1631,7 @@ public: * \retval C2_OMITTED this allocator does not support 1D allocations * \retval C2_OMITTED this allocator does not support 1D allocations * \retval C2_CORRUPTED some unknown, unrecoverable error occured during allocation (unexpected) * \retval C2_CORRUPTED some unknown, unrecoverable error occured during allocation (unexpected) */ */ virtual C2Status priorLinearAllocation( virtual c2_status_t priorLinearAllocation( const C2Handle *handle __unused, const C2Handle *handle __unused, std::shared_ptr<C2LinearAllocation> *allocation /* nonnull */) { std::shared_ptr<C2LinearAllocation> *allocation /* nonnull */) { *allocation = nullptr; *allocation = nullptr; Loading Loading @@ -1660,7 +1664,7 @@ public: * \retval C2_OMITTED this allocator does not support 2D allocations * \retval C2_OMITTED this allocator does not support 2D allocations * \retval C2_CORRUPTED some unknown, unrecoverable error occured during allocation (unexpected) * \retval C2_CORRUPTED some unknown, unrecoverable error occured during allocation (unexpected) */ */ virtual C2Status newGraphicAllocation( virtual c2_status_t newGraphicAllocation( uint32_t width __unused, uint32_t height __unused, uint32_t format __unused, uint32_t width __unused, uint32_t height __unused, uint32_t format __unused, C2MemoryUsage usage __unused, C2MemoryUsage usage __unused, std::shared_ptr<C2GraphicAllocation> *allocation /* nonnull */) { std::shared_ptr<C2GraphicAllocation> *allocation /* nonnull */) { Loading @@ -1684,7 +1688,7 @@ public: * \retval C2_OMITTED this allocator does not support 2D allocations * \retval C2_OMITTED this allocator does not support 2D allocations * \retval C2_CORRUPTED some unknown, unrecoverable error occured during recreation (unexpected) * \retval C2_CORRUPTED some unknown, unrecoverable error occured during recreation (unexpected) */ */ virtual C2Status priorGraphicAllocation( virtual c2_status_t priorGraphicAllocation( const C2Handle *handle __unused, const C2Handle *handle __unused, std::shared_ptr<C2GraphicAllocation> *allocation /* nonnull */) { std::shared_ptr<C2GraphicAllocation> *allocation /* nonnull */) { *allocation = nullptr; *allocation = nullptr; Loading Loading @@ -1764,7 +1768,7 @@ public: * \retval C2_OMITTED this pool does not support linear blocks * \retval C2_OMITTED this pool does not support linear blocks * \retval C2_CORRUPTED some unknown, unrecoverable error occured during operation (unexpected) * \retval C2_CORRUPTED some unknown, unrecoverable error occured during operation (unexpected) */ */ virtual C2Status fetchLinearBlock( virtual c2_status_t fetchLinearBlock( uint32_t capacity __unused, C2MemoryUsage usage __unused, uint32_t capacity __unused, C2MemoryUsage usage __unused, std::shared_ptr<C2LinearBlock> *block /* nonnull */) { std::shared_ptr<C2LinearBlock> *block /* nonnull */) { *block = nullptr; *block = nullptr; Loading Loading @@ -1792,7 +1796,7 @@ public: * \retval C2_OMITTED this pool does not support circular blocks * \retval C2_OMITTED this pool does not support circular blocks * \retval C2_CORRUPTED some unknown, unrecoverable error occured during operation (unexpected) * \retval C2_CORRUPTED some unknown, unrecoverable error occured during operation (unexpected) */ */ virtual C2Status fetchCircularBlock( virtual c2_status_t fetchCircularBlock( uint32_t capacity __unused, C2MemoryUsage usage __unused, uint32_t capacity __unused, C2MemoryUsage usage __unused, std::shared_ptr<C2CircularBlock> *block /* nonnull */) { std::shared_ptr<C2CircularBlock> *block /* nonnull */) { *block = nullptr; *block = nullptr; Loading Loading @@ -1823,7 +1827,7 @@ public: * \retval C2_OMITTED this pool does not support 2D blocks * \retval C2_OMITTED this pool does not support 2D blocks * \retval C2_CORRUPTED some unknown, unrecoverable error occured during operation (unexpected) * \retval C2_CORRUPTED some unknown, unrecoverable error occured during operation (unexpected) */ */ virtual C2Status fetchGraphicBlock( virtual c2_status_t fetchGraphicBlock( uint32_t width __unused, uint32_t height __unused, uint32_t format __unused, uint32_t width __unused, uint32_t height __unused, uint32_t format __unused, C2MemoryUsage usage __unused, C2MemoryUsage usage __unused, std::shared_ptr<C2GraphicBlock> *block /* nonnull */) { std::shared_ptr<C2GraphicBlock> *block /* nonnull */) { Loading media/libstagefright/codec2/include/C2Component.h +269 −97 File changed.Preview size limit exceeded, changes collapsed. Show changes media/libstagefright/codec2/include/C2Work.h +12 −11 Original line number Original line Diff line number Diff line Loading @@ -75,14 +75,9 @@ struct C2SettingResult { // WORK // WORK // ================================================================================================ // ================================================================================================ // node_id-s // c2_node_id_t-s typedef uint32_t node_id; typedef uint32_t c2_node_id_t; typedef c2_node_id_t c2_node_id_t; enum flags_t : uint32_t { BUFFERFLAG_CODEC_CONFIG = (1 << 0), BUFFERFLAG_DROP_FRAME = (1 << 1), BUFFERFLAG_END_OF_STREAM = (1 << 2), }; enum { enum { kParamIndexWorkOrdinal, kParamIndexWorkOrdinal, Loading @@ -101,6 +96,12 @@ struct C2WorkOrdinalStruct { struct C2BufferPack { struct C2BufferPack { //public: //public: enum flags_t : uint32_t { FLAG_CODEC_CONFIG = (1 << 0), FLAG_DROP_FRAME = (1 << 1), FLAG_END_OF_STREAM = (1 << 2), }; flags_t flags; flags_t flags; C2WorkOrdinalStruct ordinal; C2WorkOrdinalStruct ordinal; std::vector<std::shared_ptr<C2Buffer>> buffers; std::vector<std::shared_ptr<C2Buffer>> buffers; Loading @@ -113,7 +114,7 @@ struct C2BufferPack { struct C2Worklet { struct C2Worklet { //public: //public: // IN // IN node_id component; c2_node_id_t component; std::list<std::unique_ptr<C2Param>> tunings; //< tunings to be applied before processing this std::list<std::unique_ptr<C2Param>> tunings; //< tunings to be applied before processing this // worklet // worklet Loading Loading @@ -165,13 +166,13 @@ struct C2Work { std::list<std::unique_ptr<C2Worklet>> worklets; std::list<std::unique_ptr<C2Worklet>> worklets; uint32_t worklets_processed; uint32_t worklets_processed; C2Status result; c2_status_t result; }; }; struct C2WorkOutline { struct C2WorkOutline { //public: //public: C2WorkOrdinalStruct ordinal; C2WorkOrdinalStruct ordinal; std::list<node_id> chain; std::list<c2_node_id_t> chain; }; }; /// @} /// @} Loading media/libstagefright/codec2/tests/C2ComponentInterface_test.cpp +15 −15 Original line number Original line Diff line number Diff line Loading @@ -72,7 +72,7 @@ protected: // If a parameter is writable this is called. // If a parameter is writable this is called. // Test one filed |writableField| for given writable parameter |param|. // Test one filed |writableField| for given writable parameter |param|. // |validValues| contains all values obtained from getSupportedValues() for |writableField|. // |validValues| contains all values obtained from querySupportedValues() for |writableField|. // The test checks validity for config() with each value, and make sure values are config-ed // The test checks validity for config() with each value, and make sure values are config-ed // by query() them out. |invalidValues| contains some values which are not in |validValues|. // by query() them out. |invalidValues| contains some values which are not in |validValues|. // The test expects C2_BAD_VALUE while config() with these values, // The test expects C2_BAD_VALUE while config() with these values, Loading Loading @@ -112,11 +112,11 @@ private: // check if a component has a parameter whose type is |T|. // check if a component has a parameter whose type is |T|. // If a component has, the value should be copied into an argument, that is // If a component has, the value should be copied into an argument, that is // |p| in queryOnStack() and |heapParams| in queryOnHeap(). // |p| in queryOnStack() and |heapParams| in queryOnHeap(). // The return value is C2Status (e.g. C2_OK). // The return value is c2_status_t (e.g. C2_OK). template <typename T> C2Status queryOnStack(T *const p); template <typename T> c2_status_t queryOnStack(T *const p); template <typename T> template <typename T> C2Status queryOnHeap(const T &p, c2_status_t queryOnHeap(const T &p, std::vector<std::unique_ptr<C2Param>> *const heapParams); std::vector<std::unique_ptr<C2Param>> *const heapParams); // Get a value whose type is |T| in a component. The value is copied to |param|. // Get a value whose type is |T| in a component. The value is copied to |param|. Loading @@ -139,7 +139,7 @@ private: // Execute an interface's config_nb(). |T| is a single parameter type, not std::vector. // Execute an interface's config_nb(). |T| is a single parameter type, not std::vector. // config() creates std::vector<C2Param *const> {p} and passes it to config_nb(). // config() creates std::vector<C2Param *const> {p} and passes it to config_nb(). template <typename T> template <typename T> C2Status c2_status_t config(T *const p, config(T *const p, std::vector<std::unique_ptr<C2SettingResult>> *const failures); std::vector<std::unique_ptr<C2SettingResult>> *const failures); Loading @@ -150,7 +150,7 @@ private: // Test if config works correctly for writable parameters. // Test if config works correctly for writable parameters. // This changes the parameter's value to |newParam|. // This changes the parameter's value to |newParam|. // |stConfig| is a return value of config(). // |stConfig| is a return value of config(). template <typename T> void configWritableParamValidValue(const T &newParam, C2Status *stConfig); template <typename T> void configWritableParamValidValue(const T &newParam, c2_status_t *stConfig); // Test if config works correctly in the case an invalid value |newParam| is tried to write // Test if config works correctly in the case an invalid value |newParam| is tried to write // to an writable parameter. // to an writable parameter. Loading Loading @@ -194,13 +194,13 @@ template <> std::unique_ptr<C2PortMimeConfig::input> makeParam() { } \ } \ } while (false) } while (false) template <typename T> C2Status C2CompIntfTest::queryOnStack(T *const p) { template <typename T> c2_status_t C2CompIntfTest::queryOnStack(T *const p) { std::vector<C2Param *const> stackParams{p}; std::vector<C2Param *const> stackParams{p}; return mIntf->query_nb(stackParams, {}, nullptr); return mIntf->query_nb(stackParams, {}, nullptr); } } template <typename T> template <typename T> C2Status C2CompIntfTest::queryOnHeap( c2_status_t C2CompIntfTest::queryOnHeap( const T &p, std::vector<std::unique_ptr<C2Param>> *const heapParams) { const T &p, std::vector<std::unique_ptr<C2Param>> *const heapParams) { uint32_t index = p.type(); uint32_t index = p.type(); if (p.forStream()) { if (p.forStream()) { Loading Loading @@ -258,7 +258,7 @@ template <typename T> void C2CompIntfTest::queryUnsupportedParam() { } } template <typename T> template <typename T> C2Status C2CompIntfTest::config( c2_status_t C2CompIntfTest::config( T *const p, std::vector<std::unique_ptr<C2SettingResult>> *const failures) { T *const p, std::vector<std::unique_ptr<C2SettingResult>> *const failures) { std::vector<C2Param *const> params{p}; std::vector<C2Param *const> params{p}; return mIntf->config_nb(params, failures); return mIntf->config_nb(params, failures); Loading Loading @@ -286,7 +286,7 @@ void C2CompIntfTest::configReadOnlyParam(const T &newParam) { } } template <typename T> template <typename T> void C2CompIntfTest::configWritableParamValidValue(const T &newParam, C2Status *configResult) { void C2CompIntfTest::configWritableParamValidValue(const T &newParam, c2_status_t *configResult) { std::unique_ptr<T> p = makeParamFrom(newParam); std::unique_ptr<T> p = makeParamFrom(newParam); std::vector<C2Param *const> params{p.get()}; std::vector<C2Param *const> params{p.get()}; Loading @@ -297,7 +297,7 @@ void C2CompIntfTest::configWritableParamValidValue(const T &newParam, C2Status * // because there may be dependent limitations between fields or between parameters. // because there may be dependent limitations between fields or between parameters. // TODO(hiroh): I have to fill the return value. Comments in C2Component.h doesn't mention // TODO(hiroh): I have to fill the return value. Comments in C2Component.h doesn't mention // about the return value when conflict happens. I set C2_BAD_VALUE to it temporarily now. // about the return value when conflict happens. I set C2_BAD_VALUE to it temporarily now. C2Status stConfig = mIntf->config_nb(params, &failures); c2_status_t stConfig = mIntf->config_nb(params, &failures); if (stConfig == C2_OK) { if (stConfig == C2_OK) { EXPECT_EQ(0u, failures.size()); EXPECT_EQ(0u, failures.size()); } else { } else { Loading Loading @@ -481,7 +481,7 @@ void C2CompIntfTest::testWritableParam( TParam *const param, TRealField *const writableField, TParam *const param, TRealField *const writableField, const std::vector<TField> &validValues, const std::vector<TField> &validValues, const std::vector<TField> &invalidValues) { const std::vector<TField> &invalidValues) { C2Status stConfig; c2_status_t stConfig; // Get the parameter's value in the beginning in order to reset the value at the end. // Get the parameter's value in the beginning in order to reset the value at the end. TRACED_FAILURE(getValue(param)); TRACED_FAILURE(getValue(param)); Loading Loading @@ -555,7 +555,7 @@ void C2CompIntfTest::checkParamPermission( std::vector<std::unique_ptr<C2SettingResult>> failures; std::vector<std::unique_ptr<C2SettingResult>> failures; // Config does not change the parameter, because param is the present param. // Config does not change the parameter, because param is the present param. // This config is executed to find out if a parameter is read-only or writable. // This config is executed to find out if a parameter is read-only or writable. C2Status stStack = config(param.get(), &failures); c2_status_t stStack = config(param.get(), &failures); if (stStack == C2_BAD_VALUE) { if (stStack == C2_BAD_VALUE) { // Read-only // Read-only std::unique_ptr<T> newParam = makeParam<T>(); std::unique_ptr<T> newParam = makeParam<T>(); Loading Loading @@ -594,7 +594,7 @@ void C2CompIntfTest::outputResults(const std::string &name) { C2ParamField(param.get(), &field_type_name_::field_name_)) \ C2ParamField(param.get(), &field_type_name_::field_name_)) \ }; \ }; \ ASSERT_EQ(C2_OK, \ ASSERT_EQ(C2_OK, \ mIntf->getSupportedValues(validValueInfos)); \ mIntf->querySupportedValues_nb(validValueInfos)); \ ASSERT_EQ(1u, validValueInfos.size()); \ ASSERT_EQ(1u, validValueInfos.size()); \ std::vector<decltype(param->field_name_)> validValues; \ std::vector<decltype(param->field_name_)> validValues; \ std::vector<decltype(param->field_name_)> invalidValues; \ std::vector<decltype(param->field_name_)> invalidValues; \ Loading Loading @@ -640,7 +640,7 @@ void C2CompIntfTest::testMain(std::shared_ptr<C2ComponentInterface> intf, setComponent(intf); setComponent(intf); std::vector<std::shared_ptr<C2ParamDescriptor>> supportedParams; std::vector<std::shared_ptr<C2ParamDescriptor>> supportedParams; ASSERT_EQ(C2_OK, mIntf->getSupportedParams(&supportedParams)); ASSERT_EQ(C2_OK, mIntf->querySupportedParams_nb(&supportedParams)); EACH_TEST_SELF(C2ComponentLatencyInfo, TEST_U32_WRITABLE_FIELD); EACH_TEST_SELF(C2ComponentLatencyInfo, TEST_U32_WRITABLE_FIELD); EACH_TEST_SELF(C2ComponentTemporalInfo, TEST_U32_WRITABLE_FIELD); EACH_TEST_SELF(C2ComponentTemporalInfo, TEST_U32_WRITABLE_FIELD); Loading Loading
media/libstagefright/codec2/include/C2.h +3 −3 Original line number Original line Diff line number Diff line Loading @@ -66,7 +66,7 @@ enum { * mitigate binary breaks by adhering to the following conventions: * mitigate binary breaks by adhering to the following conventions: * * * - at most one vtable with placeholder virtual methods * - at most one vtable with placeholder virtual methods * - all optional/placeholder virtual methods returning a C2Status, with C2_OMITTED not requiring * - all optional/placeholder virtual methods returning a c2_status_t, with C2_OMITTED not requiring * any update to input/output arguments. * any update to input/output arguments. * - limiting symbol export of inline methods * - limiting symbol export of inline methods * - use of pimpl (or shared-pimpl) * - use of pimpl (or shared-pimpl) Loading Loading @@ -106,9 +106,9 @@ typedef std::string C2String; typedef const char *C2StringLiteral; typedef const char *C2StringLiteral; /** /** * C2Status: status codes used. * c2_status_t: status codes used. */ */ enum C2Status : int32_t { enum c2_status_t : int32_t { /* /* * Use android status constants if available. Otherwise, define the android status constants as * Use android status constants if available. Otherwise, define the android status constants as Loading
media/libstagefright/codec2/include/C2Buffer.h +41 −37 Original line number Original line Diff line number Diff line Loading @@ -91,7 +91,7 @@ public: * \retval C2_REFUSED no permission to wait for the fence (unexpected - system) * \retval C2_REFUSED no permission to wait for the fence (unexpected - system) * \retval C2_CORRUPTED some unknown error prevented waiting for the fence (unexpected) * \retval C2_CORRUPTED some unknown error prevented waiting for the fence (unexpected) */ */ C2Status wait(nsecs_t timeoutNs); c2_status_t wait(nsecs_t timeoutNs); /** /** * Used to check if this fence is valid (if there is a chance for it to be signaled.) * Used to check if this fence is valid (if there is a chance for it to be signaled.) Loading Loading @@ -158,7 +158,7 @@ public: * \retval C2_REFUSED no permission to signal the fence (unexpected - system) * \retval C2_REFUSED no permission to signal the fence (unexpected - system) * \retval C2_CORRUPTED some unknown error prevented signaling the fence(s) (unexpected) * \retval C2_CORRUPTED some unknown error prevented signaling the fence(s) (unexpected) */ */ C2Status fire(); c2_status_t fire(); /** /** * Trigger this event from the merging of the supplied fences. This means that it will be * Trigger this event from the merging of the supplied fences. This means that it will be Loading @@ -172,7 +172,7 @@ public: * \retval C2_REFUSED no permission to merge the fence (unexpected - system) * \retval C2_REFUSED no permission to merge the fence (unexpected - system) * \retval C2_CORRUPTED some unknown error prevented merging the fence(s) (unexpected) * \retval C2_CORRUPTED some unknown error prevented merging the fence(s) (unexpected) */ */ C2Status merge(std::vector<C2Fence> fences); c2_status_t merge(std::vector<C2Fence> fences); /** /** * Abandons the event and any associated fence(s). * Abandons the event and any associated fence(s). Loading @@ -186,7 +186,7 @@ public: * \retval C2_REFUSED no permission to abandon the fence (unexpected - system) * \retval C2_REFUSED no permission to abandon the fence (unexpected - system) * \retval C2_CORRUPTED some unknown error prevented signaling the fence(s) (unexpected) * \retval C2_CORRUPTED some unknown error prevented signaling the fence(s) (unexpected) */ */ C2Status abandon(); c2_status_t abandon(); private: private: class Impl; class Impl; Loading @@ -200,12 +200,12 @@ private: * Interface for objects that encapsulate an updatable status value. * Interface for objects that encapsulate an updatable status value. */ */ struct _C2InnateStatus { struct _C2InnateStatus { inline C2Status status() const { return mStatus; } inline c2_status_t status() const { return mStatus; } protected: protected: _C2InnateStatus(C2Status status) : mStatus(status) { } _C2InnateStatus(c2_status_t status) : mStatus(status) { } C2Status mStatus; // this status is updatable by the object c2_status_t mStatus; // this status is updatable by the object }; }; /// @} /// @} Loading @@ -230,10 +230,10 @@ public: } } protected: protected: C2Acquirable(C2Status error, C2Fence fence, T t) : C2Fence(fence), mInitialError(error), mT(t) { } C2Acquirable(c2_status_t error, C2Fence fence, T t) : C2Fence(fence), mInitialError(error), mT(t) { } private: private: C2Status mInitialError; c2_status_t mInitialError; T mT; // TODO: move instead of copy T mT; // TODO: move instead of copy }; }; Loading Loading @@ -449,11 +449,11 @@ public: /** /** * \return error during the creation/mapping of this view. * \return error during the creation/mapping of this view. */ */ C2Status error() const; c2_status_t error() const; protected: protected: C2ReadView(const _C2LinearCapacityAspect *parent, const uint8_t *data); C2ReadView(const _C2LinearCapacityAspect *parent, const uint8_t *data); explicit C2ReadView(C2Status error); explicit C2ReadView(c2_status_t error); private: private: class Impl; class Impl; Loading Loading @@ -482,11 +482,11 @@ public: /** /** * \return error during the creation/mapping of this view. * \return error during the creation/mapping of this view. */ */ C2Status error() const; c2_status_t error() const; protected: protected: C2WriteView(const _C2LinearRangeAspect *parent, uint8_t *base); C2WriteView(const _C2LinearRangeAspect *parent, uint8_t *base); explicit C2WriteView(C2Status error); explicit C2WriteView(c2_status_t error); private: private: class Impl; class Impl; Loading Loading @@ -631,7 +631,7 @@ public: * \retval C2_TIMED_OUT the reservation timed out \todo when? * \retval C2_TIMED_OUT the reservation timed out \todo when? * \retval C2_CORRUPTED some unknown error prevented reserving space. (unexpected) * \retval C2_CORRUPTED some unknown error prevented reserving space. (unexpected) */ */ C2Status reserve(size_t size, C2Fence *fence /* nullable */); c2_status_t reserve(size_t size, C2Fence *fence /* nullable */); /** /** * Abandons a portion of this segment. This will move to the beginning of this segment. * Abandons a portion of this segment. This will move to the beginning of this segment. Loading @@ -644,7 +644,7 @@ public: * \retval C2_TIMED_OUT the operation timed out (unexpected) * \retval C2_TIMED_OUT the operation timed out (unexpected) * \retval C2_CORRUPTED some unknown error prevented abandoning the data (unexpected) * \retval C2_CORRUPTED some unknown error prevented abandoning the data (unexpected) */ */ C2Status abandon(size_t size); c2_status_t abandon(size_t size); /** /** * Share a portion as block(s) with consumers (these are moved to the used section). * Share a portion as block(s) with consumers (these are moved to the used section). Loading @@ -661,7 +661,7 @@ public: * \retval C2_TIMED_OUT the operation timed out (unexpected) * \retval C2_TIMED_OUT the operation timed out (unexpected) * \retval C2_CORRUPTED some unknown error prevented sharing the data (unexpected) * \retval C2_CORRUPTED some unknown error prevented sharing the data (unexpected) */ */ C2Status share(size_t size, C2Fence fence, std::list<C2ConstLinearBlock> &blocks); c2_status_t share(size_t size, C2Fence fence, std::list<C2ConstLinearBlock> &blocks); /** /** * Returns the beginning offset of this segment from the start of this circular block. * Returns the beginning offset of this segment from the start of this circular block. Loading Loading @@ -695,7 +695,7 @@ public: /** /** * \return error during the creation/mapping of this view. * \return error during the creation/mapping of this view. */ */ C2Status error() const; c2_status_t error() const; }; }; /** /** Loading @@ -716,7 +716,7 @@ public: * \param size number of bytes to commit to the next segment * \param size number of bytes to commit to the next segment * \param fence fence used for the commit (the fence must signal before the data is committed) * \param fence fence used for the commit (the fence must signal before the data is committed) */ */ C2Status commit(size_t size, C2Fence fence); c2_status_t commit(size_t size, C2Fence fence); /** /** * Maps this block into memory and returns a write view for it. * Maps this block into memory and returns a write view for it. Loading Loading @@ -1016,14 +1016,14 @@ public: /** /** * \return error during the creation/mapping of this view. * \return error during the creation/mapping of this view. */ */ C2Status error() const; c2_status_t error() const; protected: protected: C2GraphicView( C2GraphicView( const _C2PlanarCapacityAspect *parent, const _C2PlanarCapacityAspect *parent, uint8_t *const *data, uint8_t *const *data, const C2PlaneLayout& layout); const C2PlaneLayout& layout); explicit C2GraphicView(C2Status error); explicit C2GraphicView(c2_status_t error); private: private: class Impl; class Impl; Loading Loading @@ -1224,7 +1224,7 @@ public: * \retval C2_NO_MEMORY not enough memory to register for this callback * \retval C2_NO_MEMORY not enough memory to register for this callback * \retval C2_CORRUPTED an unknown error prevented the registration (unexpected) * \retval C2_CORRUPTED an unknown error prevented the registration (unexpected) */ */ C2Status registerOnDestroyNotify(OnDestroyNotify onDestroyNotify, void *arg = nullptr); c2_status_t registerOnDestroyNotify(OnDestroyNotify onDestroyNotify, void *arg = nullptr); /** /** * Unregisters a previously registered pre-destroy notification. * Unregisters a previously registered pre-destroy notification. Loading @@ -1236,7 +1236,7 @@ public: * \retval C2_NOT_FOUND the notification was not found * \retval C2_NOT_FOUND the notification was not found * \retval C2_CORRUPTED an unknown error prevented the registration (unexpected) * \retval C2_CORRUPTED an unknown error prevented the registration (unexpected) */ */ C2Status unregisterOnDestroyNotify(OnDestroyNotify onDestroyNotify, void *arg = nullptr); c2_status_t unregisterOnDestroyNotify(OnDestroyNotify onDestroyNotify, void *arg = nullptr); ///@} ///@} Loading @@ -1262,7 +1262,7 @@ public: * \retval C2_NO_MEMORY not enough memory to attach the metadata (this return value is not * \retval C2_NO_MEMORY not enough memory to attach the metadata (this return value is not * used if the same kind of metadata is already attached to the buffer). * used if the same kind of metadata is already attached to the buffer). */ */ C2Status setInfo(const std::shared_ptr<C2Info> &info); c2_status_t setInfo(const std::shared_ptr<C2Info> &info); /** /** * Checks if there is a certain type of metadata attached to this buffer. * Checks if there is a certain type of metadata attached to this buffer. Loading Loading @@ -1385,7 +1385,7 @@ public: * the usage flags are invalid (caller error) * the usage flags are invalid (caller error) * \retval C2_CORRUPTED some unknown error prevented the operation from completing (unexpected) * \retval C2_CORRUPTED some unknown error prevented the operation from completing (unexpected) */ */ virtual C2Status map( virtual c2_status_t map( size_t offset, size_t size, C2MemoryUsage usage, int *fenceFd /* nullable */, size_t offset, size_t size, C2MemoryUsage usage, int *fenceFd /* nullable */, void **addr /* nonnull */) = 0; void **addr /* nonnull */) = 0; Loading @@ -1409,7 +1409,7 @@ public: * \retval C2_CORRUPTED some unknown error prevented the operation from completing (unexpected) * \retval C2_CORRUPTED some unknown error prevented the operation from completing (unexpected) * \retval C2_REFUSED no permission to unmap the portion (unexpected - system) * \retval C2_REFUSED no permission to unmap the portion (unexpected - system) */ */ virtual C2Status unmap(void *addr, size_t size, int *fenceFd /* nullable */) = 0; virtual c2_status_t unmap(void *addr, size_t size, int *fenceFd /* nullable */) = 0; /** /** * Returns true if this is a valid allocation. * Returns true if this is a valid allocation. Loading Loading @@ -1472,7 +1472,7 @@ public: * \retval C2_CORRUPTED some unknown error prevented the operation from completing (unexpected) * \retval C2_CORRUPTED some unknown error prevented the operation from completing (unexpected) */ */ virtual C2Status map( virtual c2_status_t map( C2Rect rect, C2MemoryUsage usage, int *fenceFd, C2Rect rect, C2MemoryUsage usage, int *fenceFd, // TODO: return <addr, size> buffers with plane sizes // TODO: return <addr, size> buffers with plane sizes C2PlaneLayout *layout /* nonnull */, uint8_t **addr /* nonnull */) = 0; C2PlaneLayout *layout /* nonnull */, uint8_t **addr /* nonnull */) = 0; Loading @@ -1492,7 +1492,7 @@ public: * \retval C2_CORRUPTED some unknown error prevented the operation from completing (unexpected) * \retval C2_CORRUPTED some unknown error prevented the operation from completing (unexpected) * \retval C2_REFUSED no permission to unmap the section (unexpected - system) * \retval C2_REFUSED no permission to unmap the section (unexpected - system) */ */ virtual C2Status unmap(C2Fence *fenceFd /* nullable */) = 0; virtual c2_status_t unmap(C2Fence *fenceFd /* nullable */) = 0; /** /** * Returns true if this is a valid allocation. * Returns true if this is a valid allocation. Loading Loading @@ -1544,8 +1544,10 @@ public: /** /** * Information about an allocator. * Information about an allocator. * * Allocators don't have a query API so all queriable information is stored here. */ */ struct Info { struct Traits { C2String name; ///< allocator name C2String name; ///< allocator name id_t id; ///< allocator ID id_t id; ///< allocator ID type_t supportedTypes; ///< supported allocation types type_t supportedTypes; ///< supported allocation types Loading Loading @@ -1574,13 +1576,15 @@ public: virtual id_t getId() const = 0; virtual id_t getId() const = 0; /** /** * Returns the allocator information. * Returns the allocator traits. * * * This method MUST be "non-blocking" and return within 1ms. * This method MUST be "non-blocking" and return within 1ms. * * * Allocators don't have a full-fledged query API, only this method. * * \return allocator information * \return allocator information */ */ virtual std::shared_ptr<const Info> getInfo() const = 0; virtual std::shared_ptr<const Traits> getTraits() const = 0; /** /** * Allocates a 1D allocation of given |capacity| and |usage|. If successful, the allocation is * Allocates a 1D allocation of given |capacity| and |usage|. If successful, the allocation is Loading @@ -1604,7 +1608,7 @@ public: * \retval C2_OMITTED this allocator does not support 1D allocations * \retval C2_OMITTED this allocator does not support 1D allocations * \retval C2_CORRUPTED some unknown, unrecoverable error occured during allocation (unexpected) * \retval C2_CORRUPTED some unknown, unrecoverable error occured during allocation (unexpected) */ */ virtual C2Status newLinearAllocation( virtual c2_status_t newLinearAllocation( uint32_t capacity __unused, C2MemoryUsage usage __unused, uint32_t capacity __unused, C2MemoryUsage usage __unused, std::shared_ptr<C2LinearAllocation> *allocation /* nonnull */) { std::shared_ptr<C2LinearAllocation> *allocation /* nonnull */) { *allocation = nullptr; *allocation = nullptr; Loading @@ -1627,7 +1631,7 @@ public: * \retval C2_OMITTED this allocator does not support 1D allocations * \retval C2_OMITTED this allocator does not support 1D allocations * \retval C2_CORRUPTED some unknown, unrecoverable error occured during allocation (unexpected) * \retval C2_CORRUPTED some unknown, unrecoverable error occured during allocation (unexpected) */ */ virtual C2Status priorLinearAllocation( virtual c2_status_t priorLinearAllocation( const C2Handle *handle __unused, const C2Handle *handle __unused, std::shared_ptr<C2LinearAllocation> *allocation /* nonnull */) { std::shared_ptr<C2LinearAllocation> *allocation /* nonnull */) { *allocation = nullptr; *allocation = nullptr; Loading Loading @@ -1660,7 +1664,7 @@ public: * \retval C2_OMITTED this allocator does not support 2D allocations * \retval C2_OMITTED this allocator does not support 2D allocations * \retval C2_CORRUPTED some unknown, unrecoverable error occured during allocation (unexpected) * \retval C2_CORRUPTED some unknown, unrecoverable error occured during allocation (unexpected) */ */ virtual C2Status newGraphicAllocation( virtual c2_status_t newGraphicAllocation( uint32_t width __unused, uint32_t height __unused, uint32_t format __unused, uint32_t width __unused, uint32_t height __unused, uint32_t format __unused, C2MemoryUsage usage __unused, C2MemoryUsage usage __unused, std::shared_ptr<C2GraphicAllocation> *allocation /* nonnull */) { std::shared_ptr<C2GraphicAllocation> *allocation /* nonnull */) { Loading @@ -1684,7 +1688,7 @@ public: * \retval C2_OMITTED this allocator does not support 2D allocations * \retval C2_OMITTED this allocator does not support 2D allocations * \retval C2_CORRUPTED some unknown, unrecoverable error occured during recreation (unexpected) * \retval C2_CORRUPTED some unknown, unrecoverable error occured during recreation (unexpected) */ */ virtual C2Status priorGraphicAllocation( virtual c2_status_t priorGraphicAllocation( const C2Handle *handle __unused, const C2Handle *handle __unused, std::shared_ptr<C2GraphicAllocation> *allocation /* nonnull */) { std::shared_ptr<C2GraphicAllocation> *allocation /* nonnull */) { *allocation = nullptr; *allocation = nullptr; Loading Loading @@ -1764,7 +1768,7 @@ public: * \retval C2_OMITTED this pool does not support linear blocks * \retval C2_OMITTED this pool does not support linear blocks * \retval C2_CORRUPTED some unknown, unrecoverable error occured during operation (unexpected) * \retval C2_CORRUPTED some unknown, unrecoverable error occured during operation (unexpected) */ */ virtual C2Status fetchLinearBlock( virtual c2_status_t fetchLinearBlock( uint32_t capacity __unused, C2MemoryUsage usage __unused, uint32_t capacity __unused, C2MemoryUsage usage __unused, std::shared_ptr<C2LinearBlock> *block /* nonnull */) { std::shared_ptr<C2LinearBlock> *block /* nonnull */) { *block = nullptr; *block = nullptr; Loading Loading @@ -1792,7 +1796,7 @@ public: * \retval C2_OMITTED this pool does not support circular blocks * \retval C2_OMITTED this pool does not support circular blocks * \retval C2_CORRUPTED some unknown, unrecoverable error occured during operation (unexpected) * \retval C2_CORRUPTED some unknown, unrecoverable error occured during operation (unexpected) */ */ virtual C2Status fetchCircularBlock( virtual c2_status_t fetchCircularBlock( uint32_t capacity __unused, C2MemoryUsage usage __unused, uint32_t capacity __unused, C2MemoryUsage usage __unused, std::shared_ptr<C2CircularBlock> *block /* nonnull */) { std::shared_ptr<C2CircularBlock> *block /* nonnull */) { *block = nullptr; *block = nullptr; Loading Loading @@ -1823,7 +1827,7 @@ public: * \retval C2_OMITTED this pool does not support 2D blocks * \retval C2_OMITTED this pool does not support 2D blocks * \retval C2_CORRUPTED some unknown, unrecoverable error occured during operation (unexpected) * \retval C2_CORRUPTED some unknown, unrecoverable error occured during operation (unexpected) */ */ virtual C2Status fetchGraphicBlock( virtual c2_status_t fetchGraphicBlock( uint32_t width __unused, uint32_t height __unused, uint32_t format __unused, uint32_t width __unused, uint32_t height __unused, uint32_t format __unused, C2MemoryUsage usage __unused, C2MemoryUsage usage __unused, std::shared_ptr<C2GraphicBlock> *block /* nonnull */) { std::shared_ptr<C2GraphicBlock> *block /* nonnull */) { Loading
media/libstagefright/codec2/include/C2Component.h +269 −97 File changed.Preview size limit exceeded, changes collapsed. Show changes
media/libstagefright/codec2/include/C2Work.h +12 −11 Original line number Original line Diff line number Diff line Loading @@ -75,14 +75,9 @@ struct C2SettingResult { // WORK // WORK // ================================================================================================ // ================================================================================================ // node_id-s // c2_node_id_t-s typedef uint32_t node_id; typedef uint32_t c2_node_id_t; typedef c2_node_id_t c2_node_id_t; enum flags_t : uint32_t { BUFFERFLAG_CODEC_CONFIG = (1 << 0), BUFFERFLAG_DROP_FRAME = (1 << 1), BUFFERFLAG_END_OF_STREAM = (1 << 2), }; enum { enum { kParamIndexWorkOrdinal, kParamIndexWorkOrdinal, Loading @@ -101,6 +96,12 @@ struct C2WorkOrdinalStruct { struct C2BufferPack { struct C2BufferPack { //public: //public: enum flags_t : uint32_t { FLAG_CODEC_CONFIG = (1 << 0), FLAG_DROP_FRAME = (1 << 1), FLAG_END_OF_STREAM = (1 << 2), }; flags_t flags; flags_t flags; C2WorkOrdinalStruct ordinal; C2WorkOrdinalStruct ordinal; std::vector<std::shared_ptr<C2Buffer>> buffers; std::vector<std::shared_ptr<C2Buffer>> buffers; Loading @@ -113,7 +114,7 @@ struct C2BufferPack { struct C2Worklet { struct C2Worklet { //public: //public: // IN // IN node_id component; c2_node_id_t component; std::list<std::unique_ptr<C2Param>> tunings; //< tunings to be applied before processing this std::list<std::unique_ptr<C2Param>> tunings; //< tunings to be applied before processing this // worklet // worklet Loading Loading @@ -165,13 +166,13 @@ struct C2Work { std::list<std::unique_ptr<C2Worklet>> worklets; std::list<std::unique_ptr<C2Worklet>> worklets; uint32_t worklets_processed; uint32_t worklets_processed; C2Status result; c2_status_t result; }; }; struct C2WorkOutline { struct C2WorkOutline { //public: //public: C2WorkOrdinalStruct ordinal; C2WorkOrdinalStruct ordinal; std::list<node_id> chain; std::list<c2_node_id_t> chain; }; }; /// @} /// @} Loading
media/libstagefright/codec2/tests/C2ComponentInterface_test.cpp +15 −15 Original line number Original line Diff line number Diff line Loading @@ -72,7 +72,7 @@ protected: // If a parameter is writable this is called. // If a parameter is writable this is called. // Test one filed |writableField| for given writable parameter |param|. // Test one filed |writableField| for given writable parameter |param|. // |validValues| contains all values obtained from getSupportedValues() for |writableField|. // |validValues| contains all values obtained from querySupportedValues() for |writableField|. // The test checks validity for config() with each value, and make sure values are config-ed // The test checks validity for config() with each value, and make sure values are config-ed // by query() them out. |invalidValues| contains some values which are not in |validValues|. // by query() them out. |invalidValues| contains some values which are not in |validValues|. // The test expects C2_BAD_VALUE while config() with these values, // The test expects C2_BAD_VALUE while config() with these values, Loading Loading @@ -112,11 +112,11 @@ private: // check if a component has a parameter whose type is |T|. // check if a component has a parameter whose type is |T|. // If a component has, the value should be copied into an argument, that is // If a component has, the value should be copied into an argument, that is // |p| in queryOnStack() and |heapParams| in queryOnHeap(). // |p| in queryOnStack() and |heapParams| in queryOnHeap(). // The return value is C2Status (e.g. C2_OK). // The return value is c2_status_t (e.g. C2_OK). template <typename T> C2Status queryOnStack(T *const p); template <typename T> c2_status_t queryOnStack(T *const p); template <typename T> template <typename T> C2Status queryOnHeap(const T &p, c2_status_t queryOnHeap(const T &p, std::vector<std::unique_ptr<C2Param>> *const heapParams); std::vector<std::unique_ptr<C2Param>> *const heapParams); // Get a value whose type is |T| in a component. The value is copied to |param|. // Get a value whose type is |T| in a component. The value is copied to |param|. Loading @@ -139,7 +139,7 @@ private: // Execute an interface's config_nb(). |T| is a single parameter type, not std::vector. // Execute an interface's config_nb(). |T| is a single parameter type, not std::vector. // config() creates std::vector<C2Param *const> {p} and passes it to config_nb(). // config() creates std::vector<C2Param *const> {p} and passes it to config_nb(). template <typename T> template <typename T> C2Status c2_status_t config(T *const p, config(T *const p, std::vector<std::unique_ptr<C2SettingResult>> *const failures); std::vector<std::unique_ptr<C2SettingResult>> *const failures); Loading @@ -150,7 +150,7 @@ private: // Test if config works correctly for writable parameters. // Test if config works correctly for writable parameters. // This changes the parameter's value to |newParam|. // This changes the parameter's value to |newParam|. // |stConfig| is a return value of config(). // |stConfig| is a return value of config(). template <typename T> void configWritableParamValidValue(const T &newParam, C2Status *stConfig); template <typename T> void configWritableParamValidValue(const T &newParam, c2_status_t *stConfig); // Test if config works correctly in the case an invalid value |newParam| is tried to write // Test if config works correctly in the case an invalid value |newParam| is tried to write // to an writable parameter. // to an writable parameter. Loading Loading @@ -194,13 +194,13 @@ template <> std::unique_ptr<C2PortMimeConfig::input> makeParam() { } \ } \ } while (false) } while (false) template <typename T> C2Status C2CompIntfTest::queryOnStack(T *const p) { template <typename T> c2_status_t C2CompIntfTest::queryOnStack(T *const p) { std::vector<C2Param *const> stackParams{p}; std::vector<C2Param *const> stackParams{p}; return mIntf->query_nb(stackParams, {}, nullptr); return mIntf->query_nb(stackParams, {}, nullptr); } } template <typename T> template <typename T> C2Status C2CompIntfTest::queryOnHeap( c2_status_t C2CompIntfTest::queryOnHeap( const T &p, std::vector<std::unique_ptr<C2Param>> *const heapParams) { const T &p, std::vector<std::unique_ptr<C2Param>> *const heapParams) { uint32_t index = p.type(); uint32_t index = p.type(); if (p.forStream()) { if (p.forStream()) { Loading Loading @@ -258,7 +258,7 @@ template <typename T> void C2CompIntfTest::queryUnsupportedParam() { } } template <typename T> template <typename T> C2Status C2CompIntfTest::config( c2_status_t C2CompIntfTest::config( T *const p, std::vector<std::unique_ptr<C2SettingResult>> *const failures) { T *const p, std::vector<std::unique_ptr<C2SettingResult>> *const failures) { std::vector<C2Param *const> params{p}; std::vector<C2Param *const> params{p}; return mIntf->config_nb(params, failures); return mIntf->config_nb(params, failures); Loading Loading @@ -286,7 +286,7 @@ void C2CompIntfTest::configReadOnlyParam(const T &newParam) { } } template <typename T> template <typename T> void C2CompIntfTest::configWritableParamValidValue(const T &newParam, C2Status *configResult) { void C2CompIntfTest::configWritableParamValidValue(const T &newParam, c2_status_t *configResult) { std::unique_ptr<T> p = makeParamFrom(newParam); std::unique_ptr<T> p = makeParamFrom(newParam); std::vector<C2Param *const> params{p.get()}; std::vector<C2Param *const> params{p.get()}; Loading @@ -297,7 +297,7 @@ void C2CompIntfTest::configWritableParamValidValue(const T &newParam, C2Status * // because there may be dependent limitations between fields or between parameters. // because there may be dependent limitations between fields or between parameters. // TODO(hiroh): I have to fill the return value. Comments in C2Component.h doesn't mention // TODO(hiroh): I have to fill the return value. Comments in C2Component.h doesn't mention // about the return value when conflict happens. I set C2_BAD_VALUE to it temporarily now. // about the return value when conflict happens. I set C2_BAD_VALUE to it temporarily now. C2Status stConfig = mIntf->config_nb(params, &failures); c2_status_t stConfig = mIntf->config_nb(params, &failures); if (stConfig == C2_OK) { if (stConfig == C2_OK) { EXPECT_EQ(0u, failures.size()); EXPECT_EQ(0u, failures.size()); } else { } else { Loading Loading @@ -481,7 +481,7 @@ void C2CompIntfTest::testWritableParam( TParam *const param, TRealField *const writableField, TParam *const param, TRealField *const writableField, const std::vector<TField> &validValues, const std::vector<TField> &validValues, const std::vector<TField> &invalidValues) { const std::vector<TField> &invalidValues) { C2Status stConfig; c2_status_t stConfig; // Get the parameter's value in the beginning in order to reset the value at the end. // Get the parameter's value in the beginning in order to reset the value at the end. TRACED_FAILURE(getValue(param)); TRACED_FAILURE(getValue(param)); Loading Loading @@ -555,7 +555,7 @@ void C2CompIntfTest::checkParamPermission( std::vector<std::unique_ptr<C2SettingResult>> failures; std::vector<std::unique_ptr<C2SettingResult>> failures; // Config does not change the parameter, because param is the present param. // Config does not change the parameter, because param is the present param. // This config is executed to find out if a parameter is read-only or writable. // This config is executed to find out if a parameter is read-only or writable. C2Status stStack = config(param.get(), &failures); c2_status_t stStack = config(param.get(), &failures); if (stStack == C2_BAD_VALUE) { if (stStack == C2_BAD_VALUE) { // Read-only // Read-only std::unique_ptr<T> newParam = makeParam<T>(); std::unique_ptr<T> newParam = makeParam<T>(); Loading Loading @@ -594,7 +594,7 @@ void C2CompIntfTest::outputResults(const std::string &name) { C2ParamField(param.get(), &field_type_name_::field_name_)) \ C2ParamField(param.get(), &field_type_name_::field_name_)) \ }; \ }; \ ASSERT_EQ(C2_OK, \ ASSERT_EQ(C2_OK, \ mIntf->getSupportedValues(validValueInfos)); \ mIntf->querySupportedValues_nb(validValueInfos)); \ ASSERT_EQ(1u, validValueInfos.size()); \ ASSERT_EQ(1u, validValueInfos.size()); \ std::vector<decltype(param->field_name_)> validValues; \ std::vector<decltype(param->field_name_)> validValues; \ std::vector<decltype(param->field_name_)> invalidValues; \ std::vector<decltype(param->field_name_)> invalidValues; \ Loading Loading @@ -640,7 +640,7 @@ void C2CompIntfTest::testMain(std::shared_ptr<C2ComponentInterface> intf, setComponent(intf); setComponent(intf); std::vector<std::shared_ptr<C2ParamDescriptor>> supportedParams; std::vector<std::shared_ptr<C2ParamDescriptor>> supportedParams; ASSERT_EQ(C2_OK, mIntf->getSupportedParams(&supportedParams)); ASSERT_EQ(C2_OK, mIntf->querySupportedParams_nb(&supportedParams)); EACH_TEST_SELF(C2ComponentLatencyInfo, TEST_U32_WRITABLE_FIELD); EACH_TEST_SELF(C2ComponentLatencyInfo, TEST_U32_WRITABLE_FIELD); EACH_TEST_SELF(C2ComponentTemporalInfo, TEST_U32_WRITABLE_FIELD); EACH_TEST_SELF(C2ComponentTemporalInfo, TEST_U32_WRITABLE_FIELD); Loading