从surfaceview视频完整清晰的视频帧 [英] Clear video frame from surfaceview on video complete
本文介绍了从surfaceview视频完整清晰的视频帧的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了一个媒体播放器,起着表面上来看视频。视频结束后的视频的最后一帧保留在表面上。我想是因为经过一段延迟另一段视频开始从表面去除视频帧。
I have created a media player which plays video on the surface view. After completion of video the last frame of the video remains on the surface. I want to remove the video frame from the surface because after some delay another video starts.
的视频流是:
NOW :视频表面 - 表面>最后的视频帧 - >其他视频表面的
但所需的流程是:
要求: 视频表面 - >清除表面(黑色) - >在表面上的另一视频的
谁能帮助解决这个问题。
can anyone help to solve this problem.
谢谢 依禅耆那教
推荐答案
建立在法登的答案,Andreimarinescu的问题,这里是一个版本的API 16及以下:
Building on Fadden's answer, and Andreimarinescu's question, here is a version for API 16 and below:
private void clearSurface(Surface surface) {
EGL10 egl = (EGL10) EGLContext.getEGL();
EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
egl.eglInitialize(display, null);
int[] attribList = {
EGL10.EGL_RED_SIZE, 8,
EGL10.EGL_GREEN_SIZE, 8,
EGL10.EGL_BLUE_SIZE, 8,
EGL10.EGL_ALPHA_SIZE, 8,
EGL10.EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT,
EGL10.EGL_NONE, 0, // placeholder for recordable [@-3]
EGL10.EGL_NONE
};
EGLConfig[] configs = new EGLConfig[1];
int[] numConfigs = new int[1];
egl.eglChooseConfig(display, attribList, configs, configs.length, numConfigs);
EGLConfig config = configs[0];
EGLContext context = egl.eglCreateContext(display, config, EGL10.EGL_NO_CONTEXT, new int[]{
EGL14.EGL_CONTEXT_CLIENT_VERSION, 2,
EGL10.EGL_NONE
});
EGLSurface eglSurface = egl.eglCreateWindowSurface(display, config, surface,
new int[]{
EGL14.EGL_NONE
});
egl.eglMakeCurrent(display, eglSurface, eglSurface, context);
GLES20.glClearColor(0, 0, 0, 1);
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
egl.eglSwapBuffers(display, eglSurface);
egl.eglDestroySurface(display, eglSurface);
egl.eglMakeCurrent(display, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE,
EGL10.EGL_NO_CONTEXT);
egl.eglDestroyContext(display, context);
egl.eglTerminate(display);
}
pretty的原油,缺少错误检查,但它为我工作。
Pretty crude, lacks error checking, but it works for me.
这篇关于从surfaceview视频完整清晰的视频帧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文