├── aavt
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ └── values
│ │ │ │ └── strings.xml
│ │ ├── assets
│ │ │ └── shader
│ │ │ │ ├── base.frag
│ │ │ │ ├── oes.frag
│ │ │ │ ├── color
│ │ │ │ └── gray.frag
│ │ │ │ ├── oes.vert
│ │ │ │ ├── base.vert
│ │ │ │ ├── effect
│ │ │ │ ├── fluorescence.frag
│ │ │ │ ├── water_color_step1.frag
│ │ │ │ └── water_color.frag
│ │ │ │ ├── func
│ │ │ │ ├── faltung3x3.frag
│ │ │ │ ├── gauss.frag
│ │ │ │ ├── sobel.frag
│ │ │ │ ├── sobel2.frag
│ │ │ │ └── candy.frag
│ │ │ │ ├── beauty
│ │ │ │ ├── beauty.vert
│ │ │ │ └── beauty.frag
│ │ │ │ └── convert
│ │ │ │ ├── export_yuv420sp.frag
│ │ │ │ ├── eo_yuv420p.frag
│ │ │ │ ├── export_yuv.frag
│ │ │ │ └── export_yuv420p.frag
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── wuwang
│ │ │ │ └── aavt
│ │ │ │ ├── core
│ │ │ │ ├── IObserver.java
│ │ │ │ ├── IObservable.java
│ │ │ │ ├── Observable.java
│ │ │ │ └── Renderer.java
│ │ │ │ ├── gl
│ │ │ │ ├── CandyFilter.java
│ │ │ │ ├── GrayFilter.java
│ │ │ │ ├── Faltung3x3Filter.java
│ │ │ │ ├── BlackMagicFilter.java
│ │ │ │ ├── BaseFuncFilter.java
│ │ │ │ ├── StickFigureFilter.java
│ │ │ │ ├── OesFilter.java
│ │ │ │ ├── WaterColorFilter.java
│ │ │ │ ├── LazyFilter.java
│ │ │ │ ├── RollFilter.java
│ │ │ │ ├── BeautyFilter.java
│ │ │ │ ├── FluorescenceFilter.java
│ │ │ │ ├── GroupFilter.java
│ │ │ │ ├── WaterMarkFilter.java
│ │ │ │ ├── ProxyFilter.java
│ │ │ │ └── FrameBuffer.java
│ │ │ │ ├── egl
│ │ │ │ ├── EGLContextAttrs.java
│ │ │ │ └── EGLConfigAttrs.java
│ │ │ │ ├── media
│ │ │ │ ├── av
│ │ │ │ │ ├── ICloseable.java
│ │ │ │ │ ├── AvException.java
│ │ │ │ │ └── IStore.java
│ │ │ │ ├── hard
│ │ │ │ │ ├── IHardStore.java
│ │ │ │ │ ├── Recycler.java
│ │ │ │ │ ├── HardMediaData.java
│ │ │ │ │ ├── Mp4MuxStore.java
│ │ │ │ │ ├── MediaMuxerWraper.java
│ │ │ │ │ └── StrengthenMp4MuxStore.java
│ │ │ │ ├── RenderBean.java
│ │ │ │ ├── ITextureProvider.java
│ │ │ │ ├── MediaConfig.java
│ │ │ │ ├── CodecUtil.java
│ │ │ │ ├── WrapRenderer.java
│ │ │ │ ├── CameraProvider.java
│ │ │ │ ├── SurfaceShower.java
│ │ │ │ ├── SoundRecorder.java
│ │ │ │ └── VideoSurfaceProcessor.java
│ │ │ │ ├── log
│ │ │ │ ├── EmptyLogger.java
│ │ │ │ ├── ILogger.java
│ │ │ │ ├── ConsoleLogger.java
│ │ │ │ └── AvLog.java
│ │ │ │ ├── av
│ │ │ │ ├── Mp4Processor2.java
│ │ │ │ └── CameraRecorder2.java
│ │ │ │ ├── expend
│ │ │ │ └── SluggardFilterTool.java
│ │ │ │ └── utils
│ │ │ │ ├── GpuUtils.java
│ │ │ │ └── MatrixUtils.java
│ │ └── AndroidManifest.xml
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── wuwang
│ │ │ └── aavt
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── wuwang
│ │ └── aavt
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
├── build.gradle
└── bintrayUpload.gradle
├── examples
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── values
│ │ │ │ ├── colors.xml
│ │ │ │ ├── styles.xml
│ │ │ │ └── strings.xml
│ │ │ ├── drawable
│ │ │ │ └── tv_start_bg.xml
│ │ │ └── layout
│ │ │ │ ├── activity_main.xml
│ │ │ │ ├── activity__export_yuv.xml
│ │ │ │ ├── activity_mp4.xml
│ │ │ │ └── activity_camera_record.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── wuwang
│ │ │ └── aavt
│ │ │ └── examples
│ │ │ ├── MainActivity.java
│ │ │ ├── VideoUtils.java
│ │ │ ├── PermissionAsker.java
│ │ │ ├── ExampleMp4ProcessActivity.java
│ │ │ ├── CameraRecorderActivity.java
│ │ │ ├── GetPathFromUri4kitkat.java
│ │ │ └── YuvExportActivity.java
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── wuwang
│ │ │ └── aavt
│ │ │ └── examples
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── wuwang
│ │ └── aavt
│ │ └── examples
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .idea
├── copyright
│ └── profiles_settings.xml
├── encodings.xml
├── vcs.xml
├── modules.xml
├── runConfigurations.xml
├── compiler.xml
├── gradle.xml
└── misc.xml
├── .gitignore
├── readme.md
├── gradle.properties
├── gradlew.bat
└── gradlew
/aavt/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/examples/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':examples', ':aavt'
2 |
--------------------------------------------------------------------------------
/aavt/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | AAVT
3 |
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiyaapp/AAVT/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/examples/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiyaapp/AAVT/HEAD/examples/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/examples/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiyaapp/AAVT/HEAD/examples/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/examples/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiyaapp/AAVT/HEAD/examples/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/examples/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiyaapp/AAVT/HEAD/examples/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/examples/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiyaapp/AAVT/HEAD/examples/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/examples/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiyaapp/AAVT/HEAD/examples/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/examples/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiyaapp/AAVT/HEAD/examples/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/examples/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiyaapp/AAVT/HEAD/examples/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/examples/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiyaapp/AAVT/HEAD/examples/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/examples/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiyaapp/AAVT/HEAD/examples/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | /.idea/misc.xml
7 | .DS_Store
8 | /build
9 | /captures
10 | .externalNativeBuild
11 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/aavt/src/main/assets/shader/base.frag:
--------------------------------------------------------------------------------
1 | precision mediump float;
2 | varying vec2 vTextureCo;
3 | uniform sampler2D uTexture;
4 | void main() {
5 | gl_FragColor = texture2D( uTexture, vTextureCo);
6 | }
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/aavt/src/main/java/com/wuwang/aavt/core/IObserver.java:
--------------------------------------------------------------------------------
1 | package com.wuwang.aavt.core;
2 |
3 | /**
4 | * Created by wuwang on 2017/10/20.
5 | */
6 |
7 | public interface IObserver {
8 |
9 | void onCall(Type type);
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/aavt/src/main/assets/shader/oes.frag:
--------------------------------------------------------------------------------
1 | #extension GL_OES_EGL_image_external : require
2 | precision mediump float;
3 | varying vec2 vTextureCo;
4 | uniform samplerExternalOES uTexture;
5 | void main() {
6 | gl_FragColor = texture2D( uTexture, vTextureCo);
7 | }
--------------------------------------------------------------------------------
/examples/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/aavt/src/main/assets/shader/color/gray.frag:
--------------------------------------------------------------------------------
1 | precision mediump float;
2 | varying vec2 vTextureCo;
3 | uniform sampler2D uTexture;
4 | const highp vec3 CO = vec3(0.2125, 0.7154, 0.0721);
5 |
6 | void main() {
7 | gl_FragColor=vec4(vec3(dot(texture2D( uTexture, vTextureCo).rgb,CO)),1.0);
8 | }
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Sep 11 10:13:41 CST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://downloads.gradle.org/distributions/gradle-3.3-all.zip
7 |
--------------------------------------------------------------------------------
/aavt/src/main/java/com/wuwang/aavt/core/IObservable.java:
--------------------------------------------------------------------------------
1 | package com.wuwang.aavt.core;
2 |
3 | /**
4 | * Created by wuwang on 2017/10/20.
5 | */
6 |
7 | public interface IObservable {
8 |
9 | void addObserver(IObserver observer);
10 |
11 | void notify(Type type);
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/aavt/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/aavt/src/main/assets/shader/oes.vert:
--------------------------------------------------------------------------------
1 | attribute vec4 aVertexCo;
2 | attribute vec2 aTextureCo;
3 |
4 | uniform mat4 uVertexMatrix;
5 | uniform mat4 uTextureMatrix;
6 |
7 | varying vec2 vTextureCo;
8 |
9 | void main(){
10 | gl_Position = uVertexMatrix*aVertexCo;
11 | vTextureCo = (uTextureMatrix*vec4(aTextureCo,0,1)).xy;
12 | }
--------------------------------------------------------------------------------
/examples/src/main/res/drawable/tv_start_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/aavt/src/main/assets/shader/base.vert:
--------------------------------------------------------------------------------
1 | precision highp float;
2 | precision highp int;
3 | attribute vec4 aVertexCo;
4 | attribute vec2 aTextureCo;
5 |
6 | uniform mat4 uVertexMatrix;
7 | uniform mat4 uTextureMatrix;
8 |
9 | varying vec2 vTextureCo;
10 |
11 | void main(){
12 | gl_Position = uVertexMatrix*aVertexCo;
13 | vTextureCo = (uTextureMatrix*vec4(aTextureCo,0,1)).xy;
14 | }
--------------------------------------------------------------------------------
/examples/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | # AAVT
2 |
3 | AAVT是Android Audio/Video Tool的简写,创建此项目的目的,是为了编写一套小巧实用的Android平台音频、视频(图像)的处理框架。
4 |
5 | [  ](https://bintray.com/doggycoder/maven/Aavt/_latestVersion)
6 |
7 | 目前AAVT功能并不完善于稳定,暂无release版本,[开发笔记相关见BLOG](http://blog.csdn.net/junzia)。
8 |
9 | # 功能记录
10 | - Mp4图像处理:Mp4Processor
11 | - 高效视频录制:CameraRecorder
12 | - Sobel滤镜:SobelFilter
13 | - GPU导出YUV:YuvOutputFilter
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/aavt/src/main/assets/shader/effect/fluorescence.frag:
--------------------------------------------------------------------------------
1 | precision highp float;
2 |
3 | uniform sampler2D uTexture;
4 | uniform sampler2D uTexture2;
5 | uniform float uWidth;
6 | uniform float uHeight;
7 | varying vec2 vTextureCo;
8 |
9 | uniform vec4 uBorderColor;
10 | uniform float uStep;
11 |
12 | void main(){
13 | vec4 baseColor=texture2D(uTexture,vTextureCo);
14 | float sobelColor=texture2D(uTexture2,vTextureCo).r;
15 | gl_FragColor=(1.-sobelColor*uStep)*baseColor+sobelColor*uBorderColor*uStep;
16 | }
--------------------------------------------------------------------------------
/aavt/src/test/java/com/wuwang/aavt/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.wuwang.aavt;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/examples/src/test/java/com/wuwang/aavt/examples/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.wuwang.aavt.examples;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/aavt/src/main/java/com/wuwang/aavt/gl/CandyFilter.java:
--------------------------------------------------------------------------------
1 | package com.wuwang.aavt.gl;
2 |
3 | import android.content.res.Resources;
4 |
5 | /**
6 | * Created by 15581 on 2017/9/30.
7 | */
8 |
9 | public class CandyFilter extends GroupFilter {
10 |
11 | public CandyFilter(Resources resource) {
12 | super(resource);
13 | }
14 |
15 | @Override
16 | protected void initBuffer() {
17 | super.initBuffer();
18 | addFilter(new GrayFilter(mRes));
19 | addFilter(new BaseFuncFilter(mRes,BaseFuncFilter.FILTER_GAUSS));
20 | addFilter(new BaseFuncFilter(mRes,BaseFuncFilter.FILTER_SOBEL));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/examples/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | AAVT
3 |
4 | Mp4处理
5 | 视频录制
6 | YUV导出
7 | 打开
8 | 处理
9 | 播放
10 |
11 | 开始
12 | 停止
13 | 获取YUV
14 |
15 | 预览
16 | 录制
17 | 捕获
18 |
19 |
--------------------------------------------------------------------------------
/aavt/src/main/java/com/wuwang/aavt/egl/EGLContextAttrs.java:
--------------------------------------------------------------------------------
1 | package com.wuwang.aavt.egl;
2 |
3 | import javax.microedition.khronos.egl.EGL10;
4 |
5 | /*
6 | * Created by Wuwang on 2017/10/18
7 | */
8 | public class EGLContextAttrs {
9 |
10 | private int version=2;
11 |
12 | private boolean isDefault;
13 |
14 | public EGLContextAttrs version(int v){
15 | this.version=v;
16 | return this;
17 | }
18 |
19 | public EGLContextAttrs makeDefault(boolean def){
20 | this.isDefault=def;
21 | return this;
22 | }
23 |
24 | public boolean isDefault(){
25 | return isDefault;
26 | }
27 |
28 | int[] build(){
29 | return new int[]{0x3098,version, EGL10.EGL_NONE};
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/aavt/src/main/assets/shader/effect/water_color_step1.frag:
--------------------------------------------------------------------------------
1 | precision mediump float;
2 |
3 | uniform sampler2D uTexture;
4 | uniform sampler2D uNoiseTexture;
5 | uniform float uWidth;
6 | uniform float uHeight;
7 | varying vec2 vTextureCo;
8 |
9 | vec4 quant(vec4 cl, float n) {
10 | cl.x = floor(cl.x * 255./n)*n/255.;
11 | cl.y = floor(cl.y * 255./n)*n/255.;
12 | cl.z = floor(cl.z * 255./n)*n/255.;
13 |
14 | return cl;
15 | }
16 |
17 | void main(void){
18 | vec4 noiseColor = texture2D(uNoiseTexture, vTextureCo);
19 | vec2 newUV = vec2(vTextureCo.x + noiseColor.x / uWidth, vTextureCo.y + noiseColor.y / uHeight);
20 | vec4 fColor = texture2D(uTexture, newUV);
21 |
22 | vec4 color = quant(fColor, 255./pow(2., 4.));
23 | //vec4 color = vec4(1., 1., .5, 1.);
24 | gl_FragColor = color;
25 | }
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/aavt/src/main/java/com/wuwang/aavt/core/Observable.java:
--------------------------------------------------------------------------------
1 | package com.wuwang.aavt.core;
2 |
3 | import java.util.ArrayList;
4 | import java.util.Observer;
5 |
6 | /*
7 | * Created by Wuwang on 2017/10/23
8 | */
9 | public class Observable implements IObservable {
10 |
11 | private ArrayList> temp;
12 |
13 | @Override
14 | public void addObserver(IObserver observer) {
15 | if(temp==null){
16 | temp=new ArrayList<>();
17 | }
18 | temp.add(observer);
19 | }
20 |
21 | public void clear(){
22 | if(temp!=null){
23 | temp.clear();
24 | temp=null;
25 | }
26 | }
27 |
28 | @Override
29 | public void notify(Type type) {
30 | for (IObserver t:temp){
31 | t.onCall(type);
32 | }
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/aavt/src/main/assets/shader/func/faltung3x3.frag:
--------------------------------------------------------------------------------
1 | precision mediump float;
2 | varying vec2 vTextureCo;
3 | uniform sampler2D uTexture;
4 | uniform mat3 uFaltung;
5 | uniform float uWidth;
6 | uniform float uHeight;
7 |
8 |
9 | vec4 getColor(float x,float y,float p){
10 | return p*texture2D(uTexture,vec2(x/uWidth,y/uHeight)+vTextureCo);
11 | }
12 |
13 | void main() {
14 |
15 | vec4 color;
16 |
17 | color+=getColor(-1.,-1.,uFaltung[0][0]);
18 | color+=getColor(0.,-1.,uFaltung[1][0]);
19 | color+=getColor(1.,-1.,uFaltung[2][0]);
20 |
21 | color+=getColor(-1.,0.,uFaltung[0][1]);
22 | color+=getColor(0.,0.,uFaltung[1][1]);
23 | color+=getColor(1.,0.,uFaltung[2][1]);
24 |
25 | color+=getColor(-1.,1.,uFaltung[0][2]);
26 | color+=getColor(0.,1.,uFaltung[1][2]);
27 | color+=getColor(1.,1.,uFaltung[2][2]);
28 |
29 | gl_FragColor = color;
30 | }
--------------------------------------------------------------------------------
/aavt/src/androidTest/java/com/wuwang/aavt/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.wuwang.aavt;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.wuwang.aavt.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/aavt/src/main/java/com/wuwang/aavt/media/av/ICloseable.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 | package com.wuwang.aavt.media.av;
15 |
16 | /**
17 | * ICloseable
18 | *
19 | * @author wuwang
20 | * @version v1.0 2017:10:28 17:25
21 | */
22 | public interface ICloseable {
23 |
24 | void close() throws AvException;
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/examples/src/androidTest/java/com/wuwang/aavt/examples/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.wuwang.aavt.examples;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.wuwang.aavt", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/aavt/src/main/java/com/wuwang/aavt/log/EmptyLogger.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 | package com.wuwang.aavt.log;
15 |
16 | /**
17 | * EmptyLogger
18 | *
19 | * @author wuwang
20 | * @version v1.0 2017:11:03 16:43
21 | */
22 | class EmptyLogger implements ILogger{
23 | @Override
24 | public void log(int level, String key, String value) {
25 |
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/aavt/src/main/assets/shader/effect/water_color.frag:
--------------------------------------------------------------------------------
1 | precision mediump float;
2 |
3 | uniform sampler2D uTexture;
4 | uniform sampler2D uNoiseTexture;
5 | uniform float uWidth;
6 | uniform float uHeight;
7 | varying vec2 vTextureCo;
8 |
9 | vec4 valueAdd(vec2 pos,float shiftX,float shiftY,float p){
10 | vec2 newPos=vec2((pos.x+shiftX)/uWidth,(pos.y+shiftY)/uHeight);
11 | return texture2D(uTexture,newPos)/p;
12 | }
13 |
14 | void main(){
15 | float step=floor(uWidth/128.);
16 | vec2 xy = vec2(vTextureCo.x * uWidth, vTextureCo.y * uHeight);
17 | vec4 color=valueAdd(xy,0.,0.,4.);
18 | color+=valueAdd(xy,-step,-step,16.);
19 | color+=valueAdd(xy,-step,step,8.);
20 | color+=valueAdd(xy,-step,step,16.);
21 | color+=valueAdd(xy,step,-step,8.);
22 | color+=valueAdd(xy,step,step,8.);
23 | color+=valueAdd(xy,step,-step,16.);
24 | color+=valueAdd(xy,step,step,8.);
25 | color+=valueAdd(xy,step,step,16.);
26 | gl_FragColor = color;
27 | }
--------------------------------------------------------------------------------
/aavt/src/main/java/com/wuwang/aavt/log/ILogger.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 | package com.wuwang.aavt.log;
15 |
16 | /**
17 | * ILoger
18 | *
19 | * @author wuwang
20 | * @version v1.0 2017:11:03 15:54
21 | */
22 | public interface ILogger {
23 |
24 | int DEBUG=1;
25 | int INFO=2;
26 | int WARN=3;
27 | int ERROR=4;
28 |
29 | void log(int level,String key,String value);
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/aavt/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\Android\android-sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/examples/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\Android\android-sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/aavt/src/main/java/com/wuwang/aavt/gl/GrayFilter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 | package com.wuwang.aavt.gl;
15 |
16 | import android.content.res.Resources;
17 |
18 | /**
19 | * GrayFilter 灰度滤镜
20 | *
21 | * @author wuwang
22 | * @version v1.0 2017:10:31 11:52
23 | */
24 | public class GrayFilter extends BaseFilter {
25 |
26 | public GrayFilter(Resources resource) {
27 | super(resource, "shader/base.vert", "shader/color/gray.frag");
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/examples/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
21 |
22 |
23 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/examples/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 25
5 | buildToolsVersion "25.0.3"
6 | defaultConfig {
7 | applicationId "com.wuwang.aavt.examples"
8 | minSdkVersion 14
9 | targetSdkVersion 25
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(include: ['*.jar'], dir: 'libs')
24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
25 | exclude group: 'com.android.support', module: 'support-annotations'
26 | })
27 | compile 'com.android.support:appcompat-v7:25.3.1'
28 | compile 'com.android.support.constraint:constraint-layout:1.0.2'
29 | testCompile 'junit:junit:4.12'
30 | compile project(':aavt')
31 | }
32 |
--------------------------------------------------------------------------------
/aavt/src/main/java/com/wuwang/aavt/media/hard/IHardStore.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 | package com.wuwang.aavt.media.hard;
15 |
16 | import android.media.MediaFormat;
17 |
18 | import com.wuwang.aavt.media.av.IStore;
19 |
20 | /**
21 | * IHardStore 硬编码的媒体文件存储器
22 | *
23 | * @author wuwang
24 | * @version v1.0 2017:10:28 16:52
25 | */
26 | public interface IHardStore extends IStore {
27 |
28 | /**
29 | * 设置存储路径
30 | * @param path 路径
31 | */
32 | void setOutputPath(String path);
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/aavt/src/main/java/com/wuwang/aavt/media/av/AvException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 | package com.wuwang.aavt.media.av;
15 |
16 | /**
17 | * AVException
18 | *
19 | * @author wuwang
20 | * @version v1.0 2017:10:28 17:27
21 | */
22 | public class AvException extends Exception {
23 |
24 | public AvException(){
25 | super();
26 | }
27 |
28 | public AvException(String msg){
29 | super("AVException:"+msg);
30 | }
31 |
32 | public AvException(String message, Throwable cause) {
33 | super("AVException:"+message, cause);
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/aavt/src/main/java/com/wuwang/aavt/media/RenderBean.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 | package com.wuwang.aavt.media;
15 |
16 | import com.wuwang.aavt.egl.EglHelper;
17 |
18 | /**
19 | * RenderBean
20 | *
21 | * @author wuwang
22 | * @version v1.0 2017:10:27 15:02
23 | */
24 | public class RenderBean {
25 |
26 | public EglHelper egl;
27 | public int sourceWidth;
28 | public int sourceHeight;
29 | public int textureId;
30 | public boolean endFlag;
31 |
32 | public long timeStamp;
33 | public long textureTime;
34 |
35 | public long threadId;
36 |
37 | }
38 |
39 |
--------------------------------------------------------------------------------
/aavt/src/main/java/com/wuwang/aavt/gl/Faltung3x3Filter.java:
--------------------------------------------------------------------------------
1 | package com.wuwang.aavt.gl;
2 |
3 | import android.content.res.Resources;
4 | import android.opengl.GLES20;
5 |
6 | /**
7 | * Created by wuwang on 2017/10/1.
8 | */
9 |
10 | public class Faltung3x3Filter extends BaseFilter {
11 |
12 | private float[] mFaltung;
13 | private int mGLFaltung;
14 |
15 | public static final float[] FILTER_SHARPEN=new float[]{0,-1,0,-1,5,-1,0,-1,0};
16 | public static final float[] FILTER_BORDER=new float[]{0,1,0,1,-4,1,0,1,0};
17 | public static final float[] FILTER_CAMEO=new float[]{2,0,2,0,0,0,3,0,-6};
18 |
19 | public Faltung3x3Filter(Resources res,float[] faltung){
20 | super(res,"shader/base.vert","shader/func/faltung3x3.frag");
21 | shaderNeedTextureSize(true);
22 | this.mFaltung=faltung;
23 | }
24 |
25 | @Override
26 | protected void onCreate() {
27 | super.onCreate();
28 | mGLFaltung= GLES20.glGetUniformLocation(mGLProgram,"uFaltung");
29 | }
30 |
31 | @Override
32 | protected void onSetExpandData() {
33 | super.onSetExpandData();
34 | GLES20.glUniformMatrix3fv(mGLFaltung,1,false,mFaltung,0);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/aavt/src/main/java/com/wuwang/aavt/media/av/IStore.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 | package com.wuwang.aavt.media.av;
15 |
16 | /**
17 | * IStore 文件存储接口
18 | *
19 | * @author wuwang
20 | * @version v1.0 2017:10:28 16:39
21 | */
22 | public interface IStore