Loading media/libstagefright/codec2/include/C2.h +3 −3 Original line number Diff line number Diff line Loading @@ -101,10 +101,10 @@ typedef std::string C2String; typedef const char *C2StringLiteral; /** * C2Error: status codes used. * C2Status: status codes used. */ typedef int32_t C2Error; enum { //typedef int32_t C2Status; enum C2Status : int32_t { #ifndef __ANDROID__ OK = 0, BAD_VALUE = -EINVAL, Loading media/libstagefright/codec2/include/C2Buffer.h +36 −36 Original line number Diff line number Diff line Loading @@ -91,7 +91,7 @@ public: * \retval C2_NO_PERMISSION no permission to wait for the fence (unexpected - system) * \retval C2_CORRUPTED some unknown error prevented waiting for the fence (unexpected) */ C2Error wait(nsecs_t timeoutNs); C2Status wait(nsecs_t timeoutNs); /** * 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_NO_PERMISSION no permission to signal the fence (unexpected - system) * \retval C2_CORRUPTED some unknown error prevented signaling the fence(s) (unexpected) */ C2Error fire(); C2Status fire(); /** * Trigger this event from the merging of the supplied fences. This means that it will be Loading @@ -172,7 +172,7 @@ public: * \retval C2_NO_PERMISSION no permission to merge the fence (unexpected - system) * \retval C2_CORRUPTED some unknown error prevented merging the fence(s) (unexpected) */ C2Error merge(std::vector<C2Fence> fences); C2Status merge(std::vector<C2Fence> fences); /** * Abandons the event and any associated fence(s). Loading @@ -186,7 +186,7 @@ public: * \retval C2_NO_PERMISSION no permission to abandon the fence (unexpected - system) * \retval C2_CORRUPTED some unknown error prevented signaling the fence(s) (unexpected) */ C2Error abandon(); C2Status abandon(); private: class Impl; Loading @@ -197,15 +197,15 @@ private: /// @{ /** * Interface for objects that encapsulate an updatable error value. * Interface for objects that encapsulate an updatable status value. */ struct _C2InnateError { inline C2Error error() const { return mError; } struct _C2InnateStatus { inline C2Status status() const { return mStatus; } protected: _C2InnateError(C2Error error) : mError(error) { } _C2InnateStatus(C2Status status) : mStatus(status) { } C2Error mError; // this error is updatable by the object C2Status mStatus; // this status is updatable by the object }; /// @} Loading @@ -230,10 +230,10 @@ public: } protected: C2Acquirable(C2Error error, C2Fence fence, T t) : C2Fence(fence), mInitialError(error), mT(t) { } C2Acquirable(C2Status error, C2Fence fence, T t) : C2Fence(fence), mInitialError(error), mT(t) { } private: C2Error mInitialError; C2Status mInitialError; T mT; // TODO: move instead of copy }; Loading Loading @@ -449,11 +449,11 @@ public: /** * \return error during the creation/mapping of this view. */ C2Error error(); C2Status error() const; protected: C2ReadView(const _C2LinearCapacityAspect *parent, const uint8_t *data); explicit C2ReadView(C2Error error); explicit C2ReadView(C2Status error); private: class Impl; Loading Loading @@ -482,11 +482,11 @@ public: /** * \return error during the creation/mapping of this view. */ C2Error error(); C2Status error() const; protected: C2WriteView(const _C2LinearRangeAspect *parent, uint8_t *base); explicit C2WriteView(C2Error error); explicit C2WriteView(C2Status error); private: class Impl; Loading Loading @@ -631,7 +631,7 @@ public: * \retval C2_TIMED_OUT the reservation timed out \todo when? * \retval C2_CORRUPTED some unknown error prevented reserving space. (unexpected) */ C2Error reserve(size_t size, C2Fence *fence /* nullable */); C2Status reserve(size_t size, C2Fence *fence /* nullable */); /** * 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_CORRUPTED some unknown error prevented abandoning the data (unexpected) */ C2Error abandon(size_t size); C2Status abandon(size_t size); /** * 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_CORRUPTED some unknown error prevented sharing the data (unexpected) */ C2Error share(size_t size, C2Fence fence, std::list<C2ConstLinearBlock> &blocks); C2Status share(size_t size, C2Fence fence, std::list<C2ConstLinearBlock> &blocks); /** * 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. */ C2Error error(); C2Status error() const; }; /** Loading @@ -716,7 +716,7 @@ public: * \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) */ C2Error commit(size_t size, C2Fence fence); C2Status commit(size_t size, C2Fence fence); /** * 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. */ C2Error error() const; C2Status error() const; protected: C2GraphicView( const _C2PlanarCapacityAspect *parent, uint8_t *const *data, const C2PlaneLayout& layout); explicit C2GraphicView(C2Error error); explicit C2GraphicView(C2Status error); private: class Impl; Loading Loading @@ -1224,7 +1224,7 @@ public: * \retval C2_NO_MEMORY not enough memory to register for this callback * \retval C2_CORRUPTED an unknown error prevented the registration (unexpected) */ C2Error registerOnDestroyNotify(OnDestroyNotify onDestroyNotify, void *arg = nullptr); C2Status registerOnDestroyNotify(OnDestroyNotify onDestroyNotify, void *arg = nullptr); /** * Unregisters a previously registered pre-destroy notification. Loading @@ -1236,7 +1236,7 @@ public: * \retval C2_NOT_FOUND the notification was not found * \retval C2_CORRUPTED an unknown error prevented the registration (unexpected) */ C2Error unregisterOnDestroyNotify(OnDestroyNotify onDestroyNotify, void *arg = nullptr); C2Status 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 * used if the same kind of metadata is already attached to the buffer). */ C2Error setInfo(const std::shared_ptr<C2Info> &info); C2Status setInfo(const std::shared_ptr<C2Info> &info); /** * 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) * \retval C2_CORRUPTED some unknown error prevented the operation from completing (unexpected) */ virtual C2Error map( virtual C2Status map( size_t offset, size_t size, C2MemoryUsage usage, int *fenceFd /* nullable */, void **addr /* nonnull */) = 0; Loading @@ -1409,7 +1409,7 @@ public: * \retval C2_CORRUPTED some unknown error prevented the operation from completing (unexpected) * \retval C2_NO_PERMISSION no permission to unmap the portion (unexpected - system) */ virtual C2Error unmap(void *addr, size_t size, int *fenceFd /* nullable */) = 0; virtual C2Status unmap(void *addr, size_t size, int *fenceFd /* nullable */) = 0; /** * 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) */ virtual C2Error map( virtual C2Status map( C2Rect rect, C2MemoryUsage usage, int *fenceFd, // TODO: return <addr, size> buffers with plane sizes 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_NO_PERMISSION no permission to unmap the section (unexpected - system) */ virtual C2Error unmap(C2Fence *fenceFd /* nullable */) = 0; virtual C2Status unmap(C2Fence *fenceFd /* nullable */) = 0; /** * Returns true if this is a valid allocation. Loading Loading @@ -1550,7 +1550,7 @@ public: * \retval C2_UNSUPPORTED this allocator does not support 1D allocations * \retval C2_CORRUPTED some unknown, unrecoverable error occured during allocation (unexpected) */ virtual C2Error allocateLinearBuffer( virtual C2Status allocateLinearBuffer( uint32_t capacity __unused, C2MemoryUsage usage __unused, std::shared_ptr<C2LinearAllocation> *allocation /* nonnull */) { *allocation = nullptr; Loading @@ -1573,7 +1573,7 @@ public: * \retval C2_UNSUPPORTED this allocator does not support 1D allocations * \retval C2_CORRUPTED some unknown, unrecoverable error occured during allocation (unexpected) */ virtual C2Error recreateLinearBuffer( virtual C2Status recreateLinearBuffer( const C2Handle *handle __unused, std::shared_ptr<C2LinearAllocation> *allocation /* nonnull */) { *allocation = nullptr; Loading Loading @@ -1606,7 +1606,7 @@ public: * \retval C2_UNSUPPORTED this allocator does not support 2D allocations * \retval C2_CORRUPTED some unknown, unrecoverable error occured during allocation (unexpected) */ virtual C2Error allocateGraphicBuffer( virtual C2Status allocateGraphicBuffer( uint32_t width __unused, uint32_t height __unused, uint32_t format __unused, C2MemoryUsage usage __unused, std::shared_ptr<C2GraphicAllocation> *allocation /* nonnull */) { Loading @@ -1630,7 +1630,7 @@ public: * \retval C2_UNSUPPORTED this allocator does not support 2D allocations * \retval C2_CORRUPTED some unknown, unrecoverable error occured during recreation (unexpected) */ virtual C2Error recreateGraphicBuffer( virtual C2Status recreateGraphicBuffer( const C2Handle *handle __unused, std::shared_ptr<C2GraphicAllocation> *allocation /* nonnull */) { *allocation = nullptr; Loading Loading @@ -1674,7 +1674,7 @@ public: * \retval C2_UNSUPPORTED this allocator does not support linear allocations * \retval C2_CORRUPTED some unknown, unrecoverable error occured during allocation (unexpected) */ virtual C2Error allocateLinearBlock( virtual C2Status allocateLinearBlock( uint32_t capacity __unused, C2MemoryUsage usage __unused, std::shared_ptr<C2LinearBlock> *block /* nonnull */) { *block = nullptr; Loading Loading @@ -1703,7 +1703,7 @@ public: * \retval C2_UNSUPPORTED this allocator does not support circular allocations * \retval C2_CORRUPTED some unknown, unrecoverable error occured during allocation (unexpected) */ virtual C2Error allocateCircularBlock( virtual C2Status allocateCircularBlock( uint32_t capacity __unused, C2MemoryUsage usage __unused, std::shared_ptr<C2CircularBlock> *block /* nonnull */) { *block = nullptr; Loading Loading @@ -1736,7 +1736,7 @@ public: * \retval C2_UNSUPPORTED this allocator does not support 2D allocations * \retval C2_CORRUPTED some unknown, unrecoverable error occured during allocation (unexpected) */ virtual C2Error allocateGraphicBlock( virtual C2Status allocateGraphicBlock( uint32_t width __unused, uint32_t height __unused, uint32_t format __unused, C2MemoryUsage usage __unused, std::shared_ptr<C2GraphicBlock> *block /* nonnull */) { Loading media/libstagefright/codec2/include/C2Component.h +23 −23 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ struct C2FieldSupportedValuesQuery { const C2ParamField field; const Type type; status_t status; C2Status status; C2FieldSupportedValues values; C2FieldSupportedValuesQuery(const C2ParamField &field_, Type type_) Loading Loading @@ -154,7 +154,7 @@ public: * \retval C2_CORRUPTED some unknown error prevented the querying of the parameters * (unexpected) */ virtual status_t query_nb( virtual C2Status query_nb( const std::vector<C2Param* const> &stackParams, const std::vector<C2Param::Index> &heapParamIndices, std::vector<std::unique_ptr<C2Param>>* const heapParams) const = 0; Loading Loading @@ -191,7 +191,7 @@ public: * \retval C2_CORRUPTED some unknown error prevented the update of the parameters * (unexpected) */ virtual status_t config_nb( virtual C2Status config_nb( const std::vector<C2Param* const> ¶ms, std::vector<std::unique_ptr<C2SettingResult>>* const failures) = 0; Loading Loading @@ -230,7 +230,7 @@ public: * \retval C2_CORRUPTED some unknown error prevented the update of the parameters * (unexpected) */ virtual status_t commit_sm( virtual C2Status commit_sm( const std::vector<C2Param* const> ¶ms, std::vector<std::unique_ptr<C2SettingResult>>* const failures) = 0; Loading @@ -255,7 +255,7 @@ public: * \retval C2_TIMED_OUT could not create the tunnel within the time limit (unexpected) * \retval C2_CORRUPTED some unknown error prevented the creation of the tunnel (unexpected) */ virtual status_t createTunnel_sm(node_id targetComponent) = 0; virtual C2Status createTunnel_sm(node_id targetComponent) = 0; /** * Releases a tunnel from this component to the target component. Loading @@ -275,7 +275,7 @@ public: * \retval C2_TIMED_OUT could not mark the tunnel for release within the time limit (unexpected) * \retval C2_CORRUPTED some unknown error prevented the release of the tunnel (unexpected) */ virtual status_t releaseTunnel_sm(node_id targetComponent) = 0; virtual C2Status releaseTunnel_sm(node_id targetComponent) = 0; // REFLECTION MECHANISM (USED FOR EXTENSION) Loading @@ -298,7 +298,7 @@ public: * \retval C2_OK the operation completed successfully. * \retval C2_NO_MEMORY not enough memory to complete this method. */ virtual status_t getSupportedParams( virtual C2Status getSupportedParams( std::vector<std::shared_ptr<C2ParamDescriptor>> * const params) const = 0; /** Loading @@ -306,7 +306,7 @@ public: * \todo should this take a list considering that setting some fields may further limit other * fields in the same list? */ virtual status_t getSupportedValues( virtual C2Status getSupportedValues( std::vector<C2FieldSupportedValuesQuery> &fields) const = 0; virtual ~C2ComponentInterface() = default; Loading Loading @@ -334,7 +334,7 @@ public: * \retval C2_NO_MEMORY not enough memory to queue the work * \retval C2_CORRUPTED some unknown error prevented queuing the work (unexpected) */ virtual status_t queue_nb(std::list<std::unique_ptr<C2Work>>* const items) = 0; virtual C2Status queue_nb(std::list<std::unique_ptr<C2Work>>* const items) = 0; /** * Announces a work to be queued later for the component. This reserves a slot for the queue Loading @@ -353,7 +353,7 @@ public: * * \todo Can this be rolled into queue_nb? */ virtual status_t announce_nb(const std::vector<C2WorkOutline> &items) = 0; virtual C2Status announce_nb(const std::vector<C2WorkOutline> &items) = 0; /** * Discards and abandons any pending work for the component, and optionally any component Loading Loading @@ -385,7 +385,7 @@ public: * \retval C2_TIMED_OUT the flush could not be completed within the time limit (unexpected) * \retval C2_CORRUPTED some unknown error prevented flushing from completion (unexpected) */ virtual status_t flush_sm(bool flushThrough, std::list<std::unique_ptr<C2Work>>* const flushedWork) = 0; virtual C2Status flush_sm(bool flushThrough, std::list<std::unique_ptr<C2Work>>* const flushedWork) = 0; /** * Drains the component, and optionally downstream components Loading Loading @@ -414,7 +414,7 @@ public: * \retval C2_TIMED_OUT the flush could not be completed within the time limit (unexpected) * \retval C2_CORRUPTED some unknown error prevented flushing from completion (unexpected) */ virtual status_t drain_nb(bool drainThrough) = 0; virtual C2Status drain_nb(bool drainThrough) = 0; // STATE CHANGE METHODS // ============================================================================================= Loading @@ -435,7 +435,7 @@ public: * \retval C2_TIMED_OUT the component could not be started within the time limit (unexpected) * \retval C2_CORRUPTED some unknown error prevented starting the component (unexpected) */ virtual status_t start() = 0; virtual C2Status start() = 0; /** * Stops the component. Loading @@ -452,7 +452,7 @@ public: * This does not alter any settings and tunings that may have resulted in a tripped state. * (Is this material given the definition? Perhaps in case we want to start again.) */ virtual status_t stop() = 0; virtual C2Status stop() = 0; /** * Resets the component. Loading Loading @@ -526,9 +526,9 @@ public: * \retval C2_TIMED_OUT could not reset the parser within the time limit (unexpected) * \retval C2_CORRUPTED some unknown error prevented the resetting of the parser (unexpected) */ virtual status_t reset() { return C2_OK; } virtual C2Status reset() { return C2_OK; } virtual status_t parseFrame(C2BufferPack &frame); virtual C2Status parseFrame(C2BufferPack &frame); virtual ~C2FrameInfoParser() = default; }; Loading Loading @@ -566,7 +566,7 @@ public: * \retval C2_NOT_FOUND no such allocator * \retval C2_NO_MEMORY not enough memory to create the allocator */ virtual status_t createAllocator(ID id, std::shared_ptr<C2Allocator>* const allocator) = 0; virtual C2Status createAllocator(ID id, std::shared_ptr<C2Allocator>* const allocator) = 0; virtual ~C2AllocatorStore() = default; }; Loading @@ -589,7 +589,7 @@ public: * \retval C2_NOT_FOUND no such component * \retval C2_NO_MEMORY not enough memory to create the component */ virtual status_t createComponent(C2String name, std::shared_ptr<C2Component>* const component); virtual C2Status createComponent(C2String name, std::shared_ptr<C2Component>* const component); /** * Creates a component interface. Loading @@ -610,7 +610,7 @@ public: * * \todo Do we need an interface, or could this just be a component that is never started? */ virtual status_t createInterface(C2String name, std::shared_ptr<C2ComponentInterface>* const interface); virtual C2Status createInterface(C2String name, std::shared_ptr<C2ComponentInterface>* const interface); /** * Returns the list of components supported by this component store. Loading @@ -624,9 +624,9 @@ public: // -------------------------------------- UTILITY METHODS -------------------------------------- // on-demand buffer layout conversion (swizzling) virtual status_t copyBuffer(std::shared_ptr<C2GraphicBuffer> src, std::shared_ptr<C2GraphicBuffer> dst); virtual C2Status copyBuffer(std::shared_ptr<C2GraphicBuffer> src, std::shared_ptr<C2GraphicBuffer> dst); // status_t selectPreferredColor(formats<A>, formats<B>); // C2Status selectPreferredColor(formats<A>, formats<B>); // GLOBAL SETTINGS // system-wide stride & slice-height (???) Loading Loading @@ -660,7 +660,7 @@ public: * \retval C2_CORRUPTED some unknown error prevented the querying of the parameters * (unexpected) */ virtual status_t query_sm( virtual C2Status query_sm( const std::vector<C2Param* const> &stackParams, const std::vector<C2Param::Index> &heapParamIndices, std::vector<std::unique_ptr<C2Param>>* const heapParams) const = 0; Loading Loading @@ -699,7 +699,7 @@ public: * \retval C2_CORRUPTED some unknown error prevented the update of the parameters * (unexpected) */ virtual status_t config_nb( virtual C2Status config_nb( const std::vector<C2Param* const> ¶ms, std::list<std::unique_ptr<C2SettingResult>>* const failures) = 0; Loading media/libstagefright/codec2/include/C2Work.h +1 −3 Original line number Diff line number Diff line Loading @@ -28,8 +28,6 @@ #include <list> #include <vector> typedef int status_t; namespace android { /// \defgroup work Work and data processing Loading Loading @@ -167,7 +165,7 @@ struct C2Work { std::list<std::unique_ptr<C2Worklet>> worklets; uint32_t worklets_processed; status_t result; C2Status result; }; struct C2WorkOutline { Loading media/libstagefright/codec2/tests/C2ComponentInterface_test.cpp +12 −12 Original line number Diff line number Diff line Loading @@ -112,11 +112,11 @@ private: // 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 // |p| in queryOnStack() and |heapParams| in queryOnHeap(). // The return value is status_t (e.g. C2_OK). template <typename T> status_t queryOnStack(T *const p); // The return value is C2Status (e.g. C2_OK). template <typename T> C2Status queryOnStack(T *const p); template <typename T> status_t queryOnHeap(const T &p, C2Status queryOnHeap(const T &p, std::vector<std::unique_ptr<C2Param>> *const heapParams); // 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. // config() creates std::vector<C2Param *const> {p} and passes it to config_nb(). template <typename T> status_t C2Status config(T *const p, std::vector<std::unique_ptr<C2SettingResult>> *const failures); Loading @@ -150,7 +150,7 @@ private: // Test if config works correctly for writable parameters. // This changes the parameter's value to |newParam|. // |stConfig| is a return value of config(). template <typename T> void configWritableParamValidValue(const T &newParam, status_t *stConfig); template <typename T> void configWritableParamValidValue(const T &newParam, C2Status *stConfig); // Test if config works correctly in the case an invalid value |newParam| is tried to write // to an writable parameter. Loading Loading @@ -194,13 +194,13 @@ template <> std::unique_ptr<C2PortMimeConfig::input> makeParam() { } \ } while (false) template <typename T> status_t C2CompIntfTest::queryOnStack(T *const p) { template <typename T> C2Status C2CompIntfTest::queryOnStack(T *const p) { std::vector<C2Param *const> stackParams{p}; return mIntf->query_nb(stackParams, {}, nullptr); } template <typename T> status_t C2CompIntfTest::queryOnHeap( C2Status C2CompIntfTest::queryOnHeap( const T &p, std::vector<std::unique_ptr<C2Param>> *const heapParams) { uint32_t index = p.type(); if (p.forStream()) { Loading Loading @@ -258,7 +258,7 @@ template <typename T> void C2CompIntfTest::queryUnsupportedParam() { } template <typename T> status_t C2CompIntfTest::config( C2Status C2CompIntfTest::config( T *const p, std::vector<std::unique_ptr<C2SettingResult>> *const failures) { std::vector<C2Param *const> params{p}; return mIntf->config_nb(params, failures); Loading Loading @@ -286,7 +286,7 @@ void C2CompIntfTest::configReadOnlyParam(const T &newParam) { } template <typename T> void C2CompIntfTest::configWritableParamValidValue(const T &newParam, status_t *configResult) { void C2CompIntfTest::configWritableParamValidValue(const T &newParam, C2Status *configResult) { std::unique_ptr<T> p = makeParamFrom(newParam); std::vector<C2Param *const> params{p.get()}; Loading @@ -297,7 +297,7 @@ void C2CompIntfTest::configWritableParamValidValue(const T &newParam, status_t * // 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 // about the return value when conflict happens. I set C2_BAD_VALUE to it temporarily now. status_t stConfig = mIntf->config_nb(params, &failures); C2Status stConfig = mIntf->config_nb(params, &failures); if (stConfig == C2_OK) { EXPECT_EQ(0u, failures.size()); } else { Loading Loading @@ -481,7 +481,7 @@ void C2CompIntfTest::testWritableParam( TParam *const param, TRealField *const writableField, const std::vector<TField> &validValues, const std::vector<TField> &invalidValues) { status_t stConfig; C2Status stConfig; // Get the parameter's value in the beginning in order to reset the value at the end. TRACED_FAILURE(getValue(param)); Loading Loading @@ -555,7 +555,7 @@ void C2CompIntfTest::checkParamPermission( std::vector<std::unique_ptr<C2SettingResult>> failures; // 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. status_t stStack = config(param.get(), &failures); C2Status stStack = config(param.get(), &failures); if (stStack == C2_BAD_VALUE) { // Read-only std::unique_ptr<T> newParam = makeParam<T>(); Loading Loading
media/libstagefright/codec2/include/C2.h +3 −3 Original line number Diff line number Diff line Loading @@ -101,10 +101,10 @@ typedef std::string C2String; typedef const char *C2StringLiteral; /** * C2Error: status codes used. * C2Status: status codes used. */ typedef int32_t C2Error; enum { //typedef int32_t C2Status; enum C2Status : int32_t { #ifndef __ANDROID__ OK = 0, BAD_VALUE = -EINVAL, Loading
media/libstagefright/codec2/include/C2Buffer.h +36 −36 Original line number Diff line number Diff line Loading @@ -91,7 +91,7 @@ public: * \retval C2_NO_PERMISSION no permission to wait for the fence (unexpected - system) * \retval C2_CORRUPTED some unknown error prevented waiting for the fence (unexpected) */ C2Error wait(nsecs_t timeoutNs); C2Status wait(nsecs_t timeoutNs); /** * 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_NO_PERMISSION no permission to signal the fence (unexpected - system) * \retval C2_CORRUPTED some unknown error prevented signaling the fence(s) (unexpected) */ C2Error fire(); C2Status fire(); /** * Trigger this event from the merging of the supplied fences. This means that it will be Loading @@ -172,7 +172,7 @@ public: * \retval C2_NO_PERMISSION no permission to merge the fence (unexpected - system) * \retval C2_CORRUPTED some unknown error prevented merging the fence(s) (unexpected) */ C2Error merge(std::vector<C2Fence> fences); C2Status merge(std::vector<C2Fence> fences); /** * Abandons the event and any associated fence(s). Loading @@ -186,7 +186,7 @@ public: * \retval C2_NO_PERMISSION no permission to abandon the fence (unexpected - system) * \retval C2_CORRUPTED some unknown error prevented signaling the fence(s) (unexpected) */ C2Error abandon(); C2Status abandon(); private: class Impl; Loading @@ -197,15 +197,15 @@ private: /// @{ /** * Interface for objects that encapsulate an updatable error value. * Interface for objects that encapsulate an updatable status value. */ struct _C2InnateError { inline C2Error error() const { return mError; } struct _C2InnateStatus { inline C2Status status() const { return mStatus; } protected: _C2InnateError(C2Error error) : mError(error) { } _C2InnateStatus(C2Status status) : mStatus(status) { } C2Error mError; // this error is updatable by the object C2Status mStatus; // this status is updatable by the object }; /// @} Loading @@ -230,10 +230,10 @@ public: } protected: C2Acquirable(C2Error error, C2Fence fence, T t) : C2Fence(fence), mInitialError(error), mT(t) { } C2Acquirable(C2Status error, C2Fence fence, T t) : C2Fence(fence), mInitialError(error), mT(t) { } private: C2Error mInitialError; C2Status mInitialError; T mT; // TODO: move instead of copy }; Loading Loading @@ -449,11 +449,11 @@ public: /** * \return error during the creation/mapping of this view. */ C2Error error(); C2Status error() const; protected: C2ReadView(const _C2LinearCapacityAspect *parent, const uint8_t *data); explicit C2ReadView(C2Error error); explicit C2ReadView(C2Status error); private: class Impl; Loading Loading @@ -482,11 +482,11 @@ public: /** * \return error during the creation/mapping of this view. */ C2Error error(); C2Status error() const; protected: C2WriteView(const _C2LinearRangeAspect *parent, uint8_t *base); explicit C2WriteView(C2Error error); explicit C2WriteView(C2Status error); private: class Impl; Loading Loading @@ -631,7 +631,7 @@ public: * \retval C2_TIMED_OUT the reservation timed out \todo when? * \retval C2_CORRUPTED some unknown error prevented reserving space. (unexpected) */ C2Error reserve(size_t size, C2Fence *fence /* nullable */); C2Status reserve(size_t size, C2Fence *fence /* nullable */); /** * 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_CORRUPTED some unknown error prevented abandoning the data (unexpected) */ C2Error abandon(size_t size); C2Status abandon(size_t size); /** * 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_CORRUPTED some unknown error prevented sharing the data (unexpected) */ C2Error share(size_t size, C2Fence fence, std::list<C2ConstLinearBlock> &blocks); C2Status share(size_t size, C2Fence fence, std::list<C2ConstLinearBlock> &blocks); /** * 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. */ C2Error error(); C2Status error() const; }; /** Loading @@ -716,7 +716,7 @@ public: * \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) */ C2Error commit(size_t size, C2Fence fence); C2Status commit(size_t size, C2Fence fence); /** * 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. */ C2Error error() const; C2Status error() const; protected: C2GraphicView( const _C2PlanarCapacityAspect *parent, uint8_t *const *data, const C2PlaneLayout& layout); explicit C2GraphicView(C2Error error); explicit C2GraphicView(C2Status error); private: class Impl; Loading Loading @@ -1224,7 +1224,7 @@ public: * \retval C2_NO_MEMORY not enough memory to register for this callback * \retval C2_CORRUPTED an unknown error prevented the registration (unexpected) */ C2Error registerOnDestroyNotify(OnDestroyNotify onDestroyNotify, void *arg = nullptr); C2Status registerOnDestroyNotify(OnDestroyNotify onDestroyNotify, void *arg = nullptr); /** * Unregisters a previously registered pre-destroy notification. Loading @@ -1236,7 +1236,7 @@ public: * \retval C2_NOT_FOUND the notification was not found * \retval C2_CORRUPTED an unknown error prevented the registration (unexpected) */ C2Error unregisterOnDestroyNotify(OnDestroyNotify onDestroyNotify, void *arg = nullptr); C2Status 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 * used if the same kind of metadata is already attached to the buffer). */ C2Error setInfo(const std::shared_ptr<C2Info> &info); C2Status setInfo(const std::shared_ptr<C2Info> &info); /** * 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) * \retval C2_CORRUPTED some unknown error prevented the operation from completing (unexpected) */ virtual C2Error map( virtual C2Status map( size_t offset, size_t size, C2MemoryUsage usage, int *fenceFd /* nullable */, void **addr /* nonnull */) = 0; Loading @@ -1409,7 +1409,7 @@ public: * \retval C2_CORRUPTED some unknown error prevented the operation from completing (unexpected) * \retval C2_NO_PERMISSION no permission to unmap the portion (unexpected - system) */ virtual C2Error unmap(void *addr, size_t size, int *fenceFd /* nullable */) = 0; virtual C2Status unmap(void *addr, size_t size, int *fenceFd /* nullable */) = 0; /** * 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) */ virtual C2Error map( virtual C2Status map( C2Rect rect, C2MemoryUsage usage, int *fenceFd, // TODO: return <addr, size> buffers with plane sizes 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_NO_PERMISSION no permission to unmap the section (unexpected - system) */ virtual C2Error unmap(C2Fence *fenceFd /* nullable */) = 0; virtual C2Status unmap(C2Fence *fenceFd /* nullable */) = 0; /** * Returns true if this is a valid allocation. Loading Loading @@ -1550,7 +1550,7 @@ public: * \retval C2_UNSUPPORTED this allocator does not support 1D allocations * \retval C2_CORRUPTED some unknown, unrecoverable error occured during allocation (unexpected) */ virtual C2Error allocateLinearBuffer( virtual C2Status allocateLinearBuffer( uint32_t capacity __unused, C2MemoryUsage usage __unused, std::shared_ptr<C2LinearAllocation> *allocation /* nonnull */) { *allocation = nullptr; Loading @@ -1573,7 +1573,7 @@ public: * \retval C2_UNSUPPORTED this allocator does not support 1D allocations * \retval C2_CORRUPTED some unknown, unrecoverable error occured during allocation (unexpected) */ virtual C2Error recreateLinearBuffer( virtual C2Status recreateLinearBuffer( const C2Handle *handle __unused, std::shared_ptr<C2LinearAllocation> *allocation /* nonnull */) { *allocation = nullptr; Loading Loading @@ -1606,7 +1606,7 @@ public: * \retval C2_UNSUPPORTED this allocator does not support 2D allocations * \retval C2_CORRUPTED some unknown, unrecoverable error occured during allocation (unexpected) */ virtual C2Error allocateGraphicBuffer( virtual C2Status allocateGraphicBuffer( uint32_t width __unused, uint32_t height __unused, uint32_t format __unused, C2MemoryUsage usage __unused, std::shared_ptr<C2GraphicAllocation> *allocation /* nonnull */) { Loading @@ -1630,7 +1630,7 @@ public: * \retval C2_UNSUPPORTED this allocator does not support 2D allocations * \retval C2_CORRUPTED some unknown, unrecoverable error occured during recreation (unexpected) */ virtual C2Error recreateGraphicBuffer( virtual C2Status recreateGraphicBuffer( const C2Handle *handle __unused, std::shared_ptr<C2GraphicAllocation> *allocation /* nonnull */) { *allocation = nullptr; Loading Loading @@ -1674,7 +1674,7 @@ public: * \retval C2_UNSUPPORTED this allocator does not support linear allocations * \retval C2_CORRUPTED some unknown, unrecoverable error occured during allocation (unexpected) */ virtual C2Error allocateLinearBlock( virtual C2Status allocateLinearBlock( uint32_t capacity __unused, C2MemoryUsage usage __unused, std::shared_ptr<C2LinearBlock> *block /* nonnull */) { *block = nullptr; Loading Loading @@ -1703,7 +1703,7 @@ public: * \retval C2_UNSUPPORTED this allocator does not support circular allocations * \retval C2_CORRUPTED some unknown, unrecoverable error occured during allocation (unexpected) */ virtual C2Error allocateCircularBlock( virtual C2Status allocateCircularBlock( uint32_t capacity __unused, C2MemoryUsage usage __unused, std::shared_ptr<C2CircularBlock> *block /* nonnull */) { *block = nullptr; Loading Loading @@ -1736,7 +1736,7 @@ public: * \retval C2_UNSUPPORTED this allocator does not support 2D allocations * \retval C2_CORRUPTED some unknown, unrecoverable error occured during allocation (unexpected) */ virtual C2Error allocateGraphicBlock( virtual C2Status allocateGraphicBlock( uint32_t width __unused, uint32_t height __unused, uint32_t format __unused, C2MemoryUsage usage __unused, std::shared_ptr<C2GraphicBlock> *block /* nonnull */) { Loading
media/libstagefright/codec2/include/C2Component.h +23 −23 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ struct C2FieldSupportedValuesQuery { const C2ParamField field; const Type type; status_t status; C2Status status; C2FieldSupportedValues values; C2FieldSupportedValuesQuery(const C2ParamField &field_, Type type_) Loading Loading @@ -154,7 +154,7 @@ public: * \retval C2_CORRUPTED some unknown error prevented the querying of the parameters * (unexpected) */ virtual status_t query_nb( virtual C2Status query_nb( const std::vector<C2Param* const> &stackParams, const std::vector<C2Param::Index> &heapParamIndices, std::vector<std::unique_ptr<C2Param>>* const heapParams) const = 0; Loading Loading @@ -191,7 +191,7 @@ public: * \retval C2_CORRUPTED some unknown error prevented the update of the parameters * (unexpected) */ virtual status_t config_nb( virtual C2Status config_nb( const std::vector<C2Param* const> ¶ms, std::vector<std::unique_ptr<C2SettingResult>>* const failures) = 0; Loading Loading @@ -230,7 +230,7 @@ public: * \retval C2_CORRUPTED some unknown error prevented the update of the parameters * (unexpected) */ virtual status_t commit_sm( virtual C2Status commit_sm( const std::vector<C2Param* const> ¶ms, std::vector<std::unique_ptr<C2SettingResult>>* const failures) = 0; Loading @@ -255,7 +255,7 @@ public: * \retval C2_TIMED_OUT could not create the tunnel within the time limit (unexpected) * \retval C2_CORRUPTED some unknown error prevented the creation of the tunnel (unexpected) */ virtual status_t createTunnel_sm(node_id targetComponent) = 0; virtual C2Status createTunnel_sm(node_id targetComponent) = 0; /** * Releases a tunnel from this component to the target component. Loading @@ -275,7 +275,7 @@ public: * \retval C2_TIMED_OUT could not mark the tunnel for release within the time limit (unexpected) * \retval C2_CORRUPTED some unknown error prevented the release of the tunnel (unexpected) */ virtual status_t releaseTunnel_sm(node_id targetComponent) = 0; virtual C2Status releaseTunnel_sm(node_id targetComponent) = 0; // REFLECTION MECHANISM (USED FOR EXTENSION) Loading @@ -298,7 +298,7 @@ public: * \retval C2_OK the operation completed successfully. * \retval C2_NO_MEMORY not enough memory to complete this method. */ virtual status_t getSupportedParams( virtual C2Status getSupportedParams( std::vector<std::shared_ptr<C2ParamDescriptor>> * const params) const = 0; /** Loading @@ -306,7 +306,7 @@ public: * \todo should this take a list considering that setting some fields may further limit other * fields in the same list? */ virtual status_t getSupportedValues( virtual C2Status getSupportedValues( std::vector<C2FieldSupportedValuesQuery> &fields) const = 0; virtual ~C2ComponentInterface() = default; Loading Loading @@ -334,7 +334,7 @@ public: * \retval C2_NO_MEMORY not enough memory to queue the work * \retval C2_CORRUPTED some unknown error prevented queuing the work (unexpected) */ virtual status_t queue_nb(std::list<std::unique_ptr<C2Work>>* const items) = 0; virtual C2Status queue_nb(std::list<std::unique_ptr<C2Work>>* const items) = 0; /** * Announces a work to be queued later for the component. This reserves a slot for the queue Loading @@ -353,7 +353,7 @@ public: * * \todo Can this be rolled into queue_nb? */ virtual status_t announce_nb(const std::vector<C2WorkOutline> &items) = 0; virtual C2Status announce_nb(const std::vector<C2WorkOutline> &items) = 0; /** * Discards and abandons any pending work for the component, and optionally any component Loading Loading @@ -385,7 +385,7 @@ public: * \retval C2_TIMED_OUT the flush could not be completed within the time limit (unexpected) * \retval C2_CORRUPTED some unknown error prevented flushing from completion (unexpected) */ virtual status_t flush_sm(bool flushThrough, std::list<std::unique_ptr<C2Work>>* const flushedWork) = 0; virtual C2Status flush_sm(bool flushThrough, std::list<std::unique_ptr<C2Work>>* const flushedWork) = 0; /** * Drains the component, and optionally downstream components Loading Loading @@ -414,7 +414,7 @@ public: * \retval C2_TIMED_OUT the flush could not be completed within the time limit (unexpected) * \retval C2_CORRUPTED some unknown error prevented flushing from completion (unexpected) */ virtual status_t drain_nb(bool drainThrough) = 0; virtual C2Status drain_nb(bool drainThrough) = 0; // STATE CHANGE METHODS // ============================================================================================= Loading @@ -435,7 +435,7 @@ public: * \retval C2_TIMED_OUT the component could not be started within the time limit (unexpected) * \retval C2_CORRUPTED some unknown error prevented starting the component (unexpected) */ virtual status_t start() = 0; virtual C2Status start() = 0; /** * Stops the component. Loading @@ -452,7 +452,7 @@ public: * This does not alter any settings and tunings that may have resulted in a tripped state. * (Is this material given the definition? Perhaps in case we want to start again.) */ virtual status_t stop() = 0; virtual C2Status stop() = 0; /** * Resets the component. Loading Loading @@ -526,9 +526,9 @@ public: * \retval C2_TIMED_OUT could not reset the parser within the time limit (unexpected) * \retval C2_CORRUPTED some unknown error prevented the resetting of the parser (unexpected) */ virtual status_t reset() { return C2_OK; } virtual C2Status reset() { return C2_OK; } virtual status_t parseFrame(C2BufferPack &frame); virtual C2Status parseFrame(C2BufferPack &frame); virtual ~C2FrameInfoParser() = default; }; Loading Loading @@ -566,7 +566,7 @@ public: * \retval C2_NOT_FOUND no such allocator * \retval C2_NO_MEMORY not enough memory to create the allocator */ virtual status_t createAllocator(ID id, std::shared_ptr<C2Allocator>* const allocator) = 0; virtual C2Status createAllocator(ID id, std::shared_ptr<C2Allocator>* const allocator) = 0; virtual ~C2AllocatorStore() = default; }; Loading @@ -589,7 +589,7 @@ public: * \retval C2_NOT_FOUND no such component * \retval C2_NO_MEMORY not enough memory to create the component */ virtual status_t createComponent(C2String name, std::shared_ptr<C2Component>* const component); virtual C2Status createComponent(C2String name, std::shared_ptr<C2Component>* const component); /** * Creates a component interface. Loading @@ -610,7 +610,7 @@ public: * * \todo Do we need an interface, or could this just be a component that is never started? */ virtual status_t createInterface(C2String name, std::shared_ptr<C2ComponentInterface>* const interface); virtual C2Status createInterface(C2String name, std::shared_ptr<C2ComponentInterface>* const interface); /** * Returns the list of components supported by this component store. Loading @@ -624,9 +624,9 @@ public: // -------------------------------------- UTILITY METHODS -------------------------------------- // on-demand buffer layout conversion (swizzling) virtual status_t copyBuffer(std::shared_ptr<C2GraphicBuffer> src, std::shared_ptr<C2GraphicBuffer> dst); virtual C2Status copyBuffer(std::shared_ptr<C2GraphicBuffer> src, std::shared_ptr<C2GraphicBuffer> dst); // status_t selectPreferredColor(formats<A>, formats<B>); // C2Status selectPreferredColor(formats<A>, formats<B>); // GLOBAL SETTINGS // system-wide stride & slice-height (???) Loading Loading @@ -660,7 +660,7 @@ public: * \retval C2_CORRUPTED some unknown error prevented the querying of the parameters * (unexpected) */ virtual status_t query_sm( virtual C2Status query_sm( const std::vector<C2Param* const> &stackParams, const std::vector<C2Param::Index> &heapParamIndices, std::vector<std::unique_ptr<C2Param>>* const heapParams) const = 0; Loading Loading @@ -699,7 +699,7 @@ public: * \retval C2_CORRUPTED some unknown error prevented the update of the parameters * (unexpected) */ virtual status_t config_nb( virtual C2Status config_nb( const std::vector<C2Param* const> ¶ms, std::list<std::unique_ptr<C2SettingResult>>* const failures) = 0; Loading
media/libstagefright/codec2/include/C2Work.h +1 −3 Original line number Diff line number Diff line Loading @@ -28,8 +28,6 @@ #include <list> #include <vector> typedef int status_t; namespace android { /// \defgroup work Work and data processing Loading Loading @@ -167,7 +165,7 @@ struct C2Work { std::list<std::unique_ptr<C2Worklet>> worklets; uint32_t worklets_processed; status_t result; C2Status result; }; struct C2WorkOutline { Loading
media/libstagefright/codec2/tests/C2ComponentInterface_test.cpp +12 −12 Original line number Diff line number Diff line Loading @@ -112,11 +112,11 @@ private: // 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 // |p| in queryOnStack() and |heapParams| in queryOnHeap(). // The return value is status_t (e.g. C2_OK). template <typename T> status_t queryOnStack(T *const p); // The return value is C2Status (e.g. C2_OK). template <typename T> C2Status queryOnStack(T *const p); template <typename T> status_t queryOnHeap(const T &p, C2Status queryOnHeap(const T &p, std::vector<std::unique_ptr<C2Param>> *const heapParams); // 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. // config() creates std::vector<C2Param *const> {p} and passes it to config_nb(). template <typename T> status_t C2Status config(T *const p, std::vector<std::unique_ptr<C2SettingResult>> *const failures); Loading @@ -150,7 +150,7 @@ private: // Test if config works correctly for writable parameters. // This changes the parameter's value to |newParam|. // |stConfig| is a return value of config(). template <typename T> void configWritableParamValidValue(const T &newParam, status_t *stConfig); template <typename T> void configWritableParamValidValue(const T &newParam, C2Status *stConfig); // Test if config works correctly in the case an invalid value |newParam| is tried to write // to an writable parameter. Loading Loading @@ -194,13 +194,13 @@ template <> std::unique_ptr<C2PortMimeConfig::input> makeParam() { } \ } while (false) template <typename T> status_t C2CompIntfTest::queryOnStack(T *const p) { template <typename T> C2Status C2CompIntfTest::queryOnStack(T *const p) { std::vector<C2Param *const> stackParams{p}; return mIntf->query_nb(stackParams, {}, nullptr); } template <typename T> status_t C2CompIntfTest::queryOnHeap( C2Status C2CompIntfTest::queryOnHeap( const T &p, std::vector<std::unique_ptr<C2Param>> *const heapParams) { uint32_t index = p.type(); if (p.forStream()) { Loading Loading @@ -258,7 +258,7 @@ template <typename T> void C2CompIntfTest::queryUnsupportedParam() { } template <typename T> status_t C2CompIntfTest::config( C2Status C2CompIntfTest::config( T *const p, std::vector<std::unique_ptr<C2SettingResult>> *const failures) { std::vector<C2Param *const> params{p}; return mIntf->config_nb(params, failures); Loading Loading @@ -286,7 +286,7 @@ void C2CompIntfTest::configReadOnlyParam(const T &newParam) { } template <typename T> void C2CompIntfTest::configWritableParamValidValue(const T &newParam, status_t *configResult) { void C2CompIntfTest::configWritableParamValidValue(const T &newParam, C2Status *configResult) { std::unique_ptr<T> p = makeParamFrom(newParam); std::vector<C2Param *const> params{p.get()}; Loading @@ -297,7 +297,7 @@ void C2CompIntfTest::configWritableParamValidValue(const T &newParam, status_t * // 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 // about the return value when conflict happens. I set C2_BAD_VALUE to it temporarily now. status_t stConfig = mIntf->config_nb(params, &failures); C2Status stConfig = mIntf->config_nb(params, &failures); if (stConfig == C2_OK) { EXPECT_EQ(0u, failures.size()); } else { Loading Loading @@ -481,7 +481,7 @@ void C2CompIntfTest::testWritableParam( TParam *const param, TRealField *const writableField, const std::vector<TField> &validValues, const std::vector<TField> &invalidValues) { status_t stConfig; C2Status stConfig; // Get the parameter's value in the beginning in order to reset the value at the end. TRACED_FAILURE(getValue(param)); Loading Loading @@ -555,7 +555,7 @@ void C2CompIntfTest::checkParamPermission( std::vector<std::unique_ptr<C2SettingResult>> failures; // 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. status_t stStack = config(param.get(), &failures); C2Status stStack = config(param.get(), &failures); if (stStack == C2_BAD_VALUE) { // Read-only std::unique_ptr<T> newParam = makeParam<T>(); Loading