├── .gitignore
├── .idea
├── gradle.xml
├── misc.xml
├── runConfigurations.xml
└── vcs.xml
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── example
│ │ └── yuvopengldemo
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── cpp
│ │ ├── CMakeLists.txt
│ │ └── native-lib.cpp
│ ├── java
│ │ └── com
│ │ │ └── example
│ │ │ └── yuvopengldemo
│ │ │ ├── MainActivity.java
│ │ │ └── YuvPlayer.java
│ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ └── activity_main.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── 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
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── example
│ └── yuvopengldemo
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── settings.gradle
└── video1_640_272.yuv
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
15 |
16 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # YuvVideoPlayerDemo
2 | 一个基于OpenGl的yuv播放demo,用于学习专门。
3 | 详细解析请看我个人博客专栏 [一看就懂的OpenGL es教程](https://juejin.cn/post/7033711811006464030)
4 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 28
5 | // buildToolsVersion "28.0.0"
6 | defaultConfig {
7 | applicationId "com.example.yuvopengldemo"
8 | minSdkVersion 19
9 | targetSdkVersion 28
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
13 | externalNativeBuild {
14 | cmake {
15 | cppFlags "-std=c++11"
16 | }
17 | }
18 | }
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 | externalNativeBuild {
26 | cmake {
27 | path "src/main/cpp/CMakeLists.txt"
28 | version "3.10.2"
29 | }
30 | }
31 | }
32 |
33 | dependencies {
34 | implementation fileTree(dir: 'libs', include: ['*.jar'])
35 | implementation 'androidx.appcompat:appcompat:1.0.2'
36 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
37 | testImplementation 'junit:junit:4.12'
38 | androidTestImplementation 'androidx.test.ext:junit:1.1.1'
39 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
40 | }
41 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/example/yuvopengldemo/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.example.yuvopengldemo;
2 |
3 | import android.content.Context;
4 |
5 | import androidx.test.platform.app.InstrumentationRegistry;
6 | import androidx.test.ext.junit.runners.AndroidJUnit4;
7 |
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 |
11 | import static org.junit.Assert.*;
12 |
13 | /**
14 | * Instrumented test, which will execute on an Android device.
15 | *
16 | * @see Testing documentation
17 | */
18 | @RunWith(AndroidJUnit4.class)
19 | public class ExampleInstrumentedTest {
20 | @Test
21 | public void useAppContext() {
22 | // Context of the app under test.
23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
24 |
25 | assertEquals("com.example.yuvopengldemo", appContext.getPackageName());
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/cpp/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # For more information about using CMake with Android Studio, read the
2 | # documentation: https://d.android.com/studio/projects/add-native-code.html
3 |
4 | # Sets the minimum version of CMake required to build the native library.
5 | cmake_minimum_required(VERSION 3.4.1)
6 |
7 |
8 | #################################### Darren教程
9 | #设置变量
10 | #SET(SRC_LIST native-lib.cpp)
11 |
12 | #给工程取名字
13 | #PROJECT(YUV)
14 | #打印源码路径
15 | #MESSAGE(STATUS "yuvPlayer BINARY DIR" ${PROJECT_SOURCE_DIR})
16 |
17 | #让SRC_LIST指向当前makeList所在目录的src下的所有源文件
18 | #AUX_SOURCE_DIRECTORY(${PROJECT_SOURCE_DIR}/src SRC_LIST)
19 | #MESSAGE(STATUS "SRC_LIST:" ${SRC_LIST})
20 | #这条命令会将后面匹配到的所有文件 src/*.cpp 交给 GLOB 子命令,由后者生成一个文件列表,
21 | #并将列表赋给 SOURCES 变量。由于这条命令可以帮助我们自动引用所有的源文件,而 set 命令需要我们一个一个地添加文件,所以这里使用 FILE 更加省事
22 | #FILE(GLOB CPP_LIST "${PROJECT_SOURCE_DIR}/src/*cpp")
23 | #FILE(GLOB C_LIST "${PROJECT_SOURCE_DIR}/src/*c")
24 |
25 | #INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include)
26 | #生成动态库.so(SHARED),自动在名字前面加lib
27 | #ADD_LIBRARY(native-lib SHARED ${CPP_LIST} ${C_LIST})
28 | #指定需要链接的so库的路径
29 | #LINK_DIRECTORIES(${PROJECT_SOURCE_DIR}/lib)
30 | #添加源文件
31 | #ADD_EXECUTABLE(native-lib ${SRC_LIST})
32 | #将native-lib.so和其他so库进行链接
33 | #TARGET_LINK_LIBRARIES(native-lib GLESv2 EGL)
34 |
35 | ############################################# Darren教程
36 |
37 |
38 | # Creates and names a library, sets it as either STATIC
39 | # or SHARED, and provides the relative paths to its source code.
40 | # You can define multiple libraries, and CMake builds them for you.
41 | # Gradle automatically packages shared libraries with your APK.
42 | add_library( # Sets the name of the library.
43 | native-lib
44 |
45 | # Sets the library as a shared library.
46 | SHARED
47 |
48 | # Provides a relative path to your source file(s).
49 | native-lib.cpp )
50 |
51 | # Searches for a specified prebuilt library and stores the path as a
52 | # variable. Because CMake includes system libraries in the search path by
53 | # default, you only need to specify the name of the public NDK library
54 | # you want to add. CMake verifies that the library exists before
55 | # completing its build.
56 |
57 | find_library( # Sets the name of the path variable.
58 | log-lib
59 |
60 | # Specifies the name of the NDK library that
61 | # you want CMake to locate.
62 | log )
63 |
64 | # Specifies libraries CMake should link to your target library. You
65 | # can link multiple libraries, such as libraries you define in this
66 | # build script, prebuilt third-party libraries, or system libraries.
67 |
68 | target_link_libraries( # Specifies the target library.
69 | native-lib
70 | GLESv2
71 | EGL
72 | android
73 | # Links the target library to the log library
74 | # included in the NDK.
75 | ${log-lib} )
--------------------------------------------------------------------------------
/app/src/main/cpp/native-lib.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 |
9 | #define LOGD(...) __android_log_print(ANDROID_LOG_WARN,"yuvOpenGlDemo",__VA_ARGS__)
10 |
11 | //顶点着色器,每个顶点执行一次,可以并行执行
12 | #define GET_STR(x) #x
13 | static const char *vertexShader = GET_STR(
14 | attribute
15 | vec4 aPosition;//输入的顶点坐标,会在程序指定将数据输入到该字段
16 | attribute
17 | vec2 aTextCoord;//输入的纹理坐标,会在程序指定将数据输入到该字段
18 | varying
19 | vec2 vTextCoord;//输出的纹理坐标
20 | void main() {
21 | //这里其实是将上下翻转过来(因为安卓图片会自动上下翻转,所以转回来)
22 | vTextCoord = vec2(aTextCoord.x, 1.0 - aTextCoord.y);
23 | //直接把传入的坐标值作为传入渲染管线。gl_Position是OpenGL内置的
24 | gl_Position = aPosition;
25 | }
26 | );
27 | //图元被光栅化为多少片段,就被调用多少次
28 | static const char *fragYUV420P = GET_STR(
29 | precision
30 | mediump float;
31 | varying
32 | vec2 vTextCoord;
33 | //输入的yuv三个纹理
34 | uniform
35 | sampler2D yTexture;//采样器
36 | uniform
37 | sampler2D uTexture;//采样器
38 | uniform
39 | sampler2D vTexture;//采样器
40 | void main() {
41 | vec3 yuv;
42 | vec3 rgb;
43 | //分别取yuv各个分量的采样纹理(r表示?)
44 | //
45 | yuv.x = texture2D(yTexture, vTextCoord).g;
46 | yuv.y = texture2D(uTexture, vTextCoord).g - 0.5;
47 | yuv.z = texture2D(vTexture, vTextCoord).g - 0.5;
48 | rgb = mat3(
49 | 1.0, 1.0, 1.0,
50 | 0.0, -0.39465, 2.03211,
51 | 1.13983, -0.5806, 0.0
52 | ) * yuv;
53 | //gl_FragColor是OpenGL内置的
54 | gl_FragColor = vec4(rgb, 1.0);
55 | }
56 | );
57 |
58 |
59 | extern "C" JNIEXPORT jstring JNICALL
60 | Java_com_example_yuvopengldemo_MainActivity_stringFromJNI(
61 | JNIEnv *env,
62 | jobject /* this */) {
63 | std::string hello = "Hello from C++";
64 | return env->NewStringUTF(hello.c_str());
65 | }
66 |
67 | GLint initShader(const char *source, int type);
68 |
69 |
70 | GLint initShader(const char *source, GLint type) {
71 | //创建shader
72 | GLint sh = glCreateShader(type);
73 | if (sh == 0) {
74 | LOGD("glCreateShader %d failed", type);
75 | return 0;
76 | }
77 | //加载shader
78 | glShaderSource(sh,
79 | 1,//shader数量
80 | &source,
81 | 0);//代码长度,传0则读到字符串结尾
82 |
83 | //编译shader
84 | glCompileShader(sh);
85 |
86 | GLint status;
87 | glGetShaderiv(sh, GL_COMPILE_STATUS, &status);
88 | if (status == 0) {
89 | LOGD("glCompileShader %d failed", type);
90 | LOGD("source %s", source);
91 | return 0;
92 | }
93 |
94 | LOGD("glCompileShader %d success", type);
95 | return sh;
96 | }
97 |
98 | extern "C"
99 | JNIEXPORT void JNICALL
100 | Java_com_example_yuvopengldemo_YuvPlayer_loadYuv(JNIEnv *env, jobject thiz, jstring jUrl,
101 | jobject surface) {
102 | const char *url = env->GetStringUTFChars(jUrl, 0);
103 |
104 | FILE *fp = fopen(url, "rb");
105 | if (!fp) {
106 | LOGD("oepn file %s fail", url);
107 | return;
108 | }
109 | LOGD("open ulr is %s", url);
110 | //1.获取原始窗口
111 | //be sure to use ANativeWindow_release()
112 | // * when done with it so that it doesn't leak.
113 | ANativeWindow *nwin = ANativeWindow_fromSurface(env, surface);
114 | //获取Display
115 | EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
116 | if (display == EGL_NO_DISPLAY) {
117 | LOGD("egl display failed");
118 | return;
119 | }
120 | //2.初始化egl,后两个参数为主次版本号
121 | if (EGL_TRUE != eglInitialize(display, 0, 0)) {
122 | LOGD("eglInitialize failed");
123 | return;
124 | }
125 |
126 | //3.1 surface配置,可以理解为窗口
127 | EGLConfig eglConfig;
128 | EGLint configNum;
129 | EGLint configSpec[] = {
130 | EGL_RED_SIZE, 8,
131 | EGL_GREEN_SIZE, 8,
132 | EGL_BLUE_SIZE, 8,
133 | EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
134 | EGL_NONE
135 | };
136 |
137 | if (EGL_TRUE != eglChooseConfig(display, configSpec, &eglConfig, 1, &configNum)) {
138 | LOGD("eglChooseConfig failed");
139 | return;
140 | }
141 |
142 | //3.2创建surface(egl和NativeWindow进行关联。最后一个参数为属性信息,0表示默认版本)
143 | EGLSurface winSurface = eglCreateWindowSurface(display, eglConfig, nwin, 0);
144 | if (winSurface == EGL_NO_SURFACE) {
145 | LOGD("eglCreateWindowSurface failed");
146 | return;
147 | }
148 |
149 | //4 创建关联上下文
150 | const EGLint ctxAttr[] = {
151 | EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE
152 | };
153 | //EGL_NO_CONTEXT表示不需要多个设备共享上下文
154 | EGLContext context = eglCreateContext(display, eglConfig, EGL_NO_CONTEXT, ctxAttr);
155 | if (context == EGL_NO_CONTEXT) {
156 | LOGD("eglCreateContext failed");
157 | return;
158 | }
159 | //将egl和opengl关联
160 | //两个surface一个读一个写。第二个一般用来离线渲染?
161 | if (EGL_TRUE != eglMakeCurrent(display, winSurface, winSurface, context)) {
162 | LOGD("eglMakeCurrent failed");
163 | return;
164 | }
165 |
166 | GLint vsh = initShader(vertexShader, GL_VERTEX_SHADER);
167 | GLint fsh = initShader(fragYUV420P, GL_FRAGMENT_SHADER);
168 |
169 | //创建渲染程序
170 | GLint program = glCreateProgram();
171 | if (program == 0) {
172 | LOGD("glCreateProgram failed");
173 | return;
174 | }
175 |
176 | //向渲染程序中加入着色器
177 | glAttachShader(program, vsh);
178 | glAttachShader(program, fsh);
179 |
180 | //链接程序
181 | glLinkProgram(program);
182 | GLint status = 0;
183 | glGetProgramiv(program, GL_LINK_STATUS, &status);
184 | if (status == 0) {
185 | LOGD("glLinkProgram failed");
186 | return;
187 | }
188 | LOGD("glLinkProgram success");
189 | //激活渲染程序
190 | glUseProgram(program);
191 |
192 | //加入三维顶点数据
193 | static float ver[] = {
194 | 1.0f, -1.0f, 0.0f,
195 | -1.0f, -1.0f, 0.0f,
196 | 1.0f, 1.0f, 0.0f,
197 | -1.0f, 1.0f, 0.0f
198 | };
199 |
200 | GLuint apos = static_cast(glGetAttribLocation(program, "aPosition"));
201 | glEnableVertexAttribArray(apos);
202 | glVertexAttribPointer(apos, 3, GL_FLOAT, GL_FALSE, 0, ver);
203 |
204 | //加入纹理坐标数据
205 | static float fragment[] = {
206 | 1.0f, 0.0f,
207 | 0.0f, 0.0f,
208 | 1.0f, 1.0f,
209 | 0.0f, 1.0f
210 | };
211 | GLuint aTex = static_cast(glGetAttribLocation(program, "aTextCoord"));
212 | glEnableVertexAttribArray(aTex);
213 | glVertexAttribPointer(aTex, 2, GL_FLOAT, GL_FALSE, 0, fragment);
214 |
215 | int width = 640;
216 | int height = 272;
217 |
218 | //纹理初始化
219 | //设置纹理层对应的对应采样器?
220 |
221 | /**
222 | * //获取一致变量的存储位置
223 | GLint textureUniformY = glGetUniformLocation(program, "SamplerY");
224 | GLint textureUniformU = glGetUniformLocation(program, "SamplerU");
225 | GLint textureUniformV = glGetUniformLocation(program, "SamplerV");
226 | //对几个纹理采样器变量进行设置
227 | glUniform1i(textureUniformY, 0);
228 | glUniform1i(textureUniformU, 1);
229 | glUniform1i(textureUniformV, 2);
230 | */
231 | //对sampler变量,使用函数glUniform1i和glUniform1iv进行设置
232 | glUniform1i(glGetUniformLocation(program, "yTexture"), 0);
233 | glUniform1i(glGetUniformLocation(program, "uTexture"), 1);
234 | glUniform1i(glGetUniformLocation(program, "vTexture"), 2);
235 | //纹理ID
236 | GLuint texts[3] = {0};
237 | //创建若干个纹理对象,并且得到纹理ID
238 | glGenTextures(3, texts);
239 |
240 | //绑定纹理。后面的的设置和加载全部作用于当前绑定的纹理对象
241 | //GL_TEXTURE0、GL_TEXTURE1、GL_TEXTURE2 的就是纹理单元,GL_TEXTURE_1D、GL_TEXTURE_2D、CUBE_MAP为纹理目标
242 | //通过 glBindTexture 函数将纹理目标和纹理绑定后,对纹理目标所进行的操作都反映到对纹理上
243 | glBindTexture(GL_TEXTURE_2D, texts[0]);
244 | //缩小的过滤器
245 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
246 | //放大的过滤器
247 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
248 | //设置纹理的格式和大小
249 | // 加载纹理到 OpenGL,读入 buffer 定义的位图数据,并把它复制到当前绑定的纹理对象
250 | // 当前绑定的纹理对象就会被附加上纹理图像。
251 | //width,height表示每几个像素公用一个yuv元素?比如width / 2表示横向每两个像素使用一个元素?
252 | glTexImage2D(GL_TEXTURE_2D,
253 | 0,//细节基本 默认0
254 | GL_LUMINANCE,//gpu内部格式 亮度,灰度图(这里就是只取一个亮度的颜色通道的意思)
255 | width,//加载的纹理宽度。最好为2的次幂(这里对y分量数据当做指定尺寸算,但显示尺寸会拉伸到全屏?)
256 | height,//加载的纹理高度。最好为2的次幂
257 | 0,//纹理边框
258 | GL_LUMINANCE,//数据的像素格式 亮度,灰度图
259 | GL_UNSIGNED_BYTE,//像素点存储的数据类型
260 | NULL //纹理的数据(先不传)
261 | );
262 |
263 | //绑定纹理
264 | glBindTexture(GL_TEXTURE_2D, texts[1]);
265 | //缩小的过滤器
266 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
267 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
268 | //设置纹理的格式和大小
269 | glTexImage2D(GL_TEXTURE_2D,
270 | 0,//细节基本 默认0
271 | GL_LUMINANCE,//gpu内部格式 亮度,灰度图(这里就是只取一个颜色通道的意思)
272 | width / 2,//u数据数量为屏幕的4分之1
273 | height / 2,
274 | 0,//边框
275 | GL_LUMINANCE,//数据的像素格式 亮度,灰度图
276 | GL_UNSIGNED_BYTE,//像素点存储的数据类型
277 | NULL //纹理的数据(先不传)
278 | );
279 |
280 | //绑定纹理
281 | glBindTexture(GL_TEXTURE_2D, texts[2]);
282 | //缩小的过滤器
283 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
284 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
285 | //设置纹理的格式和大小
286 | glTexImage2D(GL_TEXTURE_2D,
287 | 0,//细节基本 默认0
288 | GL_LUMINANCE,//gpu内部格式 亮度,灰度图(这里就是只取一个颜色通道的意思)
289 | width / 2,
290 | height / 2,//v数据数量为屏幕的4分之1
291 | 0,//边框
292 | GL_LUMINANCE,//数据的像素格式 亮度,灰度图
293 | GL_UNSIGNED_BYTE,//像素点存储的数据类型
294 | NULL //纹理的数据(先不传)
295 | );
296 |
297 | unsigned char *buf[3] = {0};
298 | buf[0] = new unsigned char[width * height];//y
299 | buf[1] = new unsigned char[width * height / 4];//u
300 | buf[2] = new unsigned char[width * height / 4];//v
301 |
302 | for (int i = 0; i < 10000; ++i) {
303 |
304 | // memset(buf[0], i, width * height);
305 | // memset(buf[1], i, width * height/4);
306 | // memset(buf[2], i, width * height/4);
307 |
308 | //读一帧yuv420p数据
309 | if (feof(fp) == 0) {
310 | fread(buf[0], 1, width * height, fp);
311 | fread(buf[1], 1, width * height / 4, fp);
312 | fread(buf[2], 1, width * height / 4, fp);
313 | }
314 |
315 | //激活第一层纹理,绑定到创建的纹理
316 | //下面的width,height主要是显示尺寸?
317 | glActiveTexture(GL_TEXTURE0);
318 | //绑定y对应的纹理
319 | glBindTexture(GL_TEXTURE_2D, texts[0]);
320 | //替换纹理,比重新使用glTexImage2D性能高多
321 | glTexSubImage2D(GL_TEXTURE_2D, 0,
322 | 0, 0,//相对原来的纹理的offset
323 | width, height,//加载的纹理宽度、高度。最好为2的次幂
324 | GL_LUMINANCE, GL_UNSIGNED_BYTE,
325 | buf[0]);
326 |
327 | //激活第二层纹理,绑定到创建的纹理
328 | glActiveTexture(GL_TEXTURE1);
329 | //绑定u对应的纹理
330 | glBindTexture(GL_TEXTURE_2D, texts[1]);
331 | //替换纹理,比重新使用glTexImage2D性能高
332 | glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width / 2, height / 2, GL_LUMINANCE,
333 | GL_UNSIGNED_BYTE,
334 | buf[1]);
335 |
336 | //激活第三层纹理,绑定到创建的纹理
337 | glActiveTexture(GL_TEXTURE2);
338 | //绑定v对应的纹理
339 | glBindTexture(GL_TEXTURE_2D, texts[2]);
340 | //替换纹理,比重新使用glTexImage2D性能高
341 | glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width / 2, height / 2, GL_LUMINANCE,
342 | GL_UNSIGNED_BYTE,
343 | buf[2]);
344 |
345 | glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
346 | //窗口显示,交换双缓冲区
347 | eglSwapBuffers(display, winSurface);
348 | }
349 |
350 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/yuvopengldemo/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.yuvopengldemo;
2 |
3 | import androidx.appcompat.app.AppCompatActivity;
4 |
5 | import android.os.Bundle;
6 | import android.widget.TextView;
7 |
8 | public class MainActivity extends AppCompatActivity {
9 |
10 | // Used to load the 'native-lib' library on application startup.
11 | static {
12 | System.loadLibrary("native-lib");
13 | }
14 |
15 | @Override
16 | protected void onCreate(Bundle savedInstanceState) {
17 | super.onCreate(savedInstanceState);
18 | setContentView(R.layout.activity_main);
19 |
20 | // Example of a call to a native method
21 | // TextView tv = findViewById(R.id.sample_text);
22 | // tv.setText(stringFromJNI());
23 | }
24 |
25 | /**
26 | * A native method that is implemented by the 'native-lib' native library,
27 | * which is packaged with this application.
28 | */
29 | public native String stringFromJNI();
30 | }
31 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/yuvopengldemo/YuvPlayer.java:
--------------------------------------------------------------------------------
1 | package com.example.yuvopengldemo;
2 |
3 | import android.content.Context;
4 | import android.opengl.GLSurfaceView;
5 | import android.util.AttributeSet;
6 | import android.view.SurfaceHolder;
7 |
8 | import javax.microedition.khronos.egl.EGLConfig;
9 | import javax.microedition.khronos.opengles.GL10;
10 |
11 | public class YuvPlayer extends GLSurfaceView implements Runnable, SurfaceHolder.Callback, GLSurfaceView.Renderer {
12 |
13 | // private final static String PATH = "/sdcard/sintel_640_360.yuv";
14 | private final static String PATH = "/sdcard/video1_640_272.yuv";
15 |
16 | public YuvPlayer(Context context, AttributeSet attrs) {
17 | super(context, attrs);
18 | setRenderer(this);
19 | }
20 |
21 | @Override
22 | public void surfaceCreated(SurfaceHolder holder) {
23 | new Thread(this).start();
24 | }
25 |
26 | @Override
27 | public void surfaceDestroyed(SurfaceHolder holder) {
28 |
29 | }
30 |
31 | @Override
32 | public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
33 |
34 | }
35 |
36 | @Override
37 | public void run() {
38 | loadYuv(PATH,getHolder().getSurface());
39 | }
40 |
41 | public native void loadYuv(String url, Object surface);
42 |
43 | @Override
44 | public void onSurfaceCreated(GL10 gl, EGLConfig config) {
45 |
46 | }
47 |
48 | @Override
49 | public void onSurfaceChanged(GL10 gl, int width, int height) {
50 |
51 | }
52 |
53 | @Override
54 | public void onDrawFrame(GL10 gl) {
55 |
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yishuinanfeng/YuvVideoPlayerDemo/977e50919a493dee15aab1503651899f06734a0a/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yishuinanfeng/YuvVideoPlayerDemo/977e50919a493dee15aab1503651899f06734a0a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yishuinanfeng/YuvVideoPlayerDemo/977e50919a493dee15aab1503651899f06734a0a/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yishuinanfeng/YuvVideoPlayerDemo/977e50919a493dee15aab1503651899f06734a0a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yishuinanfeng/YuvVideoPlayerDemo/977e50919a493dee15aab1503651899f06734a0a/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yishuinanfeng/YuvVideoPlayerDemo/977e50919a493dee15aab1503651899f06734a0a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yishuinanfeng/YuvVideoPlayerDemo/977e50919a493dee15aab1503651899f06734a0a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yishuinanfeng/YuvVideoPlayerDemo/977e50919a493dee15aab1503651899f06734a0a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yishuinanfeng/YuvVideoPlayerDemo/977e50919a493dee15aab1503651899f06734a0a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yishuinanfeng/YuvVideoPlayerDemo/977e50919a493dee15aab1503651899f06734a0a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #008577
4 | #00574B
5 | #D81B60
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | YuvOpenGlDemo
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/com/example/yuvopengldemo/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.example.yuvopengldemo;
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() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | google()
6 | jcenter()
7 |
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.6.0-alpha01'
11 |
12 | // NOTE: Do not place your application dependencies here; they belong
13 | // in the individual module build.gradle files
14 | }
15 | }
16 |
17 | allprojects {
18 | repositories {
19 | google()
20 | jcenter()
21 |
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app's APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
20 |
21 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yishuinanfeng/YuvVideoPlayerDemo/977e50919a493dee15aab1503651899f06734a0a/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Jul 27 17:39:22 CST 2019
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 | rootProject.name='YuvOpenGlDemo'
3 |
--------------------------------------------------------------------------------
/video1_640_272.yuv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yishuinanfeng/YuvVideoPlayerDemo/977e50919a493dee15aab1503651899f06734a0a/video1_640_272.yuv
--------------------------------------------------------------------------------