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

Commit 198e15e0 authored by Lajos Molnar's avatar Lajos Molnar Committed by Automerger Merge Worker
Browse files

Merge changes I8c2b3dbf,If089e274 am: 8805faa1

Original change: https://android-review.googlesource.com/c/platform/frameworks/av/+/1377906

Change-Id: Ic8d7b5a62ca068d4e8a58904b793a5a88400fae1
parents 0e0a7fd9 8805faa1
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@
#include <media/openmax/OMX_AsString.h>

#include <media/stagefright/omx/OMXUtils.h>
#include <media/stagefright/omx/OMXMaster.h>
#include <media/stagefright/omx/OMXStore.h>
#include <media/stagefright/omx/OmxGraphicBufferSource.h>

#include <media/stagefright/omx/1.0/WOmxNode.h>
@@ -41,21 +41,21 @@ namespace implementation {
constexpr size_t kMaxNodeInstances = (1 << 16);

Omx::Omx() :
    mMaster(new OMXMaster()),
    mStore(new OMXStore()),
    mParser() {
    (void)mParser.parseXmlFilesInSearchDirs();
    (void)mParser.parseXmlPath(mParser.defaultProfilingResultsXmlPath);
}

Omx::~Omx() {
    delete mMaster;
    delete mStore;
}

Return<void> Omx::listNodes(listNodes_cb _hidl_cb) {
    std::list<::android::IOMX::ComponentInfo> list;
    char componentName[256];
    for (OMX_U32 index = 0;
            mMaster->enumerateComponents(
            mStore->enumerateComponents(
            componentName, sizeof(componentName), index) == OMX_ErrorNone;
            ++index) {
        list.push_back(::android::IOMX::ComponentInfo());
@@ -63,7 +63,7 @@ Return<void> Omx::listNodes(listNodes_cb _hidl_cb) {
        info.mName = componentName;
        ::android::Vector<::android::String8> roles;
        OMX_ERRORTYPE err =
                mMaster->getRolesOfComponent(componentName, &roles);
                mStore->getRolesOfComponent(componentName, &roles);
        if (err == OMX_ErrorNone) {
            for (OMX_U32 i = 0; i < roles.size(); ++i) {
                info.mRoles.push_back(roles[i]);
@@ -101,7 +101,7 @@ Return<void> Omx::allocateNode(
                this, new LWOmxObserver(observer), name.c_str());

        OMX_COMPONENTTYPE *handle;
        OMX_ERRORTYPE err = mMaster->makeComponentInstance(
        OMX_ERRORTYPE err = mStore->makeComponentInstance(
                name.c_str(), &OMXNodeInstance::kCallbacks,
                instance.get(), &handle);

@@ -208,7 +208,7 @@ status_t Omx::freeNode(sp<OMXNodeInstance> const& instance) {

    OMX_ERRORTYPE err = OMX_ErrorNone;
    if (instance->handle() != NULL) {
        err = mMaster->destroyComponentInstance(
        err = mStore->destroyComponentInstance(
                static_cast<OMX_COMPONENTTYPE*>(instance->handle()));
    }
    return StatusFromOMXError(err);
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ cc_library_shared {
    },

    srcs: [
        "OMXMaster.cpp",
        "OMXStore.cpp",
        "OMXNodeInstance.cpp",
        "OMXUtils.cpp",
        "OmxGraphicBufferSource.cpp",
+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@
#include <inttypes.h>

#include <media/stagefright/omx/OMXNodeInstance.h>
#include <media/stagefright/omx/OMXMaster.h>
#include <media/stagefright/omx/OMXStore.h>
#include <media/stagefright/omx/OMXUtils.h>
#include <android/IOMXBufferSource.h>

+18 −13
Original line number Diff line number Diff line
@@ -15,10 +15,11 @@
 */

//#define LOG_NDEBUG 0
#define LOG_TAG "OMXMaster"
#define LOG_TAG "OMXStore"
#include <android-base/properties.h>
#include <utils/Log.h>

#include <media/stagefright/omx/OMXMaster.h>
#include <media/stagefright/omx/OMXStore.h>
#include <media/stagefright/omx/SoftOMXPlugin.h>
#include <media/stagefright/foundation/ADebug.h>

@@ -29,7 +30,7 @@

namespace android {

OMXMaster::OMXMaster() {
OMXStore::OMXStore() {

    pid_t pid = getpid();
    char filename[20];
@@ -54,19 +55,23 @@ OMXMaster::OMXMaster() {
    addPlatformPlugin();
}

OMXMaster::~OMXMaster() {
OMXStore::~OMXStore() {
    clearPlugins();
}

void OMXMaster::addVendorPlugin() {
void OMXStore::addVendorPlugin() {
    addPlugin("libstagefrighthw.so");
}

void OMXMaster::addPlatformPlugin() {
void OMXStore::addPlatformPlugin() {
    addPlugin("libstagefright_softomx_plugin.so");
}

void OMXMaster::addPlugin(const char *libname) {
void OMXStore::addPlugin(const char *libname) {
    if (::android::base::GetIntProperty("vendor.media.omx", int64_t(1)) == 0) {
        return;
    }

    void *libHandle = android_load_sphal_library(libname, RTLD_NOW);

    if (libHandle == NULL) {
@@ -94,7 +99,7 @@ void OMXMaster::addPlugin(const char *libname) {
    }
}

void OMXMaster::addPlugin(OMXPluginBase *plugin) {
void OMXStore::addPlugin(OMXPluginBase *plugin) {
    Mutex::Autolock autoLock(mLock);

    OMX_U32 index = 0;
@@ -121,7 +126,7 @@ void OMXMaster::addPlugin(OMXPluginBase *plugin) {
    }
}

void OMXMaster::clearPlugins() {
void OMXStore::clearPlugins() {
    Mutex::Autolock autoLock(mLock);

    mPluginByComponentName.clear();
@@ -143,7 +148,7 @@ void OMXMaster::clearPlugins() {
    mPlugins.clear();
}

OMX_ERRORTYPE OMXMaster::makeComponentInstance(
OMX_ERRORTYPE OMXStore::makeComponentInstance(
        const char *name,
        const OMX_CALLBACKTYPE *callbacks,
        OMX_PTR appData,
@@ -172,7 +177,7 @@ OMX_ERRORTYPE OMXMaster::makeComponentInstance(
    return err;
}

OMX_ERRORTYPE OMXMaster::destroyComponentInstance(
OMX_ERRORTYPE OMXStore::destroyComponentInstance(
        OMX_COMPONENTTYPE *component) {
    Mutex::Autolock autoLock(mLock);

@@ -188,7 +193,7 @@ OMX_ERRORTYPE OMXMaster::destroyComponentInstance(
    return plugin->destroyComponentInstance(component);
}

OMX_ERRORTYPE OMXMaster::enumerateComponents(
OMX_ERRORTYPE OMXStore::enumerateComponents(
        OMX_STRING name,
        size_t size,
        OMX_U32 index) {
@@ -208,7 +213,7 @@ OMX_ERRORTYPE OMXMaster::enumerateComponents(
    return OMX_ErrorNone;
}

OMX_ERRORTYPE OMXMaster::getRolesOfComponent(
OMX_ERRORTYPE OMXStore::getRolesOfComponent(
        const char *name,
        Vector<String8> *roles) {
    Mutex::Autolock autoLock(mLock);
+3 −3
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@

namespace android {

struct OMXMaster;
struct OMXStore;
struct OMXNodeInstance;

namespace hardware {
@@ -51,7 +51,7 @@ using ::android::hardware::Void;
using ::android::sp;
using ::android::wp;

using ::android::OMXMaster;
using ::android::OMXStore;
using ::android::OMXNodeInstance;

struct Omx : public IOmx, public hidl_death_recipient {
@@ -73,7 +73,7 @@ struct Omx : public IOmx, public hidl_death_recipient {
    status_t freeNode(sp<OMXNodeInstance> const& instance);

protected:
    OMXMaster* mMaster;
    OMXStore* mStore;
    Mutex mLock;
    KeyedVector<wp<IBase>, sp<OMXNodeInstance> > mLiveNodes;
    KeyedVector<OMXNodeInstance*, wp<IBase> > mNode2Observer;
Loading