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

Commit 8806b706 authored by Hong Teng's avatar Hong Teng
Browse files

fix for issue 4142219

Don't hard code platform-specific limitations
engine part.

Change-Id: Ibc8a539e5bbac738f60ef935670a333b7017e20e
parent 460ba2a3
Loading
Loading
Loading
Loading
+5 −71
Original line number Diff line number Diff line
@@ -1632,78 +1632,12 @@ status_t PreviewPlayer::setMediaRenderingMode(
    /* reset boolean for each clip*/
    mVideoResizedOrCropped = false;

    switch(outputVideoSize) {
        case M4VIDEOEDITING_kSQCIF:
            mOutputVideoWidth = 128;
            mOutputVideoHeight = 96;
            break;

        case M4VIDEOEDITING_kQQVGA:
            mOutputVideoWidth = 160;
            mOutputVideoHeight = 120;
            break;

        case M4VIDEOEDITING_kQCIF:
            mOutputVideoWidth = 176;
            mOutputVideoHeight = 144;
            break;

        case M4VIDEOEDITING_kQVGA:
            mOutputVideoWidth = 320;
            mOutputVideoHeight = 240;
            break;

        case M4VIDEOEDITING_kCIF:
            mOutputVideoWidth = 352;
            mOutputVideoHeight = 288;
            break;

        case M4VIDEOEDITING_kVGA:
            mOutputVideoWidth = 640;
            mOutputVideoHeight = 480;
            break;

        case M4VIDEOEDITING_kWVGA:
            mOutputVideoWidth = 800;
            mOutputVideoHeight = 480;
            break;

        case M4VIDEOEDITING_kNTSC:
            mOutputVideoWidth = 720;
            mOutputVideoHeight = 480;
            break;

        case M4VIDEOEDITING_k640_360:
            mOutputVideoWidth = 640;
            mOutputVideoHeight = 360;
            break;

        case M4VIDEOEDITING_k854_480:
            mOutputVideoWidth = 854;
            mOutputVideoHeight = 480;
            break;

        case M4VIDEOEDITING_kHD1280:
            mOutputVideoWidth = 1280;
            mOutputVideoHeight = 720;
            break;

        case M4VIDEOEDITING_kHD1080:
            mOutputVideoWidth = 1080;
            mOutputVideoHeight = 720;
            break;

        case M4VIDEOEDITING_kHD960:
            mOutputVideoWidth = 960;
            mOutputVideoHeight = 720;
            break;

        default:
            LOGE("unsupported output video size set");
            return BAD_VALUE;
    }
    status_t err = OK;
    /* get the video width and height by resolution */
    err = getVideoSizeByResolution(outputVideoSize,
              &mOutputVideoWidth, &mOutputVideoHeight);

    return OK;
    return err;
}

M4OSA_ERR PreviewPlayer::doMediaRendering() {
+6 −73
Original line number Diff line number Diff line
@@ -1376,85 +1376,18 @@ M4OSA_ERR VideoEditorPreviewController::applyVideoEffect(
    return err;
}

M4OSA_ERR VideoEditorPreviewController::setPreviewFrameRenderingMode(
status_t VideoEditorPreviewController::setPreviewFrameRenderingMode(
    M4xVSS_MediaRendering mode, M4VIDEOEDITING_VideoFrameSize outputVideoSize) {

    LOGV("setMediaRenderingMode: outputVideoSize = %d", outputVideoSize);
    mRenderingMode = mode;

    switch(outputVideoSize) {
        case M4VIDEOEDITING_kSQCIF:
            mOutputVideoWidth = 128;
            mOutputVideoHeight = 96;
            break;

        case M4VIDEOEDITING_kQQVGA:
            mOutputVideoWidth = 160;
            mOutputVideoHeight = 120;
            break;

        case M4VIDEOEDITING_kQCIF:
            mOutputVideoWidth = 176;
            mOutputVideoHeight = 144;
            break;

        case M4VIDEOEDITING_kQVGA:
            mOutputVideoWidth = 320;
            mOutputVideoHeight = 240;
            break;

        case M4VIDEOEDITING_kCIF:
            mOutputVideoWidth = 352;
            mOutputVideoHeight = 288;
            break;

        case M4VIDEOEDITING_kVGA:
            mOutputVideoWidth = 640;
            mOutputVideoHeight = 480;
            break;

        case M4VIDEOEDITING_kWVGA:
            mOutputVideoWidth = 800;
            mOutputVideoHeight = 480;
            break;

        case M4VIDEOEDITING_kNTSC:
            mOutputVideoWidth = 720;
            mOutputVideoHeight = 480;
            break;

        case M4VIDEOEDITING_k640_360:
            mOutputVideoWidth = 640;
            mOutputVideoHeight = 360;
            break;

        case M4VIDEOEDITING_k854_480:
            mOutputVideoWidth = 854;
            mOutputVideoHeight = 480;
            break;

        case M4VIDEOEDITING_kHD1280:
            mOutputVideoWidth = 1280;
            mOutputVideoHeight = 720;
            break;

        case M4VIDEOEDITING_kHD1080:
            mOutputVideoWidth = 1080;
            mOutputVideoHeight = 720;
            break;

        case M4VIDEOEDITING_kHD960:
            mOutputVideoWidth = 960;
            mOutputVideoHeight = 720;
            break;

        default:
            mOutputVideoWidth = 0;
            mOutputVideoHeight = 0;
            break;
    }
    status_t err = OK;
    /* get the video width and height by resolution */
    err = getVideoSizeByResolution(outputVideoSize,
              &mOutputVideoWidth, &mOutputVideoHeight);

    return OK;
    return err;
}

M4OSA_ERR VideoEditorPreviewController::doImageRenderingMode(
+1 −1
Original line number Diff line number Diff line
@@ -86,7 +86,7 @@ public:
    M4OSA_Void setJniCallback(void* cookie,
        jni_progress_callback_fct callbackFct);

    M4OSA_ERR setPreviewFrameRenderingMode(M4xVSS_MediaRendering mode,
    status_t setPreviewFrameRenderingMode(M4xVSS_MediaRendering mode,
        M4VIDEOEDITING_VideoFrameSize outputVideoSize);

private:
+97 −0
Original line number Diff line number Diff line
@@ -3575,3 +3575,100 @@ M4OSA_ERR applyEffectsAndRenderingMode(vePostProcessParams *params,
    }
    return M4NO_ERROR;
}

android::status_t getVideoSizeByResolution(
                      M4VIDEOEDITING_VideoFrameSize resolution,
                      uint32_t *pWidth, uint32_t *pHeight) {

    uint32_t frameWidth, frameHeight;

    if (pWidth == NULL) {
        LOGE("getVideoFrameSizeByResolution invalid pointer for pWidth");
        return android::BAD_VALUE;
    }
    if (pHeight == NULL) {
        LOGE("getVideoFrameSizeByResolution invalid pointer for pHeight");
        return android::BAD_VALUE;
    }

    switch (resolution) {
        case M4VIDEOEDITING_kSQCIF:
            frameWidth = 128;
            frameHeight = 96;
            break;

        case M4VIDEOEDITING_kQQVGA:
            frameWidth = 160;
            frameHeight = 120;
            break;

        case M4VIDEOEDITING_kQCIF:
            frameWidth = 176;
            frameHeight = 144;
            break;

        case M4VIDEOEDITING_kQVGA:
            frameWidth = 320;
            frameHeight = 240;
            break;

        case M4VIDEOEDITING_kCIF:
            frameWidth = 352;
            frameHeight = 288;
            break;

        case M4VIDEOEDITING_kVGA:
            frameWidth = 640;
            frameHeight = 480;
            break;

        case M4VIDEOEDITING_kWVGA:
            frameWidth = 800;
            frameHeight = 480;
            break;

        case M4VIDEOEDITING_kNTSC:
            frameWidth = 720;
            frameHeight = 480;
            break;

        case M4VIDEOEDITING_k640_360:
            frameWidth = 640;
            frameHeight = 360;
            break;

        case M4VIDEOEDITING_k854_480:
            frameWidth = 854;
            frameHeight = 480;
            break;

        case M4VIDEOEDITING_k1280_720:
            frameWidth = 1280;
            frameHeight = 720;
            break;

        case M4VIDEOEDITING_k1080_720:
            frameWidth = 1080;
            frameHeight = 720;
            break;

        case M4VIDEOEDITING_k960_720:
            frameWidth = 960;
            frameHeight = 720;
            break;

        case M4VIDEOEDITING_k1920_1080:
            frameWidth = 1920;
            frameHeight = 1080;
            break;

        default:
            LOGE("Unsupported video resolution %d.", resolution);
            return android::BAD_VALUE;
    }

    *pWidth = frameWidth;
    *pHeight = frameHeight;

    return android::OK;
}
+4 −2
Original line number Diff line number Diff line
@@ -29,11 +29,10 @@
#include "M4VSS3GPP_API.h"
#include "M4xVSS_API.h"
#include "M4xVSS_Internal.h"

#include "M4AIR_API.h"
#include "PreviewRenderer.h"
#define MEDIA_RENDERING_INVALID 255

#define MEDIA_RENDERING_INVALID 255
#define TRANSPARENT_COLOR 0x7E0
#define LUM_FACTOR_MAX 10
enum {
@@ -137,4 +136,7 @@ M4OSA_ERR applyLumaEffect(M4VSS3GPP_VideoEffectType videoEffect,
M4OSA_ERR applyEffectsAndRenderingMode(vePostProcessParams *params,
    M4OSA_UInt32 reportedWidth, M4OSA_UInt32 reportedHeight);

android::status_t getVideoSizeByResolution(M4VIDEOEDITING_VideoFrameSize resolution,
    uint32_t *pWidth, uint32_t *pHeight);

#endif // ANDROID_VE_TOOLS_H
Loading