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

Commit ba4b1a88 authored by Ananda Kishore's avatar Ananda Kishore Committed by Ricardo Cerqueira
Browse files

libstagefright: Framework changes for video bringup



 -Modified the makefile to define the correct macros depending on the target.
 -Added changes to select the proper video output color format for each target using
the macros defined in the makefile.
 -Modified the thumbnail generation logic to select HW decoders for supported targets.

Patchset 1: Add QCOM_HARDWARE ifdefs and rename TARGET_BOARD stuff.
Patchset 2: Fix ifdef for 8x60 for non-qcom hardware.

Conflicts:

	media/libstagefright/Android.mk

Change-Id: Ia034fb025c116a79937e70101e93fcc478898e8a
Signed-off-by: default avatarEvan McClain <aeroevan@gmail.com>
parent 81fa9c88
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

ifeq ($(BOARD_USES_QCOM_HARDWARE),true)
ifeq ($(TARGET_BOARD_PLATFORM),msm7x27a)
    LOCAL_CFLAGS += -DUSE_AAC_HW_DEC
endif

ifeq ($(TARGET_BOARD_PLATFORM),msm7k)
    LOCAL_CFLAGS += -DTARGET7x27
endif
ifeq ($(TARGET_BOARD_PLATFORM),msm7x27a)
    LOCAL_CFLAGS += -DTARGET7x27A
endif
ifeq ($(TARGET_BOARD_PLATFORM),msm7x30)
    LOCAL_CFLAGS += -DTARGET7x30
endif
ifeq ($(TARGET_BOARD_PLATFORM),qsd8k)
    LOCAL_CFLAGS += -DTARGET8x50
endif
ifeq ($(TARGET_BOARD_PLATFORM),msm8660)
    LOCAL_CFLAGS += -DTARGET8x60
endif
endif
include frameworks/base/media/libstagefright/codecs/common/Config.mk

LOCAL_SRC_FILES:=                         \
+17 −3
Original line number Diff line number Diff line
@@ -633,7 +633,7 @@ sp<MediaSource> OMXCodec::Create(
            }
        }

        LOGV("Attempting to allocate OMX node '%s'", componentName);
        LOGE("Attempting to allocate OMX node '%s'", componentName);

        uint32_t quirks = getComponentQuirks(componentNameBase, createEncoder);
#ifdef QCOM_HARDWARE
@@ -673,7 +673,7 @@ sp<MediaSource> OMXCodec::Create(

        status_t err = omx->allocateNode(componentName, observer, &node);
        if (err == OK) {
            LOGV("Successfully allocated OMX node '%s'", componentName);
            LOGE("Successfully allocated OMX node '%s'", componentName);

            sp<OMXCodec> codec = new OMXCodec(
                    omx, node, quirks, flags,
@@ -1786,8 +1786,22 @@ status_t OMXCodec::setVideoOutputFormat(
        OMX_VIDEO_PARAM_PORTFORMATTYPE format;
        InitOMXParams(&format);
        format.nPortIndex = kPortIndexOutput;
#ifdef QCOM_HARDWARE
        if (!strncmp(mComponentName, "OMX.qcom",8)) {
            int32_t reqdColorFormat = ColorFormatInfo::getPreferredColorFormat(mOMXLivesLocally);
            for(format.nIndex = 0;
                    (OK == mOMX->getParameter(mNode, OMX_IndexParamVideoPortFormat, &format, sizeof(format)));
                    format.nIndex++) {
                if(format.eColorFormat == reqdColorFormat)
                    break;
            }
        } else
#endif
        format.nIndex = 0;

        CODEC_LOGV("Video O/P format.nIndex 0x%x",format.nIndex);
        CODEC_LOGE("Video O/P format.eColorFormat 0x%x",format.eColorFormat);

        status_t err = mOMX->getParameter(
                mNode, OMX_IndexParamVideoPortFormat,
                &format, sizeof(format));
@@ -4378,7 +4392,7 @@ void OMXCodec::setG711Format(int32_t numChannels) {

void OMXCodec::setImageOutputFormat(
        OMX_COLOR_FORMATTYPE format, OMX_U32 width, OMX_U32 height) {
    CODEC_LOGV("setImageOutputFormat(%ld, %ld)", width, height);
    CODEC_LOGE("setImageOutputFormat(%ld, %ld)", width, height);

#if 0
    OMX_INDEXTYPE index;
+23 −3
Original line number Diff line number Diff line
@@ -348,19 +348,39 @@ VideoFrame *StagefrightMetadataRetriever::getFrameAtTime(
        memcpy(mAlbumArt->mData, data, dataSize);
    }

#ifdef QCOM_HARDWARE
    const char *mime;
    bool success = trackMeta->findCString(kKeyMIMEType, &mime);
    CHECK(success);
    VideoFrame *frame = NULL;

    if ((!strcmp(mime, MEDIA_MIMETYPE_VIDEO_DIVX))||
            (!strcmp(mime, MEDIA_MIMETYPE_VIDEO_DIVX311))||
            (!strcmp(mime, MEDIA_MIMETYPE_VIDEO_DIVX4))||
            (!strcmp(mime, MEDIA_MIMETYPE_VIDEO_WMV)))
    {
        LOGV("Software codec is not being used for %s clips for thumbnail ",
            mime);
    } else {
        frame = extractVideoFrameWithCodecFlags(
#else
    VideoFrame *frame =
        extractVideoFrameWithCodecFlags(
#endif
                &mClient, trackMeta, source, OMXCodec::kPreferSoftwareCodecs,
                timeUs, option);
#ifdef QCOM_HARDWARE
    }
#endif

#if defined(TARGET8x60) || !defined(QCOM_HARDWARE)
    if (frame == NULL) {
        LOGV("Software decoder failed to extract thumbnail, "
             "trying hardware decoder.");

            frame = extractVideoFrameWithCodecFlags(&mClient, trackMeta, source, 0,
                        timeUs, option);
    }

#endif
    return frame;
}