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

Commit 6ed07dc0 authored by Pawin Vongmasa's avatar Pawin Vongmasa
Browse files

Remove setQuirks() from IOMXNode and IOmxNode.

Test: Media post-submit tests on Pixel phone.
Test: Manual use of Camera, Photos, Play Movies and YouTube apps.
Bug: 36952714
Change-Id: I230df51c2d658e29cffec369ba622e336c3402d2
parent 549f2088
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -102,9 +102,6 @@ struct LWOmxNode : public H2BConverter<IOmxNode, IOMXNode, BnOMXNode> {
            const char *parameter_name,
            OMX_INDEXTYPE *index) override;
    status_t dispatchMessage(const omx_message &msg) override;

    // TODO: this is temporary, will be removed when quirks move to OMX side.
    status_t setQuirks(OMX_U32 quirks) override;
};

struct TWOmxNode : public IOmxNode {
@@ -153,7 +150,6 @@ struct TWOmxNode : public IOmxNode {
            hidl_string const& parameterName,
            getExtensionIndex_cb _hidl_cb) override;
    Return<Status> dispatchMessage(Message const& msg) override;
    Return<void> setQuirks(uint32_t quirks) override;
};

}  // namespace utils
+135 −0
Original line number Diff line number Diff line
/*
 * Copyright 2017, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef MEDIA_CODECS_XML_PARSER_H_

#define MEDIA_CODECS_XML_PARSER_H_

#include <map>
#include <vector>

#include <media/stagefright/foundation/ABase.h>
#include <media/stagefright/foundation/AString.h>

#include <sys/types.h>
#include <utils/Errors.h>
#include <utils/Vector.h>
#include <utils/StrongPointer.h>

namespace android {

struct AMessage;

// Quirk still supported, even though deprecated
enum Quirks {
    kRequiresAllocateBufferOnInputPorts   = 1,
    kRequiresAllocateBufferOnOutputPorts  = 2,

    kQuirksMask = kRequiresAllocateBufferOnInputPorts
                | kRequiresAllocateBufferOnOutputPorts,
};

// Lightweight struct for querying components.
struct TypeInfo {
    AString mName;
    std::map<AString, AString> mStringFeatures;
    std::map<AString, bool> mBoolFeatures;
    std::map<AString, AString> mDetails;
};

struct ProfileLevel {
    uint32_t mProfile;
    uint32_t mLevel;
};

struct CodecInfo {
    std::vector<TypeInfo> mTypes;
    std::vector<ProfileLevel> mProfileLevels;
    std::vector<uint32_t> mColorFormats;
    uint32_t mFlags;
    bool mIsEncoder;
};

class MediaCodecsXmlParser {
public:
    MediaCodecsXmlParser();
    ~MediaCodecsXmlParser();

    void getGlobalSettings(std::map<AString, AString> *settings) const;

    status_t getCodecInfo(const char *name, CodecInfo *info) const;

    status_t getQuirks(const char *name, std::vector<AString> *quirks) const;

private:
    enum Section {
        SECTION_TOPLEVEL,
        SECTION_SETTINGS,
        SECTION_DECODERS,
        SECTION_DECODER,
        SECTION_DECODER_TYPE,
        SECTION_ENCODERS,
        SECTION_ENCODER,
        SECTION_ENCODER_TYPE,
        SECTION_INCLUDE,
    };

    status_t mInitCheck;
    Section mCurrentSection;
    bool mUpdate;
    Vector<Section> mPastSections;
    int32_t mDepth;
    AString mHrefBase;

    std::map<AString, AString> mGlobalSettings;

    // name -> CodecInfo
    std::map<AString, CodecInfo> mCodecInfos;
    std::map<AString, std::vector<AString>> mQuirks;
    AString mCurrentName;
    std::vector<TypeInfo>::iterator mCurrentType;

    status_t initCheck() const;
    void parseTopLevelXMLFile(const char *path, bool ignore_errors = false);

    void parseXMLFile(const char *path);

    static void StartElementHandlerWrapper(
            void *me, const char *name, const char **attrs);

    static void EndElementHandlerWrapper(void *me, const char *name);

    void startElementHandler(const char *name, const char **attrs);
    void endElementHandler(const char *name);

    status_t includeXMLFile(const char **attrs);
    status_t addSettingFromAttributes(const char **attrs);
    status_t addMediaCodecFromAttributes(bool encoder, const char **attrs);
    void addMediaCodec(bool encoder, const char *name, const char *type = NULL);

    status_t addQuirk(const char **attrs);
    status_t addTypeFromAttributes(const char **attrs, bool encoder);
    status_t addLimit(const char **attrs);
    status_t addFeature(const char **attrs);
    void addType(const char *name);

    DISALLOW_EVIL_CONSTRUCTORS(MediaCodecsXmlParser);
};

}  // namespace android

#endif  // MEDIA_CODECS_XML_PARSER_H_
+0 −16
Original line number Diff line number Diff line
@@ -549,11 +549,6 @@ public:
    virtual status_t dispatchMessage(const omx_message &msg) {
        return mBase->dispatchMessage(msg);
    }

    // TODO: this is temporary, will be removed when quirks move to OMX side
    virtual status_t setQuirks(OMX_U32 quirks) {
        return mBase->setQuirks(quirks);
    }
};

IMPLEMENT_META_INTERFACE(OMX, "android.hardware.IOMX");
@@ -975,17 +970,6 @@ status_t BnOMXNode::onTransact(
            return NO_ERROR;
        }

        case SET_QUIRKS:
        {
            CHECK_OMX_INTERFACE(IOMXNode, data, reply);

            OMX_U32 quirks = data.readInt32();

            reply->writeInt32(setQuirks(quirks));

            return NO_ERROR;
        }

        default:
            return BBinder::onTransact(code, data, reply, flags);
    }
+0 −3
Original line number Diff line number Diff line
@@ -170,9 +170,6 @@ public:
            OMX_INDEXTYPE *index) = 0;

    virtual status_t dispatchMessage(const omx_message &msg) = 0;

    // TODO: this is temporary, will be removed when quirks move to OMX side
    virtual status_t setQuirks(OMX_U32 quirks) = 0;
};

struct omx_message {
+0 −10
Original line number Diff line number Diff line
@@ -242,11 +242,6 @@ status_t LWOmxNode::dispatchMessage(const omx_message &lMsg) {
    return status;
}

// TODO: this is temporary, will be removed when quirks move to OMX side.
status_t LWOmxNode::setQuirks(OMX_U32 quirks) {
    return toStatusT(mBase->setQuirks(static_cast<uint32_t>(quirks)));;
}

// TWOmxNode
TWOmxNode::TWOmxNode(sp<IOMXNode> const& base) : mBase(base) {
}
@@ -424,11 +419,6 @@ Return<Status> TWOmxNode::dispatchMessage(const Message& tMsg) {
    return toStatus(mBase->dispatchMessage(lMsg));
}

Return<void> TWOmxNode::setQuirks(uint32_t quirks) {
    mBase->setQuirks(static_cast<OMX_U32>(quirks));
    return Void();
}

}  // namespace utils
}  // namespace V1_0
}  // namespace omx
Loading