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

Commit 2351e69a authored by James Dong's avatar James Dong Committed by Android (Google) Code Review
Browse files

Merge "OMX extension to support storing meta data in video input buffers during recording"

parents 2191b4b2 387e38dd
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -79,6 +79,9 @@ public:
            node_id node, OMX_INDEXTYPE index,
            const void *params, size_t size) = 0;

    virtual status_t storeMetaDataInBuffers(
            node_id node, OMX_U32 port_index, OMX_BOOL enable) = 0;

    virtual status_t enableGraphicBuffers(
            node_id node, OMX_U32 port_index, OMX_BOOL enable) = 0;

+26 −0
Original line number Diff line number Diff line
@@ -49,6 +49,32 @@ struct EnableAndroidNativeBuffersParams {
    OMX_BOOL enable;
};

// A pointer to this struct is passed to OMX_SetParameter() when the extension
// index "OMX.google.android.index.storeMetaDataInBuffers"
// is given.
//
// When meta data is stored in the video buffers passed between OMX clients
// and OMX components, interpretation of the buffer data is up to the
// buffer receiver, and the data may or may not be the actual video data, but
// some information helpful for the receiver to locate the actual data.
// The buffer receiver thus needs to know how to interpret what is stored
// in these buffers, with mechanisms pre-determined externally. How to
// interpret the meta data is outside of the scope of this method.
//
// Currently, this is specifically used to pass meta data from video source
// (camera component, for instance) to video encoder to avoid memcpying of
// input video frame data. To do this, bStoreMetaDta is set to OMX_TRUE.
// If bStoreMetaData is set to false, real YUV frame data will be stored
// in the buffers. In addition, if no OMX_SetParameter() call is made
// with the corresponding extension index, real YUV data is stored
// in the buffers.
struct StoreMetaDataInBuffersParams {
    OMX_U32 nSize;
    OMX_VERSIONTYPE nVersion;
    OMX_U32 nPortIndex;
    OMX_BOOL bStoreMetaData;
};

// Color formats in the range [OMX_COLOR_FormatAndroidPrivateStart,
// OMX_COLOR_FormatAndroidPrivateEnd) will be converted to a gralloc pixel
// format when used to allocate Android native buffers via gralloc.  The
+28 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ enum {
    ENABLE_GRAPHIC_BUFFERS,
    USE_BUFFER,
    USE_GRAPHIC_BUFFER,
    STORE_META_DATA_IN_BUFFERS,
    ALLOC_BUFFER,
    ALLOC_BUFFER_WITH_BACKUP,
    FREE_BUFFER,
@@ -276,6 +277,19 @@ public:
        return err;
    }

    virtual status_t storeMetaDataInBuffers(
            node_id node, OMX_U32 port_index, OMX_BOOL enable) {
        Parcel data, reply;
        data.writeInterfaceToken(IOMX::getInterfaceDescriptor());
        data.writeIntPtr((intptr_t)node);
        data.writeInt32(port_index);
        data.writeInt32((uint32_t)enable);
        remote()->transact(STORE_META_DATA_IN_BUFFERS, data, &reply);

        status_t err = reply.readInt32();
        return err;
    }

    virtual status_t allocateBuffer(
            node_id node, OMX_U32 port_index, size_t size,
            buffer_id *buffer, void **buffer_data) {
@@ -634,6 +648,20 @@ status_t BnOMX::onTransact(
            return NO_ERROR;
        }

        case STORE_META_DATA_IN_BUFFERS:
        {
            CHECK_INTERFACE(IOMX, data, reply);

            node_id node = (void*)data.readIntPtr();
            OMX_U32 port_index = data.readInt32();
            OMX_BOOL enable = (OMX_BOOL)data.readInt32();

            status_t err = storeMetaDataInBuffers(node, port_index, enable);
            reply->writeInt32(err);

            return NO_ERROR;
        }

        case ALLOC_BUFFER:
        {
            CHECK_INTERFACE(IOMX, data, reply);
+3 −0
Original line number Diff line number Diff line
@@ -62,6 +62,9 @@ public:
    virtual status_t enableGraphicBuffers(
            node_id node, OMX_U32 port_index, OMX_BOOL enable);

    virtual status_t storeMetaDataInBuffers(
            node_id node, OMX_U32 port_index, OMX_BOOL enable);

    virtual status_t useBuffer(
            node_id node, OMX_U32 port_index, const sp<IMemory> &params,
            buffer_id *buffer);
+1 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ struct OMXNodeInstance {
    status_t setConfig(OMX_INDEXTYPE index, const void *params, size_t size);

    status_t enableGraphicBuffers(OMX_U32 portIndex, OMX_BOOL enable);
    status_t storeMetaDataInBuffers(OMX_U32 portIndex, OMX_BOOL enable);

    status_t useBuffer(
            OMX_U32 portIndex, const sp<IMemory> &params,
Loading