Use GL to render preview.

To speed up the preview, we direct the decoder output to a
SurfaceTexture, then draw the texture to a surface. The media
rendering parameters (crop, black-border) are implemented
using different vertex coordinates. The color effects are
implemented using fragment shaders. Currently only three color
effects are implemented, but that's all the appplication uses.

Change-Id: If84439fee572ed37ea077749ef9f2bd4f78703e1
diff --git a/libvideoeditor/lvpp/VideoEditorPreviewController.cpp b/libvideoeditor/lvpp/VideoEditorPreviewController.cpp
index f99ca79..a17015e 100755
--- a/libvideoeditor/lvpp/VideoEditorPreviewController.cpp
+++ b/libvideoeditor/lvpp/VideoEditorPreviewController.cpp
@@ -460,6 +460,11 @@
     mVEAudioPlayer->setAudioMixSettings(mBackgroundAudioSetting);
     mVEAudioPlayer->setAudioMixPCMFileHandle(mAudioMixPCMFileHandle);
 
+    // Create Video Renderer to be used for the entire storyboard duration.
+    uint32_t width, height;
+    getVideoSizeByResolution(mOutputVideoSize, &width, &height);
+    mNativeWindowRenderer = new NativeWindowRenderer(mSurface, width, height);
+
     LOGV("startPreview: loop = %d", loop);
     mPreviewLooping = loop;
 
@@ -467,7 +472,7 @@
     mCallBackAfterFrameCnt = callBackAfterFrameCount;
 
     for (int playerInst=0; playerInst<NBPLAYER_INSTANCES; playerInst++) {
-        mVePlayer[playerInst] = new VideoEditorPlayer();
+        mVePlayer[playerInst] = new VideoEditorPlayer(mNativeWindowRenderer);
         if(mVePlayer[playerInst] == NULL) {
             LOGE("startPreview:Error creating VideoEditorPlayer %d",playerInst);
             return M4ERR_ALLOC;
@@ -691,6 +696,9 @@
         mVEAudioPlayer = NULL;
     }
 
+    delete mNativeWindowRenderer;
+    mNativeWindowRenderer = NULL;
+
     // If image file playing, then free the buffer pointer
     if(mFrameStr.pBuffer != M4OSA_NULL) {
         free(mFrameStr.pBuffer);