After spending some time on this, it is better to ask. Thanks for the help guys!
Question
- How to render a video frame from MediaPlayer or VideoView into SurfaceTexture or OpenGL texture to change the color of the texture / fragment using GLSL? (We need this for fancy GLES / GLSL video processing procedures.)
Context
a) Google TV (LG G2 2012 device) - Android 3.2 device with support for SDK only (without NDK)
b) It's easy to display from a camera on a SurfaceTexture, but how do I render a SurfaceTexture video in Android 3.x? See the camera solution below.
c) I am already creating video frames for GLView / GLRenderer, but I do not grab the frame to change it using GLSL. It does not seem to work. But I need available GLES / GLSL textures with video data for video processing:
MainActivity Class:
public void onCreate(Bundle state) {
super.onCreate(state);
m_View = new GLSimpleView(this);
setContentView(m_View);
m_Holder = m_View.getHolder();
m_Holder.addCallback(this);
m_Holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
}
GLSimpleView Class:
public GLSimpleView(Context context) {
super(context);
m_Renderer = new GLTextureRenderer(context);
this.setRenderer(m_Renderer);
}
GLTextureRender Class:
int[] textures = new int[1];
GLES20.glGenTextures(1, textures, 0);
m_SurfaceTexture = textures[0];
GLES20.glBindTexture(GL_TEXTURE_EXTERNAL_OES, mTextureID);
GLES20.glTexParameterf(GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST);
GLES20.glTexParameterf(GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
m_Surface = new SurfaceTexture(m_SurfaceTexture);
m_Surface.setOnFrameAvailableListener(this);
Also compare this:
-: Android 3.x ? , ? - , ? , NDK Google TV, , .