Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e7d379c8 authored by Lajos Molnar's avatar Lajos Molnar
Browse files

Codec2: fix API style for some helpers

- remove android::C2Component placeholders
- C2FSVQuery now has private instead of const members
- fix naming of helper classes and static methods
- document C2FieldSupportedValues better
- don't return rvalues to temporary objects

Bug: 64121714
Test: Build
Change-Id: I7a9c9f35fda294fd51578355050f043b92197720
parent 467af1dd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -234,7 +234,7 @@ status_t C2OMXNode::emptyBuffer(
        std::shared_ptr<C2Buffer> c2Buffer(
                // TODO: fence
                new Buffer2D(block->share(
                        C2Rect(block->width(), block->height()), ::android::C2Fence())),
                        C2Rect(block->width(), block->height()), ::C2Fence())),
                [handle, buffer, source = getSource()](C2Buffer *ptr) {
                    delete ptr;
                    native_handle_delete(handle);
+1 −1
Original line number Diff line number Diff line
@@ -123,7 +123,7 @@ public:
        std::shared_ptr<C2Buffer> c2Buffer(
                // TODO: fence
                new Buffer2D(block->share(
                        C2Rect(block->width(), block->height()), ::android::C2Fence())),
                        C2Rect(block->width(), block->height()), ::C2Fence())),
                [handle, bufferId, src = mSource](C2Buffer *ptr) {
                    delete ptr;
                    native_handle_delete(handle);
+2 −2
Original line number Diff line number Diff line
@@ -373,7 +373,7 @@ std::shared_ptr<C2Buffer> SimpleC2Component::createLinearBuffer(

std::shared_ptr<C2Buffer> SimpleC2Component::createLinearBuffer(
        const std::shared_ptr<C2LinearBlock> &block, size_t offset, size_t size) {
    return C2Buffer::CreateLinearBuffer(block->share(offset, size, ::android::C2Fence()));
    return C2Buffer::CreateLinearBuffer(block->share(offset, size, ::C2Fence()));
}

std::shared_ptr<C2Buffer> SimpleC2Component::createGraphicBuffer(
@@ -383,7 +383,7 @@ std::shared_ptr<C2Buffer> SimpleC2Component::createGraphicBuffer(

std::shared_ptr<C2Buffer> SimpleC2Component::createGraphicBuffer(
        const std::shared_ptr<C2GraphicBlock> &block, const C2Rect &crop) {
    return C2Buffer::CreateGraphicBuffer(block->share(crop, ::android::C2Fence()));
    return C2Buffer::CreateGraphicBuffer(block->share(crop, ::C2Fence()));
}

} // namespace android
+9 −5
Original line number Diff line number Diff line
@@ -141,9 +141,13 @@ enum c2_blocking_t : int32_t {
/// \defgroup utils Utilities
/// @{

#define C2_DO_NOT_COPY(type, args...) \
    type args& operator=(const type args&) = delete; \
    type(const type args&) = delete; \
#define C2_DO_NOT_COPY(type) \
    type& operator=(const type &) = delete; \
    type(const type &) = delete; \

#define C2_DEFAULT_MOVE(type) \
    type& operator=(type &&) = default; \
    type(type &&) = default; \

#define C2_ALLOW_OVERFLOW __attribute__((no_sanitize("integer")))
#define C2_CONST    __attribute__((const))
@@ -274,7 +278,7 @@ public:
    /**
     * Convert to a smaller counter type. This is always safe.
     */
    template<typename U, typename E=typename std::enable_if<sizeof(U) < sizeof(T)>::type>
    template<typename U, typename E=typename std::enable_if<(sizeof(U) < sizeof(T))>::type>
    inline operator c2_cntr_t<U>() {
        return c2_cntr_t<U>(mValue);
    }
@@ -295,7 +299,7 @@ public:
        return c2_cntr_t<T>(mValue op compat::get(value)); \
    } \
    \
    template<typename U, typename E=typename std::enable_if<sizeof(U) < sizeof(T)>::type> \
    template<typename U, typename E=typename std::enable_if<(sizeof(U) < sizeof(T))>::type> \
    attrib inline constexpr c2_cntr_t<U> operator op(const c2_cntr_t<U> &value) const { \
        return c2_cntr_t<U>(U(mValue) op value.peeku()); \
    }
+3 −6
Original line number Diff line number Diff line
@@ -1339,6 +1339,9 @@ struct C2Rect {
    uint32_t width;
    uint32_t height;

    constexpr inline C2Rect()
        : C2Rect(0, 0, 0, 0) { }

    constexpr inline C2Rect(uint32_t width_, uint32_t height_)
        : C2Rect(width_, height_, 0, 0) { }

@@ -2262,10 +2265,4 @@ protected:

/// @}

// expose some objects in android namespace
namespace android {
    /// \deprecated
    typedef ::C2Fence C2Fence;
}

#endif  // C2BUFFER_H_
Loading