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

Commit 0edc4f46 authored by Chong Zhang's avatar Chong Zhang Committed by android-build-merger
Browse files

Merge "Revert "Revert "Remove direct libgui reference from omx server side"""...

Merge "Revert "Revert "Remove direct libgui reference from omx server side""" into qt-dev am: e313cff4
am: 46e187e3

Change-Id: If021f227682ac45c34a261615c5fff8d56071aa8
parents ff226af9 46e187e3
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ cc_library {
        "libhidltransport",
        "liblog",
        "libstagefright_bufferpool@2.0",
        "libstagefright_bufferqueue_helper",
        "libui",
        "libutils",
    ],
+0 −1
Original line number Diff line number Diff line
@@ -40,7 +40,6 @@ cc_library_shared {
        "libmedia",
        "libmedia_omx",
        "libsfplugin_ccodec_utils",
        "libstagefright_bufferqueue_helper",
        "libstagefright_codecbase",
        "libstagefright_foundation",
        "libstagefright_omx_utils",
+70 −5
Original line number Diff line number Diff line
@@ -65,7 +65,6 @@ cc_library_shared {
        "MediaCodecInfo.cpp",
        "OMXBuffer.cpp",
        "omx/1.0/WGraphicBufferSource.cpp",
        "omx/1.0/WOmx.cpp",
        "omx/1.0/WOmxBufferSource.cpp",
        "omx/1.0/WOmxNode.cpp",
        "omx/1.0/WOmxObserver.cpp",
@@ -76,12 +75,15 @@ cc_library_shared {
        export_aidl_headers: true,
    },
    
    local_include_dirs: [
        "include",
    ],

    shared_libs: [
        "android.hidl.token@1.0-utils",
        "android.hardware.media.omx@1.0",
        "libbinder",
        "libcutils",
        "libgui",
        "libhidlbase",
        "libhidltransport",
        "liblog",
@@ -93,21 +95,84 @@ cc_library_shared {
    export_shared_lib_headers: [
        "android.hidl.token@1.0-utils",
        "android.hardware.media.omx@1.0",
        "libgui",
        "libstagefright_foundation",
        "libui",
    ],

    header_libs: [
        "libmedia_headers",
        "libstagefright_headers",
        "media_plugin_headers",
    ],

    export_header_lib_headers: [
        "libmedia_headers",
        "libstagefright_headers",
        "media_plugin_headers",
    ],

    export_include_dirs: [
        "aidl",
        "include",
    ],

    cflags: [
        "-Werror",
        "-Wno-error=deprecated-declarations",
        "-Wall",
    ],

    sanitize: {
        misc_undefined: [
            "unsigned-integer-overflow",
            "signed-integer-overflow",
        ],
        cfi: true,
    },
}


cc_library_shared {
    name: "libmedia_omx_client",

    srcs: [
        "omx/1.0/WOmx.cpp",
    ],

    local_include_dirs: [
        "include",
    ],

    shared_libs: [
        "libbinder",
        "libcutils",
        "libgui",
        "libhidlbase",
        "libhidltransport",
        "liblog",
        "libmedia_omx",
        "libstagefright_foundation",
        "libui",
        "libutils",
    ],

    export_shared_lib_headers: [
        "libgui",
        "libmedia_omx",
        "libstagefright_foundation",
        "libui",
    ],

    header_libs: [
        "libstagefright_headers",
        "media_plugin_headers",
    ],

    export_header_lib_headers: [
        "libstagefright_headers",
        "media_plugin_headers",
    ],

    export_include_dirs: [
        "include",
    ],

    cflags: [
+0 −151
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@
#include <media/openmax/OMX_IndexExt.h>
#include <media/OMXBuffer.h>
#include <utils/NativeHandle.h>
#include <gui/IGraphicBufferProducer.h>

#include <media/omx/1.0/WOmxNode.h>
#include <android/IGraphicBufferSource.h>
@@ -62,79 +61,6 @@ enum {
    SET_QUIRKS,
};

class BpOMX : public BpInterface<IOMX> {
public:
    explicit BpOMX(const sp<IBinder> &impl)
        : BpInterface<IOMX>(impl) {
    }

    virtual status_t listNodes(List<ComponentInfo> *list) {
        list->clear();

        Parcel data, reply;
        data.writeInterfaceToken(IOMX::getInterfaceDescriptor());
        remote()->transact(LIST_NODES, data, &reply);

        int32_t n = reply.readInt32();
        for (int32_t i = 0; i < n; ++i) {
            list->push_back(ComponentInfo());
            ComponentInfo &info = *--list->end();

            info.mName = reply.readString8();
            int32_t numRoles = reply.readInt32();
            for (int32_t j = 0; j < numRoles; ++j) {
                info.mRoles.push_back(reply.readString8());
            }
        }

        return OK;
    }

    virtual status_t allocateNode(
            const char *name, const sp<IOMXObserver> &observer,
            sp<IOMXNode> *omxNode) {
        Parcel data, reply;
        data.writeInterfaceToken(IOMX::getInterfaceDescriptor());
        data.writeCString(name);
        data.writeStrongBinder(IInterface::asBinder(observer));
        remote()->transact(ALLOCATE_NODE, data, &reply);

        status_t err = reply.readInt32();
        if (err == OK) {
            *omxNode = IOMXNode::asInterface(reply.readStrongBinder());
        } else {
            omxNode->clear();
        }

        return err;
    }

    virtual status_t createInputSurface(
            sp<IGraphicBufferProducer> *bufferProducer,
            sp<IGraphicBufferSource> *bufferSource) {
        Parcel data, reply;
        status_t err;
        data.writeInterfaceToken(IOMX::getInterfaceDescriptor());
        err = remote()->transact(CREATE_INPUT_SURFACE, data, &reply);
        if (err != OK) {
            ALOGW("binder transaction failed: %d", err);
            return err;
        }

        err = reply.readInt32();
        if (err != OK) {
            return err;
        }

        *bufferProducer = IGraphicBufferProducer::asInterface(
                reply.readStrongBinder());
        *bufferSource = IGraphicBufferSource::asInterface(
                reply.readStrongBinder());

        return err;
    }
};

class BpOMXNode : public BpInterface<IOMXNode> {
public:
    explicit BpOMXNode(const sp<IBinder> &impl)
@@ -551,7 +477,6 @@ public:
    }
};

IMPLEMENT_META_INTERFACE(OMX, "android.hardware.IOMX");
IMPLEMENT_HYBRID_META_INTERFACE(OMXNode, "android.hardware.IOMXNode");

////////////////////////////////////////////////////////////////////////////////
@@ -562,82 +487,6 @@ IMPLEMENT_HYBRID_META_INTERFACE(OMXNode, "android.hardware.IOMXNode");
            return PERMISSION_DENIED; \
        } } while (0)

status_t BnOMX::onTransact(
    uint32_t code, const Parcel &data, Parcel *reply, uint32_t flags) {
    switch (code) {
        case LIST_NODES:
        {
            CHECK_OMX_INTERFACE(IOMX, data, reply);

            List<ComponentInfo> list;
            listNodes(&list);

            reply->writeInt32(list.size());
            for (List<ComponentInfo>::iterator it = list.begin();
                 it != list.end(); ++it) {
                ComponentInfo &cur = *it;

                reply->writeString8(cur.mName);
                reply->writeInt32(cur.mRoles.size());
                for (List<String8>::iterator role_it = cur.mRoles.begin();
                     role_it != cur.mRoles.end(); ++role_it) {
                    reply->writeString8(*role_it);
                }
            }

            return NO_ERROR;
        }

        case ALLOCATE_NODE:
        {
            CHECK_OMX_INTERFACE(IOMX, data, reply);

            const char *name = data.readCString();

            sp<IOMXObserver> observer =
                interface_cast<IOMXObserver>(data.readStrongBinder());

            if (name == NULL || observer == NULL) {
                ALOGE("b/26392700");
                reply->writeInt32(INVALID_OPERATION);
                return NO_ERROR;
            }

            sp<IOMXNode> omxNode;

            status_t err = allocateNode(name, observer, &omxNode);

            reply->writeInt32(err);
            if (err == OK) {
                reply->writeStrongBinder(IInterface::asBinder(omxNode));
            }

            return NO_ERROR;
        }

        case CREATE_INPUT_SURFACE:
        {
            CHECK_OMX_INTERFACE(IOMX, data, reply);

            sp<IGraphicBufferProducer> bufferProducer;
            sp<IGraphicBufferSource> bufferSource;
            status_t err = createInputSurface(&bufferProducer, &bufferSource);

            reply->writeInt32(err);

            if (err == OK) {
                reply->writeStrongBinder(IInterface::asBinder(bufferProducer));
                reply->writeStrongBinder(IInterface::asBinder(bufferSource));
            }

            return NO_ERROR;
        }

        default:
            return BBinder::onTransact(code, data, reply, flags);
    }
}

status_t BnOMXNode::onTransact(
    uint32_t code, const Parcel &data, Parcel *reply, uint32_t flags) {
    switch (code) {
+1 −10
Original line number Diff line number Diff line
@@ -47,9 +47,8 @@ struct omx_message;

using hardware::media::omx::V1_0::IOmxNode;

class IOMX : public IInterface {
class IOMX : public RefBase {
public:
    DECLARE_META_INTERFACE(OMX);

    typedef uint32_t buffer_id;

@@ -224,14 +223,6 @@ public:
};

////////////////////////////////////////////////////////////////////////////////

class BnOMX : public BnInterface<IOMX> {
public:
    virtual status_t onTransact(
            uint32_t code, const Parcel &data, Parcel *reply,
            uint32_t flags = 0);
};

class BnOMXNode : public BnInterface<IOMXNode> {
public:
    virtual status_t onTransact(
Loading