openGL+GLSurfaceView和MediaPlayer+GLSurfaceView与视频

> openGL + GLSurfaceView或MediaPlayer + SurfaceView播放视频

openGL + GLSurfaceView播放VR视频,MediaPlayer + GLSurfaceView播放视频

视频学习笔记:Android OpenGL渲染YUV420P图像- http://blog.csdn.net/lidec/article/details/73732369
Android--SurfaceView播放视频- http://www.cnblogs.com/plokmju/p/android_SurfaceView.html
Android SurfaceView播放视频有声音无图像问题- http://blog.csdn.net/aminfo/article/details/7588475
从头学Android之多媒体--使用MediaPlayer和SurfaceView播放视频- http://blog.csdn.net/worker90/article/details/7108358


> 将YUV转成ARGB_8888的jni代码: jintArray Java_com_spore_jni_ImageUtilEngine_decodeYUV420SP(JNIEnv * env, jobject thiz, jbyteArray buf, jint width, jint height)  { jbyte * yuv420sp = (*env)->GetByteArrayElements(env, buf, 0);   int frameSize = width * height; jint rgb[frameSize]; // 新图像像素值   int i = 0, j = 0,yp = 0; int uvp = 0, u = 0, v = 0; for (j = 0, yp = 0; j < height; j++) { uvp = frameSize + (j >> 1) * width; u = 0; v = 0; for (i = 0; i < width; i++, yp++) { int y = (0xff & ((int) yuv420sp[yp])) - 16; if (y < 0) y = 0; if ((i & 1) == 0) { v = (0xff & yuv420sp[uvp++]) - 128; u = (0xff & yuv420sp[uvp++]) - 128; }   int y1192 = 1192 * y; int r = (y1192 + 1634 * v); int g = (y1192 - 833 * v - 400 * u); int b = (y1192 + 2066 * u);   if (r < 0) r = 0; else if (r > 262143) r = 262143; if (g < 0) g = 0; else if (g > 262143) g = 262143; if (b < 0) b = 0; else if (b > 262143) b = 262143;   rgb[yp] = 0xff000000 | ((r << 6) & 0xff0000) | ((g >> 2) & 0xff00) | ((b >> 10) & 0xff); } }   jintArray result = (*env)->NewIntArray(env, frameSize); (*env)->SetIntArrayRegion(env, result, 0, frameSize, rgb); (*env)->ReleaseByteArrayElements(env, buf, yuv420sp, 0); return result; } public native int[] decodeYUV420SP(byte[] buf, int width, int height);

相关文章
相关标签/搜索
每日一句
    每一个你不满意的现在,都有一个你没有努力的曾经。
本站公众号
   欢迎关注本站公众号,获取更多程序园信息
开发小院