tlplayer for android,使用还是使用gles2渲染的 player

72 篇文章 0 订阅
30 篇文章 0 订阅

1.tlplyer 介绍

tlplayer 是Tiger Leap Player 的缩写.tlplayer是wzplayer的一次大升级,除了渲染接口基本保持和原来一样之外,所有的内核都进行升级。

2.tlplayer比wzplayer的优势

tlplayer 是针对手机高端用户需求,进行升级开发的。tlplayer是直接进行渲染,减少内存拷贝的过程.

tlplayer 框架更加灵活,可以对wzplayer的加密完全插件兼容.

tlplayer支持多音频流.

3.tlplayer支持平台

tlplayer现在支持ios,android,windows

4.视频渲染方式

windows: d3d,ddraw,gdiplus,gles2

android: gles2

ios: gles2

5.音频渲染方式

windows: dsound,wave

android: audiotrack,opensl

ios: openal,audioqueue


联系方式:weinyzhou86@gmail.com

QQ:514540005

版权所有,禁止转载.

发布自:http://blog.csdn.net/weinyzhou/article/details/8579696


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
要实现模糊效果,可以使用双重渲染技术,即将OpenGL渲染到SurfaceTexture,再将SurfaceTexture渲染到屏幕上。 下面是一个简单的示例代码: 1. 首先,在XML布局文件中添加一个TextureView: ``` <TextureView android:id="@+id/textureView" android:layout_width="match_parent" android:layout_height="match_parent" /> ``` 2. 在Activity中获取TextureView并设置监听器: ``` private TextureView textureView; private SurfaceTexture surfaceTexture; private int textureId; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); textureView = findViewById(R.id.textureView); textureView.setSurfaceTextureListener(surfaceTextureListener); } private TextureView.SurfaceTextureListener surfaceTextureListener = new TextureView.SurfaceTextureListener() { @Override public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) { surfaceTexture = surface; textureId = createTexture(); startRender(); } @Override public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) { } @Override public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) { stopRender(); surfaceTexture = null; return true; } @Override public void onSurfaceTextureUpdated(SurfaceTexture surface) { } }; ``` 3. 创建OpenGL纹理: ``` private int createTexture() { int[] textures = new int[1]; GLES20.glGenTextures(1, textures, 0); int textureId = textures[0]; GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureId); GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR); GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR); GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE); GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE); return textureId; } ``` 4. 开始渲染: ``` private RenderThread renderThread; private void startRender() { if (renderThread == null) { renderThread = new RenderThread(); renderThread.start(); } } private void stopRender() { if (renderThread != null) { renderThread.stopRender(); renderThread = null; } } private class RenderThread extends Thread { private volatile boolean isRender = true; @Override public void run() { super.run(); EglCore eglCore = new EglCore(); WindowSurface windowSurface = new WindowSurface(eglCore, surfaceTexture); GLES20.glClearColor(0.0f, 0.0f, 0.0f, 1.0f); while (isRender) { GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT); // 在这里进行OpenGL渲染操作 windowSurface.swapBuffers(); } windowSurface.release(); eglCore.release(); } public void stopRender() { isRender = false; } } ``` 5. 最后,在onDrawFrame方法中进行双重渲染: ``` @Override public void onDrawFrame(GL10 gl) { GLES20.glClearColor(0.0f, 0.0f, 0.0f, 1.0f); GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT); // 在这里进行OpenGL渲染操作 SurfaceTexture surfaceTexture = textureView.getSurfaceTexture(); surfaceTexture.updateTexImage(); // 将SurfaceTexture渲染到屏幕上 GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0); GLES20.glViewport(0, 0, getWidth(), getHeight()); GLES20.glUseProgram(programId); int uTextureSamplerLocation = GLES20.glGetUniformLocation(programId, "uTextureSampler"); GLES20.glActiveTexture(GLES20.GL_TEXTURE0); GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, textureId); GLES20.glUniform1i(uTextureSamplerLocation, 0); GLES20.glEnableVertexAttribArray(aPositionLocation); GLES20.glVertexAttribPointer(aPositionLocation, 2, GLES20.GL_FLOAT, false, 0, vertexBuffer); GLES20.glEnableVertexAttribArray(aTextureCoordLocation); GLES20.glVertexAttribPointer(aTextureCoordLocation, 2, GLES20.GL_FLOAT, false, 0, textureBuffer); GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4); GLES20.glDisableVertexAttribArray(aPositionLocation); GLES20.glDisableVertexAttribArray(aTextureCoordLocation); } ```
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值