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

Commit 717e2254 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira Committed by Steve Kondik
Browse files

exynos4: libstragefright: add support for samsung colorformat/omx/mfc

Source:
http://git.insignal.co.kr/samsung/exynos/android/platform/frameworks/av/commit/?h=exynos-jb&id=1614612f7ca2a00473d202dbedcb135fadc608ad

Conflicts:

	media/libstagefright/ACodec.cpp
	media/libstagefright/OMXCodec.cpp

cherry pick from 906eba9f

Change-Id: I1c174f8e9fa9bd3ed16a0399f070b6680f6a331c
parent 1d038e6a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -236,6 +236,9 @@ private:
    status_t submitOutputMetaDataBuffer();
    void signalSubmitOutputMetaDataBufferIfEOS_workaround();
    status_t allocateOutputBuffersFromNativeWindow();
#ifdef USE_SAMSUNG_COLORFORMAT
    void setNativeWindowColorFormat(OMX_COLOR_FORMATTYPE &eNativeColorFormat);
#endif
    status_t cancelBufferToNativeWindow(BufferInfo *info);
    status_t freeOutputBuffersNotOwnedByComponent();
    BufferInfo *dequeueBufferFromNativeWindow();
+3 −0
Original line number Diff line number Diff line
@@ -316,6 +316,9 @@ private:

    status_t allocateBuffers();
    status_t allocateBuffersOnPort(OMX_U32 portIndex);
#ifdef USE_SAMSUNG_COLORFORMAT
    void setNativeWindowColorFormat(OMX_COLOR_FORMATTYPE &eNativeColorFormat);
#endif
    status_t allocateOutputBuffersFromNativeWindow();

    status_t queueBufferToNativeWindow(BufferInfo *info);
+34 −0
Original line number Diff line number Diff line
@@ -51,6 +51,11 @@
#include <OMX_IndexExt.h>

#include "include/ExtendedUtils.h"

#ifdef USE_SAMSUNG_COLORFORMAT
#include <sec_format.h>
#endif

#include "include/avc_utils.h"

#ifdef ENABLE_AV_ENHANCEMENTS
@@ -648,11 +653,22 @@ status_t ACodec::configureOutputBuffersFromNativeWindow(
        return err;
    }

#ifdef USE_SAMSUNG_COLORFORMAT
    OMX_COLOR_FORMATTYPE eNativeColorFormat = def.format.video.eColorFormat;
    setNativeWindowColorFormat(eNativeColorFormat);

    err = native_window_set_buffers_geometry(
    mNativeWindow.get(),
    def.format.video.nFrameWidth,
    def.format.video.nFrameHeight,
    eNativeColorFormat);
#else
    err = native_window_set_buffers_geometry(
            mNativeWindow.get(),
            def.format.video.nFrameWidth,
            def.format.video.nFrameHeight,
            def.format.video.eColorFormat);
#endif

    if (err != 0) {
        ALOGE("native_window_set_buffers_geometry failed: %s (%d)",
@@ -932,6 +948,24 @@ status_t ACodec::submitOutputMetaDataBuffer() {
    return OK;
}

#ifdef USE_SAMSUNG_COLORFORMAT
void ACodec::setNativeWindowColorFormat(OMX_COLOR_FORMATTYPE &eNativeColorFormat)
{
    // In case of Samsung decoders, we set proper native color format for the Native Window
    if (!strcasecmp(mComponentName.c_str(), "OMX.Exynos.AVC.Decoder")) {
        switch (eNativeColorFormat) {
            case OMX_COLOR_FormatYUV420SemiPlanar:
                eNativeColorFormat = (OMX_COLOR_FORMATTYPE)HAL_PIXEL_FORMAT_YCbCr_420_SP;
                break;
            case OMX_COLOR_FormatYUV420Planar:
            default:
                eNativeColorFormat = (OMX_COLOR_FORMATTYPE)HAL_PIXEL_FORMAT_YCbCr_420_P;
                break;
        }
    }
}
#endif

status_t ACodec::cancelBufferToNativeWindow(BufferInfo *info) {
    CHECK_EQ((int)info->mStatus, (int)BufferInfo::OWNED_BY_US);

+10 −0
Original line number Diff line number Diff line
@@ -182,6 +182,16 @@ LOCAL_SHARED_LIBRARIES += \

LOCAL_CFLAGS += -Wno-multichar

ifeq ($(BOARD_USE_SAMSUNG_COLORFORMAT), true)
LOCAL_CFLAGS += -DUSE_SAMSUNG_COLORFORMAT

# Include native color format header path
LOCAL_C_INCLUDES += \
	$(TOP)/hardware/samsung/exynos4/hal/include \
	$(TOP)/hardware/samsung/exynos4/include

endif

LOCAL_MODULE:= libstagefright

LOCAL_MODULE_TAGS := optional
+5 −0
Original line number Diff line number Diff line
@@ -108,7 +108,12 @@ static int32_t getColorFormat(const char* colorFormat) {
    }

    if (!strcmp(colorFormat, CameraParameters::PIXEL_FORMAT_YUV420SP)) {
#ifdef USE_SAMSUNG_COLORFORMAT
        static const int OMX_SEC_COLOR_FormatNV12LPhysicalAddress = 0x7F000002;
        return OMX_SEC_COLOR_FormatNV12LPhysicalAddress;
#else
        return OMX_COLOR_FormatYUV420SemiPlanar;
#endif
    }

    if (!strcmp(colorFormat, CameraParameters::PIXEL_FORMAT_YUV422I)) {
Loading