From f7cf379966cc044068e760f0827d14dfb880b9d6 Mon Sep 17 00:00:00 2001 From: Mattia Iavarone Date: Sun, 16 Sep 2018 13:44:12 -0300 Subject: [PATCH] Rename video recorders --- .../main/java/com/otaliastudios/cameraview/Camera1.java | 5 ++--- ...RecorderVideoRecorder.java => FullVideoRecorder.java} | 9 +++------ ...odecVideoRecorder.java => SnapshotVideoRecorder.java} | 8 +++----- 3 files changed, 8 insertions(+), 14 deletions(-) rename cameraview/src/main/java/com/otaliastudios/cameraview/{MediaRecorderVideoRecorder.java => FullVideoRecorder.java} (92%) rename cameraview/src/main/java/com/otaliastudios/cameraview/{MediaCodecVideoRecorder.java => SnapshotVideoRecorder.java} (91%) diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/Camera1.java b/cameraview/src/main/java/com/otaliastudios/cameraview/Camera1.java index 9b113f68..f1173d35 100644 --- a/cameraview/src/main/java/com/otaliastudios/cameraview/Camera1.java +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/Camera1.java @@ -12,7 +12,6 @@ import android.location.Location; import android.os.Build; import android.support.annotation.NonNull; import android.support.annotation.Nullable; -import android.support.annotation.RequiresApi; import android.support.annotation.WorkerThread; import android.support.media.ExifInterface; import android.view.SurfaceHolder; @@ -692,7 +691,7 @@ class Camera1 extends CameraController implements Camera.PreviewCallback, Camera // Initialize the media recorder mCamera.unlock(); - mVideoRecorder = new MediaRecorderVideoRecorder(videoResult, Camera1.this, mCamera, mCameraId); + mVideoRecorder = new FullVideoRecorder(videoResult, Camera1.this, mCamera, mCameraId); mVideoRecorder.start(); } }); @@ -758,7 +757,7 @@ class Camera1 extends CameraController implements Camera.PreviewCallback, Camera videoResult.maxDuration = mVideoMaxDuration; GLCameraPreview cameraPreview = (GLCameraPreview) mPreview; - mVideoRecorder = new MediaCodecVideoRecorder(videoResult, Camera1.this, cameraPreview, mCameraId); + mVideoRecorder = new SnapshotVideoRecorder(videoResult, Camera1.this, cameraPreview); mVideoRecorder.start(); } }); diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/MediaRecorderVideoRecorder.java b/cameraview/src/main/java/com/otaliastudios/cameraview/FullVideoRecorder.java similarity index 92% rename from cameraview/src/main/java/com/otaliastudios/cameraview/MediaRecorderVideoRecorder.java rename to cameraview/src/main/java/com/otaliastudios/cameraview/FullVideoRecorder.java index 1197bbe8..0b6eecc5 100644 --- a/cameraview/src/main/java/com/otaliastudios/cameraview/MediaRecorderVideoRecorder.java +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/FullVideoRecorder.java @@ -7,18 +7,16 @@ import android.media.MediaRecorder; /** * A {@link VideoRecorder} that uses {@link android.media.MediaRecorder} APIs. */ -class MediaRecorderVideoRecorder extends VideoRecorder { +class FullVideoRecorder extends VideoRecorder { - private static final String TAG = MediaRecorderVideoRecorder.class.getSimpleName(); + private static final String TAG = FullVideoRecorder.class.getSimpleName(); private static final CameraLogger LOG = CameraLogger.create(TAG); private MediaRecorder mMediaRecorder; private CamcorderProfile mProfile; - private Mapper mMapper; - MediaRecorderVideoRecorder(VideoResult stub, VideoResultListener listener, Camera camera, int cameraId) { + FullVideoRecorder(VideoResult stub, VideoResultListener listener, Camera camera, int cameraId) { super(stub, listener); - mMapper = new Mapper1(); mMediaRecorder = new MediaRecorder(); mMediaRecorder.setCamera(camera); mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA); @@ -102,7 +100,6 @@ class MediaRecorderVideoRecorder extends VideoRecorder { } mProfile = null; mMediaRecorder = null; - mMapper = null; dispatchResult(); } } diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/MediaCodecVideoRecorder.java b/cameraview/src/main/java/com/otaliastudios/cameraview/SnapshotVideoRecorder.java similarity index 91% rename from cameraview/src/main/java/com/otaliastudios/cameraview/MediaCodecVideoRecorder.java rename to cameraview/src/main/java/com/otaliastudios/cameraview/SnapshotVideoRecorder.java index 3bf0949f..411fe83b 100644 --- a/cameraview/src/main/java/com/otaliastudios/cameraview/MediaCodecVideoRecorder.java +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/SnapshotVideoRecorder.java @@ -1,8 +1,6 @@ package com.otaliastudios.cameraview; import android.graphics.SurfaceTexture; -import android.media.CamcorderProfile; -import android.media.MediaFormat; import android.opengl.EGL14; import android.os.Build; import android.os.Handler; @@ -16,9 +14,9 @@ import android.support.annotation.RequiresApi; * TODO when cropping is huge, the first frame of the video result, noticeably, has no transformation applied. Don't know why. */ @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR2) -class MediaCodecVideoRecorder extends VideoRecorder implements GLCameraPreview.RendererFrameCallback { +class SnapshotVideoRecorder extends VideoRecorder implements GLCameraPreview.RendererFrameCallback { - private static final String TAG = MediaCodecVideoRecorder.class.getSimpleName(); + private static final String TAG = SnapshotVideoRecorder.class.getSimpleName(); private static final CameraLogger LOG = CameraLogger.create(TAG); private static final int STATE_RECORDING = 0; @@ -31,7 +29,7 @@ class MediaCodecVideoRecorder extends VideoRecorder implements GLCameraPreview.R private int mDesiredState = STATE_NOT_RECORDING; private int mTextureId = 0; - MediaCodecVideoRecorder(VideoResult stub, VideoResultListener listener, GLCameraPreview preview, int cameraId) { + SnapshotVideoRecorder(VideoResult stub, VideoResultListener listener, GLCameraPreview preview) { super(stub, listener); mEncoder = new VideoTextureEncoder(); mPreview = preview;