fix for issue 4142219
Don't hard code platform-specific limitations
engine part.
Change-Id: Ibc8a539e5bbac738f60ef935670a333b7017e20e
diff --git a/libvideoeditor/lvpp/PreviewPlayer.cpp b/libvideoeditor/lvpp/PreviewPlayer.cpp
index f94e2b3..b70ff4a 100755
--- a/libvideoeditor/lvpp/PreviewPlayer.cpp
+++ b/libvideoeditor/lvpp/PreviewPlayer.cpp
@@ -1632,78 +1632,12 @@
/* reset boolean for each clip*/
mVideoResizedOrCropped = false;
- switch(outputVideoSize) {
- case M4VIDEOEDITING_kSQCIF:
- mOutputVideoWidth = 128;
- mOutputVideoHeight = 96;
- break;
+ status_t err = OK;
+ /* get the video width and height by resolution */
+ err = getVideoSizeByResolution(outputVideoSize,
+ &mOutputVideoWidth, &mOutputVideoHeight);
- 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;
- }
-
- return OK;
+ return err;
}
M4OSA_ERR PreviewPlayer::doMediaRendering() {
diff --git a/libvideoeditor/lvpp/VideoEditorPreviewController.cpp b/libvideoeditor/lvpp/VideoEditorPreviewController.cpp
index c174585..f99ca79 100755
--- a/libvideoeditor/lvpp/VideoEditorPreviewController.cpp
+++ b/libvideoeditor/lvpp/VideoEditorPreviewController.cpp
@@ -1376,85 +1376,18 @@
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;
+ status_t err = OK;
+ /* get the video width and height by resolution */
+ err = getVideoSizeByResolution(outputVideoSize,
+ &mOutputVideoWidth, &mOutputVideoHeight);
- 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;
- }
-
- return OK;
+ return err;
}
M4OSA_ERR VideoEditorPreviewController::doImageRenderingMode(
diff --git a/libvideoeditor/lvpp/VideoEditorPreviewController.h b/libvideoeditor/lvpp/VideoEditorPreviewController.h
index 18b61b5..01fc65b 100755
--- a/libvideoeditor/lvpp/VideoEditorPreviewController.h
+++ b/libvideoeditor/lvpp/VideoEditorPreviewController.h
@@ -86,7 +86,7 @@
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:
diff --git a/libvideoeditor/lvpp/VideoEditorTools.cpp b/libvideoeditor/lvpp/VideoEditorTools.cpp
index 3394b64..c7c3650 100755
--- a/libvideoeditor/lvpp/VideoEditorTools.cpp
+++ b/libvideoeditor/lvpp/VideoEditorTools.cpp
@@ -3575,3 +3575,100 @@
}
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;
+}
diff --git a/libvideoeditor/lvpp/VideoEditorTools.h b/libvideoeditor/lvpp/VideoEditorTools.h
index 0552799..f39ed90 100755
--- a/libvideoeditor/lvpp/VideoEditorTools.h
+++ b/libvideoeditor/lvpp/VideoEditorTools.h
@@ -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 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