Feature: rename params

pull/221/head
xufuji456 2 years ago
parent a84240d2cd
commit 6055af2d8b
  1. 54
      CameraFilter/src/main/java/com/frank/camerafilter/recorder/video/CameraVideoRecorder.java

@ -56,7 +56,7 @@ public class CameraVideoRecorder implements Runnable {
private int mTextureId; private int mTextureId;
private EglCore mEglCore; private EglCore mEglCore;
private BeautyCameraFilter mInput; private BeautyCameraFilter mCameraFilter;
private WindowEglSurface mWindowSurface; private WindowEglSurface mWindowSurface;
private VideoRecorderCore mVideoRecorder; private VideoRecorderCore mVideoRecorder;
@ -65,7 +65,7 @@ public class CameraVideoRecorder implements Runnable {
private boolean mReady; private boolean mReady;
private boolean mRunning; private boolean mRunning;
private BaseFilter mFilter; private BaseFilter mAddFilter;
private final Context mContext; private final Context mContext;
private float[] mTransformMatrix; private float[] mTransformMatrix;
private FloatBuffer glVertexBuffer; private FloatBuffer glVertexBuffer;
@ -160,11 +160,11 @@ public class CameraVideoRecorder implements Runnable {
private void handleFrameAvailable(float[] transform, long timestamp) { private void handleFrameAvailable(float[] transform, long timestamp) {
mVideoRecorder.drainEncoder(false); mVideoRecorder.drainEncoder(false);
mInput.setTextureTransformMatrix(transform); mCameraFilter.setTextureTransformMatrix(transform);
if (mFilter == null) { if (mAddFilter == null) {
mInput.onDrawFrame(mTextureId, glVertexBuffer, glTextureBuffer); mCameraFilter.onDrawFrame(mTextureId, glVertexBuffer, glTextureBuffer);
} else { } else {
mFilter.onDrawFrame(mTextureId, glVertexBuffer, glTextureBuffer); mAddFilter.onDrawFrame(mTextureId, glVertexBuffer, glTextureBuffer);
} }
mWindowSurface.setPresentationTime(timestamp); mWindowSurface.setPresentationTime(timestamp);
mWindowSurface.swapBuffers(); mWindowSurface.swapBuffers();
@ -176,20 +176,20 @@ public class CameraVideoRecorder implements Runnable {
private void handleUpdateSharedContext(EGLContext eglContext) { private void handleUpdateSharedContext(EGLContext eglContext) {
mWindowSurface.releaseEglSurface(); mWindowSurface.releaseEglSurface();
mInput.destroy(); mCameraFilter.destroy();
mEglCore.release(); mEglCore.release();
mEglCore = new EglCore(eglContext, EglCore.FLAG_RECORDABLE); mEglCore = new EglCore(eglContext, EglCore.FLAG_RECORDABLE);
mWindowSurface.recreate(mEglCore); mWindowSurface.recreate(mEglCore);
mWindowSurface.makeCurrent(); mWindowSurface.makeCurrent();
mInput = new BeautyCameraFilter(mContext); mCameraFilter = new BeautyCameraFilter(mContext);
mInput.init(); mCameraFilter.init();
mFilter = BeautyFilterFactory.getFilter(type, mContext); mAddFilter = BeautyFilterFactory.getFilter(type, mContext);
if (mFilter != null) { if (mAddFilter != null) {
mFilter.init(); mAddFilter.init();
mFilter.onOutputSizeChanged(mVideoWidth, mVideoHeight); mAddFilter.onOutputSizeChanged(mVideoWidth, mVideoHeight);
mFilter.onInputSizeChanged(mPreviewWidth, mPreviewHeight); mAddFilter.onInputSizeChanged(mPreviewWidth, mPreviewHeight);
} }
} }
@ -205,13 +205,13 @@ public class CameraVideoRecorder implements Runnable {
mWindowSurface = new WindowEglSurface(mEglCore, mVideoRecorder.getInputSurface(), true); mWindowSurface = new WindowEglSurface(mEglCore, mVideoRecorder.getInputSurface(), true);
mWindowSurface.makeCurrent(); mWindowSurface.makeCurrent();
mInput = new BeautyCameraFilter(mContext); mCameraFilter = new BeautyCameraFilter(mContext);
mInput.init(); mCameraFilter.init();
mFilter = BeautyFilterFactory.getFilter(type, mContext); mAddFilter = BeautyFilterFactory.getFilter(type, mContext);
if (mFilter != null) { if (mAddFilter != null) {
mFilter.init(); mAddFilter.init();
mFilter.onOutputSizeChanged(mVideoWidth, mVideoHeight); mAddFilter.onOutputSizeChanged(mVideoWidth, mVideoHeight);
mFilter.onInputSizeChanged(mPreviewWidth, mPreviewHeight); mAddFilter.onInputSizeChanged(mPreviewWidth, mPreviewHeight);
} }
} }
@ -221,13 +221,13 @@ public class CameraVideoRecorder implements Runnable {
mWindowSurface.release(); mWindowSurface.release();
mWindowSurface = null; mWindowSurface = null;
} }
if (mInput != null) { if (mCameraFilter != null) {
mInput.destroy(); mCameraFilter.destroy();
mInput = null; mCameraFilter = null;
} }
if (mFilter != null) { if (mAddFilter != null) {
mFilter.destroy(); mAddFilter.destroy();
mFilter = null; mAddFilter = null;
type = BeautyFilterType.NONE; type = BeautyFilterType.NONE;
} }
if (mEglCore != null) { if (mEglCore != null) {

Loading…
Cancel
Save