summaryrefslogtreecommitdiffstats
path: root/media/jni
diff options
context:
space:
mode:
authorDheeraj Sharma <dheerajs@google.com>2011-01-24 14:46:30 -0800
committerDheeraj Sharma <dheerajs@google.com>2011-01-24 22:52:40 -0800
commit1ac760afabeb19ced48a788c7b675baba47d4db3 (patch)
tree9e11c5184cf01072905956ae25474701e7200f25 /media/jni
parent4989aa7da319e4fcf95a92c4a2d6f2cf1ed6d563 (diff)
downloadframeworks_base-1ac760afabeb19ced48a788c7b675baba47d4db3.zip
frameworks_base-1ac760afabeb19ced48a788c7b675baba47d4db3.tar.gz
frameworks_base-1ac760afabeb19ced48a788c7b675baba47d4db3.tar.bz2
Issue no : 3370622
VideoEditor: Fix for Clear Surface API Change-Id: I8d4ad90dd2a0d37bd5363c36582a16f08b161bee
Diffstat (limited to 'media/jni')
-rwxr-xr-xmedia/jni/mediaeditor/VideoEditorMain.cpp82
1 files changed, 8 insertions, 74 deletions
diff --git a/media/jni/mediaeditor/VideoEditorMain.cpp b/media/jni/mediaeditor/VideoEditorMain.cpp
index 1751396..8ce788b 100755
--- a/media/jni/mediaeditor/VideoEditorMain.cpp
+++ b/media/jni/mediaeditor/VideoEditorMain.cpp
@@ -261,9 +261,7 @@ videoEditor_generateClip(
static void videoEditor_clearSurface(JNIEnv* pEnv,
jobject thiz,
- jobject surface,
- jint width,
- jint height);
+ jobject surface);
static JNINativeMethod gManualEditMethods[] = {
{"getVersion", "()L"VERSION_CLASS_NAME";",
@@ -300,7 +298,7 @@ static JNINativeMethod gManualEditMethods[] = {
(int *)videoEditor_generateAudioRawFile },
{"nativeGenerateClip", "(L"EDIT_SETTINGS_CLASS_NAME";)I",
(void *)videoEditor_generateClip },
- {"nativeClearSurface", "(Landroid/view/Surface;II)V",
+ {"nativeClearSurface", "(Landroid/view/Surface;)V",
(void *)videoEditor_clearSurface },
};
@@ -428,16 +426,15 @@ static void videoEditor_stopPreview(JNIEnv* pEnv,
static void videoEditor_clearSurface(JNIEnv* pEnv,
jobject thiz,
- jobject surface,
- jint width,
- jint height)
+ jobject surface)
{
bool needToBeLoaded = true;
- M4OSA_UInt32 framesizeYuv =0;
M4OSA_ERR result = M4NO_ERROR;
VideoEditor_renderPreviewFrameStr frameStr;
const char* pMessage = NULL;
- M4VIFI_ImagePlane *yuvPlane;
+ // Let the size be QVGA
+ int width = 320;
+ int height = 240;
ManualEditContext* pContext = M4OSA_NULL;
// Get the context.
@@ -474,62 +471,7 @@ static void videoEditor_clearSurface(JNIEnv* pEnv,
Surface* const p = (Surface*)pEnv->GetIntField(surface, surface_native);
sp<Surface> previewSurface = sp<Surface>(p);
- /**
- * Allocate output YUV planes
- */
- yuvPlane = (M4VIFI_ImagePlane*)M4OSA_malloc(3*sizeof(M4VIFI_ImagePlane), M4VS,
- (M4OSA_Char*)"videoEditor_clearSurface Output plane YUV");
- if (yuvPlane == M4OSA_NULL) {
- VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR",
- "videoEditor_clearSurface() malloc error for yuv plane");
- pMessage = videoEditJava_getErrorName(M4ERR_ALLOC);
- jniThrowException(pEnv, "java/lang/RuntimeException", pMessage);
- return ;
- }
-
- framesizeYuv = width * height * 1.5;
- yuvPlane[0].u_width = width;
- yuvPlane[0].u_height = height;
- yuvPlane[0].u_topleft = 0;
- yuvPlane[0].u_stride = width;
- yuvPlane[0].pac_data = (M4VIFI_UInt8 *)M4OSA_malloc(framesizeYuv, M4VS,
- (M4OSA_Char*)"videoEditor pixelArray");
- if (yuvPlane[0].pac_data == M4OSA_NULL) {
- VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR",
- "videoEditor_renderPreviewFrame() malloc error");
- pMessage = videoEditJava_getErrorName(M4ERR_ALLOC);
- jniThrowException(pEnv, "java/lang/RuntimeException", pMessage);
- return;
- }
-
- /* memset yuvPlane[0].pac_data with 0 for black frame */
- M4OSA_memset((M4OSA_MemAddr8)yuvPlane[0].pac_data,framesizeYuv,0x00);
- FILE *p1 = fopen("/mnt/sdcard/black.raw","wb");
- fwrite(yuvPlane[0].pac_data,1,framesizeYuv,p1);
- fclose(p1);
-
- yuvPlane[1].u_width = width>>1;
- yuvPlane[1].u_height = height>>1;
- yuvPlane[1].u_topleft = 0;
- yuvPlane[1].u_stride = width>>1;
- yuvPlane[1].pac_data = yuvPlane[0].pac_data
- + yuvPlane[0].u_width * yuvPlane[0].u_height;
-
- M4OSA_memset((M4OSA_MemAddr8)yuvPlane[1].pac_data,yuvPlane[1].u_width *
- yuvPlane[1].u_height,128);
- yuvPlane[2].u_width = (width)>>1;
- yuvPlane[2].u_height = (height)>>1;
- yuvPlane[2].u_topleft = 0;
- yuvPlane[2].u_stride = (width)>>1;
- yuvPlane[2].pac_data = yuvPlane[1].pac_data
- + yuvPlane[1].u_width * yuvPlane[1].u_height;
-
- M4OSA_memset((M4OSA_MemAddr8)yuvPlane[2].pac_data,yuvPlane[2].u_width *
- yuvPlane[2].u_height,128);
-
- /* Fill up the render structure*/
- frameStr.pBuffer = (M4OSA_Void*)yuvPlane[0].pac_data;
-
+ frameStr.pBuffer = M4OSA_NULL;
frameStr.timeMs = 0;
frameStr.uiSurfaceWidth = width;
frameStr.uiSurfaceHeight = height;
@@ -539,19 +481,11 @@ static void videoEditor_clearSurface(JNIEnv* pEnv,
frameStr.clipBeginCutTime = 0;
frameStr.clipEndCutTime = 0;
- /*pContext->mPreviewController->setPreviewFrameRenderingMode(
- pContext->pEditSettings->\
- pClipList[iCurrentClipIndex]->xVSS.MediaRendering,
- pContext->pEditSettings->xVSS.outputVideoSize);
- */
-
- result = pContext->mPreviewController->renderPreviewFrame(previewSurface,
+ result = pContext->mPreviewController->clearSurface(previewSurface,
&frameStr);
videoEditJava_checkAndThrowRuntimeException(&needToBeLoaded, pEnv,
(M4NO_ERROR != result), result);
- M4OSA_free((M4OSA_MemAddr32)yuvPlane[0].pac_data);
- M4OSA_free((M4OSA_MemAddr32)yuvPlane);
}
static int videoEditor_renderPreviewFrame(JNIEnv* pEnv,