Merge "VideEditor:Fix for 3369908 Removed redundant code." into honeycomb
diff --git a/libvideoeditor/lvpp/VideoEditorPreviewController.cpp b/libvideoeditor/lvpp/VideoEditorPreviewController.cpp
index c079898..52aa87e 100755
--- a/libvideoeditor/lvpp/VideoEditorPreviewController.cpp
+++ b/libvideoeditor/lvpp/VideoEditorPreviewController.cpp
@@ -672,6 +672,71 @@
return M4NO_ERROR;
}
+M4OSA_ERR VideoEditorPreviewController::clearSurface(
+ const sp<Surface> &surface, VideoEditor_renderPreviewFrameStr* pFrameInfo) {
+
+ M4OSA_ERR err = M4NO_ERROR;
+ VideoEditor_renderPreviewFrameStr* pFrameStr = pFrameInfo;
+ M4OSA_UInt32 outputBufferWidth =0, outputBufferHeight=0;
+ M4VIFI_ImagePlane planeOut[3];
+ LOGV("Inside preview clear frame");
+
+ Mutex::Autolock autoLock(mLock);
+
+ // Get the Isurface to be passed to renderer
+ mISurface = surface->getISurface();
+
+ // Delete previous renderer instance
+ if(mTarget != NULL) {
+ delete mTarget;
+ mTarget = NULL;
+ }
+
+ if(mOutputVideoWidth == 0) {
+ mOutputVideoWidth = pFrameStr->uiFrameWidth;
+ }
+ if(mOutputVideoHeight == 0) {
+ mOutputVideoHeight = pFrameStr->uiFrameHeight;
+ }
+
+ // Initialize the renderer
+ if(mTarget == NULL) {
+ mTarget = new PreviewRenderer(
+ OMX_COLOR_FormatYUV420Planar, surface, mOutputVideoWidth, mOutputVideoHeight,
+ mOutputVideoWidth, mOutputVideoHeight, 0);
+ if(mTarget == NULL) {
+ LOGE("renderPreviewFrame: cannot create PreviewRenderer");
+ return M4ERR_ALLOC;
+ }
+ }
+
+ // Out plane
+ uint8_t* outBuffer;
+ size_t outBufferStride = 0;
+
+ LOGV("doMediaRendering CALL getBuffer()");
+ mTarget->getBufferYV12(&outBuffer, &outBufferStride);
+
+ // Set the output YUV420 plane to be compatible with YV12 format
+ //In YV12 format, sizes must be even
+ M4OSA_UInt32 yv12PlaneWidth = ((mOutputVideoWidth +1)>>1)<<1;
+ M4OSA_UInt32 yv12PlaneHeight = ((mOutputVideoHeight+1)>>1)<<1;
+
+ prepareYV12ImagePlane(planeOut, yv12PlaneWidth, yv12PlaneHeight,
+ (M4OSA_UInt32)outBufferStride, (M4VIFI_UInt8 *)outBuffer);
+
+ /* Fill the surface with black frame */
+ M4OSA_memset((M4OSA_MemAddr8)planeOut[0].pac_data,planeOut[0].u_width *
+ planeOut[0].u_height * 1.5,0x00);
+ M4OSA_memset((M4OSA_MemAddr8)planeOut[1].pac_data,planeOut[1].u_width *
+ planeOut[1].u_height,128);
+ M4OSA_memset((M4OSA_MemAddr8)planeOut[2].pac_data,planeOut[2].u_width *
+ planeOut[2].u_height,128);
+
+ mTarget->renderYV12();
+ return err;
+}
+
M4OSA_ERR VideoEditorPreviewController::renderPreviewFrame(
const sp<Surface> &surface, VideoEditor_renderPreviewFrameStr* pFrameInfo) {
diff --git a/libvideoeditor/lvpp/VideoEditorPreviewController.h b/libvideoeditor/lvpp/VideoEditorPreviewController.h
index 637ddb2..5828c5f 100755
--- a/libvideoeditor/lvpp/VideoEditorPreviewController.h
+++ b/libvideoeditor/lvpp/VideoEditorPreviewController.h
@@ -74,6 +74,9 @@
M4OSA_ERR renderPreviewFrame(const sp<Surface> &surface,
VideoEditor_renderPreviewFrameStr* pFrameInfo);
+ M4OSA_ERR clearSurface(const sp<Surface> &surface,
+ VideoEditor_renderPreviewFrameStr* pFrameInfo);
+
M4OSA_Void setJniCallback(void* cookie,
jni_progress_callback_fct callbackFct);
diff --git a/libvideoeditor/vss/common/inc/M4SYS_AccessUnit.h b/libvideoeditor/vss/common/inc/M4SYS_AccessUnit.h
index 08f8002..74da266 100755
--- a/libvideoeditor/vss/common/inc/M4SYS_AccessUnit.h
+++ b/libvideoeditor/vss/common/inc/M4SYS_AccessUnit.h
@@ -55,7 +55,7 @@
typedef M4OSA_UInt8 M4SYS_AU_Attr;
#define AU_Corrupted 0x01 /**< At least one fragment of the access unit is flagged corrupted.*/
-#define AU_B_Frame 0x02 /**< The access unit is a B_frame*/
+#define AU_P_Frame 0x02 /**< The access unit is a P_frame*/
#define AU_RAP 0x04 /**< The access unit is a random access point.*/
diff --git a/libvideoeditor/vss/stagefrightshells/src/VideoEditor3gpReader.cpp b/libvideoeditor/vss/stagefrightshells/src/VideoEditor3gpReader.cpp
index aba2bc1..eb48717 100755
--- a/libvideoeditor/vss/stagefrightshells/src/VideoEditor3gpReader.cpp
+++ b/libvideoeditor/vss/stagefrightshells/src/VideoEditor3gpReader.cpp
@@ -1029,6 +1029,9 @@
LOGV("SYNC FRAME FOUND--%d", i32Tmp);
pAu->attribute = AU_RAP;
}
+ else {
+ pAu->attribute = AU_P_Frame;
+ }
mMediaBuffer->meta_data()->findInt64(kKeyTime,
(int64_t*)&tempTime64);
} else {
@@ -1050,6 +1053,9 @@
LOGV("SYNC FRAME FOUND--%d", i32Tmp);
pAu->attribute = AU_RAP;
}
+ else {
+ pAu->attribute = AU_P_Frame;
+ }
mMediaBuffer->meta_data()->findInt64(kKeyTime,
(int64_t*)&tempTime64);
LOGV("VE3gpReader_getNextAu: video no seek time = %lld:",
@@ -1416,6 +1422,7 @@
const void *codec_specific_data;
size_t codec_specific_data_size;
M4OSA_Int32 ptempTime;
+ M4OSA_Int32 avgFPS=0;
LOGV("VideoEditor3gpReader_getNextStreamHandler begin");
@@ -1493,13 +1500,21 @@
LOGV("<<<<<<<<<< video: mMaxAUSize from MP4 extractor: %d",
(*pStreamHandler)->m_maxAUSize);
- //check this
- pVideoStreamHandler->m_averageFrameRate = 15;
if( (M4DA_StreamTypeVideoH263 == streamType) ||
(M4DA_StreamTypeVideoMpeg4Avc == streamType)){
((M4_StreamHandler*)pVideoStreamHandler)->m_averageBitRate =
384000;
}
+
+ meta->findInt32(kKeyFrameRate,
+ (int32_t*)&(avgFPS));
+ LOGV("<<<<<<<<<< video: Average FPS from MP4 extractor: %d",
+ avgFPS);
+
+ pVideoStreamHandler->m_averageFrameRate =(M4OSA_Float) avgFPS;
+ LOGV("<<<<<<<<<< video: Average FPS from MP4 extractor in FLOAT: %f",
+ pVideoStreamHandler->m_averageFrameRate);
+
pC->mVideoStreamHandler =
(M4_StreamHandler*)(pVideoStreamHandler);
diff --git a/libvideoeditor/vss/stagefrightshells/src/VideoEditorVideoEncoder.cpp b/libvideoeditor/vss/stagefrightshells/src/VideoEditorVideoEncoder.cpp
index 0813b5c..3112f71 100755
--- a/libvideoeditor/vss/stagefrightshells/src/VideoEditorVideoEncoder.cpp
+++ b/libvideoeditor/vss/stagefrightshells/src/VideoEditorVideoEncoder.cpp
@@ -907,7 +907,7 @@
if ( buffer->meta_data()->findInt32(kKeyIsSyncFrame,&i32Tmp) && i32Tmp){
pEncoderContext->mAccessUnit->attribute = AU_RAP;
} else {
- pEncoderContext->mAccessUnit->attribute = AU_B_Frame;
+ pEncoderContext->mAccessUnit->attribute = AU_P_Frame;
}
pEncoderContext->mLastCTS = Cts;
pEncoderContext->mAccessUnit->CTS = Cts;