Thanks guys for your replies.
I tried overrideTexelData with ByteBuffer first but could not get very far.
Then I tried SurfaceTexture and managed to get some progress. Now I have Audio playing but the video does not play.
so to test this, as a proof of concept, basically in the onSurfaceCreated of my GLSurfaceView.Renderer I create the media player and surface texture like this:
and then I have this class:
and finally in my onDrawFrame method I have:
I really appreciate your input
I tried overrideTexelData with ByteBuffer first but could not get very far.
Then I tried SurfaceTexture and managed to get some progress. Now I have Audio playing but the video does not play.
so to test this, as a proof of concept, basically in the onSurfaceCreated of my GLSurfaceView.Renderer I create the media player and surface texture like this:
Code Select
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
int[] texture = new int[1];
GLES20.glGenTextures(1,texture, 0);
GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, texture[0]);
GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
GL10.GL_TEXTURE_MIN_FILTER,GL10.GL_LINEAR);
GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);
GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE);
GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE);
int mTextureID = texture[0];
mSurface = new SurfaceTexture(mTextureID);
mSurface.setOnFrameAvailableListener(new videoTexture());
try {
AssetFileDescriptor afd = getAssets().openFd("test7.mp4");
MediaPlayer player = new MediaPlayer();
player.setDataSource(afd.getFileDescriptor(),afd.getStartOffset(),afd.getLength());
player.setSurface(new Surface(mSurface));
player.prepare();
player.start();
player.setLooping(true);
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
and then I have this class:
Code Select
class videoTexture implements SurfaceTexture.OnFrameAvailableListener {
@Override
public void onFrameAvailable(SurfaceTexture surfaceTexture) {
updateSurface = true;
mGLView.requestRender();
}
}
and finally in my onDrawFrame method I have:
Code Select
if (updateSurface) {
mSurface.updateTexImage();
updateSurface = false;
}
I really appreciate your input