From a30527f8fc18c8a31408dc6e540141988f9351e0 Mon Sep 17 00:00:00 2001 From: xufuji456 Date: Mon, 17 Oct 2022 14:17:17 +0800 Subject: [PATCH] Feature: add CameraFilterActivity --- .../camerafilter/widget/CameraRender.java | 1 + app/src/main/AndroidManifest.xml | 1 + .../ffmpeg/activity/CameraFilterActivity.kt | 35 +++++++++++++++++++ .../com/frank/ffmpeg/activity/MainActivity.kt | 5 ++- .../res/layout/activity_camera_filter.xml | 16 +++++++++ app/src/main/res/values-en/strings.xml | 3 +- app/src/main/res/values/strings.xml | 3 +- 7 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 app/src/main/java/com/frank/ffmpeg/activity/CameraFilterActivity.kt create mode 100644 app/src/main/res/layout/activity_camera_filter.xml diff --git a/CameraFilter/src/main/java/com/frank/camerafilter/widget/CameraRender.java b/CameraFilter/src/main/java/com/frank/camerafilter/widget/CameraRender.java index 3427403..464c588 100644 --- a/CameraFilter/src/main/java/com/frank/camerafilter/widget/CameraRender.java +++ b/CameraFilter/src/main/java/com/frank/camerafilter/widget/CameraRender.java @@ -83,6 +83,7 @@ public class CameraRender implements GLSurfaceView.Renderer, SurfaceTexture.OnFr if (cameraManager.getCamera() == null) cameraManager.openCamera(); Camera.Size size = cameraManager.getPreviewSize(); + // rotation=90 or rotation=270, we need to exchange width and height if (cameraManager.getOrientation() == 90 || cameraManager.getOrientation() == 270) { mImageWidth = size.height; mImageHeight = size.width; diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index dfe28bd..b234431 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -49,6 +49,7 @@ + \ No newline at end of file diff --git a/app/src/main/java/com/frank/ffmpeg/activity/CameraFilterActivity.kt b/app/src/main/java/com/frank/ffmpeg/activity/CameraFilterActivity.kt new file mode 100644 index 0000000..ae5bfb3 --- /dev/null +++ b/app/src/main/java/com/frank/ffmpeg/activity/CameraFilterActivity.kt @@ -0,0 +1,35 @@ +package com.frank.ffmpeg.activity + +import android.os.Bundle +import android.view.SurfaceView +import android.view.View +import com.frank.camerafilter.widget.BeautyCameraView +import com.frank.ffmpeg.FFMediaPlayer +import com.frank.ffmpeg.R + +class CameraFilterActivity : BaseActivity() { + + private var cameraView: BeautyCameraView ?= null + + override val layoutId: Int + get() = R.layout.activity_camera_filter + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + initView() + } + + fun initView() { + cameraView = getView(R.id.surface_camera_filter) + } + + override fun onViewClick(view: View) { + + } + + override fun onSelectedFile(filePath: String) { + + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/frank/ffmpeg/activity/MainActivity.kt b/app/src/main/java/com/frank/ffmpeg/activity/MainActivity.kt index b1555e9..90f769d 100644 --- a/app/src/main/java/com/frank/ffmpeg/activity/MainActivity.kt +++ b/app/src/main/java/com/frank/ffmpeg/activity/MainActivity.kt @@ -35,7 +35,8 @@ class MainActivity : BaseActivity() { getString(R.string.video_filter), getString(R.string.video_preview), getString(R.string.media_probe), - getString(R.string.audio_effect)) + getString(R.string.audio_effect), + getString(R.string.camera_filter)) val viewWaterfall: RecyclerView = findViewById(R.id.list_main_item) val layoutManager = StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL) @@ -71,6 +72,8 @@ class MainActivity : BaseActivity() { -> intent.setClass(this@MainActivity, ProbeFormatActivity::class.java) 8 //audio effect -> intent.setClass(this@MainActivity, AudioEffectActivity::class.java) + 9 //camera filter + -> intent.setClass(this@MainActivity, CameraFilterActivity::class.java) else -> { } } diff --git a/app/src/main/res/layout/activity_camera_filter.xml b/app/src/main/res/layout/activity_camera_filter.xml new file mode 100644 index 0000000..63e112e --- /dev/null +++ b/app/src/main/res/layout/activity_camera_filter.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values-en/strings.xml b/app/src/main/res/values-en/strings.xml index 207f3ce..6391736 100644 --- a/app/src/main/res/values-en/strings.xml +++ b/app/src/main/res/values-en/strings.xml @@ -53,7 +53,8 @@ Extract frame Video zoom Video play - Video filter + FFmpeg filter + Camera filter Video slow Video fast Video multi diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b9702ed..812096a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -53,7 +53,8 @@ 视频抽帧 视频局部放大 视频播放 - 滤镜特效 + FFmpeg滤镜 + Camera滤镜 慢放 快进 画面拼接