add mirror of filter

add mirror of filter
pull/166/head
xufulong 4 years ago
parent d7a97fa5f2
commit 29adee4aae
  1. 18
      app/src/main/java/com/frank/ffmpeg/activity/FilterActivity.java
  2. 2
      app/src/main/res/values-en/strings.xml
  3. 4
      app/src/main/res/values/strings.xml

@ -1,6 +1,7 @@
package com.frank.ffmpeg.activity; package com.frank.ffmpeg.activity;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.os.Environment;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.os.Bundle; import android.os.Bundle;
@ -13,6 +14,7 @@ import android.view.SurfaceView;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.CompoundButton; import android.widget.CompoundButton;
import android.widget.Toast;
import android.widget.ToggleButton; import android.widget.ToggleButton;
import com.frank.ffmpeg.FFmpegApplication; import com.frank.ffmpeg.FFmpegApplication;
@ -33,7 +35,7 @@ import java.util.List;
public class FilterActivity extends BaseActivity implements SurfaceHolder.Callback { public class FilterActivity extends BaseActivity implements SurfaceHolder.Callback {
private String videoPath = ""; private String videoPath = Environment.getExternalStorageDirectory().getPath() + "/beyond.mp4";
private VideoPlayer videoPlayer; private VideoPlayer videoPlayer;
private SurfaceView surfaceView; private SurfaceView surfaceView;
@ -45,24 +47,24 @@ public class FilterActivity extends BaseActivity implements SurfaceHolder.Callba
private String[] filters = new String[]{ private String[] filters = new String[]{
"lutyuv='u=128:v=128'", "lutyuv='u=128:v=128'",
"hue='h=60:s=-3'", "hue='h=60:s=-3'",
"lutrgb='r=0:g=0'",
"edgedetect=low=0.1:high=0.4", "edgedetect=low=0.1:high=0.4",
"drawgrid=w=iw/3:h=ih/3:t=2:c=white@0.5", "drawgrid=w=iw/3:h=ih/3:t=2:c=white@0.5",
"colorbalance=bs=0.3", "colorbalance=bs=0.3",
"drawbox=x=100:y=100:w=100:h=100:color=red@0.5'", "drawbox=x=100:y=100:w=100:h=100:color=red@0.5'",
"vflip", "hflip",
"rotate=180*PI/180",
"unsharp" "unsharp"
}; };
//vflip is up and down, hflip is left and right //vflip is up and down, hflip is left and right
private String[] txtArray = new String[]{ private String[] txtArray = new String[]{
FFmpegApplication.getInstance().getString(R.string.filter_sketch), FFmpegApplication.getInstance().getString(R.string.filter_sketch),
FFmpegApplication.getInstance().getString(R.string.filter_distinct), FFmpegApplication.getInstance().getString(R.string.filter_distinct),
FFmpegApplication.getInstance().getString(R.string.filter_warming),
FFmpegApplication.getInstance().getString(R.string.filter_edge), FFmpegApplication.getInstance().getString(R.string.filter_edge),
FFmpegApplication.getInstance().getString(R.string.filter_division), FFmpegApplication.getInstance().getString(R.string.filter_division),
FFmpegApplication.getInstance().getString(R.string.filter_equalize), FFmpegApplication.getInstance().getString(R.string.filter_equalize),
FFmpegApplication.getInstance().getString(R.string.filter_rectangle), FFmpegApplication.getInstance().getString(R.string.filter_rectangle),
FFmpegApplication.getInstance().getString(R.string.filter_flip), FFmpegApplication.getInstance().getString(R.string.filter_flip),
FFmpegApplication.getInstance().getString(R.string.filter_rotate),
FFmpegApplication.getInstance().getString(R.string.filter_sharpening) FFmpegApplication.getInstance().getString(R.string.filter_sharpening)
}; };
private HorizontalAdapter horizontalAdapter; private HorizontalAdapter horizontalAdapter;
@ -188,6 +190,12 @@ public class FilterActivity extends BaseActivity implements SurfaceHolder.Callba
@Override @Override
public void surfaceCreated(SurfaceHolder holder) { public void surfaceCreated(SurfaceHolder holder) {
surfaceCreated = true; surfaceCreated = true;
if (FileUtil.checkFileExist(videoPath)) {
doFilterPlay(4);
btnSound.setChecked(true);
} else {
Toast.makeText(FilterActivity.this, getString(R.string.file_not_found), Toast.LENGTH_SHORT).show();
}
} }
@Override @Override
@ -220,7 +228,7 @@ public class FilterActivity extends BaseActivity implements SurfaceHolder.Callba
@Override @Override
void onSelectedFile(String filePath) { void onSelectedFile(String filePath) {
videoPath = filePath; videoPath = filePath;
doFilterPlay(5); doFilterPlay(4);
//sound off by default //sound off by default
btnSound.setChecked(true); btnSound.setChecked(true);
} }

@ -76,12 +76,12 @@
<string name="filter_sketch">sketch</string> <string name="filter_sketch">sketch</string>
<string name="filter_distinct">distinct</string> <string name="filter_distinct">distinct</string>
<string name="filter_warming">warming</string>
<string name="filter_edge">edge</string> <string name="filter_edge">edge</string>
<string name="filter_division">division</string> <string name="filter_division">division</string>
<string name="filter_equalize">equalize</string> <string name="filter_equalize">equalize</string>
<string name="filter_rectangle">rectangle</string> <string name="filter_rectangle">rectangle</string>
<string name="filter_flip">flip</string> <string name="filter_flip">flip</string>
<string name="filter_rotate">rotate</string>
<string name="filter_sharpening">sharpen</string> <string name="filter_sharpening">sharpen</string>
</resources> </resources>

@ -76,12 +76,12 @@
<string name="filter_sketch">素描</string> <string name="filter_sketch">素描</string>
<string name="filter_distinct">鲜明</string> <string name="filter_distinct">鲜明</string>
<string name="filter_warming">暖蓝</string>
<string name="filter_edge">边缘</string> <string name="filter_edge">边缘</string>
<string name="filter_division">九宫格</string> <string name="filter_division">九宫格</string>
<string name="filter_equalize">均衡</string> <string name="filter_equalize">均衡</string>
<string name="filter_rectangle">矩形</string> <string name="filter_rectangle">矩形</string>
<string name="filter_flip">翻转</string> <string name="filter_flip">镜像</string>
<string name="filter_rotate">旋转</string>
<string name="filter_sharpening">锐化</string> <string name="filter_sharpening">锐化</string>
</resources> </resources>

Loading…
Cancel
Save