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

Commit 0d0a8b48 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes I58b03acd,I7d7eb086 into nyc-dev

* changes:
  stagefright: untangle metadata-mode handling
  stagefright: add a way to update native handle in OMX buffers
parents 6393ea69 3e328782
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -39,7 +39,8 @@ LOCAL_SHARED_LIBRARIES := \


LOCAL_C_INCLUDES:= \
LOCAL_C_INCLUDES:= \
	frameworks/av/media/libstagefright \
	frameworks/av/media/libstagefright \
	$(TOP)/frameworks/native/include/media/openmax
	$(TOP)/frameworks/native/include/media/openmax \
	$(TOP)/frameworks/native/include/media/hardware


LOCAL_CFLAGS += -Wno-multichar -Werror -Wall
LOCAL_CFLAGS += -Wno-multichar -Werror -Wall
LOCAL_CLANG := true
LOCAL_CLANG := true
@@ -63,7 +64,8 @@ LOCAL_SHARED_LIBRARIES := \


LOCAL_C_INCLUDES:= \
LOCAL_C_INCLUDES:= \
	frameworks/av/media/libstagefright \
	frameworks/av/media/libstagefright \
	$(TOP)/frameworks/native/include/media/openmax
	$(TOP)/frameworks/native/include/media/openmax \
	$(TOP)/frameworks/native/include/media/hardware


LOCAL_CFLAGS += -Wno-multichar -Werror -Wall
LOCAL_CFLAGS += -Wno-multichar -Werror -Wall
LOCAL_CLANG := true
LOCAL_CLANG := true
+8 −3
Original line number Original line Diff line number Diff line
@@ -118,6 +118,10 @@ public:
            node_id node, OMX_U32 port_index,
            node_id node, OMX_U32 port_index,
            const sp<GraphicBuffer> &graphicBuffer, buffer_id buffer) = 0;
            const sp<GraphicBuffer> &graphicBuffer, buffer_id buffer) = 0;


    virtual status_t updateNativeHandleInMeta(
            node_id node, OMX_U32 port_index,
            const sp<NativeHandle> &nativeHandle, buffer_id buffer) = 0;

    // This will set *type to resulting metadata buffer type on OMX error (not on binder error) as
    // This will set *type to resulting metadata buffer type on OMX error (not on binder error) as
    // well as on success.
    // well as on success.
    virtual status_t createInputSurface(
    virtual status_t createInputSurface(
@@ -272,17 +276,18 @@ struct CodecProfileLevel {
    OMX_U32 mLevel;
    OMX_U32 mLevel;
};
};


}  // namespace android
inline static const char *asString(MetadataBufferType i, const char *def = "??") {

inline static const char *asString(android::MetadataBufferType i, const char *def = "??") {
    using namespace android;
    using namespace android;
    switch (i) {
    switch (i) {
        case kMetadataBufferTypeCameraSource:   return "CameraSource";
        case kMetadataBufferTypeCameraSource:   return "CameraSource";
        case kMetadataBufferTypeGrallocSource:  return "GrallocSource";
        case kMetadataBufferTypeGrallocSource:  return "GrallocSource";
        case kMetadataBufferTypeANWBuffer:      return "ANWBuffer";
        case kMetadataBufferTypeANWBuffer:      return "ANWBuffer";
        case kMetadataBufferTypeNativeHandleSource: return "NativeHandleSource";
        case kMetadataBufferTypeInvalid:        return "Invalid";
        case kMetadataBufferTypeInvalid:        return "Invalid";
        default:                                return def;
        default:                                return def;
    }
    }
}
}


}  // namespace android

#endif  // ANDROID_IOMX_H_
#endif  // ANDROID_IOMX_H_
+4 −3
Original line number Original line Diff line number Diff line
@@ -28,6 +28,7 @@
#include <utils/List.h>
#include <utils/List.h>
#include <utils/RefBase.h>
#include <utils/RefBase.h>
#include <utils/String16.h>
#include <utils/String16.h>
#include <MetadataBufferType.h>


namespace android {
namespace android {


@@ -118,11 +119,11 @@ public:
     * Tell whether this camera source stores meta data or real YUV
     * Tell whether this camera source stores meta data or real YUV
     * frame data in video buffers.
     * frame data in video buffers.
     *
     *
     * @return true if meta data is stored in the video
     * @return a valid type if meta data is stored in the video
     *      buffers; false if real YUV data is stored in
     *      buffers; kMetadataBufferTypeInvalid if real YUV data is stored in
     *      the video buffers.
     *      the video buffers.
     */
     */
    bool isMetaDataStoredInVideoBuffers() const;
    MetadataBufferType metaDataStoredInVideoBuffers() const;


    virtual void signalBufferReturned(MediaBuffer* buffer);
    virtual void signalBufferReturned(MediaBuffer* buffer);


+0 −1
Original line number Original line Diff line number Diff line
@@ -37,7 +37,6 @@ struct MediaCodecSource : public MediaSource,
                          public MediaBufferObserver {
                          public MediaBufferObserver {
    enum FlagBits {
    enum FlagBits {
        FLAG_USE_SURFACE_INPUT      = 1,
        FLAG_USE_SURFACE_INPUT      = 1,
        FLAG_USE_METADATA_INPUT     = 2,
        FLAG_PREFER_SOFTWARE_CODEC  = 4,  // used for testing only
        FLAG_PREFER_SOFTWARE_CODEC  = 4,  // used for testing only
    };
    };


+8 −3
Original line number Original line Diff line number Diff line
@@ -25,6 +25,8 @@
#include <media/stagefright/MediaSource.h>
#include <media/stagefright/MediaSource.h>
#include <media/stagefright/MediaBuffer.h>
#include <media/stagefright/MediaBuffer.h>


#include <MetadataBufferType.h>

#include "foundation/ABase.h"
#include "foundation/ABase.h"


namespace android {
namespace android {
@@ -109,9 +111,9 @@ public:
    void dump(String8& result, const char* prefix, char* buffer,
    void dump(String8& result, const char* prefix, char* buffer,
                                                    size_t SIZE) const;
                                                    size_t SIZE) const;


    // isMetaDataStoredInVideoBuffers tells the encoder whether we will
    // metaDataStoredInVideoBuffers tells the encoder what kind of metadata
    // pass metadata through the buffers. Currently, it is force set to true
    // is passed through the buffers. Currently, it is set to ANWBuffer
    bool isMetaDataStoredInVideoBuffers() const;
    MetadataBufferType metaDataStoredInVideoBuffers() const;


    sp<IGraphicBufferProducer> getProducer() const { return mProducer; }
    sp<IGraphicBufferProducer> getProducer() const { return mProducer; }


@@ -234,6 +236,9 @@ private:


    Condition mMediaBuffersAvailableCondition;
    Condition mMediaBuffersAvailableCondition;


    // Allocate and return a new MediaBuffer and pass the ANW buffer as metadata into it.
    void passMetadataBuffer_l(MediaBuffer **buffer, ANativeWindowBuffer *bufferHandle) const;

    // Avoid copying and equating and default constructor
    // Avoid copying and equating and default constructor
    DISALLOW_EVIL_CONSTRUCTORS(SurfaceMediaSource);
    DISALLOW_EVIL_CONSTRUCTORS(SurfaceMediaSource);
};
};
Loading