Android Open Source - glvideoplayer-android O E S Texture






From Project

Back to project page glvideoplayer-android.

License

The source code is released under:

Apache License

If you think the Android project glvideoplayer-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package net.binzume.android.glvideoplayer;
// w  ww  .  jav a 2  s  . com
import android.graphics.SurfaceTexture;
import android.opengl.GLES20;
import android.util.Log;

public abstract class OESTexture {
  protected SurfaceTexture surfaceTexture;
  protected boolean textureUpdated;
  public int textureName = -1;

  

  protected static final int GL_TEXTURE_EXTERNAL_OES = 0x8D65;
  protected SurfaceTexture createSurfaceTexture() {
    int tex[] = new int[1];
    GLES20.glGenTextures(1, tex, 0);
//    GLES20.glPixelStorei(GLES20.GL_UNPACK_ALIGNMENT, 1);
    GLES20.glBindTexture(GL_TEXTURE_EXTERNAL_OES, tex[0]);
    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);
    GLES20.glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
    GLES20.glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
    textureName = tex[0];
    Log.d("OESTexture", "createSurfaceTexture textureName:" + textureName);
    final SurfaceTexture t = new SurfaceTexture(tex[0]);
    t.setOnFrameAvailableListener(new SurfaceTexture.OnFrameAvailableListener() {
      
      @Override
      public void onFrameAvailable(SurfaceTexture surfaceTexture) {
        textureUpdated = true;
        // Log.d("OESTexture", "onFrameAvailable textureName:" + textureName);
      }
    });
    return t;
  }
  
  public void update() {
    if (textureUpdated) {
      textureUpdated = false;
      surfaceTexture.updateTexImage();
      // cameraTexture.getTransformMatrix(mtx);
    }
  }
  
  abstract public void bindBuffer(GLShaderProgram glsl);
  
  public void release() {
    if (textureName > 0) {
      GLES20.glDeleteTextures(0, new int[]{textureName}, 0);
      textureName = -1;
    }
    if (surfaceTexture != null) {
      surfaceTexture.release();
      surfaceTexture = null;
    }
  }

}




Java Source Code List

net.binzume.android.glvideoplayer.DeviceCameraPlane.java
net.binzume.android.glvideoplayer.FBOTexture.java
net.binzume.android.glvideoplayer.GLShaderProgram.java
net.binzume.android.glvideoplayer.GLVideoRenderer.java
net.binzume.android.glvideoplayer.MainActivity.java
net.binzume.android.glvideoplayer.MediaPlayerPlane.java
net.binzume.android.glvideoplayer.NicoCommentPlane.java
net.binzume.android.glvideoplayer.OESTexture.java
net.binzume.android.glvideoplayer.TextureFactory.java
net.binzume.android.glvideoplayer.Texture.java
net.binzume.android.glvideoplayer.VideoSurfaceView.java
net.binzume.android.nicoplayer.player.CommentController.java
net.binzume.android.nicoplayer.player.CommentLoadTask.java
net.binzume.android.nicoplayer.player.CommentSlot.java
net.binzume.android.nicovideo.ChannelCategoryInfo.java
net.binzume.android.nicovideo.ChannelInfo.java
net.binzume.android.nicovideo.Comment.java
net.binzume.android.nicovideo.MyList.java
net.binzume.android.nicovideo.NicoSession.java
net.binzume.android.nicovideo.ThreadInfo.java
net.binzume.android.nicovideo.VideoFileInfo.java
net.binzume.android.nicovideo.VideoInfo.java
net.binzume.android.nicovideo.util.HtmlUtil.java
net.binzume.android.nicovideo.util.HttpClient.java
net.binzume.android.nicovideo.webapi.ChannelAPI.java
net.binzume.android.nicovideo.webapi.CommentAPI.java
net.binzume.android.nicovideo.webapi.Constants.java
net.binzume.android.nicovideo.webapi.FriendListAPI.java
net.binzume.android.nicovideo.webapi.LoginAPI.java
net.binzume.android.nicovideo.webapi.MyListAPI.java
net.binzume.android.nicovideo.webapi.NotLoginException.java
net.binzume.android.nicovideo.webapi.PaymentRequiredException.java
net.binzume.android.nicovideo.webapi.VideoAPI.java
net.binzume.android.nicovideo.webapi.VideoRssParser.java
net.binzume.android.nicovideo.webapi.VideoSearchAPI.java
net.binzume.android.nicovideo.webapi.WatchItemAPI.java
net.binzume.android.nicovideo.webapi.WebApiException.java