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

Commit 4311dcd7 authored by Lajos Molnar's avatar Lajos Molnar
Browse files

Codec2: remove some unused code

MyReflector code is copied into MyComponentInstance.

C2TypedFieldSupportedValues was meant as a helper class that should not be
part of C2Param.h. It will be reworked to reuse C2FieldSupportedValues to
avoid having to copy to-from the Codec2 struct.

Bug: 64121714
Test: build
Change-Id: Ibb6fb87f69470b721fe7bd1871c4f2400411b6b9
parent 97e8b37f
Loading
Loading
Loading
Loading
+0 −42
Original line number Diff line number Diff line
@@ -1099,48 +1099,6 @@ protected:
    virtual ~C2ParamReflector() = default;
};

/**
 * A useable supported values for a field.
 *
 * This can be either a range or a set of values. The range can be linear or geometric with a
 * clear minimum and maximum value, and can have an optional step size or geometric ratio. Values
 * can optionally represent flags.
 *
 * \note Do not use flags to represent bitfields. Use individual values or separate fields instead.
 */
template<typename T>
struct C2TypedFieldSupportedValues {
//public:
    enum Type {
        RANGE,      ///< a numeric range that can be continuous or discrete
        VALUES,     ///< a list of values
        FLAGS       ///< a list of flags that can be OR-ed
    };

    Type type;

    struct {
        T min;
        T max;
        T step;
        T nom;
        T denom;
    } range;
    std::vector<T> values;

    C2TypedFieldSupportedValues(T min, T max, T step = T(std::is_floating_point<T>::value ? 0 : 1))
        : type(RANGE),
          range{min, max, step, (T)1, (T)1} { }

    C2TypedFieldSupportedValues(T min, T max, T nom, T den) :
        type(RANGE),
        range{min, max, (T)0, nom, den} { }

    C2TypedFieldSupportedValues(bool flags, std::initializer_list<T> list) :
        type(flags ? FLAGS : VALUES),
        values(list) {}
};

/**
 * Generic supported values for a field.
 *
+0 −30
Original line number Diff line number Diff line
@@ -2197,36 +2197,6 @@ struct C2VideoConfigStruct {

typedef C2PortParam<C2Tuning, C2VideoConfigStruct> C2VideoConfigPortTuning;

class MyReflector : public C2ParamReflector {
private:
    std::unique_ptr<C2VideoConfigPortTuning::input> inputVideoConfigTuning;
    std::unique_ptr<C2VideoConfigPortTuning::output> outputVideoConfigTuning;

public:
    void describeSupportedValues() {
        C2TypedFieldSupportedValues<int32_t> supportedWidths(16, 1920, 8);
        C2FieldSupportedValues supportedWidths2(16, 1920, 8);


        std::list<C2FieldSupportedValues> supported;
        //supported.emplace_push(inputVideoConfigTuning->mNumber, range(16, 1920, 8));
        //supported.emplace_push(inputVideoConfigTuning->mHeight, range(16, 1088, 8));
        //supported.emplace_push(inputVideoConfigTuning->mMetadataType, all_enums);
        //supported.emplace_push(inputVideoConfigTuning->mSupportedFormats, { 0, 1, 5, 7 });
    }

    virtual std::unique_ptr<android::C2StructDescriptor> describe(C2Param::BaseIndex paramType) {
        switch (paramType.baseIndex()) {
        case C2VideoConfigPortTuning::baseIndex:
            return std::unique_ptr<C2StructDescriptor>(new C2StructDescriptor{
                paramType.baseIndex(),
                C2VideoConfigPortTuning::fieldList,
            });
        }
        return nullptr;
    }
};

class MyComponentInstance : public C2ComponentInterface {
public:
    virtual C2String getName() const {