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

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

media: expand media_codecs.xml to support variants and domains

Added support to variant, domain and enabled attributes for <MediaCodec>.
Added support for <Variant> tag.

Bug: 129710438
Change-Id: Icf04665fdf36d8a3e9a74918978b0eb03f0e4f6c
parent 91b8fe31
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -248,10 +248,9 @@ status_t Codec2InfoBuilder::buildMediaCodecList(MediaCodecListWriter* writer) {
    // Obtain Codec2Client
    std::vector<Traits> traits = Codec2Client::ListComponents();

    MediaCodecsXmlParser parser(
            MediaCodecsXmlParser::defaultSearchDirs,
            "media_codecs_c2.xml",
            "media_codecs_performance_c2.xml");
    MediaCodecsXmlParser parser;
    parser.parseXmlFilesInSearchDirs(
            { "media_codecs_c2.xml", "media_codecs_performance_c2.xml" });
    if (parser.getParsingStatus() != OK) {
        ALOGD("XML parser no good");
        return OK;
+7 −16
Original line number Diff line number Diff line
@@ -53,9 +53,11 @@ inline static const char *asString(status_t i, const char *def = "??") {
#define LITERAL_TO_STRING_INTERNAL(x)    #x
#define LITERAL_TO_STRING(x) LITERAL_TO_STRING_INTERNAL(x)

#ifdef CHECK
#undef CHECK
#endif
// allow to use CHECK_OP from android-base/logging.h
// TODO: longterm replace this with android-base/logging.h, but there are some nuances, e.g.
// android-base CHECK_OP requires a copy constructor, whereas we don't.
#ifndef CHECK_OP

#define CHECK(condition)                                \
    LOG_ALWAYS_FATAL_IF(                                \
            !(condition),                               \
@@ -63,10 +65,6 @@ inline static const char *asString(status_t i, const char *def = "??") {
            __FILE__ ":" LITERAL_TO_STRING(__LINE__)    \
            " CHECK(" #condition ") failed.")

#ifdef CHECK_OP
#undef CHECK_OP
#endif

#define CHECK_OP(x,y,suffix,op)                                         \
    do {                                                                \
        const auto &a = x;                                              \
@@ -82,15 +80,6 @@ inline static const char *asString(status_t i, const char *def = "??") {
        }                                                               \
    } while (false)

#ifdef CHECK_EQ
#undef CHECK_EQ
#undef CHECK_NE
#undef CHECK_LE
#undef CHECK_LT
#undef CHECK_GE
#undef CHECK_GT
#endif

#define CHECK_EQ(x,y)   CHECK_OP(x,y,EQ,==)
#define CHECK_NE(x,y)   CHECK_OP(x,y,NE,!=)
#define CHECK_LE(x,y)   CHECK_OP(x,y,LE,<=)
@@ -98,6 +87,8 @@ inline static const char *asString(status_t i, const char *def = "??") {
#define CHECK_GE(x,y)   CHECK_OP(x,y,GE,>=)
#define CHECK_GT(x,y)   CHECK_OP(x,y,GT,>)

#endif

#define TRESPASS(...) \
        LOG_ALWAYS_FATAL(                                       \
            __FILE__ ":" LITERAL_TO_STRING(__LINE__)            \
+2 −0
Original line number Diff line number Diff line
@@ -45,6 +45,8 @@ constexpr size_t kMaxNodeInstances = (1 << 16);
Omx::Omx() :
    mMaster(new OMXMaster()),
    mParser() {
    (void)mParser.parseXmlFilesInSearchDirs();
    (void)mParser.parseXmlPath(mParser.defaultProfilingResultsXmlPath);
}

Omx::~Omx() {
+7 −7
Original line number Diff line number Diff line
@@ -38,9 +38,8 @@ using ::android::hardware::media::omx::V1_0::IOmx;
OmxStore::OmxStore(
        const sp<IOmx> &omx,
        const char* owner,
        const char* const* searchDirs,
        const char* mainXmlName,
        const char* performanceXmlName,
        const std::vector<std::string> &searchDirs,
        const std::vector<std::string> &xmlNames,
        const char* profilingResultsXmlPath) {
    // retrieve list of omx nodes
    std::set<std::string> nodes;
@@ -55,10 +54,11 @@ OmxStore::OmxStore(
        });
    }

    MediaCodecsXmlParser parser(searchDirs,
            mainXmlName,
            performanceXmlName,
            profilingResultsXmlPath);
    MediaCodecsXmlParser parser;
    parser.parseXmlFilesInSearchDirs(xmlNames, searchDirs);
    if (profilingResultsXmlPath != nullptr) {
        parser.parseXmlPath(profilingResultsXmlPath);
    }
    mParsingStatus = toStatus(parser.getParsingStatus());

    const auto& serviceAttributeMap = parser.getServiceAttributeMap();
+6 −8
Original line number Diff line number Diff line
@@ -46,14 +46,12 @@ struct OmxStore : public IOmxStore {
    OmxStore(
            const sp<IOmx> &omx = nullptr,
            const char* owner = "default",
            const char* const* searchDirs
                = MediaCodecsXmlParser::defaultSearchDirs,
            const char* mainXmlName
                = MediaCodecsXmlParser::defaultMainXmlName,
            const char* performanceXmlName
                = MediaCodecsXmlParser::defaultPerformanceXmlName,
            const char* profilingResultsXmlPath
                = MediaCodecsXmlParser::defaultProfilingResultsXmlPath);
            const std::vector<std::string> &searchDirs =
                MediaCodecsXmlParser::getDefaultSearchDirs(),
            const std::vector<std::string> &xmlFiles =
                MediaCodecsXmlParser::getDefaultXmlNames(),
            const char *xmlProfilingResultsPath =
                MediaCodecsXmlParser::defaultProfilingResultsXmlPath);

    virtual ~OmxStore();

Loading