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

Commit 9c305324 authored by pgudadhe's avatar pgudadhe Committed by Dima Zavin
Browse files

libstagefright: Enable tegra hw encoder

Change-Id: Ifed6b4dc4877e3fcab86ee81c9117a92b1d1ce8f
parent cdea9193
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -199,6 +199,7 @@ static const CodecInfo kEncoderInfo[] = {
    { MEDIA_MIMETYPE_VIDEO_AVC, "OMX.qcom.7x30.video.encoder.avc" },
    { MEDIA_MIMETYPE_VIDEO_AVC, "OMX.qcom.video.encoder.avc" },
    { MEDIA_MIMETYPE_VIDEO_AVC, "OMX.TI.Video.encoder" },
    { MEDIA_MIMETYPE_VIDEO_AVC, "OMX.Nvidia.h264.encoder" },
    { MEDIA_MIMETYPE_VIDEO_AVC, "AVCEncoder" },
//    { MEDIA_MIMETYPE_VIDEO_AVC, "OMX.PV.avcenc" },
};
@@ -854,6 +855,10 @@ void OMXCodec::setVideoInputFormat(
    OMX_COLOR_FORMATTYPE colorFormat;
    CHECK_EQ(OK, findTargetColorFormat(meta, &colorFormat));

    if (!strcasecmp("OMX.Nvidia.h264.encoder", mComponentName)) {
        colorFormat = OMX_COLOR_FormatYUV420Planar;
    }

    status_t err;
    OMX_PARAM_PORTDEFINITIONTYPE def;
    OMX_VIDEO_PORTDEFINITIONTYPE *video_def = &def.format.video;
@@ -1193,6 +1198,10 @@ status_t OMXCodec::setupAVCEncoderParameters(const sp<MetaData>& meta) {
    h264type.bMBAFF = OMX_FALSE;
    h264type.eLoopFilterMode = OMX_VIDEO_AVCLoopFilterEnable;

    if (!strcasecmp("OMX.Nvidia.h264.encoder", mComponentName)) {
        h264type.eLevel = OMX_VIDEO_AVCLevelMax;
    }

    err = mOMX->setParameter(
            mNode, OMX_IndexParamVideoAvc, &h264type, sizeof(h264type));
    CHECK_EQ(err, OK);