public void displayFrame(Frame frame) { mFrameLock.lock(); if (this.mCurrentFrame != null) { this.mCurrentFrame.recycle(); Log.d(LOG_TAG, "Screenshot capture"); ByteBuffer bb = frame.getBuffer(); bb.clear(); int width = frame.getWidth(); int height = frame.getHeight(); int half_width = (width + 1) >> 1; int half_height = (height +1) >> 1;
GLES20.glUseProgram(mProgram); if (mTextureWidth != mCurrentFrame.getWidth() || mTextureHeight != mCurrentFrame.getHeight()) { setupTextures(mCurrentFrame); float ratio = (float) mCurrentFrame.getWidth() / mCurrentFrame.getHeight(); float vratio = (float) mViewportWidth / mViewportHeight; scaleX * (mCurrentFrame.isMirroredX() ? -1.0f : 1.0f), scaleY, 1); metadataListener.onMetadataReady(mCurrentFrame.getMetadata());
GLES20.glUseProgram(mProgram); if (mTextureWidth != mCurrentFrame.getWidth() || mTextureHeight != mCurrentFrame.getHeight()) { setupTextures(mCurrentFrame); float ratio = (float) mCurrentFrame.getWidth() / mCurrentFrame.getHeight(); float vratio = (float) mViewportWidth / mViewportHeight; scaleX * (mCurrentFrame.isMirroredX() ? -1.0f : 1.0f), scaleY, 1);
void setupTextures(Frame frame) { if (mTextureIds[0] != 0) { GLES20.glDeleteTextures(3, mTextureIds, 0); } GLES20.glGenTextures(3, mTextureIds, 0); int w = frame.getWidth(); int h = frame.getHeight(); int hw = (w + 1) >> 1; int hh = (h + 1) >> 1; initializeTexture(GLES20.GL_TEXTURE0, mTextureIds[0], w, h); initializeTexture(GLES20.GL_TEXTURE1, mTextureIds[1], hw, hh); initializeTexture(GLES20.GL_TEXTURE2, mTextureIds[2], hw, hh); mTextureWidth = frame.getWidth(); mTextureHeight = frame.getHeight(); }
void setupTextures(Frame frame) { if (mTextureIds[0] != 0) { GLES20.glDeleteTextures(3, mTextureIds, 0); } GLES20.glGenTextures(3, mTextureIds, 0); int w = frame.getWidth(); int h = frame.getHeight(); int hw = (w + 1) >> 1; int hh = (h +1) >> 1; initializeTexture(GLES20.GL_TEXTURE0, mTextureIds[0], w, h); initializeTexture(GLES20.GL_TEXTURE1, mTextureIds[1], hw, hh); initializeTexture(GLES20.GL_TEXTURE2, mTextureIds[2], hw, hh); mTextureWidth = frame.getWidth(); mTextureHeight = frame.getHeight(); }
public void disableVideo(boolean b) { mFrameLock.lock(); mVideoDisabled = b; if (mVideoDisabled) { if (this.mCurrentFrame != null) { this.mCurrentFrame.recycle(); } this.mCurrentFrame = null; } mFrameLock.unlock(); }
public void displayFrame(Frame frame) { mFrameLock.lock(); if (this.mCurrentFrame != null) { this.mCurrentFrame.recycle(); } this.mCurrentFrame = frame; mFrameLock.unlock(); }
public void disableVideo(boolean b) { mFrameLock.lock(); mVideoDisabled = b; if (mVideoDisabled) { if (this.mCurrentFrame != null) { this.mCurrentFrame.recycle(); } this.mCurrentFrame = null; } mFrameLock.unlock(); }