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

Commit 99908375 authored by Praveen Chavan's avatar Praveen Chavan Committed by Chien-Yu Chen
Browse files

media: Add a metadata type for native handle from camera

A payload of type kMetadataBufferTypeNativeHandleSource will
correspond to VideoNativeHandleMetadata which contains a
native_handle_t.

Bug: 26268807
Change-Id: I9805fc74c4b086b65ad57ac06385e12f255ada5b
parent abc47e39
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -120,6 +120,17 @@ struct VideoNativeMetadata {
    int nFenceFd;                           // -1 if unused
};

// Meta data buffer layout for passing a native_handle to codec
struct VideoNativeHandleMetadata {
    MetadataBufferType eType;               // must be kMetadataBufferTypeNativeHandleSource

#ifdef OMX_ANDROID_COMPILE_AS_32BIT_ON_64BIT_PLATFORMS
    OMX_PTR pHandle;
#else
    native_handle_t *pHandle;
#endif
};

// A pointer to this struct is passed to OMX_SetParameter() when the extension
// index "OMX.google.android.index.prepareForAdaptivePlayback" is given.
//
+22 −0
Original line number Diff line number Diff line
@@ -111,6 +111,28 @@ typedef enum {
     */
    kMetadataBufferTypeANWBuffer = 2,

    /*
     * kMetadataBufferTypeNativeHandleSource is used to indicate that
     * the payload of the metadata buffers can be interpreted as
     * a native_handle_t.
     *
     * In this case, the metadata that the encoder receives
     * will have a byte stream that consists of two parts:
     * 1. First, there is an integer indicating that the metadata contains a
     * native handle (kMetadataBufferTypeNativeHandleSource).
     * 2. This is followed by a pointer to native_handle_t. The encoder needs
     * to interpret this native handle and encode the frame. The encoder must
     * not free this native handle as it does not actually own this native
     * handle. The handle will be freed after the encoder releases the buffer
     * back to camera.
     * ----------------------------------------------------------------
     * |  kMetadataBufferTypeNativeHandleSource | native_handle_t* nh |
     * ----------------------------------------------------------------
     *
     * See the VideoNativeHandleMetadata structure.
     */
    kMetadataBufferTypeNativeHandleSource = 3,

    /* This value is used by framework, but is never used inside a metadata buffer  */
    kMetadataBufferTypeInvalid = -1,