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

Commit 4b8dbfc9 authored by Lajos Molnar's avatar Lajos Molnar Committed by Android (Google) Code Review
Browse files

Merge changes from topic "c2-more-adjustments"

* changes:
  Codec2/AUtils: rename nom to num for 'numerator'
  Codec2: C2ParamDescriptor fixes
  Codec2: use std::list only for C2Work/C2Worklet
  Codec2: codec2_vndk is now a shared lib, plus, add internal headers
parents 9479b4fc 5ab530c5
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -126,6 +126,7 @@ cc_library_shared {
        "libutils",
        "libutils",
        "libmedia_helper",
        "libmedia_helper",
        "libstagefright_codec2",
        "libstagefright_codec2",
        "libstagefright_codec2_vndk",
        "libstagefright_foundation",
        "libstagefright_foundation",
        "libstagefright_gbs",
        "libstagefright_gbs",
        "libstagefright_omx",
        "libstagefright_omx",
@@ -154,8 +155,6 @@ cc_library_shared {
        "libstagefright_esds",
        "libstagefright_esds",
        "libstagefright_id3",
        "libstagefright_id3",
        "libFLAC",
        "libFLAC",

        "libstagefright_codec2_vndk",
    ],
    ],


    export_shared_lib_headers: [
    export_shared_lib_headers: [
+2 −2
Original line number Original line Diff line number Diff line
@@ -117,7 +117,7 @@ public:


    virtual void onWorkDone_nb(
    virtual void onWorkDone_nb(
            std::weak_ptr<C2Component> component,
            std::weak_ptr<C2Component> component,
            std::vector<std::unique_ptr<C2Work>> workItems) override {
            std::list<std::unique_ptr<C2Work>> workItems) override {
        (void)component;
        (void)component;
        sp<CCodec> codec(mCodec.promote());
        sp<CCodec> codec(mCodec.promote());
        if (!codec) {
        if (!codec) {
@@ -601,7 +601,7 @@ void CCodec::signalRequestIDRFrame() {
    // TODO
    // TODO
}
}


void CCodec::onWorkDone(std::vector<std::unique_ptr<C2Work>> &workItems) {
void CCodec::onWorkDone(std::list<std::unique_ptr<C2Work>> &workItems) {
    Mutexed<std::list<std::unique_ptr<C2Work>>>::Locked queue(mWorkDoneQueue);
    Mutexed<std::list<std::unique_ptr<C2Work>>>::Locked queue(mWorkDoneQueue);
    for (std::unique_ptr<C2Work> &item : workItems) {
    for (std::unique_ptr<C2Work> &item : workItems) {
        queue->push_back(std::move(item));
        queue->push_back(std::move(item));
+2 −2
Original line number Original line Diff line number Diff line
@@ -237,8 +237,8 @@ std::shared_ptr<C2ComponentInterface> SimpleC2Component::intf() {


namespace {
namespace {


std::vector<std::unique_ptr<C2Work>> vec(std::unique_ptr<C2Work> &work) {
std::list<std::unique_ptr<C2Work>> vec(std::unique_ptr<C2Work> &work) {
    std::vector<std::unique_ptr<C2Work>> ret;
    std::list<std::unique_ptr<C2Work>> ret;
    ret.push_back(std::move(work));
    ret.push_back(std::move(work));
    return ret;
    return ret;
}
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -332,7 +332,7 @@ public:
    class Listener {
    class Listener {
    public:
    public:
        virtual void onWorkDone_nb(std::weak_ptr<C2Component> component,
        virtual void onWorkDone_nb(std::weak_ptr<C2Component> component,
                                std::vector<std::unique_ptr<C2Work>> workItems) = 0;
                                std::list<std::unique_ptr<C2Work>> workItems) = 0;


        virtual void onTripped_nb(std::weak_ptr<C2Component> component,
        virtual void onTripped_nb(std::weak_ptr<C2Component> component,
                               std::vector<std::shared_ptr<C2SettingResult>> settingResult) = 0;
                               std::vector<std::shared_ptr<C2SettingResult>> settingResult) = 0;
+28 −20
Original line number Original line Diff line number Diff line
@@ -1020,7 +1020,7 @@ public:
     * For vendor-defined components, it can be true even for vendor-defined params,
     * For vendor-defined components, it can be true even for vendor-defined params,
     * but it is not recommended, in case the component becomes platform-defined.
     * but it is not recommended, in case the component becomes platform-defined.
     */
     */
    inline bool isRequired() const { return _mIsRequired; }
    inline bool isRequired() const { return _mAttrib & IS_REQUIRED; }


    /**
    /**
     * Returns whether this parameter is persistent. This is always true for C2Tuning and C2Setting,
     * Returns whether this parameter is persistent. This is always true for C2Tuning and C2Setting,
@@ -1029,35 +1029,43 @@ public:
     * current frame and is not assumed to have the same value (or even be present) on subsequent
     * current frame and is not assumed to have the same value (or even be present) on subsequent
     * frames, unless it is specified for those frames.
     * frames, unless it is specified for those frames.
     */
     */
    inline bool isPersistent() const { return _mIsPersistent; }
    inline bool isPersistent() const { return _mAttrib & IS_PERSISTENT; }


    /// Returns the name of this param.
    /// Returns the name of this param.
    /// This defaults to the underlying C2Struct's name, but could be altered for a component.
    /// This defaults to the underlying C2Struct's name, but could be altered for a component.
    inline C2String name() const { return _mName; }
    inline C2String name() const { return _mName; }


    /// Returns the parameter type
    /// Returns the parameter index
    /// \todo fix this
    inline C2Param::Index index() const { return _mIndex; }
    inline C2Param::Type type() const { return _mType; }

    /// Returns the indices of parameters that this parameter has a dependency on
    inline const std::vector<C2Param::Index> &dependencies() const { return mDependencies; }

    // TODO: add more constructors that allow setting dependencies and attributes


    template<typename T>
    template<typename T>
    inline C2ParamDescriptor(bool isRequired, C2StringLiteral name, const T*)
    inline C2ParamDescriptor(bool isRequired, C2StringLiteral name, const T*)
        : _mIsRequired(isRequired),
        : _mIndex(T::PARAM_TYPE),
          _mIsPersistent(true),
          _mAttrib(IS_PERSISTENT | (isRequired ? IS_REQUIRED : 0)),
          _mName(name),
          _mName(name) { }
          _mType(T::PARAM_TYPE) { }


    inline C2ParamDescriptor(
    inline C2ParamDescriptor(
            bool isRequired, C2StringLiteral name, C2Param::Type type)
            bool isRequired, C2StringLiteral name, C2Param::Index index)
        : _mIsRequired(isRequired),
        : _mIndex(index),
          _mIsPersistent(true),
          _mAttrib(IS_PERSISTENT | (isRequired ? IS_REQUIRED : 0)),
          _mName(name),
          _mName(name) { }
          _mType(type) { }


private:
private:
    const bool _mIsRequired;
    enum attrib_t : uint32_t {
    const bool _mIsPersistent;
        IS_REQUIRED   = 1u << 0,
        IS_PERSISTENT = 1u << 1,
    };
    const C2Param::Index _mIndex;
    const uint32_t _mAttrib;
    const C2String _mName;
    const C2String _mName;
    const C2Param::Type _mType;
    std::vector<C2Param::Index> mDependencies;

    friend struct _C2ParamInspector;
};
};


/// \ingroup internal
/// \ingroup internal
@@ -1300,7 +1308,7 @@ struct C2FieldSupportedValues {
        Primitive min;
        Primitive min;
        Primitive max;
        Primitive max;
        Primitive step;
        Primitive step;
        Primitive nom;
        Primitive num;
        Primitive denom;
        Primitive denom;
    } range;
    } range;
    std::vector<Primitive> values;
    std::vector<Primitive> values;
@@ -1315,9 +1323,9 @@ struct C2FieldSupportedValues {
          range{min, max, step, (T)1, (T)1} { }
          range{min, max, step, (T)1, (T)1} { }


    template<typename T>
    template<typename T>
    C2FieldSupportedValues(T min, T max, T nom, T den) :
    C2FieldSupportedValues(T min, T max, T num, T den) :
        type(RANGE),
        type(RANGE),
        range{min, max, (T)0, nom, den} { }
        range{min, max, (T)0, num, den} { }


    template<typename T>
    template<typename T>
    C2FieldSupportedValues(bool flags, std::initializer_list<T> list)
    C2FieldSupportedValues(bool flags, std::initializer_list<T> list)
Loading