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

Commit 89869f69 authored by Lajos Molnar's avatar Lajos Molnar
Browse files

stagefright: enable decoder color format selection

Bug: 10706245
Change-Id: I9a77631bfae0358be229b079228c1fcae0e77faf
parent b382340f
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -238,7 +238,7 @@ private:
    status_t setSupportedOutputFormat();
    status_t setSupportedOutputFormat();


    status_t setupVideoDecoder(
    status_t setupVideoDecoder(
            const char *mime, int32_t width, int32_t height);
            const char *mime, const sp<AMessage> &msg);


    status_t setupVideoEncoder(
    status_t setupVideoEncoder(
            const char *mime, const sp<AMessage> &msg);
            const char *mime, const sp<AMessage> &msg);
+22 −9
Original line number Original line Diff line number Diff line
@@ -1267,13 +1267,7 @@ status_t ACodec::configureCodec(
        if (encoder) {
        if (encoder) {
            err = setupVideoEncoder(mime, msg);
            err = setupVideoEncoder(mime, msg);
        } else {
        } else {
            int32_t width, height;
            err = setupVideoDecoder(mime, msg);
            if (!msg->findInt32("width", &width)
                    || !msg->findInt32("height", &height)) {
                err = INVALID_OPERATION;
            } else {
                err = setupVideoDecoder(mime, width, height);
            }
        }
        }
    } else if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_MPEG)) {
    } else if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_MPEG)) {
        int32_t numChannels, sampleRate;
        int32_t numChannels, sampleRate;
@@ -1883,7 +1877,13 @@ static status_t GetMimeTypeForVideoCoding(
}
}


status_t ACodec::setupVideoDecoder(
status_t ACodec::setupVideoDecoder(
        const char *mime, int32_t width, int32_t height) {
        const char *mime, const sp<AMessage> &msg) {
    int32_t width, height;
    if (!msg->findInt32("width", &width)
            || !msg->findInt32("height", &height)) {
        return INVALID_OPERATION;
    }

    OMX_VIDEO_CODINGTYPE compressionFormat;
    OMX_VIDEO_CODINGTYPE compressionFormat;
    status_t err = GetVideoCodingTypeFromMime(mime, &compressionFormat);
    status_t err = GetVideoCodingTypeFromMime(mime, &compressionFormat);


@@ -1898,7 +1898,20 @@ status_t ACodec::setupVideoDecoder(
        return err;
        return err;
    }
    }


    int32_t tmp;
    if (msg->findInt32("color-format", &tmp)) {
        OMX_COLOR_FORMATTYPE colorFormat =
            static_cast<OMX_COLOR_FORMATTYPE>(tmp);
        err = setVideoPortFormatType(
                kPortIndexOutput, OMX_VIDEO_CodingUnused, colorFormat);
        if (err != OK) {
            ALOGW("[%s] does not support color format %d",
                  mComponentName.c_str(), colorFormat);
            err = setSupportedOutputFormat();
            err = setSupportedOutputFormat();
        }
    } else {
        err = setSupportedOutputFormat();
    }


    if (err != OK) {
    if (err != OK) {
        return err;
        return err;