5

After spending some time into it, it might be better to ask. Thanks for help, guys!

Question

  • How to render a video frame from MediaPlayer or VideoView to SurfaceTexture or a OpenGL texture, in order to change the texture/fragment color via GLSL? (We need it for fancy GLES/GLSL video processing routines.)

Context

a) Google TV (LG G2 2012 device) is an Android 3.2 device with SDK-only support (no NDK)

b) It is easy to render from camera to SurfaceTexture, but how to render video to SurfaceTexture in Android 3.x? For camera solution, see below.

c) I'm already rendering video frames to a GLView/GLRenderer, but I'm not grabbing a frame in order to change it via GLSL. It seems not to work. But I need accessable 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);

// THIS ONE DOESN'T WORK WITH ANDROID 3.x!
// HOW TO BIND m_Surface TO m_MediaPlayer?

//Surface surface = new Surface(m_Surface);
//m_MediaPlayer.setSurface(surface);
//surface.release();

Also compare this:

Therefore the main question is still: How to access and manipulate a video frame with Android 3.x? Perhaps a different solution? Am I missing something, after spending too much time? Consider that there is no NDK support on Google TV at all, that we're very limited if we try to manipulate video data.

Community
  • 1
  • 1
btxsqdr
  • 51
  • 3
  • Have you seen: http://stackoverflow.com/questions/8620560/video-processing-in-android? I also curious if you've looked at the now deprecated Renderscript Graphics API for your project. – Morrison Chang Aug 05 '12 at 03:51

1 Answers1

0

Megha was kind enough to look into this for me. We don't support this on Google TV for ARM. It's impossible with our current SOC's (System on a Chip).